From d0c55c4c3b71f82b2203f9f0f5bea2c5355f46af Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Apr 2012 12:20:13 +0300 Subject: [PATCH] big update --- GameEngine/Automation.php | 140 ++++++++------- GameEngine/Building.php | 24 ++- GameEngine/Logging.php | 9 - GameEngine/Market.php | 5 +- GameEngine/Units.php | 31 +++- Templates/Build/16_incomming.tpl | 117 +++++++++++-- Templates/Build/17_3.tpl | 13 +- Templates/Build/ww.tpl | 15 +- Templates/Building.tpl | 10 -- Templates/Plus/10.tpl | 4 +- Templates/Plus/11.tpl | 4 +- Templates/Plus/12.tpl | 4 +- Templates/Plus/7.tpl | 4 +- Templates/Plus/8.tpl | 4 +- Templates/Plus/9.tpl | 4 +- Templates/a2b/sendback_1.tpl | 13 ++ Templates/a2b/sendback_2.tpl | 13 ++ Templates/a2b/sendback_3.tpl | 13 ++ Templates/a2b/sendback_4.tpl | 13 ++ Templates/{Build => a2b}/sendback_5.tpl | 13 ++ Templates/multivillage.tpl | 2 +- Templates/serv_time.tpl | 13 -- install/data/constant_format.tpl | 4 + install/data/sql.sql | 63 +++---- install/process.php | 2 + install/templates/config.tpl | 7 +- login.php | 221 +++++++++++++++++++++++- 27 files changed, 578 insertions(+), 187 deletions(-) rename Templates/{Build => a2b}/sendback_5.tpl (91%) delete mode 100644 Templates/serv_time.tpl diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 68a372dc..c952be14 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -75,7 +75,7 @@ class Automation { case 40: $build = "Wonder of the World"; break; case 41: $build = "Horse Drinking Trough"; break; case 42: $build = "Great Workshop"; break; - default: $build = "Error"; break; + default: $build = "Nothing had"; break; } return $build; } @@ -116,7 +116,9 @@ class Automation { $this->ClearUser(); $this->ClearInactive(); + $this->oasisResoucesProduce(); $this->pruneResource(); + $this->pruneOResource(); if(!file_exists("GameEngine/Prevention/culturepoints.txt") or time()-filemtime("GameEngine/Prevention/culturepoints.txt")>10) { $this->culturePoints(); } @@ -133,7 +135,7 @@ class Automation { { $this->buildComplete(); } - $this->updateStore(); + $this->updateStore(); if(!file_exists("GameEngine/Prevention/market.txt") or time()-filemtime("GameEngine/Prevention/market.txt")>10) { $this->marketComplete(); } @@ -162,8 +164,9 @@ class Automation { { $this->demolitionComplete(); } - $this->updateStore(); + $this->updateStore(); } + function activeCropDead(){ global $session,$village,$database,$_SESSION, $allcrop; // var_dump($session); @@ -384,31 +387,31 @@ private function loyaltyRegeneration() { foreach($needDelete as $need) { $needVillage = $database->getVillagesID($need['uid']); //wref foreach($needVillage as $village) { - $q = "DELETE FROM ".TB_PREFIX."abdata where wref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."abdata where wref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."bdata where wid = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."bdata where wid = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."enforcement where vref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."enforcement where vref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."fdata where vref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."fdata where vref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."market where vref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."market where vref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$village['wref']." or from = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$village." or from = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."odata where wref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."odata where wref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."research where vref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."research where vref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."tdata where vref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."tdata where vref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."training where vref =".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."training where vref =".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."units where vref =".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."units where vref =".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."vdata where wref = ".$village['wref']; + $q = "DELETE FROM ".TB_PREFIX."vdata where owner = ".$village; $database->query($q); - $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = ".$village['wref']; + $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = ".$village; $database->query($q); } $q = "DELETE FROM ".TB_PREFIX."mdata where target = ".$need['uid']." or owner = ".$need['uid']; @@ -492,9 +495,6 @@ private function loyaltyRegeneration() { } } - - - private function culturePoints() { global $database,$session; $time = time()-600; @@ -516,28 +516,6 @@ private function loyaltyRegeneration() { } } - # private function culturePoints() { - # global $database; - # $ourFileHandle = @fopen("GameEngine/Prevention/culturepoints.txt", 'w'); - # @fclose($ourFileHandle); - # $time = time()-84600; - # $array = array(); - # $q = "SELECT id, lastupdate FROM ".TB_PREFIX."users where lastupdate < $time"; - # $array = $database->query_return($q); -# - # foreach($array as $indi) { - # if($indi['lastupdate'] < $time){ - # $cp = $database->getVSumField($indi['id'], 'cp'); - # $newupdate = time(); - # $q = "UPDATE ".TB_PREFIX."users set cp = cp + 2000, lastupdate = $newupdate where id = '".$indi['id']."'"; - # $database->query($q); - #} - #} - #if(file_exists("GameEngine/Prevention/culturepoints.txt")) { - # @unlink("GameEngine/Prevention/culturepoints.txt"); - #} - #} - private function buildComplete() { global $database,$bid18,$bid10,$bid11,$bid38,$bid39; $time = time(); @@ -1315,8 +1293,7 @@ ${dead.$i}=$data['t'.$i]; $qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$from['owner'].""; $resulth = mysql_query($qh); $hero_f=mysql_fetch_array($resulth); - $hero_unit=$hero_f['unit']; - //echo "///".$GLOBALS['u'.$hero_unit]['speed']."///"; + $hero_unit=$hero_f['unit']; $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; } @@ -1354,8 +1331,8 @@ ${dead.$i}=$data['t'.$i]; { if ($catp!='0') { - - if($toF['pop']<=0) + $villpop=$this->recountPop($data['to']); + if($villpop<=0) { $info_cat = ",".$catp_pic.", Village already destroyed."; } @@ -1462,7 +1439,7 @@ ${dead.$i}=$data['t'.$i]; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."market where vref = ".$data['to']; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$data['to']." or from = ".$data['to']; + $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$data['to']." or from = ".$data['to']; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."odata where wref = ".$data['to']; $database->query($q); @@ -1479,7 +1456,6 @@ ${dead.$i}=$data['t'.$i]; $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = ".$data['to']; $database->query($q); $database->clearExpansionSlot($data['to']); - $logging->VillageDestroyCatalog($data['to']); } } } @@ -1616,7 +1592,7 @@ ${dead.$i}=$data['t'.$i]; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."market where vref = ".$data['to']; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$data['to']." or from = ".$data['to']; + $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$data['to']." or from = ".$data['to']; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."odata where wref = ".$data['to']; $database->query($q); @@ -1632,7 +1608,7 @@ ${dead.$i}=$data['t'.$i]; $database->query($q); $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = ".$data['to']; $database->query($q); - $logging->VillageDestroyCatalog($data['to']); + $database->clearExpansionSlot($data['to']); } } } @@ -1767,7 +1743,7 @@ ${dead.$i}=$data['t'.$i]; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."market where vref = ".$data['to']; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$data['to']." or from = ".$data['to']; + $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$data['to']." or from = ".$data['to']; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."odata where wref = ".$data['to']; $database->query($q); @@ -1783,7 +1759,7 @@ ${dead.$i}=$data['t'.$i]; $database->query($q); $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = ".$data['to']; $database->query($q); - $logging->VillageDestroyCatalog($data['to']); + $database->clearExpansionSlot($data['to']); } } } @@ -1875,13 +1851,16 @@ ${dead.$i}=$data['t'.$i]; $pop2 = $database->getVillageField($data['to'],"pop"); if($pop1 > $pop2){ $buildlevel = $database->getResourceLevel($data['to']); - for ($i=0; $i<=99; $i++){ + for ($i=1; $i<=39; $i++){ if($buildlevel['f'.$i]!=0){ - $buildlevel2 = $buildlevel['f'.$i]; - $q = "UPDATE ".TB_PREFIX."fdata SET `".$buildlevel2."`='".$buildlevel2."' - 1 WHERE vref=".$data['to']; - $database->query($q); + $leveldown = $buildlevel['f'.$i]-1; + $database->setVillageLevel($data['to'],"f".$i,$leveldown); } } + if($buildlevel['f99']!=0){ + $leveldown = $buildlevel['f99']-1; + $database->setVillageLevel($data['to'],"f99",$leveldown); + } } //destroy wall $database->setVillageLevel($data['to'],"f40",0); @@ -1908,7 +1887,7 @@ ${dead.$i}=$data['t'.$i]; $value = $data['to']; } $database->setVillageField($data['from'],$exp,$value); - + $chiefing_village = 1; } } @@ -2067,13 +2046,37 @@ $crannyimg = "setMovementProc($data['moveid']); + if($chiefing_village != 1){ $database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],time(),$endtime); - + }else{ + $villreinf = $database->addEnforce($data); + $villtribe = $database->getUserField($from['owner'],"tribe",0); + $unittribe = $villtribe-1; + if($unittribe == 0){ + $unittribe = ""; + } + $database->modifyEnforce($villreinf,$unittribe.'1',$data['t1']-$dead1,1); + $database->modifyEnforce($villreinf,$unittribe.'2',$data['t2']-$dead2,1); + $database->modifyEnforce($villreinf,$unittribe.'3',$data['t3']-$dead3,1); + $database->modifyEnforce($villreinf,$unittribe.'4',$data['t4']-$dead4,1); + $database->modifyEnforce($villreinf,$unittribe.'5',$data['t5']-$dead5,1); + $database->modifyEnforce($villreinf,$unittribe.'6',$data['t6']-$dead6,1); + $database->modifyEnforce($villreinf,$unittribe.'7',$data['t7']-$dead7,1); + $database->modifyEnforce($villreinf,$unittribe.'8',$data['t8']-$dead8,1); + $database->modifyEnforce($villreinf,$unittribe.'9',$data['t9']-$dead9-1,1); + $database->modifyEnforce($villreinf,$unittribe.'10',$data['t10']-$dead10,1); + $database->modifyEnforce($villreinf,$unittribe.'11',$data['t11']-$dead11,1); + } // send the bounty on type 6. if($type !== 1) { $reference = $database->sendResource($steal[0],$steal[1],$steal[2],$steal[3],0,0); + $isoasis1 = $database->isVillageOases($to['wref']); + if ($isoasis1 == 0){ $database->modifyResource($to['wref'],$steal[0],$steal[1],$steal[2],$steal[3],0); + }else{ + $database->modifyOasisResource($to['wref'],$steal[0],$steal[1],$steal[2],$steal[3],0); + } $database->addMovement(6,$to['wref'],$from['wref'],$reference,time(),$endtime); //$database->updateVillage($to['wref']); $totalstolengain=$steal[0]+$steal[1]+$steal[2]+$steal[3]; @@ -2132,6 +2135,8 @@ $crannyimg = "getTypeLevel(37,$data['to']) > 0) { //don't reinforce, addunit instead $database->modifyUnit($data['to'],array("hero"),array(1),array(1)); + $heroid = $database->getHero($database->getVillageField($data['from'],"owner"),1); + $database->modifyHero("wref",$data['to'],$heroid,0); $HeroTransfer = 1; } } @@ -2822,8 +2827,7 @@ private function demolitionComplete() { } // by SlimShady95, aka Manuel Mannhardt < manuel_mannhardt@web.de > - private function updateStore() - { + private function updateStore() { global $bid10, $bid38, $bid11, $bid39; $result = mysql_query('SELECT * FROM `' . TB_PREFIX . 'fdata`'); @@ -2867,7 +2871,23 @@ private function demolitionComplete() { mysql_query('UPDATE `' . TB_PREFIX . 'vdata` SET `maxstore` = ' . $ress . ', `maxcrop` = ' . $crop . ' WHERE `wref` = ' . $row['vref']) or die(mysql_error()); } - } + } + + private function oasisResoucesProduce() { + global $database; + $time = time(); + $q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood < 800 OR clay < 800 OR iron < 800 OR crop < 800"; + $array = $database->query_return($q); + foreach($array as $getoasis) { + $oasiswood = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + $oasisclay = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + $oasisiron = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + $oasiscrop = (8*SPEED/3600)*(time()-$getoasis['lastupdated']); + $database->modifyOasisResource($getoasis['wref'],$oasiswood,$oasisclay,$oasisiron,$oasiscrop,1); + $database->updateOasis($getoasis['wref']); + } + } + } $automation = new Automation; ?> diff --git a/GameEngine/Building.php b/GameEngine/Building.php index f7effadb..bec78f27 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -102,7 +102,7 @@ class Building { return 8; } else { - if($session->plus) { + if($session->plus or $tid==40) { if($this->plus == 0) { return 9; } @@ -120,7 +120,7 @@ class Building { return 8; } else { - if($session->plus) { + if($session->plus or $tid==40) { if($this->plus == 0) { return 9; } @@ -136,7 +136,7 @@ class Building { } else { if($this->basic == 1) { - if($session->plus && $this->plus == 0) { + if(($session->plus or $tid==40) && $this->plus == 0) { return 9; } else { @@ -329,7 +329,7 @@ class Building { $time = time() + round($dataarray[$village->resarray['f'.$id]-1]['time'] / 4); $loop = 0; if($this->inner == 1 || $this->basic == 1) { - if($session->plus && $this->plus == 0) { + if(($session->plus or $village->resarray['f'.$id.'t']==40)&& $this->plus == 0) { $loop = 1; } } @@ -619,11 +619,19 @@ class Building { } private function finishAll() { - global $database,$session,$logging,$village,$bid18,$bid10,$bid11,$technology; + global $database,$session,$logging,$village,$bid18,$bid10,$bid11,$technology,$_SESSION; + if($session->access!=BANNED){ + if($session->gold >= 2){ foreach($this->buildArray as $jobs) { + if($jobs['wid']==$village->wid){ + $wwvillage = $database->getResourceLevel($jobs['wid']); + if($wwvillage['f99t']!=40){ $level = $database->getFieldLevel($jobs['wid'],$jobs['field']); $level = ($level == -1) ? 0 : $level; if($jobs['type'] != 25 AND $jobs['type'] != 26 AND $jobs['type'] != 40) { + $gold=$database->getUserField($_SESSION['username'],'gold','username'); + $gold-=2; + $database->updateUserField($_SESSION['username'],'gold',$gold,0); $resource = $this->resourceRequired($jobs['field'],$jobs['type']); $q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = f".$jobs['field']." + 1, f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid']; if($database->query($q)) { @@ -670,6 +678,8 @@ class Building { if(($jobs['field'] >= 19 && ($session->tribe == 1 || ALLOW_ALL_TRIBE)) || (!ALLOW_ALL_TRIBE && $session->tribe != 1)) { $innertimestamp = $jobs['timestamp']; } } } + } + } $technology->finishTech(); $logging->goldFinLog($village->wid); $database->modifyGold($session->uid,0,0); @@ -681,6 +691,10 @@ class Building { } } header("Location: ".$session->referrer); + } + }else{ + header("Location: banned.php"); + } } public function resourceRequired($id,$tid,$plus=1) { diff --git a/GameEngine/Logging.php b/GameEngine/Logging.php index 732b93ca..5a5bad37 100644 --- a/GameEngine/Logging.php +++ b/GameEngine/Logging.php @@ -83,15 +83,6 @@ class Logging { $database->query($q); } } - - public function VillageDestroyCatalog($wid) { - global $database; - if(LOG_GOLD_FIN) { - $log = "Village destroyed"; - $q = "Insert into ".TB_PREFIX."destroy_log values (0,$wid,'$log')"; - $database->query($q); - } - } public function addWarLog() { global $database; diff --git a/GameEngine/Market.php b/GameEngine/Market.php index 8bbb2549..93741ea0 100644 --- a/GameEngine/Market.php +++ b/GameEngine/Market.php @@ -243,6 +243,8 @@ class Market { private function tradeResource($post) { global $session,$database,$village; + $wwvillage = $database->getResourceLevel($village->wid); + if($wwvillage['f99t']!=40){ if($session->userinfo['gold'] >= 3) { //kijken of ze niet meer gs invoeren dan ze hebben if($session->access == BANNED){ @@ -259,7 +261,8 @@ class Market { } } else { header("Location: build.php?id=".$post['id']."&t=3"); - } + } + } } }; diff --git a/GameEngine/Units.php b/GameEngine/Units.php index 5765aa59..3b010fa6 100644 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -323,6 +323,21 @@ class Units { $post['t'.$i.'']='0'; } } + if(isset($post['t11'])){ + if ($post['t11'] > $enforce['hero']) + { + $form->addError("error","You can't send more units than you have"); + break; + } + + if($post['t11']<0) + { + $form->addError("error","You can't send negative units."); + break; + } + } else { + $post['t11']='0'; + } if($form->returnErrors() > 0) { $_SESSION['errorarray'] = $form->getErrors(); @@ -340,6 +355,7 @@ class Units { } //get cord + $from = $database->getVillage($enforce['from']); $fromcoor = $database->getCoor($enforce['from']); $tocoor = $database->getCoor($enforce['vref']); $fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']); @@ -361,8 +377,21 @@ class Units { $post['t'.$i.'']='0'; } } + if (isset($post['t11'])){ + if( $post['t11'] != '' && $post['t11'] > 0){ + $qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$from['owner'].""; + $resulth = mysql_query($qh); + $hero_f=mysql_fetch_array($resulth); + $hero_unit=$hero_f['unit']; + $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; + } else { + $post['t11']='0'; + } + } else { + $post['t11']='0'; + } $time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1); - $reference = $database->addAttack($enforce['from'],$post['t1'],$post['t2'],$post['t3'],$post['t4'],$post['t5'],$post['t6'],$post['t7'],$post['t8'],$post['t9'],$post['t10'],0,2,0,0,0,0); + $reference = $database->addAttack($enforce['from'],$post['t1'],$post['t2'],$post['t3'],$post['t4'],$post['t5'],$post['t6'],$post['t7'],$post['t8'],$post['t9'],$post['t10'],$post['t11'],2,0,0,0,0); $database->addMovement(4,$village->wid,$enforce['from'],$reference,time(),($time+time())); $technology->checkReinf($post['ckey']); diff --git a/Templates/Build/16_incomming.tpl b/Templates/Build/16_incomming.tpl index bdd5d61d..2c7d8023 100644 --- a/Templates/Build/16_incomming.tpl +++ b/Templates/Build/16_incomming.tpl @@ -17,24 +17,46 @@ if ($units[$y]['sort_type']==3){ } else if ($units[$y]['attack_type']==4){ $actionType = "Raid on "; } - + $reinfowner = $database->getVillageField($units[$y]['from'],"owner"); if($units[$y]['attack_type'] != 1){ if($units[$y]['from'] != 0){ + if($units[$y]['t11'] != 0 && $reinfowner == $session->uid) { + $colspan = 11; + }else{ + $colspan = 10; + } echo " - "; $tribe = $database->getUserField($database->getVillageField($units[$y]['from'],"owner"),"tribe",0); $start = ($tribe-1)*10+1; - $end = ($tribe*10); + $end = ($tribe*10); echo ""; for($i=$start;$i<=($end);$i++) { echo ""; + } + if($units[$y]['t11'] != 0) { + echo ""; } echo ""; - for($i=$start;$i<=($end);$i++) { + 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 ""; + }else{ + + + if($units[$y]['t'.$i] == 0) { + echo ""; + } + else { + echo ""; + } + }}else{ if($totalunits > $building->getTypeLevel(16)){ echo ""; }else{ @@ -45,6 +67,7 @@ if ($units[$y]['sort_type']==3){ } } } + } echo ""; echo ' @@ -66,7 +89,7 @@ if ($units[$y]['sort_type']==3){ }else{ echo "
getMapCheck($units[$y]['from'])."\">".$database->getVillageField($units[$y]['from'],"name").""; + "; echo "getVillageField($units[$y]['from'],"owner")."\">".$database->getUserField($database->getVillageField($units[$y]['from'],"owner"),"username",0)."'s troops"; echo "
 getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />\"Hero\"
Troops?0"; + echo $units[$y]['t'.$i]."?
- "; $tribe = $session->tribe; @@ -77,7 +100,7 @@ if ($units[$y]['sort_type']==3){ echo ""; } echo ""; - for($i=$start;$i<=($end);$i++) { + for($i=1;$i<=10;$i++) { echo ""; } echo ""; @@ -113,6 +136,7 @@ if ($units[$y]['sort_type']==3){ $to = $database->getMInfo($units[$y]['vref']); +if($units[$y]['from'] != 0){ ?>
village of the elders"; + "; echo "Taskmaster's troops"; echo "
getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />
Troops?
@@ -138,7 +162,6 @@ $to = $database->getMInfo($units[$y]['vref']); wid){ if($units[$y]['t'.$i] == 0) { echo ""; } @@ -146,19 +169,16 @@ $to = $database->getMInfo($units[$y]['vref']); echo ""; } - }else{ - echo ""; - } } ?> + $totalres = $res['wood']+$res['clay']+$res['iron']+$res['crop']; + if($units[$y]['attack_type']!=2 and $units[$y]['attack_type']!=1 and $totalres != ""){?>
Troops 0"; echo $units[$y]['t'.$i]."?
Bounty "> \"Lumber\"".$res['wood']."\"Clay\"".$res['clay']."\"Iron\"".$res['iron']."\"Crop\"".$res['crop'].""; echo "
\"carry\"".$totalres."/".$totalcarry."
"; @@ -184,9 +204,78 @@ $to = $database->getMInfo($units[$y]['vref']);
- + + + + + + + + + tribe; + $start = ($tribe-1)*10+1; + $end = ($tribe*10); + echo ""; + for($i=$start;$i<=($end);$i++) { + echo ""; + } + if($units[$y]['t11'] != 0) { + echo ""; + } + ?> + + + 0"; + } + else { + echo ""; + } + } + ?> + + + + + + + + + + + + + +
?">
 getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />\"Hero\"
Troops"; + echo $units[$y]['t'.$i]."
Bounty"> + \"Lumber\"".$res['wood']."\"Clay\"".$res['clay']."\"Iron\"".$res['iron']."\"Crop\"".$res['crop'].""; + echo "
\"carry\"".$totalres."/".$totalcarry."
"; + ?> +
Arrival"> + ".$generator->getTimeFormat($units[$y]['endtime']-time())." h"; + $datetime = $generator->procMtime($units[$y]['endtime']); + echo "
"; + if($datetime[0] != "today") { + echo "on ".$datetime[0]." "; + } + echo "at ".$datetime[1]."
"; + ?> + +
+" /> - + getResourceLevel($village->wid); + if($wwvillage['f99t']!=40){ + ?> - - + gold >= 2) { - if($session->access!=BANNED){ - $gold=$database->getUserField($_SESSION['username'],'gold','username'); - $gold-=2; - $database->updateUserField($_SESSION['username'],'gold',$gold,0); - }else{ - header("Location: banned.php"); - } - } - if(!isset($timer)) { $timer = 1; } diff --git a/Templates/Plus/10.tpl b/Templates/Plus/10.tpl index 3e90e1e4..a1eb8f9c 100644 --- a/Templates/Plus/10.tpl +++ b/Templates/Plus/10.tpl @@ -43,11 +43,9 @@ $done1 = "nothing has been done"; } -print "



"; -echo $done1; -print "
"; + include("Templates/Plus/3.tpl"); }else{ diff --git a/Templates/Plus/11.tpl b/Templates/Plus/11.tpl index c0c95cad..1f8592c8 100644 --- a/Templates/Plus/11.tpl +++ b/Templates/Plus/11.tpl @@ -43,11 +43,9 @@ $done1 = "nothing has been done"; } -print "



"; -echo $done1; -print "
"; + include("Templates/Plus/3.tpl"); }else{ diff --git a/Templates/Plus/12.tpl b/Templates/Plus/12.tpl index 8903113f..9cafe246 100644 --- a/Templates/Plus/12.tpl +++ b/Templates/Plus/12.tpl @@ -43,11 +43,9 @@ $done1 = "nothing has been done"; } -print "



"; -echo $done1; -print "
"; + include("Templates/Plus/3.tpl"); }else{ diff --git a/Templates/Plus/7.tpl b/Templates/Plus/7.tpl index 248c9841..cefe7664 100644 --- a/Templates/Plus/7.tpl +++ b/Templates/Plus/7.tpl @@ -43,11 +43,9 @@ $done1 = "   Nothing has been Completed"; } -print "



"; -echo $done1; -print "
"; + include("Templates/Plus/3.tpl"); }else{ diff --git a/Templates/Plus/8.tpl b/Templates/Plus/8.tpl index c8348c8d..34417fc1 100644 --- a/Templates/Plus/8.tpl +++ b/Templates/Plus/8.tpl @@ -44,11 +44,9 @@ $done1 = "nothing has been done"; } -print "



"; -echo $done1; -print "
"; + include("Templates/Plus/3.tpl"); }else{ diff --git a/Templates/Plus/9.tpl b/Templates/Plus/9.tpl index 0f2df469..b3593a23 100644 --- a/Templates/Plus/9.tpl +++ b/Templates/Plus/9.tpl @@ -43,11 +43,9 @@ $done1 = "nothing has been done"; } -print "



"; -echo $done1; -print "
"; + include("Templates/Plus/3.tpl"); }else{ diff --git a/Templates/a2b/sendback_1.tpl b/Templates/a2b/sendback_1.tpl index 48834336..53aaa742 100644 --- a/Templates/a2b/sendback_1.tpl +++ b/Templates/a2b/sendback_1.tpl @@ -104,6 +104,12 @@ $tocoor = $database->getCoor($enforce['vref']); "; + if($enforce['hero']>0){ + ?> + "; + } ?> @@ -131,6 +137,13 @@ $tocoor = $database->getCoor($enforce['vref']); } } } + if ($enforce['hero']>0){ + $qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$from['owner'].""; + $resulth = mysql_query($qh); + $hero_f=mysql_fetch_array($resulth); + $hero_unit=$hero_f['unit']; + $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; + } $time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1); ?> diff --git a/Templates/a2b/sendback_2.tpl b/Templates/a2b/sendback_2.tpl index 8c60817b..fb64454e 100644 --- a/Templates/a2b/sendback_2.tpl +++ b/Templates/a2b/sendback_2.tpl @@ -105,6 +105,12 @@ $tocoor = $database->getCoor($enforce['vref']); "; + if($enforce['hero']>0){ + ?> + "; + } ?> @@ -132,6 +138,13 @@ $tocoor = $database->getCoor($enforce['vref']); } } } + if ($enforce['hero']>0){ + $qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$to['owner'].""; + $resulth = mysql_query($qh); + $hero_f=mysql_fetch_array($resulth); + $hero_unit=$hero_f['unit']; + $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; + } $time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1); ?> diff --git a/Templates/a2b/sendback_3.tpl b/Templates/a2b/sendback_3.tpl index 10e77855..00cfdc62 100644 --- a/Templates/a2b/sendback_3.tpl +++ b/Templates/a2b/sendback_3.tpl @@ -104,6 +104,12 @@ $tocoor = $database->getCoor($enforce['vref']); "; + if($enforce['hero']>0){ + ?> + "; + } ?> @@ -131,6 +137,13 @@ $tocoor = $database->getCoor($enforce['vref']); } } } + if ($enforce['hero']>0){ + $qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$to['owner'].""; + $resulth = mysql_query($qh); + $hero_f=mysql_fetch_array($resulth); + $hero_unit=$hero_f['unit']; + $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; + } $time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1); ?> diff --git a/Templates/a2b/sendback_4.tpl b/Templates/a2b/sendback_4.tpl index 846dcf96..be2c09e8 100644 --- a/Templates/a2b/sendback_4.tpl +++ b/Templates/a2b/sendback_4.tpl @@ -105,6 +105,12 @@ $tocoor = $database->getCoor($enforce['vref']); "; + if($enforce['hero']>0){ + ?> + "; + } ?> @@ -132,6 +138,13 @@ $tocoor = $database->getCoor($enforce['vref']); } } } + if ($enforce['hero']>0){ + $qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$to['owner'].""; + $resulth = mysql_query($qh); + $hero_f=mysql_fetch_array($resulth); + $hero_unit=$hero_f['unit']; + $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; + } $time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1); ?> diff --git a/Templates/Build/sendback_5.tpl b/Templates/a2b/sendback_5.tpl similarity index 91% rename from Templates/Build/sendback_5.tpl rename to Templates/a2b/sendback_5.tpl index cd9bfe83..64e4895a 100644 --- a/Templates/Build/sendback_5.tpl +++ b/Templates/a2b/sendback_5.tpl @@ -103,6 +103,12 @@ $tocoor = $database->getCoor($enforce['vref']); "; + if($enforce['hero']>0){ + ?> + "; + } ?> @@ -130,6 +136,13 @@ $tocoor = $database->getCoor($enforce['vref']); } } } + if ($enforce['hero']>0){ + $qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$to['owner'].""; + $resulth = mysql_query($qh); + $hero_f=mysql_fetch_array($resulth); + $hero_unit=$hero_f['unit']; + $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; + } $time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1); ?> diff --git a/Templates/multivillage.tpl b/Templates/multivillage.tpl index c5abcf5f..f63cae61 100644 --- a/Templates/multivillage.tpl +++ b/Templates/multivillage.tpl @@ -104,7 +104,7 @@ else if(isset($_GET['vill']) && isset($_GET['id'])) { for($i=1;$i<=count($session->villages);++$i){echo' - + '; }}?> diff --git a/Templates/serv_time.tpl b/Templates/serv_time.tpl deleted file mode 100644 index 6c665a71..00000000 --- a/Templates/serv_time.tpl +++ /dev/null @@ -1,13 +0,0 @@ - -
-
-
-"; -echo round(($generator->pageLoadTimeEnd()-$start)*1000); -echo " ".MILISECS."
\n"; -echo SERVER_TIME.' '.date('H:i:s').''; -?> -
-
-
\ No newline at end of file diff --git a/install/data/constant_format.tpl b/install/data/constant_format.tpl index 672db03b..ff6c23de 100644 --- a/install/data/constant_format.tpl +++ b/install/data/constant_format.tpl @@ -28,6 +28,10 @@ define("SERVER_NAME","%SERVERNAME%"); // Defines when has server started. define("COMMENCE","%STARTTIME%"); +// ***** Server Start Date / Time +define("START_DATE", "%SSTARTDATE%"); +define("START_TIME", "%SSTARTTIME%"); + // ***** Language // Choose your server language. define("LANG","%LANG%"); diff --git a/install/data/sql.sql b/install/data/sql.sql index 2f819f25..1ae441b7 100644 --- a/install/data/sql.sql +++ b/install/data/sql.sql @@ -452,24 +452,6 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%demolition` ( -- --- -------------------------------------------------------- - --- --- Table structure for table `%prefix%destroy_log` --- - -CREATE TABLE IF NOT EXISTS `%PREFIX%destroy_log` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `wid` int(10) unsigned NOT NULL, - `log` text NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- --- Dumping data for table `%prefix%destroy_log` --- - - -- -------------------------------------------------------- -- @@ -1329,29 +1311,28 @@ INSERT INTO `%PREFIX%users` (`id`, `username`, `password`, `email`, `tribe`, `ac -- CREATE TABLE IF NOT EXISTS `%PREFIX%vdata` ( - `wref` int(10) unsigned NOT NULL, - `owner` int(10) unsigned NOT NULL, - `name` varchar(45) NOT NULL, - `capital` tinyint(1) unsigned NOT NULL, - `pop` int(10) unsigned NOT NULL, - `cp` int(10) unsigned NOT NULL, - `celebration` int(10) NOT NULL DEFAULT '0', - `type` int(10) NOT NULL DEFAULT '0', - `wood` float(12,2) NOT NULL, - `clay` float(12,2) NOT NULL, - `iron` float(12,2) NOT NULL, - `maxstore` int(10) unsigned NOT NULL, - `crop` float(12,2) NOT NULL, - `maxcrop` int(10) unsigned NOT NULL, - `lastupdate` int(11) unsigned NOT NULL, - `loyalty` float(9,6) unsigned NOT NULL DEFAULT '100', - `exp1` int(10) NOT NULL, - `exp2` int(10) NOT NULL, - `exp3` int(10) NOT NULL, - `created` int(11) NOT NULL, - PRIMARY KEY (`wref`), - KEY `wref` (`wref`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +`wref` int(10) unsigned NOT NULL, +`owner` int(10) unsigned NOT NULL, +`name` varchar(45) NOT NULL, +`capital` tinyint(1) unsigned NOT NULL, +`pop` int(10) unsigned NOT NULL, +`cp` int(10) unsigned NOT NULL, +`celebration` int(10) NOT NULL DEFAULT '0', +`type` int(10) NOT NULL DEFAULT '0', +`wood` float(12,2) NOT NULL, +`clay` float(12,2) NOT NULL, +`iron` float(12,2) NOT NULL, +`maxstore` int(10) unsigned NOT NULL, +`crop` float(12,2) NOT NULL, +`maxcrop` int(10) unsigned NOT NULL, +`lastupdate` int(11) unsigned NOT NULL, +`loyalty` float(9,6) unsigned NOT NULL DEFAULT '100', +`exp1` int(10) NOT NULL, +`exp2` int(10) NOT NULL, +`exp3` int(10) NOT NULL, +`created` int(11) NOT NULL, +PRIMARY KEY (`wref`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -- Dumping data for table `%prefix%vdata` diff --git a/install/process.php b/install/process.php index d74eb39b..30752392 100644 --- a/install/process.php +++ b/install/process.php @@ -36,6 +36,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: install\include\constant.php"); $text = file_get_contents("data/constant_format.tpl"); $text = preg_replace("'%SERVERNAME%'", $_POST['servername'], $text); + $text = preg_replace("'%SSTARTDATE%'", $_POST['start_date'], $text); + $text = preg_replace("'%SSTARTTIME%'", $_POST['start_time'], $text); $text = preg_replace("'%LANG%'", $_POST['lang'], $text); $text = preg_replace("'%SPEED%'", $_POST['speed'], $text); $text = preg_replace("'%INCSPEED%'", $_POST['incspeed'], $text); diff --git a/install/templates/config.tpl b/install/templates/config.tpl index 8f0dc8c1..852e87b7 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -240,7 +240,12 @@ echo "
Error creating constant.php
NPC Trade
Lumber awood); ?> @@ -255,5 +257,8 @@ function testSum() { testSum(); - + +

+ \ No newline at end of file diff --git a/Templates/Build/ww.tpl b/Templates/Build/ww.tpl index 4c757d82..3bd4bda4 100644 --- a/Templates/Build/ww.tpl +++ b/Templates/Build/ww.tpl @@ -10,13 +10,14 @@ ## 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; ?>
-

Wonder of the World
Level resarray['f99']; ?>

+

Wonder of the World
Level resarray['f99'];?>

The World Wonder (otherwise known as a Wonder of the World) is as wonderful as it sounds. "This building" is built in order to win the server. Each level of the World Wonder costs hundreds of thousands (even millions) of resources to build.

@@ -29,7 +30,7 @@ echo 'You need to have World Wonder level 1 to be able to change its name.

World Wonder name:

'; } else if($village->resarray['f99'] > 0 and $village->resarray['f99'] < 11) { echo '

World Wonder name:

'; -} else if ($village->resarray['f99'] < 0){ +} else if ($village->resarray['f99'] > 10){ echo 'You can not change the name of the World Wonder after level 10.

World Wonder name:

'; }?> @@ -46,9 +47,9 @@ if($village->resarray['f99'] == 100) { echo "

Building already at max level

"; } else { -$uprequire = $building->resourceRequired($id,$village->resarray['f99t']); +$uprequire = $building->resourceRequired($id,$village->resarray['f99t'],($loopsame > 0 ? 2:1)+$doublebuild); ?> -

Costs for upgrading to level resarray['f99']+1; ?>:
+

Costs for upgrading to level resarray['f99']+1+$loopsame+$doublebuild; ?>:
Lumber | Clay | Iron | Crop | Crop consumption | durationgetTimeFormat($uprequire['time']); if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { echo "|\"NPC"; @@ -83,7 +84,7 @@ if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { else { echo "checker\">Upgrade to level "; } - echo $village->resarray['f99']+1; + echo $village->resarray['f99']+1+$loopsame+$doublebuild; echo "."; } else if($bindicate == 9) { @@ -96,7 +97,7 @@ if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { else { echo "checker\">Upgrade to level "; } - echo $village->resarray['f99']+1; + echo $village->resarray['f99']+1+$loopsame+$doublebuild; echo ". (waiting loop) "; } } diff --git a/Templates/Building.tpl b/Templates/Building.tpl index 610d6918..6e6a322e 100644 --- a/Templates/Building.tpl +++ b/Templates/Building.tpl @@ -29,16 +29,6 @@

Equites Caesaris name="t6" value="" maxlength="6" type="text"> (".$enforce['u6'].")Hero + (".$enforce['hero'].")
Teutonic Knight name="t6" value="" maxlength="6" type="text"> (".$enforce['u16'].")Hero + (".$enforce['hero'].")
Haeduan name="t6" value="" maxlength="6" type="text"> (".$enforce['u26'].")Hero + (".$enforce['hero'].")
Teutonic Knight name="t6" value="" maxlength="6" type="text"> (".$enforce['u36'].")Hero + (".$enforce['hero'].")
Natarian Knight name="t6" value="" maxlength="6" type="text"> (".$enforce['u6'].")Hero + (".$enforce['hero'].")
('.$returnVillageArray[$i-1]['x'].'
|
'.$returnVillageArray[$i-1]['y'].')

- +
+ Server Start Settings + + + +
Start Date:
Start Time:
diff --git a/login.php b/login.php index dc8228a1..8c9691df 100644 --- a/login.php +++ b/login.php @@ -64,10 +64,179 @@ else ?>
login

+ date('m/d/Y')){ +?> +
Server will start in:
+ + date('H:i')){ +?> +
Server will start in:
+ + - + @@ -87,7 +256,55 @@ else

- + + + +
+ + + + + + + + + + +
" maxlength="15" autocomplete='off' /> getError("user"); ?>
" maxlength="20" autocomplete='off' /> getError("pw"); ?>
+ +

+ + +

+ + +getError("pw") == LOGIN_PW_ERROR) { echo "