mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Fixed some bugs
+Returning troops time will now flow correctly in the rally point +Resources won't be set to 0 anymore if overflow (this could have happened in high speed servers) +Fixed a distorted view of the right part of the page, while reading a mass message
This commit is contained in:
+66
-94
@@ -2280,9 +2280,8 @@ class Automation {
|
||||
|
||||
//no units can stay in the village itself
|
||||
$units2reset = [];
|
||||
for ($u = 1; $u <= 50; $u++) {
|
||||
$units2reset[] = 'u'.$u.' = 0';
|
||||
}
|
||||
for ($u = 1; $u <= 50; $u++) $units2reset[] = 'u'.$u.' = 0';
|
||||
|
||||
$units2reset[] = 'u99 = 0';
|
||||
$units2reset[] = 'u99o = 0';
|
||||
$units2reset[] = 'hero = 0';
|
||||
@@ -2298,10 +2297,9 @@ class Automation {
|
||||
$pop2 = $poparray[1]['Total'];
|
||||
if($pop1 > $pop2){
|
||||
$buildlevel = $database->getResourceLevel($data['to']);
|
||||
|
||||
for ($i=1; $i<=39; $i++){
|
||||
for ($i = 1; $i <= 39; $i++){
|
||||
if($buildlevel['f'.$i]!=0){
|
||||
if($buildlevel['f'.$i."t"]!=35 && $buildlevel['f'.$i."t"]!=36 && $buildlevel['f'.$i."t"]!=41){
|
||||
if($buildlevel['f'.$i."t"] != 35 && $buildlevel['f'.$i."t"] != 36 && $buildlevel['f'.$i."t"] != 41){
|
||||
$leveldown = $buildlevel['f'.$i]-1;
|
||||
$newLevels_fieldNames[] = "f".$i;
|
||||
$newLevels_fieldValues[] = $leveldown;
|
||||
@@ -2321,8 +2319,8 @@ class Automation {
|
||||
}
|
||||
}
|
||||
|
||||
if ($buildlevel['f99']!=0) {
|
||||
$leveldown = $buildlevel['f99']-1;
|
||||
if ($buildlevel['f99'] != 0) {
|
||||
$leveldown = $buildlevel['f99'] - 1;
|
||||
$newLevels_fieldNames[] = "f99";
|
||||
$newLevels_fieldValues[] = $leveldown;
|
||||
}
|
||||
@@ -2381,12 +2379,12 @@ class Automation {
|
||||
$info_chief = "".$chief_pic.",Could not reduce cultural points during raid";
|
||||
}
|
||||
|
||||
if(($data['t11'] - $dead11 - $traped11)> 0){ //hero
|
||||
if(($data['t11'] - $dead11 - $traped11) > 0){ //hero
|
||||
if ($heroxp == 0) {
|
||||
$xp="";
|
||||
$xp = "";
|
||||
$info_hero = $hero_pic.",Your hero had nothing to kill therefore gains no XP at all.";
|
||||
} else {
|
||||
$xp=" and gained <b>".$heroxp."</b> XP from the battle.";
|
||||
$xp = " and gained <b>".$heroxp."</b> XP from the battle.";
|
||||
$info_hero = $hero_pic.",Your hero gained <b>".$heroxp."</b> XP.";
|
||||
}
|
||||
|
||||
@@ -2449,7 +2447,7 @@ class Automation {
|
||||
<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".round($totclay)." |
|
||||
<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".round($totiron)." |
|
||||
<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".round($totcrop)."</div>
|
||||
<div class=\"carry\"><img class=\"car\" src=\"img/x.gif\" alt=\"carry\" title=\"carry\" />Total Resources : ".round($totwood+$totclay+$totiron+$totcrop)."</div>
|
||||
<div class=\"carry\"><img class=\"car\" src=\"img/x.gif\" alt=\"carry\" title=\"carry\" />Total Resources: ".round($totwood+$totclay+$totiron+$totcrop)."</div>
|
||||
";
|
||||
}else if($data['spy'] == 2){
|
||||
if ($isoasis == 0){
|
||||
@@ -3685,108 +3683,82 @@ class Automation {
|
||||
}
|
||||
|
||||
private function bountyGetWoodProd() {
|
||||
global $bid1,$bid5,$session;
|
||||
global $bid1, $bid5;
|
||||
|
||||
$wood = $sawmill = 0;
|
||||
$woodholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 1) {
|
||||
array_push($woodholder,'f'.$i);
|
||||
}
|
||||
if($this->bountyresarray['f'.$i.'t'] == 5) {
|
||||
$sawmill = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
$woodholder = [];
|
||||
for($i = 1; $i <= 38; $i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 1) array_push($woodholder,'f'.$i);
|
||||
if($this->bountyresarray['f'.$i.'t'] == 5) $sawmill = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
for($i=0;$i<=count($woodholder)-1;$i++) { $wood+= $bid1[$this->bountyresarray[$woodholder[$i]]]['prod']; }
|
||||
if($sawmill >= 1) {
|
||||
$wood += $wood /100 * $bid5[$sawmill]['attri'];
|
||||
}
|
||||
if($this->bountyocounter[0] != 0) {
|
||||
$wood += $wood*0.25*$this->bountyocounter[0];
|
||||
}
|
||||
$wood *= SPEED;
|
||||
return round($wood);
|
||||
|
||||
for($i = 0; $i <= count($woodholder) - 1; $i++) $wood += $bid1[$this->bountyresarray[$woodholder[$i]]]['prod'];
|
||||
|
||||
if($sawmill >= 1) $wood += $wood / 100 * $bid5[$sawmill]['attri'];
|
||||
if($this->bountyocounter[0] != 0) $wood += $wood * 0.25 * $this->bountyocounter[0];
|
||||
|
||||
return round($wood * SPEED);
|
||||
}
|
||||
|
||||
private function bountyGetClayProd() {
|
||||
global $bid2,$bid6,$session;
|
||||
global $bid2, $bid6;
|
||||
|
||||
$clay = $brick = 0;
|
||||
$clayholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 2) {
|
||||
array_push($clayholder,'f'.$i);
|
||||
}
|
||||
if($this->bountyresarray['f'.$i.'t'] == 6) {
|
||||
$brick = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
$clayholder = [];
|
||||
for($i = 1; $i <= 38; $i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 2) array_push($clayholder,'f'.$i);
|
||||
if($this->bountyresarray['f'.$i.'t'] == 6) $brick = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
for($i=0;$i<=count($clayholder)-1;$i++) { $clay+= $bid2[$this->bountyresarray[$clayholder[$i]]]['prod']; }
|
||||
if($brick >= 1) {
|
||||
$clay += $clay /100 * $bid6[$brick]['attri'];
|
||||
}
|
||||
if($this->bountyocounter[1] != 0) {
|
||||
$clay += $clay*0.25*$this->bountyocounter[1];
|
||||
}
|
||||
$clay *= SPEED;
|
||||
return round($clay);
|
||||
|
||||
for($i = 0; $i <= count($clayholder) - 1; $i++) $clay+= $bid2[$this->bountyresarray[$clayholder[$i]]]['prod'];
|
||||
|
||||
if($brick >= 1) $clay += $clay / 100 * $bid6[$brick]['attri'];
|
||||
if($this->bountyocounter[1] != 0) $clay += $clay * 0.25 * $this->bountyocounter[1];
|
||||
|
||||
return round($clay * SPEED);
|
||||
}
|
||||
|
||||
private function bountyGetIronProd() {
|
||||
global $bid3,$bid7,$session;
|
||||
global $bid3, $bid7;
|
||||
|
||||
$iron = $foundry = 0;
|
||||
$ironholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 3) {
|
||||
array_push($ironholder,'f'.$i);
|
||||
}
|
||||
if($this->bountyresarray['f'.$i.'t'] == 7) {
|
||||
$foundry = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
for($i = 1; $i <= 38; $i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 3) array_push($ironholder,'f'.$i);
|
||||
if($this->bountyresarray['f'.$i.'t'] == 7) $foundry = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
for($i=0;$i<=count($ironholder)-1;$i++) { $iron+= $bid3[$this->bountyresarray[$ironholder[$i]]]['prod']; }
|
||||
if($foundry >= 1) {
|
||||
$iron += $iron /100 * $bid7[$foundry]['attri'];
|
||||
}
|
||||
if($this->bountyocounter[2] != 0) {
|
||||
$iron += $iron*0.25*$this->bountyocounter[2];
|
||||
}
|
||||
$iron *= SPEED;
|
||||
return round($iron);
|
||||
|
||||
for($i = 0; $i <= count($ironholder) - 1; $i++) $iron+= $bid3[$this->bountyresarray[$ironholder[$i]]]['prod'];
|
||||
|
||||
if($foundry >= 1) $iron += $iron / 100 * $bid7[$foundry]['attri'];
|
||||
if($this->bountyocounter[2] != 0) $iron += $iron * 0.25 * $this->bountyocounter[2];
|
||||
|
||||
return round($iron * SPEED);
|
||||
}
|
||||
|
||||
private function bountyGetCropProd() {
|
||||
global $bid4,$bid8,$bid9,$session;
|
||||
global $bid4, $bid8, $bid9;
|
||||
|
||||
$crop = $grainmill = $bakery = 0;
|
||||
$cropholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 4) {
|
||||
array_push($cropholder,'f'.$i);
|
||||
}
|
||||
if($this->bountyresarray['f'.$i.'t'] == 8) {
|
||||
$grainmill = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
if($this->bountyresarray['f'.$i.'t'] == 9) {
|
||||
$bakery = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
$cropholder = [];
|
||||
for($i = 1; $i <= 38;$i++) {
|
||||
if($this->bountyresarray['f'.$i.'t'] == 4) array_push($cropholder,'f'.$i);
|
||||
if($this->bountyresarray['f'.$i.'t'] == 8) $grainmill = $this->bountyresarray['f'.$i];
|
||||
if($this->bountyresarray['f'.$i.'t'] == 9) $bakery = $this->bountyresarray['f'.$i];
|
||||
}
|
||||
for($i=0;$i<=count($cropholder)-1;$i++) { $crop+= $bid4[$this->bountyresarray[$cropholder[$i]]]['prod']; }
|
||||
if($grainmill >= 1) {
|
||||
$crop += $crop /100 * (isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0);
|
||||
}
|
||||
if($bakery >= 1) {
|
||||
$crop += $crop /100 * (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0);
|
||||
}
|
||||
if($this->bountyocounter[3] != 0) {
|
||||
$crop += $crop*0.25*$this->bountyocounter[3];
|
||||
}
|
||||
if(!empty($bountyresarray['vref']) && is_numeric($bountyresarray['vref'])){
|
||||
for($i = 0; $i <= count($cropholder) - 1; $i++) $crop+= $bid4[$this->bountyresarray[$cropholder[$i]]]['prod'];
|
||||
|
||||
if($grainmill >= 1) $crop += $crop / 100 * (isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0);
|
||||
if($bakery >= 1) $crop += $crop / 100 * (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0);
|
||||
if($this->bountyocounter[3] != 0) $crop += $crop * 0.25 * $this->bountyocounter[3];
|
||||
|
||||
if(!empty($bountyresarray['vref']) && is_numeric($bountyresarray['vref'])){
|
||||
$who=$database->getVillageField($bountyresarray['vref'],"owner");
|
||||
$croptrue=$database->getUserField($who,"b4",0);
|
||||
if($croptrue > time()) {
|
||||
$crop*=1.25;
|
||||
}
|
||||
$croptrue = $database->getUserField($who, "b4", 0);
|
||||
if($croptrue > time()) $crop *= 1.25;
|
||||
}
|
||||
$crop *= SPEED;
|
||||
return round($crop);
|
||||
|
||||
return round($crop * SPEED);
|
||||
}
|
||||
|
||||
private function trainingComplete() {
|
||||
|
||||
@@ -69,6 +69,7 @@ class Session {
|
||||
var $bonus2 = 0;
|
||||
var $bonus3 = 0;
|
||||
var $bonus4 = 0;
|
||||
var $timer = 0;
|
||||
var $checker, $mchecker;
|
||||
public $userinfo = array();
|
||||
private $userarray = array();
|
||||
|
||||
+129
-150
@@ -18,23 +18,20 @@ include_once("Technology.php");
|
||||
class Village {
|
||||
|
||||
public $type;
|
||||
public $coor = array();
|
||||
public $awood,$aclay,$airon,$acrop,$pop,$maxstore,$maxcrop,$atotal;
|
||||
public $wid,$vname,$capital,$natar,$master;
|
||||
public $resarray = array();
|
||||
public $unitarray,$techarray,$unitall,$researching,$abarray = array();
|
||||
private $infoarray = array();
|
||||
private $production = array();
|
||||
private $oasisowned,$ocounter = array();
|
||||
public $coor = [];
|
||||
public $awood, $aclay, $airon, $acrop, $pop, $maxstore, $maxcrop, $atotal;
|
||||
public $wid, $vname, $capital, $natar, $master;
|
||||
public $resarray = [];
|
||||
public $unitarray, $techarray, $unitall, $researching, $abarray = [];
|
||||
private $infoarray = [];
|
||||
private $production = [];
|
||||
private $oasisowned, $ocounter = [];
|
||||
|
||||
function __construct() {
|
||||
global $session, $database;
|
||||
if(isset($_SESSION['wid'])) {
|
||||
$this->wid = $_SESSION['wid'];
|
||||
}
|
||||
else {
|
||||
$this->wid = $session->villages[0];
|
||||
}
|
||||
|
||||
if(isset($_SESSION['wid'])) $this->wid = $_SESSION['wid'];
|
||||
else $this->wid = $session->villages[0];
|
||||
|
||||
$this->preloadVillagesData();
|
||||
|
||||
@@ -67,12 +64,13 @@ class Village {
|
||||
}
|
||||
|
||||
public function getAllUnits($vid) {
|
||||
global $database,$technology;
|
||||
global $database, $technology;
|
||||
return $technology->getUnits($database->getUnit($vid),$database->getEnforceVillage($vid,0));
|
||||
}
|
||||
|
||||
private function LoadTown($second_run = false) {
|
||||
global $database,$session,$logging,$technology;
|
||||
global $database, $session, $logging, $technology;
|
||||
|
||||
$this->infoarray = $database->getVillage($this->wid);
|
||||
if($this->infoarray['owner'] != $session->uid && !$session->isAdmin) {
|
||||
unset($_SESSION['wid']);
|
||||
@@ -110,15 +108,35 @@ class Village {
|
||||
$this->allcrop = $this->getCropProd();
|
||||
$this->loyalty = $this->infoarray['loyalty'];
|
||||
$this->master = count($database->getMasterJobs($this->wid));
|
||||
//de gs in town, zetten op max pakhuisinhoud
|
||||
|
||||
//If resources overflow the warehouse/granary limit, set them at the maximum value
|
||||
$resourceUpdates = [];
|
||||
if($this->awood>$this->maxstore){ $this->awood=$this->maxstore; $resourceUpdates['wood'] = $this->maxstore; }
|
||||
if($this->aclay>$this->maxstore){ $this->aclay=$this->maxstore; $resourceUpdates['clay'] = $this->maxstore; }
|
||||
if($this->airon>$this->maxstore){ $this->airon=$this->maxstore; $resourceUpdates['iron'] = $this->maxstore; }
|
||||
if($this->acrop>$this->maxcrop){ $this->acrop=$this->maxcrop; $resourceUpdates['crop'] = $this->maxcrop; }
|
||||
if($this->awood > $this->maxstore)
|
||||
{
|
||||
$this->awood = $this->maxstore;
|
||||
$resourceUpdates['wood'] = $this->maxstore;
|
||||
}
|
||||
|
||||
if($this->aclay > $this->maxstore)
|
||||
{
|
||||
$this->aclay = $this->maxstore;
|
||||
$resourceUpdates['clay'] = $this->maxstore;
|
||||
}
|
||||
|
||||
if($this->airon > $this->maxstore)
|
||||
{
|
||||
$this->airon = $this->maxstore;
|
||||
$resourceUpdates['iron'] = $this->maxstore;
|
||||
}
|
||||
|
||||
if($this->acrop > $this->maxcrop)
|
||||
{
|
||||
$this->acrop = $this->maxcrop;
|
||||
$resourceUpdates['crop'] = $this->maxcrop;
|
||||
}
|
||||
|
||||
if (count($resourceUpdates)) {
|
||||
$database->updateResource( $this->wid, array_keys( $resourceUpdates ), array_values($resourceUpdates) );
|
||||
$database->updateResource($this->wid, array_keys($resourceUpdates), array_values($resourceUpdates));
|
||||
|
||||
// reload cache if we've updated resources and the like
|
||||
if ($second_run) {
|
||||
@@ -126,188 +144,148 @@ class Village {
|
||||
call_user_func(get_class($database).'::clearVillageCache');
|
||||
$this->preloadVillagesData();
|
||||
}
|
||||
} else if ($second_run) {
|
||||
$this->preloadVillagesData();
|
||||
}
|
||||
}
|
||||
else if ($second_run) $this->preloadVillagesData();
|
||||
}
|
||||
|
||||
private function calculateProduction() {
|
||||
global $technology,$database,$session;
|
||||
global $technology, $database, $session;
|
||||
|
||||
// clear cache, since we're updating village data
|
||||
call_user_func(get_class($database).'::clearVillageCache');
|
||||
$normalA = $database->getOwnArtefactInfoByType($_SESSION['wid'],4);
|
||||
$largeA = $database->getOwnUniqueArtefactInfo($session->uid,4,2);
|
||||
$uniqueA = $database->getOwnUniqueArtefactInfo($session->uid,4,3);
|
||||
$upkeep = $technology->getUpkeep($this->unitall, 0, $this->wid);
|
||||
$this->production['wood'] = $this->getWoodProd();
|
||||
$this->production['clay'] = $this->getClayProd();
|
||||
$this->production['iron'] = $this->getIronProd();
|
||||
|
||||
if ($uniqueA['size']==3 && $uniqueA['owner']==$session->uid){
|
||||
$this->production['crop'] = $this->getCropProd()- $this->pop - (($upkeep)-round($upkeep*0.50));
|
||||
|
||||
}else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$session->uid){
|
||||
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));
|
||||
|
||||
}else if ($largeA['size']==2 && $largeA['owner']==$session->uid){
|
||||
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));
|
||||
|
||||
}else{
|
||||
$this->production['crop'] = $this->getCropProd()-$this->pop-$upkeep;
|
||||
$this->production['crop'] = $this->getCropProd() - $this->pop - $upkeep;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function processProduction() {
|
||||
global $database;
|
||||
|
||||
$timepast = time() - $this->infoarray['lastupdate'];
|
||||
$nwood = ($this->production['wood'] / 3600) * $timepast;
|
||||
$nclay = ($this->production['clay'] / 3600) * $timepast;
|
||||
$niron = ($this->production['iron'] / 3600) * $timepast;
|
||||
$ncrop = ($this->production['crop'] / 3600) * $timepast;
|
||||
|
||||
$database->modifyResource($this->wid,$nwood,$nclay,$niron,$ncrop,1);
|
||||
$nwood = min(($this->production['wood'] / 3600) * $timepast, $this->maxstore);
|
||||
$nclay = min(($this->production['clay'] / 3600) * $timepast, $this->maxstore);
|
||||
$niron = min(($this->production['iron'] / 3600) * $timepast, $this->maxstore);
|
||||
$ncrop = min(($this->production['crop'] / 3600) * $timepast, $this->maxcrop);
|
||||
|
||||
$database->modifyResource($this->wid, $nwood, $nclay, $niron, $ncrop, 1);
|
||||
$database->updateVillage($this->wid);
|
||||
$this->LoadTown(true);
|
||||
}
|
||||
|
||||
private function getWoodProd() {
|
||||
global $bid1,$bid5,$session;
|
||||
$basewood = $sawmill = 0;
|
||||
$woodholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 1) {
|
||||
array_push($woodholder,'f'.$i);
|
||||
}
|
||||
if($this->resarray['f'.$i.'t'] == 5) {
|
||||
$sawmill = $this->resarray['f'.$i];
|
||||
}
|
||||
global $bid1, $bid5, $session;
|
||||
|
||||
$wood = $sawmill = 0;
|
||||
$woodholder = [];
|
||||
for($i = 1; $i <= 38; $i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 1) array_push($woodholder,'f'.$i);
|
||||
if($this->resarray['f'.$i.'t'] == 5) $sawmill = $this->resarray['f'.$i];
|
||||
}
|
||||
for($i=0;$i<=count($woodholder)-1;$i++) { $basewood+= $bid1[$this->resarray[$woodholder[$i]]]['prod']; }
|
||||
$wood = $basewood + $basewood * 0.25 * $this->ocounter[0];
|
||||
if($sawmill >= 1) {
|
||||
$wood += $basewood / 100 * $bid5[$sawmill]['attri'];
|
||||
}
|
||||
if($session->bonus1 == 1) {
|
||||
$wood *= 1.25;
|
||||
}
|
||||
$wood *= SPEED;
|
||||
return round($wood);
|
||||
|
||||
for($i = 0; $i <= count($woodholder) - 1; $i++) $wood += $bid1[$this->resarray[$woodholder[$i]]]['prod'];
|
||||
$wood = $wood + $wood * 0.25 * $this->ocounter[0];
|
||||
|
||||
if($sawmill >= 1) $wood += $wood / 100 * $bid5[$sawmill]['attri'];
|
||||
if($session->bonus1 == 1) $wood *= 1.25;
|
||||
|
||||
return round($wood * SPEED);
|
||||
}
|
||||
|
||||
private function getClayProd() {
|
||||
global $bid2,$bid6,$session;
|
||||
$baseclay = $clay = $brick = 0;
|
||||
$clayholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 2) {
|
||||
array_push($clayholder,'f'.$i);
|
||||
}
|
||||
if($this->resarray['f'.$i.'t'] == 6) {
|
||||
$brick = $this->resarray['f'.$i];
|
||||
}
|
||||
global $bid2, $bid6, $session;
|
||||
|
||||
$clay = $brick = 0;
|
||||
$clayholder = [];
|
||||
for($i = 1; $i <= 38; $i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 2) array_push($clayholder,'f'.$i);
|
||||
if($this->resarray['f'.$i.'t'] == 6) $brick = $this->resarray['f'.$i];
|
||||
}
|
||||
for($i=0;$i<=count($clayholder)-1;$i++) { $baseclay+= $bid2[$this->resarray[$clayholder[$i]]]['prod']; }
|
||||
$clay = $baseclay + $baseclay * 0.25 * $this->ocounter[1];
|
||||
if($brick >= 1) {
|
||||
$clay += $baseclay / 100 * $bid6[$brick]['attri'];
|
||||
}
|
||||
if($session->bonus2 == 1) {
|
||||
$clay *= 1.25;
|
||||
}
|
||||
$clay *= SPEED;
|
||||
return round($clay);
|
||||
|
||||
for($i = 0; $i <= count($clayholder) - 1; $i++) $clay+= $bid2[$this->resarray[$clayholder[$i]]]['prod'];
|
||||
$clay = $clay + $clay * 0.25 * $this->ocounter[1];
|
||||
|
||||
if($brick >= 1) $clay += $clay / 100 * $bid6[$brick]['attri'];
|
||||
if($session->bonus2 == 1) $clay *= 1.25;
|
||||
|
||||
return round($clay * SPEED);
|
||||
}
|
||||
|
||||
private function getIronProd() {
|
||||
global $bid3,$bid7,$session;
|
||||
$baseiron = $foundry = 0;
|
||||
$ironholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 3) {
|
||||
array_push($ironholder,'f'.$i);
|
||||
}
|
||||
if($this->resarray['f'.$i.'t'] == 7) {
|
||||
$foundry = $this->resarray['f'.$i];
|
||||
}
|
||||
global $bid3, $bid7, $session;
|
||||
|
||||
$iron = $foundry = 0;
|
||||
$ironholder = [];
|
||||
for($i = 1; $i <= 38; $i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 3) array_push($ironholder,'f'.$i);
|
||||
if($this->resarray['f'.$i.'t'] == 7) $foundry = $this->resarray['f'.$i];
|
||||
}
|
||||
for($i=0;$i<=count($ironholder)-1;$i++) { $baseiron+= $bid3[$this->resarray[$ironholder[$i]]]['prod']; }
|
||||
$iron = $baseiron + $baseiron * 0.25 * $this->ocounter[2];
|
||||
if($foundry >= 1) {
|
||||
$iron += $baseiron / 100 * $bid7[$foundry]['attri'];
|
||||
}
|
||||
if($session->bonus3 == 1) {
|
||||
$iron *= 1.25;
|
||||
}
|
||||
$iron *= SPEED;
|
||||
return round($iron);
|
||||
|
||||
for($i = 0;$i <= count($ironholder) - 1; $i++) $iron+= $bid3[$this->resarray[$ironholder[$i]]]['prod'];
|
||||
$iron = $iron + $iron * 0.25 * $this->ocounter[2];
|
||||
|
||||
if($foundry >= 1) $iron += $iron / 100 * $bid7[$foundry]['attri'];
|
||||
if($session->bonus3 == 1) $iron *= 1.25;
|
||||
|
||||
return round($iron * SPEED);
|
||||
}
|
||||
|
||||
private function getCropProd() {
|
||||
global $bid4,$bid8,$bid9,$session;
|
||||
$basecrop = $grainmill = $bakery = 0;
|
||||
$cropholder = array();
|
||||
for($i=1;$i<=38;$i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 4) {
|
||||
array_push($cropholder,'f'.$i);
|
||||
}
|
||||
if($this->resarray['f'.$i.'t'] == 8) {
|
||||
$grainmill = $this->resarray['f'.$i];
|
||||
}
|
||||
if($this->resarray['f'.$i.'t'] == 9) {
|
||||
$bakery = $this->resarray['f'.$i];
|
||||
}
|
||||
global $bid4, $bid8, $bid9, $session;
|
||||
|
||||
$crop = $grainmill = $bakery = 0;
|
||||
$cropholder = [];
|
||||
for($i = 1; $i <= 38; $i++) {
|
||||
if($this->resarray['f'.$i.'t'] == 4) array_push($cropholder,'f'.$i);
|
||||
if($this->resarray['f'.$i.'t'] == 8) $grainmill = $this->resarray['f'.$i];
|
||||
if($this->resarray['f'.$i.'t'] == 9) $bakery = $this->resarray['f'.$i];
|
||||
}
|
||||
for ( $i = 0; $i <= count( $cropholder ) - 1; $i ++ ) {
|
||||
$basecrop += $bid4[ $this->resarray[ $cropholder[ $i ] ] ]['prod'];
|
||||
}
|
||||
|
||||
for ($i = 0; $i <= count($cropholder) - 1; $i++) $crop += $bid4[$this->resarray[$cropholder[$i]]]['prod'];
|
||||
$bonus = 0.25 * $this->ocounter[3];
|
||||
$crop = $basecrop + $basecrop * 0.25 * $this->ocounter[3];
|
||||
$crop = $crop + $crop * 0.25 * $this->ocounter[3];
|
||||
|
||||
if($grainmill >= 1 || $bakery >= 1) {
|
||||
$crop += $basecrop /100 * ((isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0) + (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0));
|
||||
$crop += $crop / 100 * ((isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0) + (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0));
|
||||
}
|
||||
if($session->bonus4 == 1) $crop *= 1.25;
|
||||
|
||||
if($session->bonus4 == 1) {
|
||||
$crop *= 1.25;
|
||||
}
|
||||
$crop *= SPEED;
|
||||
return round($crop);
|
||||
return round($crop * SPEED);
|
||||
}
|
||||
|
||||
private function sortOasis() {
|
||||
$crop = $clay = $wood = $iron = 0;
|
||||
if (!empty($this->oasisowned)) {
|
||||
foreach ($this->oasisowned as $oasis) {
|
||||
switch ( $oasis['type'] ) {
|
||||
if(!empty($this->oasisowned)){
|
||||
foreach($this->oasisowned as $oasis){
|
||||
switch($oasis['type']){
|
||||
case 1:
|
||||
case 2:
|
||||
$wood += 1;
|
||||
$wood++;
|
||||
break;
|
||||
case 3:
|
||||
$wood += 1;
|
||||
$crop += 1;
|
||||
$wood++;
|
||||
$crop++;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
$clay += 1;
|
||||
$clay++;
|
||||
break;
|
||||
case 6:
|
||||
$clay += 1;
|
||||
$crop += 1;
|
||||
$clay++;
|
||||
$crop++;
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
$iron += 1;
|
||||
$iron++;
|
||||
break;
|
||||
case 9:
|
||||
$iron += 1;
|
||||
$crop += 1;
|
||||
$iron++;
|
||||
$crop++;
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
$crop += 1;
|
||||
$crop++;
|
||||
break;
|
||||
case 12:
|
||||
$crop += 2;
|
||||
@@ -315,19 +293,20 @@ class Village {
|
||||
}
|
||||
}
|
||||
}
|
||||
return array($wood,$clay,$iron,$crop);
|
||||
return [$wood, $clay, $iron, $crop];
|
||||
}
|
||||
|
||||
private function ActionControl() {
|
||||
global $session;
|
||||
if(SERVER_WEB_ROOT) {
|
||||
$page = $_SERVER['SCRIPT_NAME'];
|
||||
}
|
||||
else {
|
||||
|
||||
if(SERVER_WEB_ROOT) $page = $_SERVER['SCRIPT_NAME'];
|
||||
else
|
||||
{
|
||||
$explode = explode("/",$_SERVER['SCRIPT_NAME']);
|
||||
$i = count($explode)-1;
|
||||
$page = $explode[$i];
|
||||
}
|
||||
|
||||
if($page == "build.php" && $session->uid != $this->infoarray['owner']) {
|
||||
unset($_SESSION['wid']);
|
||||
header("Location: dorf1.php");
|
||||
|
||||
@@ -13,7 +13,7 @@ $res1 = mysqli_query($database->dblink,"SELECT wood, clay, iron, crop FROM " . T
|
||||
$res = mysqli_fetch_array($res1);
|
||||
}
|
||||
}
|
||||
$timer = $y+1;
|
||||
$session->timer++;
|
||||
if ($units[$y]['sort_type']==3){
|
||||
if ($units[$y]['attack_type']==3){
|
||||
$actionType = ATTACK_ON;
|
||||
@@ -79,7 +79,7 @@ if ($units[$y]['sort_type']==3){
|
||||
<tr>
|
||||
<th>'.ARRIVAL.'</th>
|
||||
<td colspan='.$colspan.'>
|
||||
<div class="in small"><span id=timer'.$timer.'>'.$generator->getTimeFormat($units[$y]['endtime']-time()).'</span> h</div>';
|
||||
<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") {
|
||||
@@ -114,7 +114,7 @@ if ($units[$y]['sort_type']==3){
|
||||
<tr>
|
||||
<th>'.ARRIVAL.'</th>
|
||||
<td colspan="10">
|
||||
<div class="in small"><span id=timer'.$timer.'>'.$generator->getTimeFormat($units[$y]['endtime']-time()).'</span> h</div>';
|
||||
<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") {
|
||||
@@ -201,7 +201,7 @@ $to = $database->getMInfo($units[$y]['vref']);
|
||||
<th><?php echo ARRIVAL;?></th>
|
||||
<td colspan="<?php echo $units[$y]['t11'] == 0 ? 10 : 11 ?>">
|
||||
<?php
|
||||
echo "<div class=\"in small\"><span id=timer".$timer.">".$generator->getTimeFormat($units[$y]['endtime']-time())."</span> h</div>";
|
||||
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") {
|
||||
@@ -222,7 +222,7 @@ foreach($array as $conqured){
|
||||
$oasis = $database->getMovement("6",$conqured['wref'],0);
|
||||
$total_for = count($oasis);
|
||||
for($y=0;$y < $total_for;$y++){
|
||||
$timer = $y+1;
|
||||
$session->timer++;
|
||||
$to = $database->getOMInfo($oasis[$y]['to']);
|
||||
if ($oasis[$y]['attack_type']==2){
|
||||
$actionType = REINFORCEMENTFOR;
|
||||
@@ -286,7 +286,7 @@ $to = $database->getOMInfo($oasis[$y]['to']);
|
||||
<tr>
|
||||
<th>'.ARRIVAL.'</th>
|
||||
<td colspan="'.$colspan.'">
|
||||
<div class="in small"><span id=timer'.$timer.'>'.$generator->getTimeFormat($oasis[$y]['endtime']-time()).'</span> h</div>';
|
||||
<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") {
|
||||
@@ -304,7 +304,7 @@ $to = $database->getOMInfo($oasis[$y]['to']);
|
||||
$settlers = $database->getMovement("7",$village->wid,1);
|
||||
$total_for3 = count($settlers);
|
||||
for($x=0;$x < $total_for3;$x++){
|
||||
$timer = $x+1;
|
||||
$session->timer++;
|
||||
$to = $database->getMInfo($settlers[$x]['to']);
|
||||
?>
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
@@ -348,7 +348,7 @@ $to = $database->getMInfo($settlers[$x]['to']);
|
||||
<th><?php echo ARRIVAL;?></th>
|
||||
<td colspan="10">
|
||||
<?php
|
||||
echo "<div class=\"in small\"><span id=timer".$timer.">".$generator->getTimeFormat($settlers[$x]['endtime']-time())."</span> h</div>";
|
||||
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") {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
$units = $database->getMovement(3,$village->wid,0);
|
||||
$total_for = count($units);
|
||||
$timer = 0;
|
||||
|
||||
for($y=0;$y<$total_for;$y++){
|
||||
$timer += 1;
|
||||
$session->timer++;
|
||||
|
||||
if($units[$y]['attack_type'] == 2){
|
||||
$attack_type = REINFORCEMENTFOR;
|
||||
@@ -78,7 +77,7 @@ $to = $database->getOMInfo($units[$y]['to']);}
|
||||
<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$timer>".$generator->getTimeFormat($units[$y]['endtime']-time())."</span> h</div>";
|
||||
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") {
|
||||
@@ -104,7 +103,7 @@ $to = $database->getOMInfo($units[$y]['to']);}
|
||||
$total_for = count($settlers);
|
||||
|
||||
for($y=0;$y<$total_for;$y++){
|
||||
$timer += 1;
|
||||
$session->timer++;
|
||||
|
||||
?>
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
@@ -147,7 +146,7 @@ $timer += 1;
|
||||
<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$timer>".$generator->getTimeFormat($settlers[$y]['endtime']-time())."</span> h</div>";
|
||||
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") {
|
||||
|
||||
+4
-4
@@ -84,7 +84,7 @@ div.c1 {text-align: center}
|
||||
}
|
||||
?>
|
||||
</div><?php
|
||||
if($_SESSION['ok']=='1'){
|
||||
if($_SESSION['ok'] == 1){
|
||||
?>
|
||||
|
||||
<div id="content" class="village1">
|
||||
@@ -99,10 +99,10 @@ div.c1 {text-align: center}
|
||||
</div>
|
||||
|
||||
<div id="side_info">
|
||||
<?php
|
||||
include("Templates/quest.tpl");
|
||||
include("Templates/news.tpl");
|
||||
<?php
|
||||
include("Templates/multivillage.tpl");
|
||||
include("Templates/quest.tpl");
|
||||
include("Templates/news.tpl");
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user