From e108c061c203e88170e969b09513e6aecb25d2f9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Jul 2012 18:53:06 +0300 Subject: [PATCH] fix artefact of the fool --- GameEngine/Automation.php | 222 ++++++++++++++++++++++++------- GameEngine/Battle.php | 57 +++++++- GameEngine/Database/db_MYSQL.php | 17 ++- GameEngine/Technology.php | 11 ++ GameEngine/Units.php | 35 ++++- Templates/Build/19_train.tpl | 14 +- Templates/Build/20_1.tpl | 14 +- Templates/Build/20_2.tpl | 14 +- Templates/Build/20_3.tpl | 14 +- Templates/Build/20_4.tpl | 14 +- Templates/Build/20_5.tpl | 15 ++- Templates/Build/21.tpl | 14 +- Templates/Build/23.tpl | 19 ++- Templates/Build/25_train.tpl | 14 +- Templates/Build/26_train.tpl | 14 +- Templates/Build/29_train.tpl | 15 ++- Templates/Build/30_train.tpl | 15 ++- Templates/Build/42_train.tpl | 15 ++- Templates/a2b/attack.tpl | 22 +++ Templates/a2b/attack_5.tpl | 24 +++- Templates/a2b/newdorf.tpl | 12 +- Templates/a2b/sendback_1.tpl | 12 +- Templates/a2b/sendback_2.tpl | 12 +- Templates/a2b/sendback_3.tpl | 12 +- Templates/a2b/sendback_4.tpl | 12 +- Templates/a2b/sendback_5.tpl | 12 +- Templates/a2b/startRaid.tpl | 18 ++- install/data/sql.sql | 5 +- 28 files changed, 586 insertions(+), 88 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 1783d844..d73fe3d3 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -208,6 +208,7 @@ class Automation { $this->procClimbers(); $this->CheckBan(); $this->regenerateOasisTroops(); + $this->artefactOfTheFool(); } private function loyaltyRegeneration() { @@ -1580,6 +1581,17 @@ class Automation { }else{ $artefact_bouns = 1; } + $foolartefact = $database->getFoolArtefactInfo(7,$vid,$session->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $cranny_eff *= $arte['effect2']; + }else{ + $cranny_eff /= $arte['effect2']; + $cranny_eff = round($cranny_eff); + } + } + } $cranny_eff = ($cranny * $atk_bonus)*$def_bonus*$artefact_bouns; // work out available resources. @@ -1817,23 +1829,10 @@ class Automation { $tblevel = $bdo['f'.$rand]; $tbgid = $bdo['f'.$rand.'t']; $tbid = $rand; - $artowner = $database->getVillageField($data['to'],"owner"); - $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); - $bartefact1 = count($database->getOwnUniqueArtefactInfo2($data['to'],1,1,1)); - $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); - if($bartefact > 0){ - $strongerbuildings = 5; - }else if($bartefact1 > 0){ - $strongerbuildings = 4; - }else if($bartefact2 > 0){ - $strongerbuildings = 3; - }else{ - $strongerbuildings = 1; - } if($stonemason==0){ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings)) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5); }else{ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); } if ($battlepart[4]>$needed_cata) { @@ -1954,23 +1953,10 @@ class Automation { $tblevel = $bdo['f'.$rand]; $tbgid = $bdo['f'.$rand.'t']; $tbid = $rand; - $artowner = $database->getVillageField($data['to'],"owner"); - $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); - $bartefact1 = count($database->getOwnUniqueArtefactInfo2($data['to'],1,1,1)); - $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); - if($bartefact > 0){ - $strongerbuildings = 5; - }else if($bartefact1 > 0){ - $strongerbuildings = 4; - }else if($bartefact2 > 0){ - $strongerbuildings = 3; - }else{ - $strongerbuildings = 1; - } if($stonemason==0){ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings)) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5); }else{ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); } if (($battlepart[4]/2)>$needed_cata) { @@ -2091,23 +2077,10 @@ class Automation { $tblevel = $bdo['f'.$rand]; $tbgid = $bdo['f'.$rand.'t']; $tbid = $rand; - $artowner = $database->getVillageField($data['to'],"owner"); - $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); - $bartefact1 = count($database->getOwnUniqueArtefactInfo2($data['to'],1,1,1)); - $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); - if($bartefact > 0){ - $strongerbuildings = 5; - }else if($bartefact1 > 0){ - $strongerbuildings = 4; - }else if($bartefact2 > 0){ - $strongerbuildings = 3; - }else{ - $strongerbuildings = 1; - } if($stonemason==0){ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings)) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5); }else{ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); } if (($battlepart[4]/2)>$needed_cata) { @@ -2544,6 +2517,17 @@ $crannyimg = "procDistanceTime($p_to,$p_from,min($p_speeds),1)/$p_fastertroops); + $foolartefact1 = $database->getFoolArtefactInfo(2,$prisoner['from'],$p_owner); + if(count($foolartefact1) > 0){ + foreach($foolartefact1 as $arte){ + if($arte['bad_effect'] == 1){ + $p_time *= $arte['effect2']; + }else{ + $p_time /= $arte['effect2']; + $p_time = round($p_time); + } + } + } $p_reference = $database->addAttack($prisoner['from'],$prisoner['t1'],$prisoner['t2'],$prisoner['t3'],$prisoner['t4'],$prisoner['t5'],$prisoner['t6'],$prisoner['t7'],$prisoner['t8'],$prisoner['t9'],$prisoner['t10'],$prisoner['t11'],3,0,0,0,0,0,0,0,0,0,0,0); $database->addMovement(4,$prisoner['wref'],$prisoner['from'],$p_reference,time(),($p_time+time())); $anothertroops += $prisoner['t1']+$prisoner['t2']+$prisoner['t3']+$prisoner['t4']+$prisoner['t5']+$prisoner['t6']+$prisoner['t7']+$prisoner['t8']+$prisoner['t9']+$prisoner['t10']+$prisoner['t11']; @@ -2592,8 +2576,19 @@ $crannyimg = "procDistanceTime($from,$to,min($speeds),1)/$fastertroops) + time(); - //$endtime = $this->procDistanceTime($from,$to,min($speeds),1) + time(); + $endtime = round($this->procDistanceTime($from,$to,min($speeds),1)/$fastertroops); + $foolartefact2 = $database->getFoolArtefactInfo(2,$from['wref'],$from['owner']); + if(count($foolartefact2) > 0){ + foreach($foolartefact2 as $arte){ + if($arte['bad_effect'] == 1){ + $endtime *= $arte['effect2']; + }else{ + $endtime /= $arte['effect2']; + $endtime = round($endtime); + } + } + } + $endtime += time(); if($type == 1) { $database->addNotice($from['owner'],$to['wref'],$ownally,18,''.addslashes($from['name']).' scouts '.addslashes($to['name']).'',$data2,$AttackArrivalTime); }else { @@ -2710,7 +2705,19 @@ $crannyimg = "procDistanceTime($from,$to,min($speeds),1)/$fastertroops) + time(); + $endtime = round($this->procDistanceTime($from,$to,min($speeds),1)/$fastertroops); + $foolartefact3 = $database->getFoolArtefactInfo(2,$from['wref'],$from['owner']); + if(count($foolartefact3) > 0){ + foreach($foolartefact3 as $arte){ + if($arte['bad_effect'] == 1){ + $endtime *= $arte['effect2']; + }else{ + $endtime /= $arte['effect2']; + $endtime = round($endtime); + } + } + } + $endtime += time(); $database->setMovementProc($data['moveid']); $database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],time(),$endtime); $peace = PEACE; @@ -2906,6 +2913,17 @@ $crannyimg = "procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops); + $foolartefact4 = $database->getFoolArtefactInfo(2,$from['wref'],$from['owner']); + if(count($foolartefact4) > 0){ + foreach($foolartefact4 as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($endtime); + } + } + } $reference = $database->addAttack($enforce['from'],$post['t1'],$post['t2'],$post['t3'],$post['t4'],$post['t5'],$post['t6'],$post['t7'],$post['t8'],$post['t9'],$post['t10'],$post['t11'],2,0,0,0,0); $database->addMovement(4,$village->wid,$enforce['from'],$reference,time(),($time+time())); $technology->checkReinf($post['ckey']); @@ -3238,7 +3256,11 @@ $crannyimg = "wid; } + $buildarray = array(); + $buildarray = $database->getResourceLevel($vid); $upkeep = 0; switch($type) { case 0: @@ -3267,13 +3289,76 @@ $crannyimg = "= 10) + || ($i==5 && $buildarray['f'.$horsedrinking] >= 15) + || ($i==6 && $buildarray['f'.$horsedrinking] == 20)) { + $upkeep += ($dataarray['pop']-1) * $array[$unit]; + } else { $upkeep += $dataarray['pop'] * $array[$unit]; + }}else{ + $upkeep += $dataarray['pop'] * $array[$unit]; + } + }else{ + if(isset($horsedrinking)){ + if(($i==4 && $buildarray['f'.$horsedrinking] >= 10) + || ($i==5 && $buildarray['f'.$horsedrinking] >= 15) + || ($i==6 && $buildarray['f'.$horsedrinking] == 20)) { + $upkeep += ($dataarray['pop']-1) * $array[$unit2]; + } else { + $upkeep += $dataarray['pop'] * $array[$unit2]; + }}else{ + $upkeep += $dataarray['pop'] * $array[$unit2]; + } + } } + // $unit = "hero"; + // global $$unit; + // $dataarray = $$unit; + if($prisoners == 0){ + $upkeep += $array['hero'] * 6; + }else{ + $upkeep += $array['t11'] * 6; + } + $artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,4,3,0)); + $artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1)); + $artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,4,2,0)); + if($artefact > 0){ + $upkeep /= 2; + $upkeep = round($upkeep); + }else if($artefact1 > 0){ + $upkeep /= 2; + $upkeep = round($upkeep); + }else if($artefact2 > 0){ + $upkeep /= 4; + $upkeep = round($upkeep); + $upkeep *= 3; + } + $foolartefact = $database->getFoolArtefactInfo(4,$vid,$session->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $upkeep *= $arte['effect2']; + }else{ + $upkeep /= $arte['effect2']; + $upkeep = round($upkeep); + } + } + } return $upkeep; } + private function bountycalculateOProduction($bountywid) { global $technology,$database; $this->bountyOproduction['wood'] = $this->bountyGetOWoodProd(); @@ -4085,6 +4170,45 @@ $crannyimg = "updateOasis($oasis['wref']); } } + + private function artefactOfTheFool() { + global $database; + $time = time(); + $q = "SELECT * FROM " . TB_PREFIX . "artefacts where type = 8 and active = 1 and $time - lastupdate >= 86400"; + $array = $database->query_return($q); + foreach($array as $artefact) { + $kind = rand(1,7); + while($kind == 6){ + $kind = rand(1,7); + } + if($artefact['size'] != 3){ + $bad_effect = rand(0,1); + }else{ + $bad_effect = 0; + } + switch($kind) { + case 1: + $effect = rand(1,5); + break; + case 2: + $effect = rand(1,3); + break; + case 3: + $effect = rand(3,10); + break; + case 4: + $effect = rand(2,4); + break; + case 5: + $effect = rand(2,4); + break; + case 7: + $effect = rand(1,6); + break; + } + mysql_query("UPDATE ".TB_PREFIX."artefacts SET kind = $kind, bad_effect = $bad_effect, effect2 = $effect, lastupdate = $time WHERE id = ".$artefact['id'].""); + } + } } $automation = new Automation; ?> \ No newline at end of file diff --git a/GameEngine/Battle.php b/GameEngine/Battle.php index c9dce26a..21beb24b 100644 --- a/GameEngine/Battle.php +++ b/GameEngine/Battle.php @@ -292,7 +292,17 @@ class Battle { 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); + } + } + } } else { $ap += ($Attacker['u'.$i] * $Attacker['u'.$i] * $Attacker['u'.$i])/3; @@ -372,6 +382,17 @@ class Battle { 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{ + $dp /= $arte['effect2']; + $dp = round($dp); + } + } + } } else { $dp += ($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4; @@ -585,10 +606,21 @@ class Battle { }else{ $strongerbuildings = 1; } - if($stonemason==0){ - $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / $strongerbuildings)) + 0.5); + $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{ - $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); + $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); + }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); } // Aantal katapulten om het gebouw neer te halen $result[3] = $need; @@ -614,10 +646,21 @@ class Battle { }else{ $strongerbuildings = 1; } - if($stonemason==0){ - $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / $strongerbuildings)) + 0.5); + $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{ - $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); + $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); + }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); } // Aantal katapulten om het gebouw neer te halen $result[7] = $need; diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index be4f0016..a4d4a809 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -2408,6 +2408,17 @@ class MYSQL_DB { $each *= 3; $each = round($each); } + $foolartefact = $database->getFoolArtefactInfo(5,$vid,$uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $each *= $arte['effect2']; + }else{ + $each /= $arte['effect2']; + $each = round($each); + } + } + } if($each == 0){ $each = 1; } $time2 = $now+$each; if(count($queued) > 0) { @@ -2942,10 +2953,10 @@ class MYSQL_DB { return $this->mysql_fetch_all($result); } - function getArtefactInfo() { - $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE id > 0"; + function getFoolArtefactInfo($type,$vid,$uid) { + $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vid AND type = $type OR owner = $uid AND size > 1 AND active = 1 AND type = $type"; $result = mysql_query($q, $this->connection); - return mysql_fetch_array($result); + return $this->mysql_fetch_all($result); } function claimArtefact($vref, $ovref, $id) { diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index 991423de..9c7020d1 100644 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -454,6 +454,17 @@ class Technology { $upkeep = round($upkeep); $upkeep *= 3; } + $foolartefact = $database->getFoolArtefactInfo(4,$vid,$session->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $upkeep *= $arte['effect2']; + }else{ + $upkeep /= $arte['effect2']; + $upkeep = round($upkeep); + } + } + } return $upkeep; } diff --git a/GameEngine/Units.php b/GameEngine/Units.php index d5efd632..e4892b75 100644 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -313,12 +313,32 @@ if($session->access != BANNED){ $fastertroops = 1; } $time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops); + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } $to_owner = $database->getVillageField($data['to_vid'],"owner"); $artefact_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,3,0)); $artefact1_2 = count($database->getOwnUniqueArtefactInfo2($data['to_vid'],7,1,1)); $artefact2_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,2,0)); - if (isset($post['ctar1'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0){$post['ctar1'] = 99;}else{$post['ctar1'] = $post['ctar1'];}}else{ $post['ctar1'] = 0;} - if (isset($post['ctar2'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0){$post['ctar2'] = 99;}else{$post['ctar2'] = $post['ctar2'];}}else{ $post['ctar2'] = 0;} + $foolartefact2 = $database->getFoolArtefactInfo(7,$data['to_vid'],$to_owner); + $good_artefact = 0; + if(count($foolartefact2) > 0){ + foreach($foolartefact2 as $arte){ + if($arte['bad_effect'] == 0){ + $good_artefact = 1; + } + } + } + if (isset($post['ctar1'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0 or $good_artefact == 1){$post['ctar1'] = 99;}else{$post['ctar1'] = $post['ctar1'];}}else{ $post['ctar1'] = 0;} + if (isset($post['ctar2'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0 or $good_artefact == 1){$post['ctar2'] = 99;}else{$post['ctar2'] = $post['ctar2'];}}else{ $post['ctar2'] = 0;} if (isset($post['spy'])){$post['spy'] = $post['spy'];}else{ $post['spy'] = 0;} $abdata = $database->getABTech($village->wid); $reference = $database->addAttack(($village->wid),$data['u1'],$data['u2'],$data['u3'],$data['u4'],$data['u5'],$data['u6'],$data['u7'],$data['u8'],$data['u9'],$data['u10'],$data['u11'],$data['type'],$post['ctar1'],$post['ctar2'],$post['spy'],$abdata['b1'],$abdata['b2'],$abdata['b3'],$abdata['b4'],$abdata['b5'],$abdata['b6'],$abdata['b7'],$abdata['b8']); @@ -448,6 +468,17 @@ if($session->access != BANNED){ $fastertroops = 1; } $time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops); + $foolartefact2 = $database->getFoolArtefactInfo(2,$village->wid,$session->uid); + if(count($foolartefact2) > 0){ + foreach($foolartefact2 as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } $reference = $database->addAttack($enforce['from'],$post['t1'],$post['t2'],$post['t3'],$post['t4'],$post['t5'],$post['t6'],$post['t7'],$post['t8'],$post['t9'],$post['t10'],$post['t11'],2,0,0,0,0); $database->addMovement(4,$village->wid,$enforce['from'],$reference,time(),($time+time())); $technology->checkReinf($post['ckey']); diff --git a/Templates/Build/19_train.tpl b/Templates/Build/19_train.tpl index 7c57ccec..18c5a4f3 100644 --- a/Templates/Build/19_train.tpl +++ b/Templates/Build/19_train.tpl @@ -25,7 +25,19 @@ echo "
\"Wood\"".(${'u'.$i}['wood'])."|\"Clay\"".(${'u'.$i}['clay'])."|\"Iron\"".(${'u'.$i}['iron'])."|\"Crop\"".(${'u'.$i}['crop'])."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; -$dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); +$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"; diff --git a/Templates/Build/20_1.tpl b/Templates/Build/20_1.tpl index eec7d234..eea8a849 100644 --- a/Templates/Build/20_1.tpl +++ b/Templates/Build/20_1.tpl @@ -27,7 +27,19 @@ for($i=4;$i<=6;$i++) { echo "
\"Wood\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"Crop".(${'u'.$i}['pop'])."|\"Duration\""; } - $dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / SPEED * $artefact_bonus2 / $artefact_bonus)); + $dur=round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / 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"; diff --git a/Templates/Build/20_2.tpl b/Templates/Build/20_2.tpl index 4dffa44d..17388e9b 100644 --- a/Templates/Build/20_2.tpl +++ b/Templates/Build/20_2.tpl @@ -22,7 +22,19 @@ for($i=15;$i<=16;$i++) { ".$technology->getUnitName($i)." (Avaliable: ".$village->unitarray['u'.$i].")
"; echo "
\"Wood\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; - $dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); + $dur=round(${'u'.$i}['time'] * ($bid20[$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"; diff --git a/Templates/Build/20_3.tpl b/Templates/Build/20_3.tpl index 17628cb5..34cd2f11 100644 --- a/Templates/Build/20_3.tpl +++ b/Templates/Build/20_3.tpl @@ -22,7 +22,19 @@ for($i=23;$i<=26;$i++) { ".$technology->getUnitName($i)." (Avaliable: ".$village->unitarray['u'.$i].")
"; echo "
\"Wood\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; - $dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); + $dur=round(${'u'.$i}['time'] * ($bid20[$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"; diff --git a/Templates/Build/20_4.tpl b/Templates/Build/20_4.tpl index 729a9987..73534839 100644 --- a/Templates/Build/20_4.tpl +++ b/Templates/Build/20_4.tpl @@ -22,7 +22,19 @@ for($i=35;$i<=36;$i++) { ".$technology->getUnitName($i)." (Avaliable: ".$village->unitarray['u'.$i].")
"; echo "
\"Wood\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; - $dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); + $dur=round(${'u'.$i}['time'] * ($bid20[$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"; diff --git a/Templates/Build/20_5.tpl b/Templates/Build/20_5.tpl index 3f7e76e8..80f2803d 100644 --- a/Templates/Build/20_5.tpl +++ b/Templates/Build/20_5.tpl @@ -22,7 +22,20 @@ for($i=45;$i<=46;$i++) { ".$technology->getUnitName($i)." (Avaliable: ".$village->unitarray['u'.$i].")
"; echo "
\"Wood\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; - echo $generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); + $dur=round(${'u'.$i}['time'] * ($bid20[$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; echo "
diff --git a/Templates/Build/21.tpl b/Templates/Build/21.tpl index 369d82fb..13afe928 100644 --- a/Templates/Build/21.tpl +++ b/Templates/Build/21.tpl @@ -53,7 +53,19 @@ ".$technology->getUnitName($i)." (Avaliable: ".$village->unitarray['u'.$i].")
"; echo "
\"Wood\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; - $dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid21[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); + $dur=round(${'u'.$i}['time'] * ($bid21[$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"; diff --git a/Templates/Build/23.tpl b/Templates/Build/23.tpl index bbe65b6f..8e737548 100644 --- a/Templates/Build/23.tpl +++ b/Templates/Build/23.tpl @@ -12,6 +12,17 @@ include("next.tpl"); }else{ $artefact_bouns = 1; } + $good_effect = $bad_effect = 1; + $foolartefact = $database->getFoolArtefactInfo(7,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $bad_effect = $arte['effect2']; + }else{ + $good_effect = $arte['effect2']; + } + } + } ?>
\"Lumber\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"duration\""; -$dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid25[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); +$dur=round(${'u'.$i}['time'] * ($bid25[$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 "|\"NPC"; diff --git a/Templates/Build/26_train.tpl b/Templates/Build/26_train.tpl index 5aa2fbf0..e3781c61 100644 --- a/Templates/Build/26_train.tpl +++ b/Templates/Build/26_train.tpl @@ -52,7 +52,19 @@ echo " \"".$technology-getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> ".$technology->getUnitName($i)." (Available: ".$village->unitarray['u'.$i].")
\"Lumber\"".${'u'.$i}['wood']."|\"Clay\"".${'u'.$i}['clay']."|\"Iron\"".${'u'.$i}['iron']."|\"Crop\"".${'u'.$i}['crop']."|\"duration\""; -$dur=$generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid26[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); +$dur=round(${'u'.$i}['time'] * ($bid26[$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 "|\"NPC"; diff --git a/Templates/Build/29_train.tpl b/Templates/Build/29_train.tpl index cdf3c457..83228cb0 100644 --- a/Templates/Build/29_train.tpl +++ b/Templates/Build/29_train.tpl @@ -25,7 +25,20 @@ echo "
\"Wood\"".(${'u'.$i}['wood']*3)."|\"Clay\"".(${'u'.$i}['clay']*3)."|\"Iron\"".(${'u'.$i}['iron']*3)."|\"Crop\"".(${'u'.$i}['crop']*3)."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; -echo $generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid29[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); +$dur=round(${'u'.$i}['time'] * ($bid29[$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"; } diff --git a/Templates/Build/30_train.tpl b/Templates/Build/30_train.tpl index 9aea6de8..7ebb574f 100644 --- a/Templates/Build/30_train.tpl +++ b/Templates/Build/30_train.tpl @@ -25,7 +25,20 @@ echo "
\"Wood\"".(${'u'.$i}['wood']*3)."|\"Clay\"".(${'u'.$i}['clay']*3)."|\"Iron\"".(${'u'.$i}['iron']*3)."|\"Crop\"".(${'u'.$i}['crop']*3)."|\"Crop".(${'u'.$i}['pop']-($building->getTypeLevel(41)>=1?1:0))."|\"Duration\""; -echo $generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid30[$village->resarray['f'.$id]]['attri'] * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); +$dur=round(${'u'.$i}['time'] * ($bid30[$village->resarray['f'.$id]]['attri'] * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / 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"; } diff --git a/Templates/Build/42_train.tpl b/Templates/Build/42_train.tpl index d306107a..41d18dce 100644 --- a/Templates/Build/42_train.tpl +++ b/Templates/Build/42_train.tpl @@ -24,7 +24,20 @@ echo "
\"Wood\"".(${'u'.$i}['wood']*3)."|\"Clay\"".(${'u'.$i}['clay']*3)."|\"Iron\"".(${'u'.$i}['iron']*3)."|\"Crop\"".(${'u'.$i}['crop']*3)."|\"Crop".${'u'.$i}['pop']."|\"Duration\""; -echo $generator->getTimeFormat(round(${'u'.$i}['time'] * ($bid42[$village->resarray['f'.$id]]['attri'] / 100) / SPEED * $artefact_bonus2 / $artefact_bonus)); +$dur=round(${'u'.$i}['time'] * ($bid42[$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"; } diff --git a/Templates/a2b/attack.tpl b/Templates/a2b/attack.tpl index 971eaf22..9692246c 100644 --- a/Templates/a2b/attack.tpl +++ b/Templates/a2b/attack.tpl @@ -20,6 +20,17 @@ $to = array('x'=>$coor['x'], 'y'=>$coor['y']); $fastertroops = 1; } $time = round($generator->procDistanceTime($from,$to,300,0)/$fastertroops); +$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); +if(count($foolartefact) > 0){ +foreach($foolartefact as $arte){ +if($arte['bad_effect'] == 1){ +$time *= $arte['effect2']; +}else{ +$time /= $arte['effect2']; +$time = round($time); +} +} +} // Temp @@ -392,6 +403,17 @@ $end = ($tribe*10); $fastertroops = 1; } $time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops); + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } ?> diff --git a/Templates/a2b/attack_5.tpl b/Templates/a2b/attack_5.tpl index aa63f4b8..e725e589 100644 --- a/Templates/a2b/attack_5.tpl +++ b/Templates/a2b/attack_5.tpl @@ -23,7 +23,17 @@ $to = array('x'=>$coor['x'], 'y'=>$coor['y']); $fastertroops = 1; } $time = round($generator->procDistanceTime($from,$to,300,0)/$fastertroops); - +$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); +if(count($foolartefact) > 0){ +foreach($foolartefact as $arte){ +if($arte['bad_effect'] == 1){ +$time *= $arte['effect2']; +}else{ +$time /= $arte['effect2']; +$time = round($time); +} +} +} // Temp $ckey= $generator->generateRandStr(6); @@ -388,7 +398,17 @@ $actionType = "Raid"; $fastertroops = 1; } $time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops); - + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } ?> diff --git a/Templates/a2b/newdorf.tpl b/Templates/a2b/newdorf.tpl index 8e3a4960..728969ef 100644 --- a/Templates/a2b/newdorf.tpl +++ b/Templates/a2b/newdorf.tpl @@ -18,7 +18,17 @@ $to = array('x'=>$newvillage['x'], 'y'=>$newvillage['y']); $fastertroops = 1; } $time = round($generator->procDistanceTime($from,$to,300,0)/$fastertroops); - +$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); +if(count($foolartefact) > 0){ +foreach($foolartefact as $arte){ +if($arte['bad_effect'] == 1){ +$time *= $arte['effect2']; +}else{ +$time /= $arte['effect2']; +$time = round($time); +} +} +} echo '
';
 echo '
'; ?> diff --git a/Templates/a2b/sendback_1.tpl b/Templates/a2b/sendback_1.tpl index 413f6d07..0ba80971 100644 --- a/Templates/a2b/sendback_1.tpl +++ b/Templates/a2b/sendback_1.tpl @@ -156,7 +156,17 @@ $tocoor = $database->getCoor($enforce['vref']); $fastertroops = 1; } $time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops); - + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } ?> diff --git a/Templates/a2b/sendback_2.tpl b/Templates/a2b/sendback_2.tpl index 93b3cf63..e7321208 100644 --- a/Templates/a2b/sendback_2.tpl +++ b/Templates/a2b/sendback_2.tpl @@ -157,7 +157,17 @@ $tocoor = $database->getCoor($enforce['vref']); $fastertroops = 1; } $time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops); - + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } ?> diff --git a/Templates/a2b/sendback_3.tpl b/Templates/a2b/sendback_3.tpl index aa7ea159..abd510b3 100644 --- a/Templates/a2b/sendback_3.tpl +++ b/Templates/a2b/sendback_3.tpl @@ -156,7 +156,17 @@ $tocoor = $database->getCoor($enforce['vref']); $fastertroops = 1; } $time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops); - + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } ?> diff --git a/Templates/a2b/sendback_4.tpl b/Templates/a2b/sendback_4.tpl index 8a460873..990a88d0 100644 --- a/Templates/a2b/sendback_4.tpl +++ b/Templates/a2b/sendback_4.tpl @@ -157,7 +157,17 @@ $tocoor = $database->getCoor($enforce['vref']); $fastertroops = 1; } $time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops); - + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } ?> diff --git a/Templates/a2b/sendback_5.tpl b/Templates/a2b/sendback_5.tpl index 25e1daff..f6007fce 100644 --- a/Templates/a2b/sendback_5.tpl +++ b/Templates/a2b/sendback_5.tpl @@ -156,7 +156,17 @@ $tocoor = $database->getCoor($enforce['vref']); $fastertroops = 1; } $time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops); - + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } ?> diff --git a/Templates/a2b/startRaid.tpl b/Templates/a2b/startRaid.tpl index 4f89800e..945b8473 100644 --- a/Templates/a2b/startRaid.tpl +++ b/Templates/a2b/startRaid.tpl @@ -60,8 +60,22 @@ $fastertroops = 1; } $time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops); - - $ctar1 = 0; + $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$seesion->uid); + if(count($foolartefact) > 0){ + foreach($foolartefact as $arte){ + if($arte['bad_effect'] == 1){ + $time *= $arte['effect2']; + }else{ + $time /= $arte['effect2']; + $time = round($time); + } + } + } + if($data['u7'] > 0){ + $ctar1 = 99; + }else{ + $ctar1 = 0; + } $ctar2 = 0; $abdata = $database->getABTech($getFLData['wref']); $reference = $database->addAttack(($getFLData['wref']),$data['u1'],$data['u2'],$data['u3'],$data['u4'],$data['u5'],$data['u6'],$data['u7'],$data['u8'],$data['u9'],$data['u10'],$data['u11'],$data['type'],$ctar1,$ctar2,0,$abdata['b1'],$abdata['b2'],$abdata['b3'],$abdata['b4'],$abdata['b5'],$abdata['b6'],$abdata['b7'],$abdata['b8']); diff --git a/install/data/sql.sql b/install/data/sql.sql index 4a8740ce..7f10badf 100644 --- a/install/data/sql.sql +++ b/install/data/sql.sql @@ -188,7 +188,10 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%artefacts` ( `desc` text NOT NULL, `effect` varchar(100) NOT NULL, `img` varchar(20) NOT NULL, - `active` tinyint(1) unsigned NOT NULL, + `kind` tinyint(1) unsigned NOT NULL, + `bad_effect` tinyint(1) unsigned NOT NULL, + `effect2` tinyint(2) unsigned NOT NULL, + `lastupdate` int(11) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MYISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;