From 8c44bb4e2a58dd3bc1d7ae8826bd78f1cbdcba5c Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 1 Sep 2012 13:00:40 +0300 Subject: [PATCH] big update --- Admin/admin.php | 7 +- GameEngine/Account.php | 1 - GameEngine/Admin/database.php | 36 +- GameEngine/Alliance.php | 9 +- GameEngine/Automation.php | 421 +++++-- GameEngine/Battle.php | 1578 +++++++++++++-------------- GameEngine/Building.php | 2 +- GameEngine/Database/db_MYSQL.php | 24 +- GameEngine/Generator.php | 2 +- GameEngine/Ranking.php | 8 +- GameEngine/Session.php | 1 + GameEngine/Technology.php | 14 +- Templates/Ajax/quest_core.tpl | 62 +- Templates/Alliance/alliance.tpl | 57 + Templates/Alliance/overview.tpl | 2 +- Templates/Build/19_train.tpl | 34 + Templates/Build/20.tpl | 4 +- Templates/Build/21.tpl | 6 +- Templates/Build/25_train.tpl | 2 +- Templates/Build/26_train.tpl | 2 +- Templates/Build/37_hero.tpl | 2 +- Templates/Message/write.tpl | 4 +- Templates/Notice/18.tpl | 16 +- Templates/Notice/18x.tpl | 16 +- Templates/Notice/19.tpl | 16 +- Templates/Notice/19x.tpl | 16 +- Templates/Notice/20.tpl | 16 +- Templates/Notice/20x.tpl | 16 +- Templates/Notice/21.tpl | 16 +- Templates/Notice/21x.tpl | 16 +- Templates/Notice/3x.tpl | 8 +- Templates/Plus/10.tpl | 2 +- Templates/Plus/11.tpl | 2 +- Templates/Plus/12.tpl | 2 +- Templates/Plus/9.tpl | 2 +- Templates/Profile/account.tpl | 4 +- Templates/Ranking/ww.tpl | 2 +- Templates/menu.tpl | 2 - Templates/quest.tpl | 4 +- anmelden.php | 4 +- create_account.php | 2 +- dorf1.php | 2 +- gpack/travian_default/img/q/l4.jpg | Bin 0 -> 5417 bytes gpack/travian_default/img/q/l4g.jpg | Bin 0 -> 5417 bytes login.php | 4 +- medals.php | 42 +- 46 files changed, 1480 insertions(+), 1008 deletions(-) create mode 100644 Templates/Alliance/alliance.tpl create mode 100644 gpack/travian_default/img/q/l4.jpg create mode 100644 gpack/travian_default/img/q/l4g.jpg diff --git a/Admin/admin.php b/Admin/admin.php index d43abdbf..ec566b5e 100644 --- a/Admin/admin.php +++ b/Admin/admin.php @@ -93,7 +93,6 @@ $timeformat = new timeFormatGenerator; Server Homepage Control Panel Home Return to the server - Server Update
Logout
@@ -103,8 +102,8 @@ $timeformat = new timeFormatGenerator; Players Not Activated
Search - General Search - Search IGMs/Reports + Search Players/Alliances/Villages/E-mails/IPs/Deleted Players + Search Messages/Battle Reports
Ban Ban/Unban Players @@ -130,7 +129,7 @@ $timeformat = new timeFormatGenerator;
Natars Add WW Villages - Add WW Building Plan Villages + Add WW Buildingplan Villages
Admin: Admin Log diff --git a/GameEngine/Account.php b/GameEngine/Account.php index 8f6f7a8a..94f955fd 100644 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -114,7 +114,6 @@ class Account { if($uid) { setcookie("COOKUSR",$_POST['name'],time()+COOKIE_EXPIRE,COOKIE_PATH); setcookie("COOKEMAIL",$_POST['email'],time()+COOKIE_EXPIRE,COOKIE_PATH); - $database->updateUserField($uid,"act","",1); $database->updateUserField($uid,"invited",$_POST['invited'],1); $this->generateBase($_POST['kid'],$uid,$_POST['name']); diff --git a/GameEngine/Admin/database.php b/GameEngine/Admin/database.php index 47d6ee75..5e66ef38 100644 --- a/GameEngine/Admin/database.php +++ b/GameEngine/Admin/database.php @@ -52,6 +52,7 @@ class adm_DB { for ($i = 0; $i <= count($villages)-1; $i++) { $vid = $villages[$i]['wref']; $this->recountPop($vid); + $this->recountCP($vid); } } @@ -60,15 +61,30 @@ class adm_DB { $fdata = $database->getResourceLevel($vid); $popTot = 0; for ($i = 1; $i <= 40; $i++) { - $lvl = $fdata["f".$i]; - $building = $fdata["f".$i."t"]; - if($building){ + $lvl = $fdata["f".$i]; + $building = $fdata["f".$i."t"]; + if($building){ $popTot += $this->buildingPOP($building,$lvl); - } + } } $q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid"; mysql_query($q, $this->connection); } + + function recountCP($vid){ + global $database; + $fdata = $database->getResourceLevel($vid); + $popTot = 0; + for ($i = 1; $i <= 40; $i++) { + $lvl = $fdata["f".$i]; + $building = $fdata["f".$i."t"]; + if($building){ + $popTot += $this->buildingCP($building,$lvl); + } + } + $q = "UPDATE ".TB_PREFIX."vdata set cp = $popTot where wref = $vid"; + mysql_query($q, $this->connection); + } function buildingPOP($f,$lvl){ $name = "bid".$f; @@ -80,6 +96,18 @@ class adm_DB { } return $popT; } + + function buildingCP($f,$lvl){ + $name = "bid".$f; + global $$name; + $popT = 0; + $dataarray = $$name; + + for ($i = 0; $i <= $lvl; $i++) { + $popT += $dataarray[$i]['cp']; + } + return $popT; + } function getWref($x,$y) { $q = "SELECT id FROM ".TB_PREFIX."wdata where x = $x and y = $y"; diff --git a/GameEngine/Alliance.php b/GameEngine/Alliance.php index 7dcdb802..5671020d 100644 --- a/GameEngine/Alliance.php +++ b/GameEngine/Alliance.php @@ -108,7 +108,7 @@ public function sendInvite($post) { global $form, $database, $session; if($session->access != BANNED){ - if(isset($post['a_name']) && $post['a_uid'] != ""){ + if(isset($post['a_name']) or $post['a_uid'] == ""){ $UserData = $database->getUserArray($post['a_name'], 0); if($this->userPermArray['opt4'] == 0) { $form->addError("perm", NO_PERMISSION); @@ -393,6 +393,13 @@ } elseif(md5($post['pw']) !== $session->userinfo['password']) { $form->addError("pw2", PW_ERR); } else { + if($database->isAllianceOwner($sessiom->uid)){ + $newowner = $database->getAllMember2($session->alliance); + $newleader = $newowner['id']; + $q = "UPDATE " . TB_PREFIX . "alidata set leader = ".$newleader." where id = ".$session->alliance.""; + $database->query($q); + $database->updateAlliPermissions($newleader, 1, 1, 1, 1, 1, 1, 1, 1, 1); + } $database->updateUserField($session->uid, 'alliance', 0, 1); $database->deleteAlliPermissions($session->uid); // log the notice diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index a153c38b..a26e7e9a 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1,7 +1,9 @@ getResourceLevel($vid); $popTot = 0; + for ($i = 1; $i <= 40; $i++) { $lvl = $fdata["f".$i]; $building = $fdata["f".$i."t"]; @@ -109,7 +112,7 @@ class Automation { } } - $q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid"; + $q = "UPDATE ".TB_PREFIX."vdata set cp = $popTot where wref = $vid"; mysql_query($q); return $popTot; @@ -141,39 +144,77 @@ class Automation { } public function Automation() { + $this->procClimbers(); + $this->ClearUser(); $this->ClearInactive(); $this->oasisResoucesProduce(); $this->pruneResource(); $this->pruneOResource(); $this->checkWWAttacks(); - $this->culturePoints(); - $this->updateHero(); - $this->clearDeleting(); - $this->buildComplete(); + if(!file_exists("GameEngine/Prevention/culturepoints.txt") or time()-filemtime("GameEngine/Prevention/culturepoints.txt")>10) { + $this->culturePoints(); + } + if(!file_exists("GameEngine/Prevention/updatehero.txt") or time()-filemtime("GameEngine/Prevention/updatehero.txt")>50) { + $this->updateHero(); + } + if(!file_exists("GameEngine/Prevention/cleardeleting.txt") or time()-filemtime("GameEngine/Prevention/cleardeleting.txt")>10) { + $this->clearDeleting(); + } + if (! file_exists("GameEngine/Prevention/build.txt") or time() - filemtime("GameEngine/Prevention/build.txt") > 10) + { + $this->buildComplete(); + } $this->MasterBuilder(); - $this->demolitionComplete(); + if (! file_exists("GameEngine/Prevention/demolition.txt") or time() - filemtime("GameEngine/Prevention/demolition.txt") > 10) + { + $this->demolitionComplete(); + } $this->updateStore(); $this->delTradeRoute(); $this->TradeRoute(); - $this->marketComplete(); - $this->researchComplete(); - $this->trainingComplete(); - $this->starvation(); - $this->celebrationComplete(); - $this->sendunitsComplete(); - $this->loyaltyRegeneration(); - $this->sendreinfunitsComplete(); - $this->returnunitsComplete(); - $this->sendSettlersComplete(); + if(!file_exists("GameEngine/Prevention/market.txt") or time()-filemtime("GameEngine/Prevention/market.txt")>10) { + $this->marketComplete(); + } + if(!file_exists("GameEngine/Prevention/research.txt") or time()-filemtime("GameEngine/Prevention/research.txt")>10) { + $this->researchComplete(); + } + if(!file_exists("GameEngine/Prevention/training.txt") or time()-filemtime("GameEngine/Prevention/training.txt")>10) { + $this->trainingComplete(); + } + if(!file_exists("GameEngine/Prevention/starvation.txt") or time()-filemtime("GameEngine/Prevention/starvation.txt")>10) { + $this->starvation(); + } + if(!file_exists("GameEngine/Prevention/celebration.txt") or time()-filemtime("GameEngine/Prevention/celebration.txt")>10) { + $this->celebrationComplete(); + } + if(!file_exists("GameEngine/Prevention/sendunits.txt") or time()-filemtime("GameEngine/Prevention/sendunits.txt")>10) { + $this->sendunitsComplete(); + } + if(!file_exists("GameEngine/Prevention/loyalty.txt") or time()-filemtime("GameEngine/Prevention/loyalty.txt")>50) { + $this->loyaltyRegeneration(); + } + if(!file_exists("GameEngine/Prevention/sendreinfunits.txt") or time()-filemtime("GameEngine/Prevention/sendreinfunits.txt")>10) { + $this->sendreinfunitsComplete(); + } + if(!file_exists("GameEngine/Prevention/returnunits.txt") or time()-filemtime("GameEngine/Prevention/returnunits.txt")>51) { + $this->returnunitsComplete(); + } + if(!file_exists("GameEngine/Prevention/settlers.txt") or time()-filemtime("GameEngine/Prevention/settlers.txt")>10) { + $this->sendSettlersComplete(); + } $this->updateGeneralAttack(); $this->checkInvitedPlayes(); + $this->updateStore(); $this->CheckBan(); $this->regenerateOasisTroops(); $this->artefactOfTheFool(); } private function loyaltyRegeneration() { + if(file_exists("GameEngine/Prevention/loyalty.txt")) { + unlink("GameEngine/Prevention/loyalty.txt"); + } global $database; $array = array(); $q = "SELECT * FROM ".TB_PREFIX."vdata WHERE loyalty<>100"; @@ -209,6 +250,9 @@ class Automation { $database->query($q); } } + if(file_exists("GameEngine/Prevention/loyalty.txt")) { + unlink("GameEngine/Prevention/loyalty.txt"); + } } private function getfieldDistance($coorx1, $coory1, $coorx2, $coory2) { @@ -271,7 +315,12 @@ class Automation { } private function clearDeleting() { + if(file_exists("GameEngine/Prevention/cleardeleting.txt")) { + unlink("GameEngine/Prevention/cleardeleting.txt"); + } global $database; + $ourFileHandle = fopen("GameEngine/Prevention/cleardeleting.txt", 'w'); + fclose($ourFileHandle); $needDelete = $database->getNeedDelete(); if(count($needDelete) > 0) { foreach($needDelete as $need) { @@ -281,14 +330,12 @@ class Automation { $database->query($q); $q = "DELETE FROM ".TB_PREFIX."bdata where wid = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."enforcement where vref = ".$village; + $q = "DELETE FROM ".TB_PREFIX."enforcement where from = ".$village; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."fdata where vref = ".$village; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."market where vref = ".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."movement where to = ".$village." or from = ".$village; - $database->query($q); $q = "DELETE FROM ".TB_PREFIX."odata where wref = ".$village; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."research where vref = ".$village; @@ -299,11 +346,56 @@ class Automation { $database->query($q); $q = "DELETE FROM ".TB_PREFIX."units where vref =".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."vdata where vref = ".$village; + $q = "DELETE FROM ".TB_PREFIX."vdata where wref = ".$village; $database->query($q); $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = ".$village; $database->query($q); + $getmovement = $database->getMovement(3,$village,1); + foreach($getmovement as $movedata) { + $time = time(); + $time2 = $time - $movedata['starttime']; + $database->addMovement(4,$movedata['to'],$movedata['from'],$movedata['ref'],$time,$time+$time2); + $database->setMovementProc($movedata['moveid']); + } + $q = "DELETE FROM ".TB_PREFIX."movement where from = ".$village; + $database->query($q); + $getprisoners = $database->getPrisoners($village); + foreach($getprisoners as $pris) { + $troops = 0; + for($i=1;$i<12;$i++){ + $troops += $pris['t'.$i]; + } + $database->modifyUnit($pris['wref'],array("99o"),array($troops),array(0)); + $database->deletePrisoners($pris['id']); + } + $getprisoners = $database->getPrisoners3($village); + foreach($getprisoners as $pris) { + $troops = 0; + for($i=1;$i<12;$i++){ + $troops += $pris['t'.$i]; + } + $database->modifyUnit($pris['wref'],array("99o"),array($troops),array(0)); + $database->deletePrisoners($pris['id']); + } + $enforcement = $database->getEnforceVillage($village,0); + foreach($enforcement as $enforce) { + $time = time(); + $fromcoor = $database->getCoor($enforce['vref']); + $tocoor = $database->getCoor($enforce['from']); + $targettribe = $database->getUserField($database->getVillageField($enforce['from'],"owner"),"tribe",0); + $time2 = $this->procDistanceTime($tocoor,$fromcoor,$targettribe,0); + $start = 10*($targettribe-1); + for($i=1;$i<11;$i++){ + $unit = $start + $i; + $post['t'.$i] = $enforce['u'.$unit]; + } + $post['t11'] = $enforce['hero']; + $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,$enforce['vref'],$enforce['from'],$reference,$time,$time+$time2); + } } + $q = "DELETE FROM ".TB_PREFIX."hero where uid = ".$need['uid']; + $database->query($q); $q = "DELETE FROM ".TB_PREFIX."mdata where target = ".$need['uid']." or owner = ".$need['uid']; $database->query($q); $q = "DELETE FROM ".TB_PREFIX."ndata where uid = ".$need['uid']; @@ -312,8 +404,20 @@ class Automation { $database->query($q); } } + if(file_exists("GameEngine/Prevention/cleardeleting.txt")) { + unlink("GameEngine/Prevention/cleardeleting.txt"); + } } - + + private function ClearUser() { + global $database; + if(AUTO_DEL_INACTIVE) { + $time = time()+UN_ACT_TIME; + $q = "DELETE from ".TB_PREFIX."users where timestamp >= $time and act != ''"; + $database->query($q); + } + } + private function ClearInactive() { global $database; if(TRACK_USR) { @@ -470,6 +574,9 @@ class Automation { } private function culturePoints() { + if(file_exists("GameEngine/Prevention/culturepoints.txt")) { + unlink("GameEngine/Prevention/culturepoints.txt"); + } global $database,$session; $time = time()-600; // 10minutes $array = array(); @@ -485,9 +592,15 @@ class Automation { $database->query($q); } } - } + if(file_exists("GameEngine/Prevention/culturepoints.txt")) { + unlink("GameEngine/Prevention/culturepoints.txt"); + } +} private function buildComplete() { + if(file_exists("GameEngine/Prevention/build.txt")) { + unlink("GameEngine/Prevention/build.txt"); + } global $database,$bid18,$bid10,$bid11,$bid38,$bid39; $time = time(); $array = array(); @@ -584,6 +697,9 @@ class Automation { $database->setVillageField($indi['wid'], 'starvupdate', $time); } } + if(file_exists("GameEngine/Prevention/build.txt")) { + unlink("GameEngine/Prevention/build.txt"); + } } // by SlimShady95 aka Manuel Mannhardt < manuel_mannhardt@web.de > @@ -782,7 +898,12 @@ class Automation { } private function marketComplete() { + if(file_exists("GameEngine/Prevention/market.txt")) { + unlink("GameEngine/Prevention/market.txt"); + } global $database; + $ourFileHandle = fopen("GameEngine/Prevention/market.txt", 'w'); + fclose($ourFileHandle); $time = time(); $q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."send where ".TB_PREFIX."movement.ref = ".TB_PREFIX."send.id and ".TB_PREFIX."movement.proc = 0 and sort_type = 0 and endtime < $time"; $dataarray = $database->query_return($q); @@ -817,6 +938,9 @@ class Automation { $this->sendResource2($data1['wood'],$data1['clay'],$data1['iron'],$data1['crop'],$data1['to'],$data1['from'],$targettribe1,$send); } } + if(file_exists("GameEngine/Prevention/market.txt")) { + unlink("GameEngine/Prevention/market.txt"); + } } private function sendResource2($wtrans,$ctrans,$itrans,$crtrans,$from,$to,$tribe,$send) { @@ -854,7 +978,12 @@ class Automation { } private function sendunitsComplete() { + if(file_exists("GameEngine/Prevention/sendunits.txt")) { + unlink("GameEngine/Prevention/sendunits.txt"); + } global $bid23,$bid34,$database,$battle,$village,$technology,$logging,$generator; + $ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w'); + fclose($ourFileHandle); $time = time(); $q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type != '2' and endtime < $time ORDER BY endtime ASC"; $dataarray = $database->query_return($q); @@ -956,9 +1085,9 @@ class Automation { $end = ($owntribe*10); $u = (($owntribe-1)*10); $catp = 0; - $catapult = array(8,18,28,38,48); - $ram = array(7,17,27,37,47); - $chief = array(9,19,29,39,49); + $catapult = array(8,18,28,48); + $ram = array(7,17,27,47); + $chief = array(9,19,29,49); $spys = array(4,14,23,44); for($i=$start;$i<=$end;$i++) { $y = $i-$u; @@ -1112,8 +1241,6 @@ class Automation { $end = ($owntribe*10); $u = (($owntribe-1)*10); $catp = 0; - $rams = 0; - $chiefs = 0; $catapult = array(8,18,28,38,48); $ram = array(7,17,27,37,47); $chief = array(9,19,29,39,49); @@ -1703,7 +1830,7 @@ class Automation { for ($i=1;$i<=41;$i++) { if ($i==41) $i=99; - if ($bdo['f'.$i.'t']==$rand && $bdo['f'.$i]>0) + if ($bdo['f'.$i.'t']==$rand && $bdo['f'.$i]>0 && $rand != 31 && $rand != 32 && $rand != 33) { $j++; $_rand[$j]=$bdo['f'.$i]; @@ -1732,7 +1859,7 @@ class Automation { for ($i=1;$i<=41;$i++) { if ($i==41) $i=99; - if ($bdo['f'.$i] > 0) + if ($bdo['f'.$i] > 0 && $rand != 31 && $rand != 32 && $rand != 33) { $list[$j]=$i; $j++; @@ -1773,7 +1900,8 @@ class Automation { $database->query($q); } $pop=$this->recountPop($data['to']); - if($pop=='0') + $capital = $database->getVillage($data['to']); + if($pop=='0' && $capital['capital']=='0') { $village_destroyed = 1; } @@ -1827,7 +1955,7 @@ class Automation { for ($i=1;$i<=41;$i++) { if ($i==41) $i=99; - if ($bdo['f'.$i.'t']==$rand && $bdo['f'.$i]>0) + if ($bdo['f'.$i.'t']==$rand && $bdo['f'.$i]>0 && $rand != 31 && $rand != 32 && $rand != 33) { $j++; $_rand[$j]=$bdo['f'.$i]; @@ -1856,7 +1984,7 @@ class Automation { for ($i=1;$i<=41;$i++) { if ($i==41) $i=99; - if ($bdo['f'.$i] > 0) + if ($bdo['f'.$i] > 0 && $rand != 31 && $rand != 32 && $rand != 33) { $j++; $list[$j]=$i; @@ -1951,7 +2079,7 @@ class Automation { for ($i=1;$i<=41;$i++) { if ($i==41) $i=99; - if ($bdo['f'.$i.'t']==$rand && $bdo['f'.$i]>0) + if ($bdo['f'.$i.'t']==$rand && $bdo['f'.$i]>0 && $rand != 31 && $rand != 32 && $rand != 33) { $j++; $_rand[$j]=$bdo['f'.$i]; @@ -2380,7 +2508,7 @@ $crannyimg = "modifyAttack2($data['ref'],10,$prisoner['t10']); $database->modifyAttack2($data['ref'],11,$prisoner['t11']); $mytroops = $prisoner['t1']+$prisoner['t2']+$prisoner['t3']+$prisoner['t4']+$prisoner['t5']+$prisoner['t6']+$prisoner['t7']+$prisoner['t8']+$prisoner['t9']+$prisoner['t10']+$prisoner['t11']; - $newtraps = (round($mytroops/3))*2; + $newtraps = round($mytroops/3); $database->modifyUnit($data['to'],array("99"),array($newtraps),array(0)); $database->modifyUnit($data['to'],array("99o"),array($mytroops),array(0)); }else{ @@ -2464,7 +2592,7 @@ $crannyimg = "addNotice($to['owner'],$to['wref'],$targetally,7,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,$AttackArrivalTime); }else if($totaldead_alldef == 0){ @@ -2582,6 +2710,40 @@ $crannyimg = "deletePrisoners($pris['id']); + } + $getprisoners = $database->getPrisoners3($data['to']); + foreach($getprisoners as $pris) { + $troops = 0; + for($i=1;$i<12;$i++){ + $troops += $pris['t'.$i]; + } + $database->modifyUnit($pris['wref'],array("99o"),array($troops),array(0)); + $database->deletePrisoners($pris['id']); + } + $enforcement = $database->getEnforceVillage($data['to'],0); + foreach($enforcement as $enforce) { + $time = time(); + $fromcoor = $database->getCoor($enforce['vref']); + $tocoor = $database->getCoor($enforce['from']); + $targettribe = $database->getUserField($database->getVillageField($enforce['from'],"owner"),"tribe",0); + $time2 = $this->procDistanceTime($tocoor,$fromcoor,$targettribe,0); + $start = 10*($targettribe-1); + for($i=1;$i<11;$i++){ + $unit = $start + $i; + $post['t'.$i] = $enforce['u'.$unit]; + } + $post['t11'] = $enforce['hero']; + $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,$enforce['vref'],$enforce['from'],$reference,$time,$time+$time2); + } } } }else{ @@ -2716,6 +2878,9 @@ $crannyimg = "query_return($q); foreach($dataarray as $data) { @@ -2909,10 +3079,18 @@ $crannyimg = "setMovementProc($data['moveid']); } } + if(file_exists("GameEngine/Prevention/sendreinfunits.txt")) { + unlink("GameEngine/Prevention/sendreinfunits.txt"); + } } private function returnunitsComplete() { + if(file_exists("GameEngine/Prevention/returnunits.txt")) { + unlink("GameEngine/Prevention/returnunits.txt"); + } global $database; + $ourFileHandle = fopen("GameEngine/Prevention/returnunits.txt", 'w'); + fclose($ourFileHandle); $time = time(); $q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '4' and endtime < $time"; $dataarray = $database->query_return($q); @@ -2961,10 +3139,19 @@ $crannyimg = "modifyUnit($data['to'],array($tribe."0"),array(3),array(1)); $database->setMovementProc($data['moveid']); } + + if(file_exists("GameEngine/Prevention/returnunits.txt")) { + unlink("GameEngine/Prevention/returnunits.txt"); + } } private function sendSettlersComplete() { + if(file_exists("GameEngine/Prevention/settlers.txt")) { + unlink("GameEngine/Prevention/settlers.txt"); + } global $database, $building; + $ourFileHandle = fopen("GameEngine/Prevention/settlers.txt", 'w'); + fclose($ourFileHandle); $time = time(); $q = "SELECT * FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 5 and endtime < $time"; $dataarray = $database->query_return($q); @@ -3005,10 +3192,18 @@ $crannyimg = "setMovementProc($data['moveid']); } } - } + if(file_exists("GameEngine/Prevention/settlers.txt")) { + unlink("GameEngine/Prevention/settlers.txt"); + } + } private function researchComplete() { + if(file_exists("GameEngine/Prevention/research.txt")) { + unlink("GameEngine/Prevention/research.txt"); + } global $database; + $ourFileHandle = fopen("GameEngine/Prevention/research.txt", 'w'); + fclose($ourFileHandle); $time = time(); $q = "SELECT * FROM ".TB_PREFIX."research where timestamp < $time"; $dataarray = $database->query_return($q); @@ -3027,6 +3222,9 @@ $crannyimg = "getResourceLevel($vid); + if($vid==0) { $vid=$village->wid; } + $buildarray = array(); + if($vid!=0){ $buildarray = $database->getResourceLevel($vid); } $upkeep = 0; switch($type) { case 0: @@ -3209,9 +3408,9 @@ $crannyimg = "getOwnUniqueArtefactInfo2($_SESSION['id_user'],4,3,0)); + $artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,4,3,0)); $artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1)); - $artefact2 = count($database->getOwnUniqueArtefactInfo2($_SESSION['id_user'],4,2,0)); + $artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,4,2,0)); if($artefact > 0){ $upkeep /= 2; $upkeep = round($upkeep); @@ -3223,7 +3422,7 @@ $crannyimg = "getFoolArtefactInfo(4,$vid,$_SESSION['id_user']); + $foolartefact = $database->getFoolArtefactInfo(4,$vid,$session->uid); if(count($foolartefact) > 0){ foreach($foolartefact as $arte){ if($arte['bad_effect'] == 1){ @@ -3414,8 +3613,13 @@ $crannyimg = "getTrainingList(); if(count($trainlist) > 0){ foreach($trainlist as $train){ @@ -3452,6 +3656,9 @@ $crannyimg = "getCel(); foreach($varray as $vil){ $id = $vil['wref']; @@ -3556,10 +3769,19 @@ $crannyimg = "clearCel($id); $database->setCelCp($user,$cp); } + if(file_exists("GameEngine/Prevention/celebration.txt")) { + unlink("GameEngine/Prevention/celebration.txt"); + } } private function demolitionComplete() { + if(file_exists("GameEngine/Prevention/demolition.txt")) { + unlink("GameEngine/Prevention/demolition.txt"); + } global $building,$database; + $ourFileHandle = fopen("GameEngine/Prevention/demolition.txt", 'w'); + fclose($ourFileHandle); + $varray = $database->getDemolition(); foreach($varray as $vil) { if ($vil['timetofinish'] <= time()) { @@ -3586,16 +3808,22 @@ $crannyimg = "delDemolition($vil['vref']); } } + if(file_exists("GameEngine/Prevention/demolition.txt")) { + unlink("GameEngine/Prevention/demolition.txt"); + } } private function updateHero() { + if(file_exists("GameEngine/Prevention/updatehero.txt")) { + unlink("GameEngine/Prevention/updatehero.txt"); + } global $database,$hero_levels; $harray = $database->getHero(); if(!empty($harray)){ foreach($harray as $hdata){ if((time()-$hdata['lastupdate'])>=1){ if($hdata['health']<100 and $hdata['health']>0){ - $reg = $hdata['health']+$hdata['regeneration']*5*SPEED/86400*(time()-$hdata['lastupdate']); + $reg = $hdata['health']+$hdata['regeneration']*5*ceil(SPEED/10)/86400*(time()-$hdata['lastupdate']); if($reg <= 100){ $database->modifyHero("health",$reg,$hdata['heroid']); }else{ @@ -3619,45 +3847,58 @@ $crannyimg = " UPDATED FROM songeriux < haroldas.snei@gmail.com > private function updateStore() { global $bid10, $bid38, $bid11, $bid39; - - $result = mysql_query("SELECT * FROM `".TB_PREFIX."fdata` WHERE vref = '".$_SESSION['wid']."' LIMIT 1"); - $row = mysql_fetch_assoc($result); - if ($row == null) { return; } - - $ress = $crop = 0; - - for ($i = 19; $i < 40; ++$i) { - switch ($row['f' . $i . 't']) { - case 10: + + $result = mysql_query('SELECT * FROM `' . TB_PREFIX . 'fdata`'); + while ($row = mysql_fetch_assoc($result)) + { + $ress = $crop = 0; + for ($i = 19; $i < 40; ++$i) + { + if ($row['f' . $i . 't'] == 10) + { $ress += $bid10[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER; - break; - - case 11: - $crop += $bid11[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER; - break; - - case 38: + } + + if ($row['f' . $i . 't'] == 38) + { $ress += $bid38[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER; - break; - - case 39: + } + + + + if ($row['f' . $i . 't'] == 11) + { + $crop += $bid11[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER; + } + + if ($row['f' . $i . 't'] == 39) + { $crop += $bid39[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER; - break; + } } + + if ($ress == 0) + { + $ress = 800 * STORAGE_MULTIPLIER; + } + + if ($crop == 0) + { + $crop = 800 * STORAGE_MULTIPLIER; + } + + mysql_query('UPDATE `' . TB_PREFIX . 'vdata` SET `maxstore` = ' . $ress . ', `maxcrop` = ' . $crop . ' WHERE `wref` = ' . $row['vref']) or die(mysql_error()); } - - if ($ress == 0) { - $ress = 800 * STORAGE_MULTIPLIER; - } - if ($crop == 0) { - $crop = 800 * STORAGE_MULTIPLIER; - } - - mysql_query('UPDATE `' . TB_PREFIX . 'vdata` SET `maxstore` = ' . $ress . ', `maxcrop` = ' . $crop . ' WHERE `wref` = ' . $row['vref']) or die(mysql_error()); } private function oasisResoucesProduce() { @@ -3682,8 +3923,6 @@ $crannyimg = "getProfileVillages($user['id'])); if($varray > 1){ $usergold = $database->getUserField($user['invited'],"gold",0); @@ -3764,7 +4003,12 @@ $crannyimg = "1, @@ -3918,9 +4162,16 @@ $crannyimg = "query_return($users); @@ -3936,6 +4187,9 @@ $crannyimg = "getUserRank($session['id']); + if($session['oldrank'] == 0){ + $database->updateoldrank($session['id'], $oldrank); + }else{ if($week > 1){ if($session['oldrank'] > $oldrank) { $totalpoints = $session['oldrank'] - $oldrank; @@ -3954,6 +4208,7 @@ $crannyimg = "getARanking(); $ranking->procARankArray(); if(count($ranking->getRank()) > 0){ @@ -3962,6 +4217,9 @@ $crannyimg = "getVSumField($member['id'],"pop"); + } + if($ally['oldrank'] == 0){ + $database->updateoldrankAlly($ally['id'], $oldrank); } if($ally['oldrank'] < $oldrank) { $totalpoints = $oldrank - $ally['oldrank']; @@ -3975,6 +4233,9 @@ $crannyimg = " 0) { - if($post['palast'] == "") { - $post['palast'] = 0; - } - if(isset($post['wall1']) && $post['wall1'] == "") { - $post['wall1'] = 0; - } - if(isset($post['wall2']) && $post['wall2'] == "") { - $post['wall2'] = 0; - } - if(isset($post['wall3']) && $post['wall3'] == "") { - $post['wall3'] = 0; - } - if(isset($post['wall4']) && $post['wall4'] == "") { - $post['wall4'] = 0; - } - if(isset($post['wall5']) && $post['wall5'] == "") { - $post['wall5'] = 0; - } - $post['tribe'] = $target[0]; - $_POST['result'] = $this->simulate($post); - $form->valuearray = $post; + $_POST['target'] = $target; + if(isset($post['a1_1'])) { + $sum = $sum2 = 0; + for($i=1;$i<=10;$i++) { + $sum += $post['a1_'.$i]; + } + if($sum > 0) { + if($post['palast'] == "") { + $post['palast'] = 0; + } + if(isset($post['wall1']) && $post['wall1'] == "") { + $post['wall1'] = 0; + } + if(isset($post['wall2']) && $post['wall2'] == "") { + $post['wall2'] = 0; + } + if(isset($post['wall3']) && $post['wall3'] == "") { + $post['wall3'] = 0; + }if(isset($post['wall4']) && $post['wall4'] == "") { + $post['wall4'] = 0; + }if(isset($post['wall5']) && $post['wall5'] == "") { + $post['wall5'] = 0; + } + $post['tribe'] = $target[0]; + $_POST['result'] = $this->simulate($post); + $form->valuearray = $post; + } + } } - } } - } - private function getBattleHero($uid) { + private function getBattleHero($uid) { global $database; $heroarray = $database->getHero($uid); $herodata = $GLOBALS["h".$heroarray[0]['unit']]; @@ -78,104 +76,103 @@ class Battle { $h_db = 1 + 0.002 * $heroarray[0]['defencebonus']; return array('heroid'=>$heroarray[0]['heroid'],'unit'=>$heroarray[0]['unit'],'atk'=>$h_atk,'di'=>$h_di,'dc'=>$h_dc,'ob'=>$h_ob,'db'=>$h_db,'health'=>$heroarray['health']); - } + } - private function simulate($post) { - // Establecemos los arrays con las unidades del atacante y defensor - $attacker = array('u1'=>0,'u2'=>0,'u3'=>0,'u4'=>0,'u5'=>0,'u6'=>0,'u7'=>0,'u8'=>0,'u9'=>0,'u10'=>0,'u11'=>0,'u12'=>0,'u13'=>0,'u14'=>0,'u15'=>0,'u16'=>0,'u17'=>0,'u18'=>0,'u19'=>0,'u20'=>0,'u21'=>0,'u22'=>0,'u23'=>0,'u24'=>0,'u25'=>0,'u26'=>0,'u27'=>0,'u28'=>0,'u29'=>0,'u30'=>0,'u31'=>0,'u32'=>0,'u33'=>0,'u34'=>0,'u35'=>0,'u36'=>0,'u37'=>0,'u38'=>0,'u39'=>0,'u40'=>0,'u41'=>0,'u42'=>0,'u43'=>0,'u44'=>0,'u45'=>0,'u46'=>0,'u47'=>0,'u48'=>0,'u49'=>0,'u50'=>0); - $start = ($post['a1_v']-1)*10+1; - $index = 1; - for($i=$start;$i<=($start+9);$i++) { - $attacker['u'.$i] = $post['a1_'.$index]; - if($index <=8) { - ${att_ab.$index} = $post['f1_'.$index]; - } - $index += 1; - } - $defender = array(); - for($i=1;$i<=50;$i++) { - if(isset($post['a2_'.$i]) && $post['a2_'.$i] != "") { - $defender['u'.$i] = $post['a2_'.$i]; - } - else { - $defender['u'.$i] = 0; - } - } - $deftribe = $post['tribe']; - $wall = 0; - switch($deftribe) { - case 1: - for($i=1;$i<=8;$i++) { - ${def_ab.$i} = $post['f2_'.$i]; + private function simulate($post) { + // Establecemos los arrays con las unidades del atacante y defensor + $attacker = array('u1'=>0,'u2'=>0,'u3'=>0,'u4'=>0,'u5'=>0,'u6'=>0,'u7'=>0,'u8'=>0,'u9'=>0,'u10'=>0,'u11'=>0,'u12'=>0,'u13'=>0,'u14'=>0,'u15'=>0,'u16'=>0,'u17'=>0,'u18'=>0,'u19'=>0,'u20'=>0,'u21'=>0,'u22'=>0,'u23'=>0,'u24'=>0,'u25'=>0,'u26'=>0,'u27'=>0,'u28'=>0,'u29'=>0,'u30'=>0,'u31'=>0,'u32'=>0,'u33'=>0,'u34'=>0,'u35'=>0,'u36'=>0,'u37'=>0,'u38'=>0,'u39'=>0,'u40'=>0,'u41'=>0,'u42'=>0,'u43'=>0,'u44'=>0,'u45'=>0,'u46'=>0,'u47'=>0,'u48'=>0,'u49'=>0,'u50'=>0); + $start = ($post['a1_v']-1)*10+1; + $index = 1; + for($i=$start;$i<=($start+9);$i++) { + $attacker['u'.$i] = $post['a1_'.$index]; + if($index <=8) { + ${att_ab.$index} = $post['f1_'.$index]; + } + $index += 1; } - break; - case 2: - for($i=11;$i<=18;$i++) { - ${def_ab.$i-10} = $post['f2_'.$i]; + $defender = array(); + for($i=1;$i<=50;$i++) { + if(isset($post['a2_'.$i]) && $post['a2_'.$i] != "") { + $defender['u'.$i] = $post['a2_'.$i]; + } + else { + $defender['u'.$i] = 0; + } } - break; - case 3: - for($i=21;$i<=28;$i++) { - ${def_ab.$i-20} = $post['f2_'.$i]; - } - break; + $deftribe = $post['tribe']; + $wall = 0; + switch($deftribe) { + case 1: + for($i=1;$i<=8;$i++) { + ${def_ab.$i} = $post['f2_'.$i]; + } + break; + case 2: + for($i=11;$i<=18;$i++) { + ${def_ab.$i-10} = $post['f2_'.$i]; + } + break; + case 3: + for($i=21;$i<=28;$i++) { + ${def_ab.$i-20} = $post['f2_'.$i]; + } + break; case 4: - for($i=31;$i<=38;$i++) { - ${def_ab.$i-30} = $post['f2_'.$i]; - } - break; + for($i=31;$i<=38;$i++) { + ${def_ab.$i-30} = $post['f2_'.$i]; + } + break; case 5: - for($i=41;$i<=48;$i++) { - ${def_ab.$i-40} = $post['f2_'.$i]; - } - break; - } - if($post['kata'] == "") { - $post['kata'] = 0; - } - - // check scout - - $scout = 1; - for($i=$start;$i<=($start+9);$i++) { - if($i == 4 || $i == 14 || $i == 23 || $i == 44) - { + for($i=41;$i<=48;$i++) { + ${def_ab.$i-40} = $post['f2_'.$i]; } - else{ - if($attacker['u'.$i]>0) { - $scout = 0; - break; + break; + } + if($post['kata'] == "") { + $post['kata'] = 0; } - } - } - if($post['wall1'] != 0){ - $walllevel = $post['wall1']; - }elseif($post['wall2'] != 0){ - $walllevel = $post['wall2']; - }elseif($post['wall3'] != 0){ - $walllevel = $post['wall3']; - }elseif($post['wall4'] != 0){ - $walllevel = $post['wall4']; - }elseif($post['wall5'] != 0){ - $walllevel = $post['wall5']; - }else{ - $walllevel = 0; - } - if($walllevel > 20){ - $walllevel = 0; - } - $wall = $walllevel; - if(!$scout) - return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],$post['ktyp']+3,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0); - else - return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],1,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0); - } - public function getTypeLevel($tid,$vid) { + // check scout + + $scout = 1; + for($i=$start;$i<=($start+9);$i++) { + if($i == 4 || $i == 14 || $i == 23 || $i == 44) + {} + else{ + if($attacker['u'.$i]>0) { + $scout = 0; + break; + } + } + } + if($post['wall1'] != 0){ + $walllevel = $post['wall1']; + }elseif($post['wall2'] != 0){ + $walllevel = $post['wall2']; + }elseif($post['wall3'] != 0){ + $walllevel = $post['wall3']; + }elseif($post['wall4'] != 0){ + $walllevel = $post['wall4']; + }elseif($post['wall5'] != 0){ + $walllevel = $post['wall5']; + }else{ + $walllevel = 0; + } + if($walllevel > 20){ + $walllevel = 0; + } + $wall = $walllevel; + if(!$scout) + return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],$post['ktyp']+3,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0); + else + return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],1,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0); + } + + public function getTypeLevel($tid,$vid) { global $village,$database; $keyholder = array(); - $resourcearray = $database->getResourceLevel($vid); + $resourcearray = $database->getResourceLevel($vid); foreach(array_keys($resourcearray,$tid) as $key) { if(strpos($key,'t')) { @@ -192,7 +189,7 @@ class Battle { } foreach ($temparray as $key => $val) { if ($val == max($temparray)) - $target = $key; + $target = $key; } } else { @@ -218,135 +215,137 @@ class Battle { } } - //1 raid 0 normal - function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$tblevel,$stonemason,$walllevel,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref) { - global $bid34,$bid35,$database; - // Define the array with the units - $calvary = array(4,5,6,15,16,23,24,25,26,35,36,45,46); - $catapult = array(8,18,28,38,48); - $rams = array(7,17,27,37,47); - $catp = $ram = 0; - // Array to return the result of the calculation - $result = array(); - $involve = 0; - $winner = false; - // 0 for all partial results - $cap = $ap = $dp = $cdp = $rap = $rdp = 0; + //1 raid 0 normal + function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$tblevel,$stonemason,$walllevel,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref) { + global $bid34,$bid35,$database; + // Definieer de array met de eenheden + $calvary = array(4,5,6,15,16,23,24,25,26,45,46); + $catapult = array(8,18,28,48); + $rams = array(7,17,27,47); + $catp = $ram = 0; + // Array om terug te keren met het resultaat van de berekening + $result = array(); + $involve = 0; + $winner = false; + // bij 0 alle deelresultaten + $cap = $ap = $dp = $cdp = $rap = $rdp = 0; //exit($type); - $att_artefact = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,3,0)); - $att_artefact1 = count($database->getOwnUniqueArtefactInfo2($AttackerWref,3,1,1)); - $att_artefact2 = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,2,0)); - if($att_artefact > 0){ + $att_artefact = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,3,0)); + $att_artefact1 = count($database->getOwnUniqueArtefactInfo2($AttackerWref,3,1,1)); + $att_artefact2 = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,2,0)); + if($att_artefact > 0){ $attacker_artefact = 10; - }else if($att_artefact1 > 0){ + }else if($att_artefact1 > 0){ $attacker_artefact = 5; - }else if($att_artefact2 > 0){ + }else if($att_artefact2 > 0){ $attacker_artefact = 3; - }else{ + }else{ $attacker_artefact = 1; - } - $def_artefact = count($database->getOwnUniqueArtefactInfo2($DefenderID,3,3,0)); - $def_artefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,3,1,1)); - $def_artefact2 = count($database->getOwnUniqueArtefactInfo2($DefenderID,3,2,0)); - if($def_artefact > 0){ + } + $def_artefact = count($database->getOwnUniqueArtefactInfo2($DefenderID,3,3,0)); + $def_artefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,3,1,1)); + $def_artefact2 = count($database->getOwnUniqueArtefactInfo2($DefenderID,3,2,0)); + if($def_artefact > 0){ $defender_artefact = 10; - }else if($att_artefact1 > 0){ + }else if($att_artefact1 > 0){ $defender_artefact = 5; - }else if($def_artefact2 > 0){ + }else if($def_artefact2 > 0){ $defender_artefact = 3; - }else{ + }else{ $defender_artefact = 1; - } + } if($Attacker['uhero'] != 0) { //exit($AttackerID); - $atkhero = $this->getBattleHero($AttackerID); + $atkhero = $this->getBattleHero($AttackerID); } if($Defender['hero'] != 0) { //exit($DefenderID); - $defenderhero = $this->getBattleHero($DefenderID); + $defenderhero = $this->getBattleHero($DefenderID); } $DefendersAll = $database->getEnforceVillage($DefenderWref,0); if(!empty($DefendersAll)){ - foreach($DefendersAll as $defenders) { - $fromvillage = $defenders['from']; - $reinfowner = $database->getVillageField($fromvillage,"owner"); - $defhero[$fromvillage] = $this->getBattleHero($reinfowner); - } + foreach($DefendersAll as $defenders) { + $fromvillage = $defenders['from']; + $reinfowner = $database->getVillageField($fromvillage,"owner"); + $defhero[$fromvillage] = $this->getBattleHero($reinfowner); } - // Calculate the total points of Attacker + } + // Berekenen het totaal aantal punten van Aanvaller $start = ($att_tribe-1)*10+1; $end = ($att_tribe*10); if($att_tribe == 3){ - $abcount = 3; + $abcount = 3; }else{ - $abcount = 4; + $abcount = 4; } + + if($type == 1) + { + for($i=$start;$i<=$end;$i++) { + global ${'u'.$i}; + $j = $i-$start+1; + if($abcount <= 8 && ${att_ab.$abcount} > 0) { - if($type == 1) - { - for($i=$start;$i<=$end;$i++) { - global ${'u'.$i}; - $j = $i-$start+1; - if($abcount <= 8 && ${att_ab.$abcount} > 0) { - $ap += (35 + ( 35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i] * $attacker_artefact; - $att_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID); - if(count($att_foolartefact) > 0){ - foreach($att_foolartefact as $arte){ - if($arte['bad_effect'] == 1){ - $ap *= $arte['effect2']; - }else{ - $ap /= $arte['effect2']; - $ap = round($ap); - } + $ap += (35 + ( 35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i] * $attacker_artefact; + $att_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID); + if(count($att_foolartefact) > 0){ + foreach($att_foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $ap *= $arte['effect2']; + }else{ + $ap /= $arte['effect2']; + $ap = round($ap); + } + } + } + } + else { + $ap += ($Attacker['u'.$i] * $Attacker['u'.$i] * $Attacker['u'.$i])/3; + } + + + $units['Att_unit'][$i] = $Attacker['u'.$i]; } - } - } - else { - $ap += ($Attacker['u'.$i] * $Attacker['u'.$i] * $Attacker['u'.$i])/3; - } - - $units['Att_unit'][$i] = $Attacker['u'.$i]; - } if ($Attacker['uhero'] != 0){ - $ap += $atkhero['atk'] * 35; - $ap = $ap * $atkhero['ob']; + $ap += $atkhero['atk'] * 35; + $ap = $ap * $atkhero['ob']; } - } - else - { - $abcount = 1; - for($i=$start;$i<=$end;$i++) { - global ${'u'.$i}; - $j = $i-$start+1; - if($abcount <= 8 && ${att_ab.$abcount} > 0) { - if(in_array($i,$calvary)) { - $cap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i]; - } - else { - $ap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i]; - } - } - else { - if(in_array($i,$calvary)) { - $cap += $Attacker['u'.$i]*${'u'.$i}['atk']; - } - else { - $ap += $Attacker['u'.$i]*${'u'.$i}['atk']; - } } + else + { + $abcount = 1; + for($i=$start;$i<=$end;$i++) { + global ${'u'.$i}; + $j = $i-$start+1; + if($abcount <= 8 && ${att_ab.$abcount} > 0) { + if(in_array($i,$calvary)) { + $cap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i]; + } + else { + $ap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i]; + } + } + else { + if(in_array($i,$calvary)) { + $cap += $Attacker['u'.$i]*${'u'.$i}['atk']; + } + else { + $ap += $Attacker['u'.$i]*${'u'.$i}['atk']; + } + } - $abcount +=1; - // catapult attack - if(in_array($i,$catapult)) { - $catp += $Attacker['u'.$i]; - } - // ram + $abcount +=1; + // Punten van de catavult van de aanvaller + if(in_array($i,$catapult)) { + $catp += $Attacker['u'.$i]; + } + // Punten van de Rammen van de aanvaller if(in_array($i,$rams)) { $ram += $Attacker['u'.$i]; @@ -366,71 +365,76 @@ class Battle { } - // - // Calculates the total points of the Defender - // + // + // Berekent het totaal aantal punten van de Defender + // $start = ($def_tribe-1)*10+1; $end = ($def_tribe*10); $abcount = 1; - if($type == 1) - { - for($y=4;$y<=44;$y++) { - if($y == 4 || $y == 14 || $y == 23 || $y == 44) + if($type == 1) { - global ${'u'.$y}; - if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) { - $dp += (20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * (($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4) * $defender_artefact; - $abcount +=1; - $def_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID); - if(count($def_foolartefact) > 0){ - foreach($def_foolartefact as $arte){ - if($arte['bad_effect'] == 1){ + for($y=4;$y<=44;$y++) { + if($y == 4 || $y == 14 || $y == 23) + { + global ${'u'.$y}; + if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) { + $dp += (20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * (($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4) * $defender_artefact; + $abcount +=1; + $def_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID); + if(count($def_foolartefact) > 0){ + foreach($def_foolartefact as $arte){ + if($arte['bad_effect'] == 1){ $dp *= $arte['effect2']; - }else{ + }else{ $dp /= $arte['effect2']; $dp = round($dp); - } + } + } + } + } + else { + $dp += ($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4; + } + $units['Def_unit'][$y] = $Defender['u'.$y]; + if($units['Def_unit'][$y] > 0){ + $detected = 1; + } } + } + if($detected == 1){ + if ($Defender['hero'] != 0){ + $dp += $defenderhero['di'] * 35; + $dp = $dp * $defenderhero['db']; } - } - else { - $dp += ($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4; - } - $units['Def_unit'][$y] = $Defender['u'.$y]; + $DefendersAll = $database->getEnforceVillage($DefenderWref,0); + if(!empty($DefendersAll)){ + foreach($DefendersAll as $defenders) { + $fromvillage = $defenders['from']; + $dp += $defhero[$fromvillage]['di'] * 35; + $dp = $dp * $defhero[$fromvillage]['db']; + } + } + } } - } - if ($Defender['hero'] != 0){ - $dp += $defenderhero['di'] * 35; - $dp = $dp * $defenderhero['db']; - } - $DefendersAll = $database->getEnforceVillage($DefenderWref,0); - if(!empty($DefendersAll)){ - foreach($DefendersAll as $defenders) { - $fromvillage = $defenders['from']; - $dp += $defhero[$fromvillage]['di'] * 35; - $dp = $dp * $defhero[$fromvillage]['db']; - } - } - } - else - { - for($y=1;$y<=50;$y++) { - global ${'u'.$y}; - if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) { - $dp += (${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y]; - $cdp += (${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y]; - } - else { - $dp += $Defender['u'.$y]*${'u'.$y}['di']; - $cdp += $Defender['u'.$y]*${'u'.$y}['dc']; - } - $involve += $Defender['u'.$y]; - $units['Def_unit'][$y] = $Defender['u'.$y]; - $abcount +=1; - } + else + { + for($y=1;$y<=50;$y++) { + global ${'u'.$y}; + if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) { + $dp += (${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y]; + $cdp += (${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y]; + } + else { + $dp += $Defender['u'.$y]*${'u'.$y}['di']; + $cdp += $Defender['u'.$y]*${'u'.$y}['dc']; + } + $involve += $Defender['u'.$y]; + $units['Def_unit'][$y] = $Defender['u'.$y]; + $abcount +=1; + } if($Defender['hero'] != 0) { $units['Def_unit']['hero'] = $Defender['hero']; @@ -441,160 +445,156 @@ class Battle { } $DefendersAll = $database->getEnforceVillage($DefenderWref,0); if(!empty($DefendersAll)){ - foreach($DefendersAll as $defenders) { - $fromvillage = $defenders['from']; - $cdp += $defhero[$fromvillage]['dc']; - $dp += $defhero[$fromvillage]['di']; - $dp = $dp * $defhero[$fromvillage]['db']; - $cdp = $cdp * $defhero[$fromvillage]['db']; + foreach($DefendersAll as $defenders) { + $fromvillage = $defenders['from']; + $cdp += $defhero[$fromvillage]['dc']; + $dp += $defhero[$fromvillage]['di']; + $dp = $dp * $defhero[$fromvillage]['db']; + $cdp = $cdp * $defhero[$fromvillage]['db']; + } + } } - } - } - // - // Formula for calculating the bonus defense wall and Residence - // - if($def_wall > 0) { - // Set the factor for calculating the "Wall" as the type of civilization - // Factor = 1030 Roman wall - // Factor = 1020 German wall - // Factor = 1025 Gallic Wall - $factor = ($def_tribe == 1)? 1.030 : (($def_tribe == 2)? 1.020 : 1.025); - // Defense Infantry = Infantry * Wall (%) - $dp *= pow($factor,$def_wall); - // Defense Cavalry = Cavalry * Wall (%) - $cdp *= pow($factor,$def_wall); + // + // Formule voor de berekening van de bonus verdedigingsmuur "en" Residence "; + // + if($def_wall > 0) { + // Stel de factor berekening voor de "Muur" als het type van de beschaving + // Factor = 1030 Romeinse muur + // Factor = 1020 Wall Germanen + // Factor = 1025 Wall Galliers + $factor = ($def_tribe == 1)? 1.030 : (($def_tribe == 2)? 1.020 : 1.025); + // Verdediging infantery = Infantery * Muur (%) + $dp *= pow($factor,$def_wall); + // Verdediging Cavelerie = Cavelerie * Muur (%) + $cdp *= pow($factor,$def_wall); - // Calculation of the Basic defense bonus "Residence" - $dp += ((2*(pow($residence,2)))*(pow($factor,$def_wall))); - $cdp += ((2*(pow($residence,2)))*(pow($factor,$def_wall))); - } - else - { - // Calculation of the Basic defense bonus "Residence" - $dp += (2*(pow($residence,2))); - $cdp += (2*(pow($residence,2))); - } + // Berekening van de Basic defence bonus "Residence" + $dp += ((2*(pow($residence,2)))*(pow($factor,$def_wall))); + $cdp += ((2*(pow($residence,2)))*(pow($factor,$def_wall))); + } + else + { + // Berekening van de Basic defence bonus "Residence" + $dp += (2*(pow($residence,2))); + $cdp += (2*(pow($residence,2))); + } - // - // Formula for calculating points attackers (Infantry & Cavalry) - // - if($AttackerWref != 0){ - $rap = ($ap+$cap)+(($ap+$cap)/100*$bid35[$this->getTypeLevel(35,$AttackerWref)]['attri']); - }else{ - $rap = $ap+$cap; - } - // - // Formula for calculating Defensive Points - // - if ($rap==0) - $rdp = ($dp) + ($cdp) + 10; - else - $rdp = ($dp * ($ap/$rap)) + ($cdp * ($cap/$rap)) + 10; - // - // And the Winner is ....: - // - $result['Attack_points'] = $rap; - $result['Defend_points'] = $rdp; - - $winner = ($rap > $rdp); - - $result['Winner'] = ($winner)? "attacker" : "defender"; - - // Formula for calculating the Moral - if($attpop > $defpop) { - if ($rap < $rdp) { - $moralbonus = min(1.5, pow($attpop / $defpop, (0.2*($rap/$rdp)))); - } - else { - if($defpop==0){ - $moralbonus = min(1.5, pow($attpop, 0.2)); + // + // Formule voor het berekenen van punten aanvallers (Infanterie & Cavalry) + // + if($AttackerWref != 0){ + $rap = ($ap+$cap)+(($ap+$cap)/100*$bid35[$this->getTypeLevel(35,$AttackerWref)]['attri']); }else{ - $moralbonus = min(1.5, pow($attpop / $defpop, 0.2)); + $rap = $ap+$cap; } - } - } - else { - $moralbonus = 1.0; - } + // + // Formule voor de berekening van Defensive Punten + // + if ($rap==0) + $rdp = ($dp) + ($cdp) + 10; + else + $rdp = ($dp * ($ap/$rap)) + ($cdp * ($cap/$rap)) + 10; + // + // En de Winnaar is....: + // + $result['Attack_points'] = $rap; + $result['Defend_points'] = $rdp; - if($involve >= 1000) { - $Mfactor = round(2*(1.8592-pow($involve,0.015)),4); - } - else { - $Mfactor = 1.5; - } - if ($Mfactor < 1.25778){ - $Mfactor=1.25778; - }elseif ($Mfactor > 1.5){ - $Mfactor=1.5; - } - // Formula for calculating lost units - // $type = 1 Raid, 0 Normal - if($type == 1) - { - $holder = pow((($rdp*$moralbonus)/$rap),$Mfactor); - $holder = $holder / (1 + $holder); - // Attacker - $result[1] = $holder; + $winner = ($rap > $rdp); - // Defender - $result[2] = 0; - } - else if($type == 2) - { + $result['Winner'] = ($winner)? "attacker" : "defender"; - } - else if($type == 4) { - $holder = ($winner) ? pow((($rdp*$moralbonus)/$rap),$Mfactor) : pow(($rap/($rdp*$moralbonus)),$Mfactor); - $holder = $holder / (1 + $holder); - // Attacker - $result[1] = $winner ? $holder : 1 - $holder; - // Defender - $result[2] = $winner ? 1 - $holder : $holder; - $ram -= round($ram*$result[1]/100); + // Formule voor de berekening van de Moraal + if($attpop > $defpop) { + if ($rap < $rdp) { + $moralbonus = min(1.5, pow($attpop / $defpop, (0.2*($rap/$rdp)))); + } + else { + if($defpop==0){ + $moralbonus = min(1.5, pow($attpop, 0.2)); + }else{ + $moralbonus = min(1.5, pow($attpop / $defpop, 0.2)); + } + } + } + else { + $moralbonus = 1.0; + } + + if($involve >= 1000) { + $Mfactor = round(2*(1.8592-pow($involve,0.015)),4); + } + else { + $Mfactor = 1.5; + } + if ($Mfactor < 1.25778){$Mfactor=1.25778;}elseif ($Mfactor > 1.5){$Mfactor=1.5;} + // Formule voor het berekenen verloren drives + // $type = 1 Raid, 0 Normal + if($type == 1) + { + $holder = pow((($rdp*$moralbonus)/$rap),$Mfactor); + $holder = $holder / (1 + $holder); + // Attacker + $result[1] = $holder; + + // Defender + $result[2] = 0; + } + else if($type == 2) + { + + } + else if($type == 4) { + $holder = ($winner) ? pow((($rdp*$moralbonus)/$rap),$Mfactor) : pow(($rap/($rdp*$moralbonus)),$Mfactor); + $holder = $holder / (1 + $holder); + // Attacker + $result[1] = $winner ? $holder : 1 - $holder; + // Defender + $result[2] = $winner ? 1 - $holder : $holder; + $ram -= round($ram*$result[1]/100); $catp -= round($catp*$result[1]/100); - } - else if($type == 3) + } + else if($type == 3) { - // Attacker - $result[1] = ($winner)? pow((($rdp*$moralbonus)/$rap),$Mfactor) : 1; - $result[1] = round($result[1],8); + // Attacker + $result[1] = ($winner)? pow((($rdp*$moralbonus)/$rap),$Mfactor) : 1; + $result[1] = round($result[1],8); - // Defender - $result[2] = (!$winner)? pow(($rap/($rdp*$moralbonus)),$Mfactor) : 1; - $result[2] = round($result[2],8); - // If attacked by a Hero - $ku = ($att_tribe-1)*10+9; + // Defender + $result[2] = (!$winner)? pow(($rap/($rdp*$moralbonus)),$Mfactor) : 1; + $result[2] = round($result[2],8); + // Als aangevallen met "Hero" + $ku = ($att_tribe-1)*10+9; $kings = $Attacker['u'.$ku]; $aviables= $kings-round($kings*$result[1]); - if ($aviables>0){ - switch($aviables){ - case 1: - $fealthy = rand(20,30); - break; - case 2: - $fealthy = rand(40,60); - break; - case 3: - $fealthy = rand(60,80); - break; - case 4: - $fealthy = rand(80,100); - break; - default: - $fealthy = 100; - break; - } - $result['hero_fealthy'] = $fealthy; - } - $ram -= ($winner)? round($ram*$result[1]/100) : round($ram*$result[2]/100); + if ($aviables>0){ + switch($aviables){ + case 1: + $fealthy = rand(20,30); + break; + case 2: + $fealthy = rand(40,60); + break; + case 3: + $fealthy = rand(60,80); + break; + case 4: + $fealthy = rand(80,100); + break; + default: + $fealthy = 100; + break; + } + $result['hero_fealthy'] = $fealthy; + } + $ram -= ($winner)? round($ram*$result[1]/100) : round($ram*$result[2]/100); $catp -= ($winner)? round($catp*$result[1]/100) : round($catp*$result[2]/100); - } - // Formula for the calculation of catapults needed - if($catp > 0 && $tblevel != 0) { + } + // Formule voor de berekening van katapulten nodig + if($catp > 0 && $tblevel != 0) { $wctp = pow(($rap/$rdp),1.5); $wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp; $wctp *= $catp; @@ -603,33 +603,33 @@ class Battle { $bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1)); $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); if($bartefact > 0){ - $strongerbuildings = 5; + $strongerbuildings = 5; }else if($bartefact1 > 0){ - $strongerbuildings = 4; + $strongerbuildings = 4; }else if($bartefact2 > 0){ - $strongerbuildings = 3; + $strongerbuildings = 3; }else{ - $strongerbuildings = 1; + $strongerbuildings = 1; } $good_effect = $bad_effect = 1; $foolartefact = $database->getFoolArtefactInfo(3,$DefenderWref,$artowner); if(count($foolartefact) > 0){ - foreach($foolartefact as $arte){ - if($arte['bad_effect'] == 1){ - $bad_effect = $arte['effect2']; - }else{ - $good_effect = $arte['effect2']; - } - } + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $bad_effect = $arte['effect2']; + }else{ + $good_effect = $arte['effect2']; + } + } } if($stonemason==0){ - $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); + $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); }else{ - $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); + $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); } - // Number of catapults to take down the building + // Aantal katapulten om het gebouw neer te halen $result[3] = $need; - // Number of catapults that act + // Aantal Katapulten die handeling $result[4] = $wctp; $result[5] = $moralbonus; $result[6] = $att_ab['a8']; @@ -643,40 +643,40 @@ class Battle { $bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1)); $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); if($bartefact > 0){ - $strongerbuildings = 5; + $strongerbuildings = 5; }else if($bartefact1 > 0){ - $strongerbuildings = 4; + $strongerbuildings = 4; }else if($bartefact2 > 0){ - $strongerbuildings = 3; + $strongerbuildings = 3; }else{ - $strongerbuildings = 1; + $strongerbuildings = 1; } $good_effect = $bad_effect = 1; $foolartefact = $database->getFoolArtefactInfo(3,$DefenderWref,$artowner); if(count($foolartefact) > 0){ - foreach($foolartefact as $arte){ - if($arte['bad_effect'] == 1){ - $bad_effect = $arte['effect2']; - }else{ - $good_effect = $arte['effect2']; - } - } + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $bad_effect = $arte['effect2']; + }else{ + $good_effect = $arte['effect2']; + } + } } if($stonemason==0){ - $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); + $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); }else{ - $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); + $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5); } - // Number rams to take down the building + // Aantal katapulten om het gebouw neer te halen $result[7] = $need; - // Number rams that act + // Aantal Katapulten die handeling $result[8] = $wctp; } - $result[6] = pow($rap/$rdp*$moralbonus,$Mfactor); + $result[6] = pow($rap/$rdp*$moralbonus,$Mfactor); - $total_att_units = count($units['Att_unit']); + $total_att_units = count($units['Att_unit']); $start = intval(($att_tribe-1)*10+1); $end = intval(($att_tribe*10)); @@ -708,7 +708,7 @@ class Battle { mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'"); } } - unset($_result,$fdb,$hero_id,$hero_health,$damage_health); + unset($_result,$fdb,$hero_id,$hero_health,$damage_health); if ($units['Def_unit']['hero']>0) @@ -732,387 +732,349 @@ class Battle { mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'"); } } - unset($_result,$fdb,$hero_id,$hero_health,$damage_health); + unset($_result,$fdb,$hero_id,$hero_health,$damage_health); - $DefendersAll = $database->getEnforceVillage($DefenderWref,0); - if(!empty($DefendersAll)){ + $DefendersAll = $database->getEnforceVillage($DefenderWref,0); + if(!empty($DefendersAll)){ foreach($DefendersAll as $defenders) { if($defenders['hero']>0) { - if(!empty($heroarray)) { - reset($heroarray); - } - $ReinforcerData = $database->getVillageBattleData($defenders['from']); - $heroarraydefender = $this->getBattleHero($ReinforcerData['id']); - $_result=mysql_query("select * from " . TB_PREFIX . "hero where `dead`='0' and `heroid`='".$heroarraydefender['heroid']."'"); - $fdb = mysql_fetch_array($_result); - $hero_id=$fdb['heroid']; - $hero_health=$fdb['health']; - $damage_health=round(100*$result[2]); - if ($hero_health<=$damage_health or $damage_health>90) - { - //hero die - $result['deadheroref'][$defenders['id']] = 1; - mysql_query("update " . TB_PREFIX . "hero set `dead`='1' where `heroid`='".$hero_id."'"); - mysql_query("update " . TB_PREFIX . "hero set `health`='0' where `heroid`='".$hero_id."'"); - } - else - { - $result['deadheroref'][$defenders['id']] = 0; - mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'"); - } - } + if(!empty($heroarray)) { reset($heroarray); } + $ReinforcerData = $database->getVillageBattleData($defenders['from']); + $heroarraydefender = $this->getBattleHero($ReinforcerData['id']); + $_result=mysql_query("select * from " . TB_PREFIX . "hero where `dead`='0' and `heroid`='".$heroarraydefender['heroid']."'"); + $fdb = mysql_fetch_array($_result); + $hero_id=$fdb['heroid']; + $hero_health=$fdb['health']; + $damage_health=round(100*$result[2]); + if ($hero_health<=$damage_health or $damage_health>90) + { + //hero die + $result['deadheroref'][$defenders['id']] = 1; + mysql_query("update " . TB_PREFIX . "hero set `dead`='1' where `heroid`='".$hero_id."'"); + mysql_query("update " . TB_PREFIX . "hero set `health`='0' where `heroid`='".$hero_id."'"); + } + else + { + $result['deadheroref'][$defenders['id']] = 0; + mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'"); + } + } } } - unset($_result,$fdb,$hero_id,$hero_health,$damage_health); + unset($_result,$fdb,$hero_id,$hero_health,$damage_health); - // Work out bounty + // Work out bounty $start = ($att_tribe-1)*10+1; $end = ($att_tribe*10); $max_bounty = 0; - for($i=$start;$i<=$end;$i++) { - $j = $i-$start+1; + for($i=$start;$i<=$end;$i++) { + $j = $i-$start+1; $y = $i-(($att_tribe-1)*10); - $max_bounty += ($Attacker['u'.$i]-$result['casualties_attacker'][$y])*${'u'.$i}['cap']; + $max_bounty += ($Attacker['u'.$i]-$result['casualties_attacker'][$y])*${'u'.$i}['cap']; + } + + $result['bounty'] = $max_bounty; + + + return $result; } - $result['bounty'] = $max_bounty; + public function resolveConflict($data) { + global $database,$units,$unitsbytype; + $UnitChief = $UnitRam = $UnitCatapult = 0; + $attacker_count = $attack_infantry = $attack_cavalry = $attack_scout = $rams = $catapults = 0; + $defender_count = $defense_infantry = $defense_cavalry = $defense_scout = $defense_heros = 0; + $DefenderFieldsArray = $ResourceImprovementArray = $TrapperArray = array(); + $FieldPalRes = $BonusPalRes = $BonusStoneMason = $BonusArtefactDurability = 0; + $ExperienceAttacker = $ExperienceDefender = 0; + $RecountReqd = $AllDefendersDead = False; + $AttackArrivalTime = $data['endtime']; + $AttackerData = $database->getVillageBattleData($data['from']); + $AttackerData['pop'] = $database->getPopulation($AttackerData['id']); + $Blacksmith = $database->getABTech($data['from']); - return $result; - } + for($i=1;$i<=11;$i++) { $attacker_count += $data['t'.$i]; } + if($data['type'] != 1) { + // Trap attacking troops if this is not a scouting mission + } - public function resolveConflict($data) { - global $database,$units,$unitsbytype; - $UnitChief = $UnitRam = $UnitCatapult = 0; - $attacker_count = $attack_infantry = $attack_cavalry = $attack_scout = $rams = $catapults = 0; - $defender_count = $defense_infantry = $defense_cavalry = $defense_scout = $defense_heros = 0; - $DefenderFieldsArray = $ResourceImprovementArray = $TrapperArray = array(); - $FieldPalRes = $BonusPalRes = $BonusStoneMason = $BonusArtefactDurability = 0; - $ExperienceAttacker = $ExperienceDefender = 0; - $RecountReqd = $AllDefendersDead = False; - - $AttackArrivalTime = $data['endtime']; - $AttackerData = $database->getVillageBattleData($data['from']); - $AttackerData['pop'] = $database->getPopulation($AttackerData['id']); - $Blacksmith = $database->getABTech($data['from']); - - for($i=1;$i<=11;$i++) { - $attacker_count += $data['t'.$i]; - } - if($data['type'] != 1) { - // Trap attacking troops if this is not a scouting mission - } - - for($i=1;$i<=10;$i++) { - if($data['t'.$i] > 0) { - $unit = ($AttackerData['tribe']-1)*10+$i; - $unitdata = $GLOBALS['u'.$unit]; - if(in_array($unit,$unitsbytype['cavalry'])) { - $attack_cavalry += $data['t'.$i] * ($unitdata['atk'] + ($unitdata['atk'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Blacksmith['b'.$i]) - 1)); - } else { - $attack_infantry += $data['t'.$i] * ($unitdata['atk'] + ($unitdata['atk'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Blacksmith['b'.$i]) - 1)); - } - if(in_array($unit,$unitsbytype['scout'])) { - $attack_scout = $data['t'.$i] * 35 * pow(1.021,$Blacksmith['b'.$i]); - } - if(in_array($unit,$unitsbytype['chief'])) { - $UnitChief = $i; - } - if(in_array($unit,$unitsbytype['ram'])) { - $UnitRam = $i; - } - if(in_array($unit,$unitsbytype['catapult'])) { - $UnitCatapult = $i; - } - } - } - if($data['t11'] == 1 && $data['type'] != 1) { - $heroarrayAttacker = $this->getBattleHero($AttackerData['id']); - if(in_array($heroarrayAttacker['unit'],$unitsbytype['cavalry'])) { - $attack_cavalry += $heroarrayAttacker['atk']; - } else { - $attack_infantry += $heroarrayAttacker['atk']; - } - $attack_infantry *= $heroarrayAttacker['ob']; - $attack_cavalry *= $heroarrayAttacker['ob']; - } - $attack_total = $attack_infantry + $attack_cavalry; - if($attacker_count == 1 && $attack_total < 83 && $data['type'] != 1) { - // kill the single non-scout low level attacker due to basic village defense - } - - if ($database->isVillageOases($id) == 0) { - $DefenderData = $database->getVillageBattleData($data['to']); - $DefenderData['pop'] = $database->getPopulation($DefenderData['id']); - $IsOasis = False; - } else { - $OasisData = $database->getOMInfo($data['to']); - $IsOasis = True; - if($OasisData['conqured'] == 0) { - $DefenderData['pop'] = 500; - } else { - $DefenderData['pop'] = $database->getPopulation($OasisData['conqured']); - } - $DefenderData['tribe'] = 4; - $DefenderData['wall'] = 0; - } - $DefenderUnits = $database->getUnit($data['to']); - $DefendersAll = $database->getEnforceVillage($data['to'],0); - array_unshift($DefendersAll,$DefenderUnits); - foreach($DefendersAll as $defenders) { - $definf = $defcav = 0; - if(!empty($Armoury)) { - reset($Armoury); - } - $Armoury = $defenders['from'] != $defenders['vref'] ? $database->getABTech($defenders['from']) : $database->getABTech($defenders['vref']); - for($i=1;$i<=50;$i++) { - if($defenders['u'.$i] > 0) { - if(!empty($unitdata)) { - reset($unitdata); - } - $unitdata = $GLOBALS['u'.$i]; - $definf += $defenders['u'.$i] * ($unitdata['di'] + ($unitdata['di'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Armoury['a'.($i%10)]) - 1)); - $defcav += $defenders['u'.$i] * ($unitdata['dc'] + ($unitdata['dc'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Armoury['a'.($i%10)]) - 1)); - if(in_array($i,$unitsbytype['scout'])) { - $defense_scout += $defenders['u'.$i] * 20 * pow(1.03,$Armoury['a'.($i%10)]); - } - $defender_count += $defenders['u'.$i]; - } - } - if($defenders['hero'] == 1 && $data['type'] != 1) { - if(!empty($heroarray)) { - reset($heroarray); - } - if($defenders['vref'] == $data['to']) { - $heroarraydefender = $this->getBattleHero($DefenderData['id']); - } else { - $ReinforcerData = $database->getVillageBattleData($defenders['from']); - $heroarraydefender = $this->getBattleHero($ReinforcerData['id']); - } - $definf = ($definf + $heroarraydefender['di']) * $heroarraydefender['db']; - $defcav = ($defcav + $heroarraydefender['dc']) * $heroarraydefender['db']; - $defense_heros++; - } - $defense_infantry += $definf; - $defense_cavalry += $defcav; - } - - if($data['type'] == 1) { - if($attack_scout > $defense_scout) { - $attack_scout_casualties = pow(($defense_scout / $attack_scout),1.5); - // generate scout report and process casualties - } else { - $attack_scout_casualties = 1; - // kill all scouts - } - } else { - $defense_total = $attack_infantry * $defense_infantry / $attack_total + $attack_cavalry * $defense_cavalry / $attack_total; - - if($DefenderData['pop'] < $AttackerData['pop']) { - $defense_total *= min(1.5,pow($AttackerData['pop']/$DefenderData['pop'],0.2)); - } - - $DefenderFields = $database->getResourceLevel($data['to']); - for($i=1;$i<=38;$i++) { - if($DefenderFields['f'.$i] > 0) { - $DefenderFieldsArray[] = $i; - } - if($DefenderFields['f'.$i.'t'] == 25 || $DefenderFields['f'.$i.'t'] == 26) { - $BonusPalRes = 2 * pow($DefenderFields['f'.$i],2); - $FieldPalRes = $i; - } - if($DefenderFields['f'.$i.'t'] == 34) { - $BonusStoneMason = $DefenderFields['f'.$i] / 10 + 1; - } - if($DefenderFields['f'.$i.'t'] >= 5 && $DefenderFields['f'.$i.'t'] <= 9) { - $ResourceImprovementArray[] = $i; - } - if($DefenderFields['f'.$i.'t'] == 36) { - $TrapperArray[] = $i; - } - if($DefenderFields['f'.$i.'t'] == $data['ctar1'] && $data['ctar1'] != 0) { - $ctarf[1] = $i; - } - if($DefenderFields['f'.$i.'t'] == $data['ctar2'] && $data['ctar2'] != 0 && ($data['ctar1'] != $data['ctar2'] || $data['ctar2'] <= 18)) { - $ctarf[2]= $i; - } - } - $defense_total += $BonusPalRes; - - $BonusWall = $DefenderData['tribe'] == 1 ? 1.03 : ($DefenderData['tribe'] == 2 ? 1.02 : 1.025); - $defense_total *= pow($BonusWall,$DefenderData['wall']); - - if($attacker_count + $defender_count + $defense_heros > 1000) { - $DiffModifier = 2 * (1.8592 - pow(($attacker_count + $defender_count + $defense_heros),0.015)); - } else { - $DiffModifier = 1.5; - } - $attack_casualties = $defense_casualties = 1; - if($attack_total > $defense_total) { - $attack_casualties = pow(($defense_total / $attack_total),$DiffModifier); - if($data['type'] == 4) { - $attack_casualties = $attack_casualties / (1 + $attack_casualties); - $defense_casualties = 1 - $attack_casualties; - } - } else { - $defense_casualties = pow(($attack_total / $defense_total),$DiffModifier); - if($data['type'] == 4) { - $defense_casualties = $defense_casualties / (1 + $defense_casualties); - $attack_casualties = 1 - $defense_casualties; - } - } - - if($rams > 0 && $DefenderData['wall'] > 0) { - if($attack_casualties < 1) { - $database->setVillageLevel($data['to'],'f40t',0); - $database->setVillageLevel($data['to'],'f40',0); - } else { - $RequiredRams=array(1=>array(1,2,2,3,4,6,7,10,12,14,17,20,23,27,31,35,39,43,48,53),array(1,4,8,13,19,27,36,46,57,69,83,98,114,132,151,171,192,214,238,263),array(1,2,4,6,8,11,15,19,23,28,34,40,46,53,61,69,77,86,96,106)); - $DC = max(1,$BonusStoneMason) * max(1,$BonusPalRes) / (pow(1.015,$Blacksmith['b'.$UnitRam])) ; - $L = $DefenderData['wall']; - $L2 = round(($DefenderData['wall'] - 1) /2); - $DDR = $DC / ( $L*($L+1)/8 + 5 + (24.875 + 0.625*$L2)*$L2/2 ); - //calculate damage to wall based on surviving rams - } - $RecountReqd = True; - } - if($catapults > 0 && !$IsOasis) { - $BuildLevelStrength=array(1=>1,2,2,3,4,6,8,10,12,14,17,20,23,27,31,35,39,43,48,53); - $RequiredCatapults = $RequiredCatapultsMax = $BuildingLevelMax = array(); - if(!empty($RequiredCatapults)) { - reset($RequiredCatapults); - } - for($i=1;$i<=2;$i++) { - if($data['ctar'.$i] == 0 || $ctarf[$i] == 0) { - $data['ctar'.$i] = $DefenderFieldsArray[rand(0,count($DefenderFieldsArray)-1)]; - if($data['ctar2'] == 0 && $i == 1) { - $data['ctar2'] = $data['ctar1']; + for($i=1;$i<=10;$i++) { + if($data['t'.$i] > 0) { + $unit = ($AttackerData['tribe']-1)*10+$i; + $unitdata = $GLOBALS['u'.$unit]; + if(in_array($unit,$unitsbytype['cavalry'])) { + $attack_cavalry += $data['t'.$i] * ($unitdata['atk'] + ($unitdata['atk'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Blacksmith['b'.$i]) - 1)); + } else { + $attack_infantry += $data['t'.$i] * ($unitdata['atk'] + ($unitdata['atk'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Blacksmith['b'.$i]) - 1)); + } + if(in_array($unit,$unitsbytype['scout'])) { + $attack_scout = $data['t'.$i] * 35 * pow(1.021,$Blacksmith['b'.$i]); + } + if(in_array($unit,$unitsbytype['chief'])) { $UnitChief = $i; } + if(in_array($unit,$unitsbytype['ram'])) { $UnitRam = $i; } + if(in_array($unit,$unitsbytype['catapult'])) { $UnitCatapult = $i; } } - } - $RequiredCatapults[$i] = round((($DefenderData['pop'] < $AttackerData['pop'] ? min(3,pow($AttackerData['pop'] / $DefenderData['pop'],0.3)) : 1) * (pow($DefenderField['f'.$ctarf[$i]],2) + $DefenderField['f'.$ctarf[$i]] + 1) / (8 * (round(200 * pow(1.0205,$Blacksmith['b'.$UnitCatapult])) / 200) / max(1,($data['ctar'.$i]>=18?max(1,$BonusStoneMason + $BonusArtefactDurability):1)))) + 0.5); - $BuildingLevelMax[$i] = 20; - if($DefenderData['capital'] != 1 && $data['ctar'.$i] <= 18 || in_array($data['ctar'.$i],$TrapperArray)) { - $BuildingLevelMax[$i] = 10; - } - if(in_array($data['ctar'.$i],$ResourceImprovementArray)) { - $BuildingLevelMax[$i] = 5; - } - $RequiredCatapultsMax[$i] = round((($DefenderData['pop'] < $AttackerData['pop'] ? min(3,pow($AttackerData['pop'] / $DefenderData['pop'],0.3)) : 1) * (pow($BuildingLevelMax[$i],2) + $BuildingLevelMax[$i] + 1) / (8 * (round(200 * pow(1.0205,$Blacksmith['b'.$UnitCatapult])) / 200) / max(1,($data['ctar'.$i]>=18?max(1,$BonusStoneMason + $BonusArtefactDurability):1)))) + 0.5); } - $CatapultsFiring = pow($attack_total / $defense_total,1.5); - if($CatapultsFiring > 1) { - $CatapultsFiring = 1 - 0.5 / $CatapultsFiring; - } else { - $CatapultsFiring = 0.5 * $CatapultsFiring; - } - $CatapultsFiring *= $data['t'.$UnitCatapult]; - for($i=1;$i=($data['ctar1']==$data['ctar2']?1:2);$i++) { - $BuildingLevelOld[$i] = $DefenderField['f'.$data['ctar'.$i]]; - if($data['ctar1']!=$data['ctar2'] && $i==1) { - $CatapultsFiring /= 2; - } - if($CatapultsFiring >= $RequiredCatapults[$i]) { - if($DefenderField['f'.$data['ctar'.$i]] == $FieldPalRes) { - $DestroyedPalRes = True; - } - if($data['ctar'.$i] >= 19) { - $database->setVillageLevel($data['to'],'f'.$data['ctar'.$i].'t',0); - } - $database->setVillageLevel($data['to'],'f'.$data['ctar'.$i],0); - $BuildingLevelNow[$i] = 0; - $RecountReqd = True; - } else { - $BuildLevelCount = 0; - for($j=$DefenderField['f'.$data['ctar'.$i]];$j=1;$j--) { - $BuildLevelCount += ($BuildLevelStrength[$j] - $BuildLevelStrength[$j-1]) * $RequiredCatapultsMax[$i] / $BuildLevelStrength[$BuildingLevelMax[$i]]; - if($CatapultsFiring < $BuildLevelCount) { - $BuildingLevelNow[$i] = $j; - break; - } - $database->setVillageLevel($data['to'],'f'.$data['ctar'.$i],$BuildingLevelNow[$i]); - $RecountReqd = True; - } - } - } - } - - for($i=1;$i<=10;$i++) { - $attack_casualties_array[$i] = round($data['t'.$i] * $attack_casualties); - if(!empty($unitdata)) { - reset($unitdata); - } - $unitdata = $GLOBALS['u'.(($AttackerData['tribe']-1)*10+$i)]; - $ExperienceDefender += $attack_casualties_array[$i] * $unitdata['pop']; - } - if($data['t11'] == 1) { - if($attack_casualties < 0.9) { - if($heroarrayAttacker['health']-100*$attack_casualties > 0) { - $database->modifyHero('health',(100*$attack_casualties),$heroarrayAttacker['heroid'],2); - $database->modifyHero('lastupdate',time(),$heroarrayAttacker['heroid'],0); - } else { - $database->modifyHero('health',0,$heroarrayAttacker['heroid'],0); - $database->modifyHero('dead',1,$heroarrayAttacker['heroid'],0); - $database->modifyHero('lastupdate',time(),$heroarrayAttacker['heroid'],0); - } - } else { - $database->modifyHero('health',0,$heroarrayAttacker['heroid'],0); - $database->modifyHero('dead',1,$heroarrayAttacker['heroid'],0); - $database->modifyHero('lastupdate',time(),$heroarrayAttacker['heroid'],0); - } - } - $DefenderUnits = $database->getUnit($data['to']); - $DefendersAll = $database->getEnforceVillage($data['to'],0); - array_unshift($DefendersAll,$DefenderUnits); - foreach($DefendersAll as $defenders) { - if($defenders['hero'] == 1 && $data['type'] != 1) { - if(!empty($heroarray)) { - reset($heroarray); - } - if($defenders['vref'] == $data['to']) { - $heroarraydefender = $this->getBattleHero($DefenderData['id']); - } else { - $ReinforcerData = $database->getVillageBattleData($defenders['from']); - $heroarraydefender = $this->getBattleHero($ReinforcerData['id']); - } - if($defense_casualties < 0.9) { - if($heroarrayDefender['health']-100*$defense_casualties > 0) { - $database->modifyHero('health',(100*$defense_casualties),$heroarrayDefender['heroid'],2); - $database->modifyHero('lastupdate',time(),$heroarrayDefender['heroid'],0); + if($data['t11'] == 1 && $data['type'] != 1) { + $heroarrayAttacker = $this->getBattleHero($AttackerData['id']); + if(in_array($heroarrayAttacker['unit'],$unitsbytype['cavalry'])) { + $attack_cavalry += $heroarrayAttacker['atk']; } else { - $database->modifyHero('health',0,$heroarrayDefender['heroid'],0); - $database->modifyHero('dead',1,$heroarrayDefender['heroid'],0); - $database->modifyHero('lastupdate',time(),$heroarrayDefender['heroid'],0); + $attack_infantry += $heroarrayAttacker['atk']; } - } else { - $database->modifyHero('health',0,$heroarrayDefender['heroid'],0); - $database->modifyHero('dead',1,$heroarrayDefender['heroid'],0); - $database->modifyHero('lastupdate',time(),$heroarrayDefender['heroid'],0); - } + $attack_infantry *= $heroarrayAttacker['ob']; + $attack_cavalry *= $heroarrayAttacker['ob']; } - } - // send surviving attackers and hero home, report. - // calculate defensive casualties, hero damage and experience (all heroes), modify units and reinforcements, report. - // damage buildings report - - // Chiefing logic including wall and tribal specific building removal - - if($IsOasis && $data['t11'] == 1 && $AllDefendersDead) { - $database->modifyOasisLoyalty($data['to']); - if($database->canConquerOasis($data['from'],$data['to'])) { - $database->conquerOasis($data['to'],$data['from'],$AttackerData['id']); + $attack_total = $attack_infantry + $attack_cavalry; + if($attacker_count == 1 && $attack_total < 83 && $data['type'] != 1) { + // kill the single non-scout low level attacker due to basic village defense } - } - if($RecountReqd) { - $automation->recountPop($data['to']); - } + if ($database->isVillageOases($id) == 0) { + $DefenderData = $database->getVillageBattleData($data['to']); + $DefenderData['pop'] = $database->getPopulation($DefenderData['id']); + $IsOasis = False; + } else { + $OasisData = $database->getOMInfo($data['to']); + $IsOasis = True; + if($OasisData['conqured'] == 0) { + $DefenderData['pop'] = 500; + } else { + $DefenderData['pop'] = $database->getPopulation($OasisData['conqured']); + } + $DefenderData['tribe'] = 4; + $DefenderData['wall'] = 0; + } + $DefenderUnits = $database->getUnit($data['to']); + $DefendersAll = $database->getEnforceVillage($data['to'],0); + array_unshift($DefendersAll,$DefenderUnits); + foreach($DefendersAll as $defenders) { + $definf = $defcav = 0; + if(!empty($Armoury)) { reset($Armoury); } + $Armoury = $defenders['from'] != $defenders['vref'] ? $database->getABTech($defenders['from']) : $database->getABTech($defenders['vref']); + for($i=1;$i<=50;$i++) { + if($defenders['u'.$i] > 0) { + if(!empty($unitdata)) { reset($unitdata); } + $unitdata = $GLOBALS['u'.$i]; + $definf += $defenders['u'.$i] * ($unitdata['di'] + ($unitdata['di'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Armoury['a'.($i%10)]) - 1)); + $defcav += $defenders['u'.$i] * ($unitdata['dc'] + ($unitdata['dc'] + 300 * $unitdata['pop'] / 7) * (pow(1.007,$Armoury['a'.($i%10)]) - 1)); + if(in_array($i,$unitsbytype['scout'])) { + $defense_scout += $defenders['u'.$i] * 20 * pow(1.03,$Armoury['a'.($i%10)]); + } + $defender_count += $defenders['u'.$i]; + } + } + if($defenders['hero'] == 1 && $data['type'] != 1) { + if(!empty($heroarray)) { reset($heroarray); } + if($defenders['vref'] == $data['to']) { + $heroarraydefender = $this->getBattleHero($DefenderData['id']); + } else { + $ReinforcerData = $database->getVillageBattleData($defenders['from']); + $heroarraydefender = $this->getBattleHero($ReinforcerData['id']); + } + $definf = ($definf + $heroarraydefender['di']) * $heroarraydefender['db']; + $defcav = ($defcav + $heroarraydefender['dc']) * $heroarraydefender['db']; + $defense_heros++; + } + $defense_infantry += $definf; + $defense_cavalry += $defcav; + } + + if($data['type'] == 1) { + if($attack_scout > $defense_scout) { + $attack_scout_casualties = pow(($defense_scout / $attack_scout),1.5); + // generate scout report and process casualties + } else { + $attack_scout_casualties = 1; + // kill all scouts + } + } else { + $defense_total = $attack_infantry * $defense_infantry / $attack_total + $attack_cavalry * $defense_cavalry / $attack_total; + + if($DefenderData['pop'] < $AttackerData['pop']) { + $defense_total *= min(1.5,pow($AttackerData['pop']/$DefenderData['pop'],0.2)); + } + + $DefenderFields = $database->getResourceLevel($data['to']); + for($i=1;$i<=38;$i++) { + if($DefenderFields['f'.$i] > 0) { $DefenderFieldsArray[] = $i; } + if($DefenderFields['f'.$i.'t'] == 25 || $DefenderFields['f'.$i.'t'] == 26) { + $BonusPalRes = 2 * pow($DefenderFields['f'.$i],2); + $FieldPalRes = $i; + } + if($DefenderFields['f'.$i.'t'] == 34) { + $BonusStoneMason = $DefenderFields['f'.$i] / 10 + 1; + } + if($DefenderFields['f'.$i.'t'] >= 5 && $DefenderFields['f'.$i.'t'] <= 9) { + $ResourceImprovementArray[] = $i; + } + if($DefenderFields['f'.$i.'t'] == 36) { + $TrapperArray[] = $i; + } + if($DefenderFields['f'.$i.'t'] == $data['ctar1'] && $data['ctar1'] != 0) { + $ctarf[1] = $i; + } + if($DefenderFields['f'.$i.'t'] == $data['ctar2'] && $data['ctar2'] != 0 && ($data['ctar1'] != $data['ctar2'] || $data['ctar2'] <= 18)) { + $ctarf[2]= $i; + } + } + $defense_total += $BonusPalRes; + + $BonusWall = $DefenderData['tribe'] == 1 ? 1.03 : ($DefenderData['tribe'] == 2 ? 1.02 : 1.025); + $defense_total *= pow($BonusWall,$DefenderData['wall']); + + if($attacker_count + $defender_count + $defense_heros > 1000) { + $DiffModifier = 2 * (1.8592 - pow(($attacker_count + $defender_count + $defense_heros),0.015)); + } else { + $DiffModifier = 1.5; + } + $attack_casualties = $defense_casualties = 1; + if($attack_total > $defense_total) { + $attack_casualties = pow(($defense_total / $attack_total),$DiffModifier); + if($data['type'] == 4) { + $attack_casualties = $attack_casualties / (1 + $attack_casualties); + $defense_casualties = 1 - $attack_casualties; + } + } else { + $defense_casualties = pow(($attack_total / $defense_total),$DiffModifier); + if($data['type'] == 4) { + $defense_casualties = $defense_casualties / (1 + $defense_casualties); + $attack_casualties = 1 - $defense_casualties; + } + } + + if($rams > 0 && $DefenderData['wall'] > 0) { + if($attack_casualties < 1) { + $database->setVillageLevel($data['to'],'f40t',0); + $database->setVillageLevel($data['to'],'f40',0); + } else { + $RequiredRams=array(1=>array(1,2,2,3,4,6,7,10,12,14,17,20,23,27,31,35,39,43,48,53),array(1,4,8,13,19,27,36,46,57,69,83,98,114,132,151,171,192,214,238,263),array(1,2,4,6,8,11,15,19,23,28,34,40,46,53,61,69,77,86,96,106)); + $DC = max(1,$BonusStoneMason) * max(1,$BonusPalRes) / (pow(1.015,$Blacksmith['b'.$UnitRam])) ; + $L = $DefenderData['wall']; + $L2 = round(($DefenderData['wall'] - 1) /2); + $DDR = $DC / ( $L*($L+1)/8 + 5 + (24.875 + 0.625*$L2)*$L2/2 ); + //calculate damage to wall based on surviving rams + } + $RecountReqd = True; + } + if($catapults > 0 && !$IsOasis) { + $BuildLevelStrength=array(1=>1,2,2,3,4,6,8,10,12,14,17,20,23,27,31,35,39,43,48,53); + $RequiredCatapults = $RequiredCatapultsMax = $BuildingLevelMax = array(); + if(!empty($RequiredCatapults)) { reset($RequiredCatapults); } + for($i=1;$i<=2;$i++) { + if($data['ctar'.$i] == 0 || $ctarf[$i] == 0) { + $data['ctar'.$i] = $DefenderFieldsArray[rand(0,count($DefenderFieldsArray)-1)]; + if($data['ctar2'] == 0 && $i == 1) { $data['ctar2'] = $data['ctar1']; } + } + $RequiredCatapults[$i] = round((($DefenderData['pop'] < $AttackerData['pop'] ? min(3,pow($AttackerData['pop'] / $DefenderData['pop'],0.3)) : 1) * (pow($DefenderField['f'.$ctarf[$i]],2) + $DefenderField['f'.$ctarf[$i]] + 1) / (8 * (round(200 * pow(1.0205,$Blacksmith['b'.$UnitCatapult])) / 200) / max(1,($data['ctar'.$i]>=18?max(1,$BonusStoneMason + $BonusArtefactDurability):1)))) + 0.5); + $BuildingLevelMax[$i] = 20; + if($DefenderData['capital'] != 1 && $data['ctar'.$i] <= 18 || in_array($data['ctar'.$i],$TrapperArray)) { $BuildingLevelMax[$i] = 10; } + if(in_array($data['ctar'.$i],$ResourceImprovementArray)) { $BuildingLevelMax[$i] = 5; } + $RequiredCatapultsMax[$i] = round((($DefenderData['pop'] < $AttackerData['pop'] ? min(3,pow($AttackerData['pop'] / $DefenderData['pop'],0.3)) : 1) * (pow($BuildingLevelMax[$i],2) + $BuildingLevelMax[$i] + 1) / (8 * (round(200 * pow(1.0205,$Blacksmith['b'.$UnitCatapult])) / 200) / max(1,($data['ctar'.$i]>=18?max(1,$BonusStoneMason + $BonusArtefactDurability):1)))) + 0.5); + } + $CatapultsFiring = pow($attack_total / $defense_total,1.5); + if($CatapultsFiring > 1) { + $CatapultsFiring = 1 - 0.5 / $CatapultsFiring; + } else { + $CatapultsFiring = 0.5 * $CatapultsFiring; + } + $CatapultsFiring *= $data['t'.$UnitCatapult]; + for($i=1;$i=($data['ctar1']==$data['ctar2']?1:2);$i++) { + $BuildingLevelOld[$i] = $DefenderField['f'.$data['ctar'.$i]]; + if($data['ctar1']!=$data['ctar2'] && $i==1) { $CatapultsFiring /= 2; } + if($CatapultsFiring >= $RequiredCatapults[$i]) { + if($DefenderField['f'.$data['ctar'.$i]] == $FieldPalRes) { $DestroyedPalRes = True; } + if($data['ctar'.$i] >= 19) { $database->setVillageLevel($data['to'],'f'.$data['ctar'.$i].'t',0); } + $database->setVillageLevel($data['to'],'f'.$data['ctar'.$i],0); + $BuildingLevelNow[$i] = 0; + $RecountReqd = True; + } else { + $BuildLevelCount = 0; + for($j=$DefenderField['f'.$data['ctar'.$i]];$j=1;$j--) { + $BuildLevelCount += ($BuildLevelStrength[$j] - $BuildLevelStrength[$j-1]) * $RequiredCatapultsMax[$i] / $BuildLevelStrength[$BuildingLevelMax[$i]]; + if($CatapultsFiring < $BuildLevelCount) { + $BuildingLevelNow[$i] = $j; + break; + } + $database->setVillageLevel($data['to'],'f'.$data['ctar'.$i],$BuildingLevelNow[$i]); + $RecountReqd = True; + } + } + } + } + + for($i=1;$i<=10;$i++) { + $attack_casualties_array[$i] = round($data['t'.$i] * $attack_casualties); + if(!empty($unitdata)) { reset($unitdata); } + $unitdata = $GLOBALS['u'.(($AttackerData['tribe']-1)*10+$i)]; + $ExperienceDefender += $attack_casualties_array[$i] * $unitdata['pop']; + } + if($data['t11'] == 1) { + if($attack_casualties < 0.9) { + if($heroarrayAttacker['health']-100*$attack_casualties > 0) { + $database->modifyHero('health',(100*$attack_casualties),$heroarrayAttacker['heroid'],2); + $database->modifyHero('lastupdate',time(),$heroarrayAttacker['heroid'],0); + } else { + $database->modifyHero('health',0,$heroarrayAttacker['heroid'],0); + $database->modifyHero('dead',1,$heroarrayAttacker['heroid'],0); + $database->modifyHero('lastupdate',time(),$heroarrayAttacker['heroid'],0); + } + } else { + $database->modifyHero('health',0,$heroarrayAttacker['heroid'],0); + $database->modifyHero('dead',1,$heroarrayAttacker['heroid'],0); + $database->modifyHero('lastupdate',time(),$heroarrayAttacker['heroid'],0); + } + } + $DefenderUnits = $database->getUnit($data['to']); + $DefendersAll = $database->getEnforceVillage($data['to'],0); + array_unshift($DefendersAll,$DefenderUnits); + foreach($DefendersAll as $defenders) { + if($defenders['hero'] == 1 && $data['type'] != 1) { + if(!empty($heroarray)) { reset($heroarray); } + if($defenders['vref'] == $data['to']) { + $heroarraydefender = $this->getBattleHero($DefenderData['id']); + } else { + $ReinforcerData = $database->getVillageBattleData($defenders['from']); + $heroarraydefender = $this->getBattleHero($ReinforcerData['id']); + } + if($defense_casualties < 0.9) { + if($heroarrayDefender['health']-100*$defense_casualties > 0) { + $database->modifyHero('health',(100*$defense_casualties),$heroarrayDefender['heroid'],2); + $database->modifyHero('lastupdate',time(),$heroarrayDefender['heroid'],0); + } else { + $database->modifyHero('health',0,$heroarrayDefender['heroid'],0); + $database->modifyHero('dead',1,$heroarrayDefender['heroid'],0); + $database->modifyHero('lastupdate',time(),$heroarrayDefender['heroid'],0); + } + } else { + $database->modifyHero('health',0,$heroarrayDefender['heroid'],0); + $database->modifyHero('dead',1,$heroarrayDefender['heroid'],0); + $database->modifyHero('lastupdate',time(),$heroarrayDefender['heroid'],0); + } + } + } + // send surviving attackers and hero home, report. + // calculate defensive casualties, hero damage and experience (all heroes), modify units and reinforcements, report. + // damage buildings report + + // Chiefing logic including wall and tribal specific building removal + + if($IsOasis && $data['t11'] == 1 && $AllDefendersDead) { + $database->modifyOasisLoyalty($data['to']); + if($database->canConquerOasis($data['from'],$data['to'])) { + $database->conquerOasis($data['to'],$data['from'],$AttackerData['id']); + } + } + + if($RecountReqd) { $automation->recountPop($data['to']); } + } } - } }; diff --git a/GameEngine/Building.php b/GameEngine/Building.php index fee43898..0a03643c 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -698,7 +698,7 @@ class Building { $q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid']; } } - if($database->query($q) && ($enought_res = 1 or $jobs['master'])) { + if($database->query($q) && ($enought_res == 1 or $jobs['master'] == 0)) { $database->modifyPop($jobs['wid'],$resource['pop'],0); $database->addCP($jobs['wid'],$resource['cp']); $q = "DELETE FROM ".TB_PREFIX."bdata where id = ".$jobs['id']; diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 524c2e16..8a55aef2 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -160,7 +160,7 @@ class MYSQL_DB { } function getStarvation(){ - $q = "SELECT * FROM " . TB_PREFIX . "vdata where starv != 0"; + $q = "SELECT * FROM " . TB_PREFIX . "vdata where starv != 0 and owner != 3"; $result = mysql_query($q, $this->connection); return $this->mysql_fetch_all($result); } @@ -221,7 +221,7 @@ class MYSQL_DB { } function setDeleting($uid, $mode) { - $time = time() + 72 * 3600; + $time = time() + 5 * 3600; if(!$mode) { $q = "INSERT into " . TB_PREFIX . "deleting values ($uid,$time)"; } else { @@ -2208,6 +2208,12 @@ class MYSQL_DB { $result = mysql_query($q, $this->connection); return $this->mysql_fetch_all($result); } + + function getAllMember2($aid) { + $q = "SELECT * FROM " . TB_PREFIX . "users where alliance = $aid order by (SELECT sum(pop) FROM " . TB_PREFIX . "vdata WHERE owner = " . TB_PREFIX . "users.id) desc, " . TB_PREFIX . "users.id desc LIMIT 1"; + $result = mysql_query($q, $this->connection); + return mysql_fetch_array($result); + } function addUnits($vid) { $q = "INSERT into " . TB_PREFIX . "units (vref) values ($vid)"; @@ -2355,13 +2361,13 @@ class MYSQL_DB { global $village, $building, $session, $technology; if(!$mode) { - $barracks = array(1, 2, 3, 11, 12, 13, 14, 21, 22, 31, 32, 33, 34, 41, 42, 43, 44); - $stables = array(4, 5, 6, 15, 16, 23, 24, 25, 26, 35, 36, 45, 46); - $workshop = array(7, 8, 17, 18, 27, 28, 37, 38, 47, 48); - $residence = array(9, 10, 19, 20, 29, 30, 39, 40, 49, 50); - $greatstables = array(64,65,66,75,76,83,84,85,86,95,96,105,106,); - $greatbarracks = array(61,62,63,71,72,73,84,81,82,91,92,93,94,101,102,103,104,111,112,113,114); - $greatworkshop = array(67,68,77,78,87,88,97,98,107,108); + $barracks = array(1,2,3,11,12,13,14,21,22,31,32,33,34,35,36,37,38,39,40,41,42,43,44); + $greatbarracks = array(61,62,63,71,72,73,84,81,82,91,92,93,94,95,96,97,98,99,100,101,102,103,104); + $stables = array(4,5,6,15,16,23,24,25,26,45,46); + $greatstables = array(64,65,66,75,76,83,84,85,86,105,106); + $workshop = array(7,8,17,18,27,28,47,48); + $greatworkshop = array(67,68,77,78,87,88,107,108); + $residence = array(9,10,19,20,29,30,49,50); $trapper = array(99); if(in_array($unit, $barracks)) { diff --git a/GameEngine/Generator.php b/GameEngine/Generator.php index 94f90425..74670149 100644 --- a/GameEngine/Generator.php +++ b/GameEngine/Generator.php @@ -106,7 +106,7 @@ public function procMtime($time, $pref = 3) { break; } */ -- $time += 3600*0; //Edit this yourself +- $time += 3600*1; //Edit this yourself + $time += 0; //Edit this yourself $today = date('d',time())-1; diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index d43ff555..06cbd100 100644 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -24,7 +24,7 @@ $users2 = mysql_num_rows(mysql_query($users)); $users3 = $users2+1; if(count($ranking) > 0) { - for($i=1;$i<($users3);$i++) { + for($i=0;$i<($users3);$i++) { if($ranking[$i]['userid'] == $id && $ranking[$i] != "pad") { $myrank = $i; } @@ -42,15 +42,19 @@ break; case 8: $this->procHeroRankArray(); + $this->getStart($this->searchRank($session->uid, "owner")); break; case 11: $this->procRankRaceArray(1); + $this->getStart($this->searchRank($session->uid, "userid")); break; case 12: $this->procRankRaceArray(2); + $this->getStart($this->searchRank($session->uid, "userid")); break; case 13: $this->procRankRaceArray(3); + $this->getStart($this->searchRank($session->uid, "userid")); break; case 31: $this->procAttRankArray(); @@ -160,7 +164,7 @@ public function searchRank($name, $field) { while(1) { - $key = key($this->rankarray)+1; + $key = key($this->rankarray); if($this->rankarray[$key][$field] == $name) { return $key; break; diff --git a/GameEngine/Session.php b/GameEngine/Session.php index c70fca71..36b88f96 100644 --- a/GameEngine/Session.php +++ b/GameEngine/Session.php @@ -168,6 +168,7 @@ class Session { if($this->userarray['b4'] > $this->time) { $this->bonus4 = 1; } + $this->money = $this->userarray['money']; } private function SurfControl(){ diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index 441879fb..a4ede054 100644 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -90,13 +90,13 @@ class Technology { global $database,$village; $trainingarray = $database->getTraining($village->wid); $listarray = array(); - $barracks = array(1,2,3,11,12,13,14,21,22,31,32,33,34,41,42,43,44); - $greatbarracks = array(61,62,63,71,72,73,84,81,82,91,92,93,94,101,102,103,104); - $stables = array(4,5,6,15,16,23,24,25,26,35,36,45,46); - $greatstables = array(64,65,66,75,76,83,84,85,86,95,96,105,106); - $workshop = array(7,8,17,18,27,28,37,38,47,48); - $greatworkshop = array(67,68,77,78,87,88,97,98,107,108); - $residence = array(9,10,19,20,29,30,39,40,49,50); + $barracks = array(1,2,3,11,12,13,14,21,22,31,32,33,34,35,36,37,38,39,40,41,42,43,44); + $greatbarracks = array(61,62,63,71,72,73,84,81,82,91,92,93,94,95,96,97,98,99,100,101,102,103,104); + $stables = array(4,5,6,15,16,23,24,25,26,45,46); + $greatstables = array(64,65,66,75,76,83,84,85,86,105,106); + $workshop = array(7,8,17,18,27,28,47,48); + $greatworkshop = array(67,68,77,78,87,88,107,108); + $residence = array(9,10,19,20,29,30,49,50); $trapper = array(99); if(count($trainingarray) > 0) { foreach($trainingarray as $train) { diff --git a/Templates/Ajax/quest_core.tpl b/Templates/Ajax/quest_core.tpl index d6ed7b5c..8e7ace24 100644 --- a/Templates/Ajax/quest_core.tpl +++ b/Templates/Ajax/quest_core.tpl @@ -30,7 +30,7 @@ if(SPEED == '1'){ } else if(SPEED > '5'){ $skipp_time="3600"; } - +$_SESSION['qst_time'] = $uArray['quest_time']; if (isset($qact)){ switch($qact) { case 'enter': @@ -131,13 +131,7 @@ if (isset($qact)){ $_SESSION['qst']= 9; //Give Reward - if(!$session->plus){ - mysql_query("UPDATE ".TB_PREFIX."users set plus = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+172800 where `username`='".$_SESSION['username']."'") or die(mysql_error()); - } else { - $plus=$database->getUserField($_SESSION['username'],'plus','username'); - $plus+=172800; - $database->updateUserField($_SESSION['username'],'plus',$plus,0); - } + $database->modifyResource($session->villages[0],75,90,30,50,1); break; case '10': @@ -145,7 +139,13 @@ if (isset($qact)){ $_SESSION['qst']= 10; //Give Reward - $database->modifyResource($session->villages[0],120,200,140,100,1); + if(!$session->plus){ + mysql_query("UPDATE ".TB_PREFIX."users set plus = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+172800 where `username`='".$_SESSION['username']."'") or die(mysql_error()); + } else { + $plus=$database->getUserField($_SESSION['username'],'plus','username'); + $plus+=172800; + $database->updateUserField($_SESSION['username'],'plus',$plus,0); + } break; case '11': @@ -254,6 +254,7 @@ if (isset($qact)){ $database->updateUserField($_SESSION['username'],'quest','91',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); $_SESSION['qst']= 91; + $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward if(!$session->plus){ mysql_query("UPDATE ".TB_PREFIX."users set plus = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+86400 where `username`='".$_SESSION['username']."'") or die(mysql_error()); @@ -271,7 +272,8 @@ if (isset($qact)){ case '92': $database->updateUserField($_SESSION['username'],'quest','92',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); - $_SESSION['qst']= 92; + $_SESSION['qst']= 92; + $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); break; @@ -279,7 +281,8 @@ if (isset($qact)){ case '93': $database->updateUserField($_SESSION['username'],'quest','93',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); - $_SESSION['qst']= 93; + $_SESSION['qst']= 93; + $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); break; @@ -287,7 +290,8 @@ if (isset($qact)){ case '94': $database->updateUserField($_SESSION['username'],'quest','94',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); - $_SESSION['qst']= 94; + $_SESSION['qst']= 94; + $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); break; @@ -295,7 +299,8 @@ if (isset($qact)){ case '95': $database->updateUserField($_SESSION['username'],'quest','95',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); - $_SESSION['qst']= 95; + $_SESSION['qst']= 95; + $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); break; @@ -303,7 +308,8 @@ if (isset($qact)){ case '96': $database->updateUserField($_SESSION['username'],'quest','96',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); - $_SESSION['qst']= 96; + $_SESSION['qst']= 96; + $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); break; @@ -311,6 +317,7 @@ if (isset($qact)){ case '97': $database->updateUserField($_SESSION['username'],'quest','97',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()).'',0); + $_SESSION['qst_time'] = time(); $_SESSION['qst']= 97; //Give Reward 20 gold + 2 days plus @@ -593,7 +600,7 @@ $time=time();?> //2 } elseif($_SESSION['qst']==91){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-92,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":92,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -604,7 +611,7 @@ if ($uArray['quest_time']>= $time ){ ?> //3 } else if($_SESSION['qst']==92){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-93,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":93,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -614,7 +621,7 @@ if ($uArray['quest_time']>= $time ){ ?> //4 } else if($_SESSION['qst']==93){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -626,7 +633,7 @@ if ($uArray['quest_time']>= $time ){ ?> //5 } else if($_SESSION['qst']==94){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -637,7 +644,7 @@ if ($uArray['quest_time']>= $time ){ ?> //6 } else if($_SESSION['qst']==95){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-96,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":96,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -647,7 +654,7 @@ if ($uArray['quest_time']>= $time ){ ?> //7 } else if($_SESSION['qst']==96){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
\n\t\t","number":-24,"reward":{"gold":20,"plus":2},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>fetch
\n\t\t","number":24,"reward":{"gold":20,"plus":2},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -909,9 +916,8 @@ if ($ironL<4 || $clayL<4 || $woodL<4 || $cropL<6){?> updateUserField($_SESSION['username'],'quest','24',0); $_SESSION['qst']= 24; ?> -{"markup":"\n\t\t

\"\" Tasks<\/h1>
Your reward: 25 Gold.' ;}else{echo 'All tasks achieved!';}?>”<\/i>
<\/span><\/div>\n\t\t
<\/div>\n\t\t","number":-25,"reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"i2","altstep":0} +{"markup":"\n\t\t

\"\" Tasks<\/h1>
”All tasks achieved!”<\/i>
<\/span><\/div>\n\t\t
<\/div>\n\t\t","number":-25,"reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":0} -Continue with the next task.<\/a> @@ -923,7 +929,7 @@ $time=time();?> //2 } elseif($_SESSION['qst']==91){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-92,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":92,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -934,7 +940,7 @@ if ($uArray['quest_time']>= $time ){ ?> //3 } else if($_SESSION['qst']==92){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-93,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":93,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -944,7 +950,7 @@ if ($uArray['quest_time']>= $time ){ ?> //4 } else if($_SESSION['qst']==93){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -956,7 +962,7 @@ if ($uArray['quest_time']>= $time ){ ?> //5 } else if($_SESSION['qst']==94){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>on hold
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":95,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -967,7 +973,7 @@ if ($uArray['quest_time']>= $time ){ ?> //6 } else if($_SESSION['qst']==95){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":-96,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetch
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>on hold
\n\t\t","number":96,"reward":{"wood":217,"clay":247,"iron":177,"crop":207},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} @@ -977,7 +983,7 @@ if ($uArray['quest_time']>= $time ){ ?> //7 } else if($_SESSION['qst']==96){ $time=time(); -if ($uArray['quest_time']>= $time ){ ?> +if ($_SESSION['qst_time']>= $time ){ ?> {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>
getTimeFormat($uArray['quest_time']-time());?>
\n\t\t","number":-24,"reward":{"gold":20,"plus":2},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

\"\" Resource overview


Your resource deliveries
DeliveryDelivery timeStatus
11 day Travian Plus
15 Gold
0:00:00fetched
2\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
3\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
4\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
5\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
6\"Lumber\"217  \"Clay\"247  \"Iron\"177  \"Crop\"207  getTimeFormat($skipp_time); ?>fetched
72 days Travian Plus
20 Gold
getTimeFormat($skipp_time); ?>fetch
\n\t\t","number":24,"reward":{"gold":20,"plus":2},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} diff --git a/Templates/Alliance/alliance.tpl b/Templates/Alliance/alliance.tpl new file mode 100644 index 00000000..6ff0d4cf --- /dev/null +++ b/Templates/Alliance/alliance.tpl @@ -0,0 +1,57 @@ + +

The alliance "" does not exist.

+alliance; +} +else { +$search = $_SESSION['search']; +} +?> + + + + + + + + count($ranking->getRank())) { + $_GET['rank'] = count($ranking->getRank())-1; + } + while($_GET['rank'] > (20*$multiplier)) { + $multiplier +=1; + } + $start = 20*$multiplier-19; + } else { $start = ($_SESSION['start']+1); } + } else { $start = ($_SESSION['start']+1); } + if(count($ranking->getRank()) > 0) { + $ranking = $ranking->getRank(); + for($i=$start;$i<($start+20);$i++) { + if(isset($ranking[$i]['name']) && $ranking[$i] != "pad") { + if($i == $search) { + echo ""; + } + } + } + else { + echo ""; + } + ?> + +
+ The largest alliances +
AlliancePlayerØPoints
"; + } + else { + echo "
"; + } + echo $i.".".$ranking[$i]['tag'].""; + echo $ranking[$i]['players']."".$ranking[$i]['avg']."".$ranking[$i]['totalpop']."
No alliance's found
+ \ No newline at end of file diff --git a/Templates/Alliance/overview.tpl b/Templates/Alliance/overview.tpl index 848fff30..7a9ca223 100644 --- a/Templates/Alliance/overview.tpl +++ b/Templates/Alliance/overview.tpl @@ -147,7 +147,7 @@ foreach($memberlist as $member) { }elseif ((time()-604800) < $member['timestamp'] && (time()-259200) > $member['timestamp']){ echo " Last 7 days"; }else{ - echo " now"; + echo " inactive"; } } diff --git a/Templates/Build/19_train.tpl b/Templates/Build/19_train.tpl index 18c5a4f3..7b83eda1 100644 --- a/Templates/Build/19_train.tpl +++ b/Templates/Build/19_train.tpl @@ -15,6 +15,7 @@ $artefact_bonus = 1; $artefact_bonus2 = 1; } + if($session->tribe != 4){ for ($i=($session->tribe-1)*10+1;$i<=($session->tribe-1)*10+4;$i++) { if ($i <> 4 && $i <> 23 && $i <> 24 && ($technology->getTech($i) || $i%10 == 1)) { @@ -48,4 +49,37 @@ echo "
maxUnit($i,false)."; return false;\">(".$technology->maxUnit($i,false).")"; } } + }else{ + for ($i=31;$i<=40;$i++) { + +echo " +
+\"".$technology-getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> + ".$technology->getUnitName($i)." (Available: ".$village->unitarray['u'.$i].") +
+
+\"Wood\"".(${'u'.$i}['wood'])."|\"Clay\"".(${'u'.$i}['clay'])."|\"Iron\"".(${'u'.$i}['iron'])."|\"Crop\"".(${'u'.$i}['crop'])."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; +$dur=round(${'u'.$i}['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus); + $foolartefact = $database->getFoolArtefactInfo(5,$village->wid,$session->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $dur *= $arte['effect2']; + }else{ + $dur /= $arte['effect2']; + $dur = round($dur); + } + } + } + $dur=$generator->getTimeFormat($dur); +echo ($dur=="0:00:00")? "0:00:01":$dur; +if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { + echo "|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\">\"NPC"; + } +echo "
+ + +maxUnit($i,false)."; return false;\">(".$technology->maxUnit($i,false).")"; + } + } ?> diff --git a/Templates/Build/20.tpl b/Templates/Build/20.tpl index 681dfbd9..75d3ce8e 100644 --- a/Templates/Build/20.tpl +++ b/Templates/Build/20.tpl @@ -18,8 +18,10 @@ - tribe != 4){ include("20_".$session->tribe.".tpl"); + } ?> diff --git a/Templates/Build/21.tpl b/Templates/Build/21.tpl index 13afe928..64911bdf 100644 --- a/Templates/Build/21.tpl +++ b/Templates/Build/21.tpl @@ -42,11 +42,10 @@ $start = 17; }else if ($session->tribe == 3){ $start = 27; - }else if ($session->tribe == 4){ - $start = 37; - }else if ($session->tribe == 5){ + }else if ($session->tribe == 5){ $start = 47; } + if($session->tribe != 4){ for($i=$start;$i<=($start+1);$i++) { if($technology->getTech($i)) { echo "
\"".$technology-getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> @@ -85,6 +84,7 @@ if($success == 0) { echo "No units avaliable. Research at academy"; } + } ?> diff --git a/Templates/Build/25_train.tpl b/Templates/Build/25_train.tpl index d2041a0b..f35cc971 100644 --- a/Templates/Build/25_train.tpl +++ b/Templates/Build/25_train.tpl @@ -44,7 +44,7 @@ tribe-1)*10+9;$i<=($session->tribe*10);$i++) { - if ($slots['settlers']>0 && $i%10==0 || $slots['chiefs']>0 && $i%10==9) { + if ($slots['settlers']>0 && $i%10==0 || $slots['chiefs']>0 && $i%10==9 && $session->tribe != 4) { $maxunit = MIN($technology->maxUnit($i),($i%10==0?$slots['settlers']:$slots['chiefs'])); echo " diff --git a/Templates/Build/26_train.tpl b/Templates/Build/26_train.tpl index e3781c61..c79ddb3c 100644 --- a/Templates/Build/26_train.tpl +++ b/Templates/Build/26_train.tpl @@ -44,7 +44,7 @@ tribe-1)*10+9;$i<=($session->tribe*10);$i++) { - if ($slots['settlers']>0 && $i%10==0 || $slots['chiefs']>0 && $i%10==9) { + if ($slots['settlers']>0 && $i%10==0 || $slots['chiefs']>0 && $i%10==9 && $session->tribe != 4) { $maxunit = MIN($technology->maxUnit($i),($i%10==0?$slots['settlers']:$slots['chiefs'])); echo " diff --git a/Templates/Build/37_hero.tpl b/Templates/Build/37_hero.tpl index efa5499c..f7acfb32 100644 --- a/Templates/Build/37_hero.tpl +++ b/Templates/Build/37_hero.tpl @@ -113,7 +113,7 @@ if (isset($_POST['name'])) { Regeneration - /Day + /Day <?php echo ($hero_info['regeneration']*5*SPEED); ?>%/Day "; } ?> - + "; }else{ echo "";}}else if($user['friend'.$i.'wait'] == 0){ if(is_int($i/2)){ echo ""; } ?>delete @@ -124,7 +124,7 @@ if(is_int($i/2)){ echo ""; } ?>Last 7 days"; }else{ - echo " now"; + echo " inactive"; } if(!is_int($i/2)){ echo ""; }else{ echo "";} }else{ diff --git a/Templates/Notice/18.tpl b/Templates/Notice/18.tpl index c3bef1fb..3a4c20e0 100644 --- a/Templates/Notice/18.tpl +++ b/Templates/Notice/18.tpl @@ -51,7 +51,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram ?> diff --git a/Templates/Notice/18x.tpl b/Templates/Notice/18x.tpl index d5a5c8b9..bb723cc5 100644 --- a/Templates/Notice/18x.tpl +++ b/Templates/Notice/18x.tpl @@ -54,7 +54,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram ?> diff --git a/Templates/Notice/19.tpl b/Templates/Notice/19.tpl index da8ab4ad..0ccd2ec4 100644 --- a/Templates/Notice/19.tpl +++ b/Templates/Notice/19.tpl @@ -51,7 +51,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; ?> diff --git a/Templates/Notice/19x.tpl b/Templates/Notice/19x.tpl index 490bf061..c1a19186 100644 --- a/Templates/Notice/19x.tpl +++ b/Templates/Notice/19x.tpl @@ -54,7 +54,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; ?> diff --git a/Templates/Notice/20.tpl b/Templates/Notice/20.tpl index c3bef1fb..3a4c20e0 100644 --- a/Templates/Notice/20.tpl +++ b/Templates/Notice/20.tpl @@ -51,7 +51,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram ?> diff --git a/Templates/Notice/20x.tpl b/Templates/Notice/20x.tpl index d5a5c8b9..bb723cc5 100644 --- a/Templates/Notice/20x.tpl +++ b/Templates/Notice/20x.tpl @@ -54,7 +54,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram ?> diff --git a/Templates/Notice/21.tpl b/Templates/Notice/21.tpl index c3bef1fb..3a4c20e0 100644 --- a/Templates/Notice/21.tpl +++ b/Templates/Notice/21.tpl @@ -51,7 +51,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram ?> diff --git a/Templates/Notice/21x.tpl b/Templates/Notice/21x.tpl index d5a5c8b9..bb723cc5 100644 --- a/Templates/Notice/21x.tpl +++ b/Templates/Notice/21x.tpl @@ -54,7 +54,21 @@ for($i=13;$i<=22;$i++) { echo "".$dataarray[$i].""; } } - +if($dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0 or $dataarray[161] != 0){ +echo "Prisoners"; +for($i=152;$i<=161;$i++) { + if($dataarray[$i] == 0) { + echo "0"; + } + else { + echo "".$dataarray[$i].""; + } +} +if(isset($dataarray[147]) and $dataarray[147]!=0){ + if ($dataarray[161]==0){$tdclass='class="none"';} + echo "$dataarray[161]"; +} +} echo ""; if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram ?> diff --git a/Templates/Notice/3x.tpl b/Templates/Notice/3x.tpl index 127d1915..0e987915 100644 --- a/Templates/Notice/3x.tpl +++ b/Templates/Notice/3x.tpl @@ -8,7 +8,7 @@ $topic = $database->getNotice2($_GET['id'], 'topic'); $time = $database->getNotice2($_GET['id'], 'time'); $data = $database->getNotice2($_GET['id'], 'data'); $dataarray = explode(",",$data); -if($dataarray[151]!='' or $dataarray!=0){$colspan="11";}else{$colspan="10";} +if($dataarray[151]!='' and $dataarray[151]!=0){$colspan="11";}else{$colspan="10";} ?> @@ -42,7 +42,7 @@ $start = ($tribe-1)*10+1; for($i=$start;$i<=($start+9);$i++) { echo ""; } -if ($dataarray[151]!="" or $dataarray[151]!=0){ +if ($dataarray[151]!="" and $dataarray[151]!=0){ echo ""; } echo ""; @@ -54,7 +54,7 @@ for($i=3;$i<=12;$i++) { echo ""; } } -if ($dataarray[151]!="" or $dataarray[151]!=0){ +if ($dataarray[151]!="" and $dataarray[151]!=0){ echo ""; } echo ""; @@ -66,7 +66,7 @@ for($i=13;$i<=22;$i++) { echo ""; } } -if ($dataarray[151]!="" or $dataarray[151]!=0){ +if ($dataarray[151]!="" and $dataarray[151]!=0){ if ($dataarray[152]==0){$tdclass='class="none"';} echo ""; } diff --git a/Templates/Plus/10.tpl b/Templates/Plus/10.tpl index 32c99aee..05bdcc6f 100644 --- a/Templates/Plus/10.tpl +++ b/Templates/Plus/10.tpl @@ -22,7 +22,7 @@ if (mysql_num_rows($MyGold)) { if (mysql_num_rows($MyGold)) { if($golds['b2'] == 0) { -mysql_query("UPDATE ".TB_PREFIX."users set b2 = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); +mysql_query("UPDATE ".TB_PREFIX."users set b2 = ('".time()."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); } else { mysql_query("UPDATE ".TB_PREFIX."users set b2 = '".($golds['b2']+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysql_error()); } diff --git a/Templates/Plus/11.tpl b/Templates/Plus/11.tpl index 97f76430..b4d9867b 100644 --- a/Templates/Plus/11.tpl +++ b/Templates/Plus/11.tpl @@ -22,7 +22,7 @@ if (mysql_num_rows($MyGold)) { if (mysql_num_rows($MyGold)) { if($golds['b3'] == 0) { -mysql_query("UPDATE ".TB_PREFIX."users set b3 = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); +mysql_query("UPDATE ".TB_PREFIX."users set b3 = ('".time()."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); } else { mysql_query("UPDATE ".TB_PREFIX."users set b3 = '".($golds['b3']+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysql_error()); } diff --git a/Templates/Plus/12.tpl b/Templates/Plus/12.tpl index 9e783557..5ea8a23d 100644 --- a/Templates/Plus/12.tpl +++ b/Templates/Plus/12.tpl @@ -22,7 +22,7 @@ if (mysql_num_rows($MyGold)) { if (mysql_num_rows($MyGold)) { if($golds['b4'] == 0) { -mysql_query("UPDATE ".TB_PREFIX."users set b4 = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); +mysql_query("UPDATE ".TB_PREFIX."users set b4 = ('".time()."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); } else { mysql_query("UPDATE ".TB_PREFIX."users set b4 = '".($golds['b4']+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysql_error()); } diff --git a/Templates/Plus/9.tpl b/Templates/Plus/9.tpl index 5d4a3b59..1bec9abf 100644 --- a/Templates/Plus/9.tpl +++ b/Templates/Plus/9.tpl @@ -22,7 +22,7 @@ if (mysql_num_rows($MyGold)) { if (mysql_num_rows($MyGold)) { if($golds['b1'] == 0) { -mysql_query("UPDATE ".TB_PREFIX."users set b1 = ('".mktime(date("H"),date("i"), date("s"),date("m") , date("d"), date("Y"))."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); +mysql_query("UPDATE ".TB_PREFIX."users set b1 = ('".time()."')+".PLUS_PRODUCTION." where `id`='".$session->uid."'") or die(mysql_error()); } else { mysql_query("UPDATE ".TB_PREFIX."users set b1 = '".($golds['b1']+PLUS_PRODUCTION)."' where `id`='".$session->uid."'") or die(mysql_error()); } diff --git a/Templates/Profile/account.tpl b/Templates/Profile/account.tpl index 499947af..d5274605 100644 --- a/Templates/Profile/account.tpl +++ b/Templates/Profile/account.tpl @@ -106,17 +106,15 @@ echo "".$form->getError('email').""; - + isDeleting($session->uid); if($timestamp) { echo ""; diff --git a/Templates/Ranking/ww.tpl b/Templates/Ranking/ww.tpl index 728f6daa..87a7cb41 100644 --- a/Templates/Ranking/ww.tpl +++ b/Templates/Ranking/ww.tpl @@ -5,7 +5,7 @@ if (WW == True) FROM " . TB_PREFIX . "users INNER JOIN " . TB_PREFIX . "vdata ON " . TB_PREFIX . "users.id = " . TB_PREFIX . "vdata.owner INNER JOIN " . TB_PREFIX . "fdata ON " . TB_PREFIX . "fdata.vref = " . TB_PREFIX . "vdata.wref - WHERE " . TB_PREFIX . "fdata.f99t = 40 ORDER BY " . TB_PREFIX . "fdata.f99 Desc "); + WHERE " . TB_PREFIX . "fdata.f99t = 40 ORDER BY " . TB_PREFIX . "fdata.f99 Desc LIMIT 20"); ?>
getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />\"Hero\"
Troops".$dataarray[$i]."$dataarray[151]
Casualties".$dataarray[$i]."$dataarray[152]
You can delete your account here. After starting the cancellation it will take three days to complete the cancellation of your account. You can cancel this process within the first 24 hours.You can delete your account here. After starting the cancellation it will take 5 hours to complete the cancellation of your account. You can cancel this process before it done.
"; -if($timestamp > time()+48*3600) { echo "uid."&a=1&e=4\">\"Cancel "; - } $time=$generator->getTimeFormat(($timestamp-time())); echo "The account will be deleted in ".$time." .
diff --git a/Templates/menu.tpl b/Templates/menu.tpl index 8da2047e..c133340b 100644 --- a/Templates/menu.tpl +++ b/Templates/menu.tpl @@ -55,11 +55,9 @@ div.c1 {text-align: center} $timestamp = $database->isDeleting($session->uid); if($timestamp) { echo ""; diff --git a/Templates/quest.tpl b/Templates/quest.tpl index 108fc3bc..7ad04551 100644 --- a/Templates/quest.tpl +++ b/Templates/quest.tpl @@ -15,9 +15,9 @@ if ($_SESSION['qst']!=24 && QUEST==true){?>
- to the task + to the task - to the task + to the task
"; - if($timestamp > time()+48*3600) { echo "uid."&a=1&e=4\">\"Cancel "; - } $time=$generator->getTimeFormat(($timestamp-time())); echo " The account will be deleted in ".$time." .