Artifacts fixes part 4

Completely fixed the artifact of the fool and fixed all kind of
artifact:

+Deleted some useless .tpl files and merged into one (Stable)
+The artifact of the fool effect won't be displayed if not active
+Fixed a bug that permitted to have a great and a unique artefacts
active at the same moment
+Big reductions of code in a lot of files
+Created some new methods to support artifacts
+Fixed a bug that prevented the effect of the "Rivals confusion" to work
correctly
+Fixed a bug that prevented "The eagles eyes" artifact to work correctly
for the attacker
+Fixed the artifact of the fool of every kind, now it's calculated with
a new method
+Fixed the cranny capacity when a "Rivals confusion" artifact is active
+Some minor bug fixing , improovements and optimization
This commit is contained in:
iopietro
2018-04-26 20:37:47 +02:00
parent 42eda2f935
commit 56e280f436
32 changed files with 275 additions and 1194 deletions
+2 -1
View File
@@ -35,4 +35,5 @@ $units = $database->getUnit($village['wref']);
<td><?php echo $village['name']; ?></td>
</td>
</tbody>
</table>
</table>
<?php }?>
+11 -56
View File
@@ -652,28 +652,10 @@ class adm_DB {
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($enforce['from'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 0){
$fastertroops = 2;
}else if($artefact2 > 0){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($this->procDistanceTime($fromCor,$toCor,min($speeds),$enforce['from'])/$fastertroops);
$foolartefact2 = $database->getFoolArtefactInfo(2,$enforce['from'],$from['owner']);
if(count($foolartefact2) > 0){
foreach($foolartefact2 as $arte){
if($arte['bad_effect'] == 1){
$time *= $arte['effect2'];
}else{
$time /= $arte['effect2'];
$time = round($time);
}
}
}
$troopsTime = $this->procDistanceTime($fromCor, $toCor, min($speeds), $enforce['from']);
$time = $database->getArtifactsValueInfluence($from['owner'], $enforce['from'], 2, $troopsTime);
$reference = $database->addAttack($enforce['from'],$enforce['u'.$start],$enforce['u'.($start+1)],$enforce['u'.($start+2)],$enforce['u'.($start+3)],$enforce['u'.($start+4)],$enforce['u'.($start+5)],$enforce['u'.($start+6)],$enforce['u'.($start+7)],$enforce['u'.($start+8)],$enforce['u'.($start+9)],$enforce['hero'],2,0,0,0,0);
$database->addMovement(4,$wref,$enforce['from'],$reference,time(),($time+time()));
$database->deleteReinf($enforce['id']);
@@ -937,40 +919,13 @@ class adm_DB {
}
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
if($prisoners == 0){
$upkeep += (isset($array['hero'])? $array['hero'] * 6:0);
}else{
$upkeep += (isset($array['t11'])? $array['t11'] * 6:0);
}
$artefact = count($database->getOwnUniqueArtefactInfo2($uid,4,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($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,$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;
$unit = ($prisoners > 0) ? 't11' : 'hero';
if(!isset($array[$unit])) $array[$unit] = 0;
$upkeep += $array[$unit] * 6;
return $database->getArtifactsValueInfluence($uid, $vid, 4, $upkeep);
}
};
+24 -121
View File
@@ -2063,34 +2063,11 @@ class Automation {
}
//cranny efficiency
//TODO: Needs to be connected to a function
$atk_bonus = ($owntribe == 2)? (4/5) : 1;
$def_bonus = ($targettribe == 3)? 2 : 1;
$to_owner = $database->getVillageField($data['to'],"owner");
$artefact_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,3,0));
$artefact1_2 = count($database->getOwnUniqueArtefactInfo2($data['to'],7,1,1));
$artefact2_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,2,0));
if($artefact_2 > 0){
$artefact_bouns = 6;
}else if($artefact1_2 > 0){
$artefact_bouns = 3;
}else if($artefact2_2 > 0){
$artefact_bouns = 2;
}else{
$artefact_bouns = 1;
}
$foolartefact = $database->getFoolArtefactInfo(7, (isset($vid) ? $vid : 0), $DefenderID);
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);
}
}
}
$crannySpy = $cranny * $def_bonus * $artefact_bouns;
$to_owner = $database->getVillageField($data['to'], "owner");
$crannySpy = $database->getArtifactsValueInfluence($to_owner, $data['to'], 7, $cranny * $def_bonus);
$cranny_eff = $crannySpy * $atk_bonus;
// work out available resources.
@@ -2840,30 +2817,9 @@ class Automation {
$p_speeds[] = $GLOBALS['u'.$p_hero_unit]['speed'];
}
$p_artefact = count($database->getOwnUniqueArtefactInfo2($p_owner,2,3,0));
$p_artefact1 = count($database->getOwnUniqueArtefactInfo2($prisoner['from'],2,1,1));
$p_artefact2 = count($database->getOwnUniqueArtefactInfo2($p_owner,2,2,0));
if($p_artefact > 0){
$p_fastertroops = 3;
}else if($p_artefact1 > 0){
$p_fastertroops = 2;
}else if($p_artefact2 > 0){
$p_fastertroops = 1.5;
}else{
$p_fastertroops = 1;
}
$p_time = round($this->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);
}
}
}
$troopsTime = $this->procDistanceTime($p_to, $p_from, min($p_speeds), 1);
$p_time = $database->getArtifactsValueInfluence($p_owner, $prisoner['from'], 2, $troopsTime);
$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);
$movementType[] = 4;
$movementFrom[] = $prisoner['wref'];
@@ -2925,7 +2881,7 @@ class Automation {
if($totalsend_att - ($totaldead_att + (isset($totaltraped_att) ? $totaltraped_att : 0)) > 0)
{
$troopsTime = $this->procDistanceTime($from, $to, min($speeds), 1);
$endtime = $database->getTroopsWalkingTime($from['owner'], $from['wref'], 2, $troopsTime);
$endtime = $database->getArtifactsValueInfluence($from['owner'], $from['wref'], 2, $troopsTime);
$endtime += $AttackArrivalTime;
if($type == 1) {
if($from['owner'] == 3) { //fix natar report by ronix
@@ -3023,7 +2979,7 @@ class Automation {
}
$troopsTime = $this->procDistanceTime($from, $to, min($speeds), 1);
$endtime = $database->getTroopsWalkingTime($from['owner'], $from['wref'], 2, $troopsTime);
$endtime = $database->getArtifactsValueInfluence($from['owner'], $from['wref'], 2, $troopsTime);
$endtime += $AttackArrivalTime;
$database->setMovementProc($data['moveid']);
@@ -3696,11 +3652,11 @@ class Automation {
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['small']++;
}elseif($artifact['size'] == 2 && !$ownArtifacts['great']){ //Account effect
}elseif($artifact['size'] == 2 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Account effect
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['great']++;
}elseif($artifact['size'] == 3 && !$ownArtifacts['unique']){ //Unique effect
}elseif($artifact['size'] == 3 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Unique effect
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['unique']++;
@@ -4005,52 +3961,14 @@ class Automation {
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
if ( $prisoners == 0 ) {
if ( ! isset( $array['hero'] ) ) {
$array['hero'] = 0;
}
$upkeep += $array['hero'] * 6;
} else {
if ( ! isset( $array['t11'] ) ) {
$array['t11'] = 0;
}
$upkeep += $array['t11'] * 6;
}
$unit = ($prisoners > 0) ? 't11' : 'hero';
if(!isset($array[$unit])) $array[$unit] = 0;
$upkeep += $array[$unit] * 6;
$who = $database->getVillageField( $vid, "owner" );
$artefact = count( $database->getOwnUniqueArtefactInfo2( $who, 4, 3, 0 ) );
$artefact1 = count( $database->getOwnUniqueArtefactInfo2( $vid, 4, 1, 1 ) );
$artefact2 = count( $database->getOwnUniqueArtefactInfo2( $who, 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, $who );
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;
$who = $database->getVillageField($vid, "owner");
return $database->getArtifactsValueInfluence($who, $vid, 4, $upkeep);
}
private function bountycalculateOProduction($bountywid) {
@@ -4060,27 +3978,12 @@ class Automation {
$this->bountyOproduction['crop'] = $this->bountyGetOCropProd();
}
private function bountycalculateProduction($bountywid,$uid) {
global $technology,$database;
$normalA = $database->getOwnArtefactInfoByType($bountywid,4);
$largeA = $database->getOwnUniqueArtefactInfo($uid,4,2);
$uniqueA = $database->getOwnUniqueArtefactInfo($uid,4,3);
$upkeep = $this->getUpkeep($this->getAllUnits($bountywid),0);
private function bountycalculateProduction($bountywid, $uid) {
$upkeep = $this->getUpkeep($this->getAllUnits($bountywid), 0);
$this->bountyproduction['wood'] = $this->bountyGetWoodProd();
$this->bountyproduction['clay'] = $this->bountyGetClayProd();
$this->bountyproduction['iron'] = $this->bountyGetIronProd();
if ($uniqueA['size']==3 && $uniqueA['owner']==$uid){
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-(($upkeep)-round($upkeep*0.50));
}else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$uid){
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-(($upkeep)-round($upkeep*0.25));
}else if ($largeA['size']==2 && $largeA['owner']==$uid){
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-(($upkeep)-round($upkeep*0.25));
}else{
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-$upkeep;
}
$this->bountyproduction['crop'] = $this->bountyGetCropProd() - $this->bountypop - $upkeep;
}
private function bountyprocessProduction($bountywid) {
@@ -4280,7 +4183,7 @@ class Automation {
$database->updateTraining($train['id'], $trained, $trained * $train['eachtime']);
if($train['amt'] - $trained <= 0) $database->trainUnit($train['id'], 0, 0, 0, 0, 1, 1);
if($train['amt'] - $trained <= 0) $database->trainUnit($train['id'], 0, 0, 0, 0, 1);
}
if ($valuesUpdated) {
@@ -5822,9 +5725,9 @@ class Automation {
if ($array) {
foreach($array as $artefact) {
$kind = rand(1, 7);
while($kind == 6){
$kind = rand(1, 7);
}
while($kind == 6) $kind = rand(1, 7);
if($artefact['size'] != 3) $bad_effect = rand(0, 1);
else $bad_effect = 0;
+34 -137
View File
@@ -268,31 +268,12 @@ class Battle {
//rap = Result attack points
//rdp = Result defense points
$cap = $ap = $dp = $cdp = $rap = $rdp = 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){
$attacker_artefact = 5;
}else if($att_artefact2 > 0){
$attacker_artefact = 3;
}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){
$defender_artefact = 10;
}else if($att_artefact1 > 0){
$defender_artefact = 5;
}else if($def_artefact2 > 0){
$defender_artefact = 3;
}else{
$defender_artefact = 1;
}
//Get involved artifacts
$attacker_artefact = $database->getArtifactsValueInfluence($AttackerID, $AttackerWref, 3, 1);
$defender_artefact = $database->getArtifactsValueInfluence($DefenderID, $DefenderWref, 3, 1);
$strongerbuildings = $database->getArtifactsValueInfluence($DefenderID, $DefenderWref, 1, 1);
if(isset($Attacker['uhero']) && $Attacker['uhero'] != 0){
$atkhero = $this->getBattleHero($AttackerID);
}
@@ -383,32 +364,20 @@ class Battle {
}
if($type == 1) {//scout
for($i=$start;$i<=$end;$i++) {
for($i = $start;$i <= $end; $i++) {
global ${'u'.$i};
$j = $i-$start+1;
if($Attacker['u'.$i]>0 && ($i == 4 || $i == 14 || $i == 23 || $i == 44)){
$j = $i - $start + 1;
if($Attacker['u'.$i] > 0 && ($i == 4 || $i == 14 || $i == 23 || $i == 44)){
if(${'att_ab'.$abcount} > 0) {
$ap += round(35 + (35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${'att_ab'.$abcount}) - 1), 4) * $Attacker['u'.$i];
}else{
$ap += $Attacker['u'.$i]*35;
$ap += round(35 + (35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${'att_ab'.$abcount}) - 1), 4) * $Attacker['u'.$i];
}
else $ap += $Attacker['u'.$i] * 35;
}
$involve += $Attacker['u'.$i];
$units['Att_unit'][$i] = $Attacker['u'.$i];
}
$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 *= $attacker_artefact;
}else{ //type=3 normal 4=raid
$abcount = 1;
@@ -598,33 +567,8 @@ class Battle {
$wctp = ($wctp >= 1) ? 1 - 0.5 / $wctp : 0.5 * $wctp;
$wctp *= ($catp + $upgrades);
$artowner = $database->getVillageField( $DefenderWref, "owner" );
$bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0));
$bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1));
$bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0));
if($bartefact > 0){
$strongerbuildings = 5;
}elseif($bartefact1 > 0){
$strongerbuildings = 4;
}elseif($bartefact2 > 0){
$strongerbuildings = 3;
}else{
$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'];
}
}
}
//catapults downgrades
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1) / $strongerbuildings / $good_effect * $bad_effect;
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1) / $strongerbuildings;
//catapults moral
$catpMoral = pow($attpop / ($defpop > 0 ? $defpop : 1) , 0.3);
@@ -645,32 +589,7 @@ class Battle {
$wctp = pow(($rap / $rdp), 1.5);
$wctp = ($wctp >= 1) ? 1 - 0.5 / $wctp : 0.5 * $wctp;
$wctp *= ($ram ) + $upgrades;
$artowner = $database->getVillageField( $DefenderWref, "owner" );
$bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0));
$bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,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;
}
$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'];
}
}
}
$wctp *= ($ram) + $upgrades;
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1) / $strongerbuildings / $good_effect * $bad_effect;
@@ -779,82 +698,60 @@ class Battle {
return $result;
}
public function getDataDefScout($defenders,$def_ab,$defender_artefact,$AttackerWref,$AttackerID) {
global $database;
$abcount=1;
$invol=0;
$dp=0;
$cdp=0;
$detected=0;
public function getDataDefScout($defenders, $def_ab, $defender_artefact, $AttackerWref, $AttackerID) {
$abcount = 1;
$invol = $dp = $cdp = $detected = 0;
for($y=4;$y<=54;$y++) {
for($y = 4; $y <= 54; $y++) {
if($y == 4 || $y == 14 || $y == 23 || $y == 44){
global ${'u'.$y};
if($defenders['u'.$y]>0 && $def_ab[$y] > 0) {
if($defenders['u'.$y] > 0 && $def_ab[$y] > 0) {
$dp += round(20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y] * $defender_artefact;
$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 {
if($defenders['u'.$y]>0) {
if($defenders['u'.$y] > 0) {
$dp += $defenders['u'.$y]* 20 * $defender_artefact;
}
$units['Def_unit'][$y] = $defenders['u'.$y];
if($units['Def_unit'][$y] > 0){
$detected = 1;
}
if($units['Def_unit'][$y] > 0) $detected = 1;
}
$invol += $defenders['u'.$y]; //total troops
$units['Def_unit'][$y] = $defenders['u'.$y];
}
}
$datadef['dp']=$dp;
$datadef['cdp']=$cdp;
$datadef['detect']=($detected==1)? 1:0;
$datadef['involve']=$invol;
$datadef['dp'] = $dp;
$datadef['cdp'] = $cdp;
$datadef['detect'] = $detected;
$datadef['involve'] = $invol;
return $datadef;
}
public function getDataDef($defenders,$def_ab) {
$dp=0;
$cdp=0;
$invol=0;
for($y=1;$y<=50;$y++) {
$dp = $cdp = $invol = 0;
for($y = 1;$y <= 50; $y++) {
global ${'u'.$y};
if ($defenders['u'.$y]>0) {
if ($defenders['u'.$y] > 0) {
if (!isset($def_ab[$y])) {
$def_ab[$y] = 0;
}
if ($def_ab[$y]>0) {
if ($def_ab[$y] > 0) {
$dp += round(${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y];
$cdp += round(${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y];
}else{
$dp += $defenders['u'.$y]*${'u'.$y}['di'];
$cdp += $defenders['u'.$y]*${'u'.$y}['dc'];
$dp += $defenders['u'.$y] * ${'u'.$y}['di'];
$cdp += $defenders['u'.$y] * ${'u'.$y}['dc'];
}
}
$invol += $defenders['u'.$y]; //total troops
$units['Def_unit'][$y] = $defenders['u'.$y];
}
$datadef['dp']=$dp;
$datadef['cdp']=$cdp;
$datadef['involve']=$invol;
$datadef['dp'] = $dp;
$datadef['cdp'] = $cdp;
$datadef['involve'] = $invol;
return $datadef;
}
/**
+16 -17
View File
@@ -676,30 +676,29 @@ class Building {
case 40:
$wwlevel = $village->resarray['f99'];
if ( $wwlevel > 50 ) {
$needed_plan = 1;
} else {
$needed_plan = 0;
}
if($wwlevel > 50) $needed_plan = 1;
else $needed_plan = 0;
$wwbuildingplan = 0;
$villages = $database->getVillagesID( $session->uid );
foreach ( $villages as $village1 ) {
$plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) );
if ( $plan > 0 ) {
$villages = $database->getVillagesID( $session->uid );
foreach($villages as $village1) {
$plan = count($database->getOwnArtefactInfoByType2($village1, 11));
if($plan > 0){
$wwbuildingplan = 1;
break;
}
}
if ( $session->alliance != 0 ) {
$alli_users = $database->getUserByAlliance( $session->alliance );
foreach ( $alli_users as $users ) {
$villages = $database->getVillagesID( $users['id'] );
if ( $users['id'] != $session->uid ) {
foreach ( $villages as $village1 ) {
$plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) );
if ( $plan > 0 ) {
if($session->alliance != 0) {
$alli_users = $database->getUserByAlliance($session->alliance);
foreach($alli_users as $users) {
$villages = $database->getVillagesID($users['id']);
if($users['id'] != $session->uid) {
foreach($villages as $village1) {
$plan = count($database->getOwnArtefactInfoByType2($village1, 11 ));
if($plan > 0) {
$wwbuildingplan += 1;
break;
}
}
}
+82 -109
View File
@@ -6029,87 +6029,46 @@ References: User ID/Message ID, Mode
return $this->mysqli_fetch_all($result);
}
function trainUnit($vid, $unit, $amt, $pop, $each, $time, $mode) {
list($vid, $unit, $amt, $pop, $each, $time, $mode) = $this->escape_input((int) $vid, (int) $unit, (int) $amt, (int) $pop, (int) $each, (int) $time, $mode);
function trainUnit($vid, $unit, $amt, $pop, $each, $mode) {
list($vid, $unit, $amt, $pop, $each, $mode) = $this->escape_input((int) $vid, (int) $unit, (int) $amt, (int) $pop, (int) $each, $mode);
global $village, $building, $session, $technology;
if(!$mode) {
$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);
$barracks = [1, 2, 3, 11, 12, 13, 14, 21, 22, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44];
// fix by brainiac - THANK YOU
$greatbarracks = array(61,62,63,71,72,73,74,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);
$greatbarracks = [61, 62, 63, 71, 72, 73, 74, 81, 82, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104];
$stables = [4, 5, 6, 15, 16, 23, 24, 25, 26, 45, 46];
$greatstables = [64, 65, 66, 75, 76, 83, 84, 85, 86, 105, 106];
$workshop = [7, 8, 17, 18, 27, 28, 47, 48];
$greatworkshop = [67, 68, 77, 78, 87, 88, 107, 108];
$residence = [9, 10, 19, 20, 29, 30, 49, 50];
$trapper = [99];
if(in_array($unit, $barracks)) {
$queued = $technology->getTrainingList(1);
} elseif(in_array($unit, $stables)) {
$queued = $technology->getTrainingList(2);
} elseif(in_array($unit, $workshop)) {
$queued = $technology->getTrainingList(3);
} elseif(in_array($unit, $residence)) {
$queued = $technology->getTrainingList(4);
} elseif(in_array($unit, $greatstables)) {
$queued = $technology->getTrainingList(6);
} elseif(in_array($unit, $greatbarracks)) {
$queued = $technology->getTrainingList(5);
} elseif(in_array($unit, $greatworkshop)) {
$queued = $technology->getTrainingList(7);
} elseif(in_array($unit, $trapper)) {
$queued = $technology->getTrainingList(8);
}
if(in_array($unit, $barracks)) $queued = $technology->getTrainingList(1);
elseif(in_array($unit, $stables)) $queued = $technology->getTrainingList(2);
elseif(in_array($unit, $workshop)) $queued = $technology->getTrainingList(3);
elseif(in_array($unit, $residence)) $queued = $technology->getTrainingList(4);
elseif(in_array($unit, $greatbarracks)) $queued = $technology->getTrainingList(5);
elseif(in_array($unit, $greatstables)) $queued = $technology->getTrainingList(6);
elseif(in_array($unit, $greatworkshop)) $queued = $technology->getTrainingList(7);
elseif(in_array($unit, $trapper)) $queued = $technology->getTrainingList(8);
$now = time();
$uid = $this->getVillageField( $vid, "owner" );
$artefact = count( $this->getOwnUniqueArtefactInfo2( $uid, 5, 3, 0 ) );
$artefact1 = count( $this->getOwnUniqueArtefactInfo2( $vid, 5, 1, 1 ) );
$artefact2 = count( $this->getOwnUniqueArtefactInfo2( $uid, 5, 2, 0 ) );
if ( $artefact > 0 ) {
$time = $now + round( ( $time - $now ) / 2 );
$each /= 2;
$each = round( $each );
} else if ( $artefact1 > 0 ) {
$time = $now + round( ( $time - $now ) / 2 );
$each /= 2;
$each = round( $each );
} else if ( $artefact2 > 0 ) {
$time = $now + round( ( $time - $now ) / 4 * 3 );
$each /= 4;
$each = round( $each );
$each *= 3;
$each = round( $each );
}
$foolartefact = $this->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 );
}
}
}
$uid = $this->getVillageField($vid, "owner");
$each = $this->getArtifactsValueInfluence($uid, $vid, 5, $each);
$time2 = $now + $each;
if ( count( $queued ) > 0 ) {
$time += $queued[ count( $queued ) - 1 ]['timestamp'] - $now;
$time2 += $queued[ count( $queued ) - 1 ]['timestamp'] - $now;
}
// TROOPS MAKE SUM IN BARAKS , ETC
//if($queued[count($queued) - 1]['unit'] == $unit){
//$time = $amt*$queued[count($queued) - 1]['eachtime'];
//$q = "UPDATE " . TB_PREFIX . "training SET amt = amt + $amt, timestamp = timestamp + $time WHERE id = ".$queued[count($queued) - 1]['id']."";
//}else{
$q = "INSERT INTO " . TB_PREFIX . "training values (0,$vid,$unit,$amt,$pop,$time,$each,$time2)";
//}
} else {
$q = "DELETE FROM " . TB_PREFIX . "training where id = $vid";
}
$time = $now + ($each * $amt);
if(count($queued) > 0){
$time += $queued[count($queued) - 1]['timestamp'] - $now;
$time2 += $queued[count($queued) - 1]['timestamp'] - $now;
}
$q = "INSERT INTO " . TB_PREFIX . "training values (0, $vid, $unit, $amt, $pop, $time, $each, $time2)";
}
else $q = "DELETE FROM " . TB_PREFIX . "training where id = $vid";
return mysqli_query($this->dblink,$q);
}
@@ -6947,29 +6906,30 @@ References: User ID/Message ID, Mode
}
/**
* Calculates how much time troops spend to walk from a village to another, counting artifacts
* Calculates how much artifacts affect troops speed, cranny efficency, etc.
*
* @param int $uid The User ID
* @param int $vid The village ID
* @param int $time The old time, without multipliers
* @return int Returns the new time, multiplied or divided by artifacts bonus or malus
* @param int $kind The kind of the artifact
* @param float $multiplicand The value which needs to be multiplied
* @return int Returns the new value, multiplied or divided by artifacts bonus or malus
*/
function getTroopsWalkingTime($uid, $vid, $kind, $time){
list($uid, $vid, $time) = $this->escape_input((int) $uid,(int) $vid, $time);
function getArtifactsValueInfluence($uid, $vid, $kind, $multiplicand){
list($uid, $vid, $kind, $multiplicand) = $this->escape_input((int) $uid,(int) $vid, $kind, $multiplicand);
$artefacts = $foolArefacts = [];
$multiplier = [2, 3, 1.5];
$multipliers = [1 => [4, 5, 3], 2 => [1/2, 1/3, 2/3], 3 => [5, 10, 3], 4 => [1/2, 1/2, 3/4], 5 => [1/2, 1/2, 3/4], 7 => [3, 6, 2]];
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($vid, $kind, 1, 1)); //Village effect
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($uid, $kind, 3, 0)); //Unique effect
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($uid, $kind, 2, 0)); //Account effect
$fasterTroops = 1;
$multiplier = 1;
for($i = 0; $i < count($artefacts); $i++)
{
if($artefacts[$i] > 0) {
$fasterTroops = $multiplier[$i];
$multiplier = $multipliers[$kind][$i];
break;
}
}
@@ -6982,12 +6942,35 @@ References: User ID/Message ID, Mode
{
if(count($foolArefacts[$i]) > 0 && $foolArefacts[$i]['kind'] == $kind)
{
$foolEffect = $foolArefacts[$i]['bad_effect'] == 1 ? $foolArefacts[$i]['effect2'] : 1 / $foolArefacts[$i]['effect2'];
$foolEffect = $foolArefacts[$i]['bad_effect'] == 1 ? 1 / $foolArefacts[$i]['effect2'] : $foolArefacts[$i]['effect2'];
break;
}
}
return round(($time / $fasterTroops) * $foolEffect);
if(in_array($kind, [2, 4, 5])) $foolEffect = 1 / $foolEffect;
return ($multiplicand == 1 ) ? $multiplicand * $multiplier * $foolEffect : round($multiplicand * $multiplier * $foolEffect);
}
/**
* Get the total artifacts sum, divided by small, great and unique, by kind
*
* @param int $uid The User ID
* @param int $vid The Village ID
* @param int $kind The kind of the artifact
* @return array Returns the total artifacts sum divided by size
*/
function getArtifactsSumByKind($uid, $vid, $kind){
list($uid, $vid, $kind) = $this->escape_input((int) $uid, (int) $vid, (int) $kind);
$q = "SELECT SUM(IF((size = '1' AND vref = $vid) OR size > '1', 1, 0)) totals,
SUM(IF(size = '1' AND vref = $vid, 1, 0)) small,
SUM(IF(size = '2', 1, 0)) great,
SUM(IF(size = '3', 1, 0)) `unique`
FROM " . TB_PREFIX . "artefacts WHERE owner = ".(int) $uid." AND active = 1 AND (type = $kind OR kind = $kind)";
$result = mysqli_query($this->dblink, $q);
return $this->mysqli_fetch_all($result)[0];
}
function addArtefact($vref, $owner, $type, $size, $name, $desc, $effect, $img) {
@@ -7276,6 +7259,7 @@ References: User ID/Message ID, Mode
* Activate an artifact by his id
*
* @param int $id The id of the artifact
* @param int $mode 1 for activating an artifact, 0 for deactivating it
* @return bool Returns true if the query was successful, false otherwise
*/
@@ -7307,12 +7291,11 @@ References: User ID/Message ID, Mode
list($size,$type) = $this->escape_input((int) $size,(int) $type);
//fix by Ronix
global $session, $form;
$size1 = $size2 = $size3 = 0;
global $form;
$artifact = $this->getOwnArtefactInfo($from);
if (!empty($artifact)) {
$form->addError( "error", "Treasury is full. Your hero could not claim the artefact" );
$form->addError("error", "Treasury is full. Your hero could not claim the artefact");
return false;
}
@@ -7325,51 +7308,41 @@ References: User ID/Message ID, Mode
$DefenderFields = $this->getResourceLevel( $vref );
$defcanclaim = true;
for ( $i = 19; $i <= 38; $i ++ ) {
if ( $DefenderFields[ 'f' . $i . 't' ] == 27 ) {
$defTresuaryLevel = $DefenderFields[ 'f' . $i ];
if ( $defTresuaryLevel > 0 ) {
for ($i = 19; $i <= 38; $i++) {
if ($DefenderFields['f'.$i.'t'] == 27) {
$defTresuaryLevel = $DefenderFields['f'.$i];
if ($defTresuaryLevel > 0) {
$defcanclaim = false;
$form->addError( "error", "Treasury has not been destroyed. Your hero could not claim the artefact" );
$form->addError("error", "Treasury has not been destroyed. Your hero could not claim the artefact");
return false;
} else {
$defcanclaim = true;
}
else $defcanclaim = true;
}
}
$AttackerFields = $this->getResourceLevel( $from, 2 );
for ( $i = 19; $i <= 38; $i ++ ) {
if ( $AttackerFields[ 'f' . $i . 't' ] == 27 ) {
$attTresuaryLevel = $AttackerFields[ 'f' . $i ];
for($i = 19; $i <= 38; $i++) {
if($AttackerFields['f'.$i.'t'] == 27) {
$attTresuaryLevel = $AttackerFields['f'.$i];
$villageartifact = $attTresuaryLevel >= 10;
$accountartifact = $attTresuaryLevel >= 20;
}
}
if (($artifact['great'] > 0 || $artifact['unique'] > 0) && $size > 1 && $uid != $vuid) {
if(($artifact['great'] > 0 || $artifact['unique'] > 0) && $size > 1 && $uid != $vuid) {
$form->addError( "error", "Max num. of great/unique artefacts. Your hero could not claim the artefact" );
return false;
}
if ( ( $size == 1 && ( $villageartifact || $accountartifact ) ) || ( ( $size == 2 || $size == 3 ) && $accountartifact ) ) {
if(($size == 1 && ($villageartifact || $accountartifact)) || (($size == 2 || $size == 3) && $accountartifact)) {
return true;
/*
if($this->getVillageField($from,"capital")==1 && $type==11) {
$form->addError("error","Ancient Construction Plan cannot kept in capital village");
return FALSE;
}else{
return TRUE;
}
*/
} else {
$form->addError( "error", "Your level treasury is low. Your hero could not claim the artefact" );
$form->addError("error", "Your level treasury is low. Your hero could not claim the artefact");
return false;
}
} else {
$form->addError( "error", "Max num. of artefacts. Your hero could not claim the artefact" );
$form->addError("error", "Max num. of artefacts. Your hero could not claim the artefact");
return false;
}
}
+1 -1
View File
@@ -992,7 +992,7 @@ define("OWN_ARTIFACTS","Own artefacts");
define("CONQUERED","Conquered");
define("DISTANCE","Distance");
define("EFFECT","Effect");
define("ACCOUNT","account");
define("ACCOUNT","Account");
define("SMALL_ARTIFACTS","Small artefacts");
define("LARGE_ARTIFACTS","Large artefacts");
define("NO_ARTIFACTS","There is no artefacts.");
+9 -49
View File
@@ -499,52 +499,12 @@ class Technology {
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
if ( $prisoners == 0 ) {
if ( ! isset( $array['hero'] ) ) {
$array['hero'] = 0;
}
$upkeep += $array['hero'] * 6;
} else {
if ( ! isset( $array['t11'] ) ) {
$array['t11'] = 0;
}
$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 ) {
var_dump($foolartefact);
foreach ( $foolartefact as $arte ) {
if ( $arte['bad_effect'] == 1 ) {
$upkeep *= $arte['effect2'];
} else {
$upkeep /= $arte['effect2'];
$upkeep = round( $upkeep );
}
}
}
return $upkeep;
$unit = ($prisoners > 0) ? 't11' : 'hero';
if(!isset($array[$unit])) $array[$unit] = 0;
$upkeep += $array[$unit] * 6;
return $database->getArtifactsValueInfluence($session->uid, $vid, 4, $upkeep);
}
private function trainUnit($unit,$amt,$great=false) {
@@ -627,9 +587,9 @@ class Technology {
$clay = ${'u'.$unit}['clay'] * $amt * ($great?3:1);
$iron = ${'u'.$unit}['iron'] * $amt * ($great?3:1);
$crop = ${'u'.$unit}['crop'] * $amt * ($great?3:1);
$time = $each*$amt;
if($database->modifyResource($village->wid,$wood,$clay,$iron,$crop,0) && $amt > 0) {
$database->trainUnit($village->wid,$unit+($great?60:0),$amt,${'u'.$unit}['pop'],$each,time()+$time,0);
if($database->modifyResource($village->wid, $wood , $clay, $iron, $crop, 0) && $amt > 0) {
$database->trainUnit($village->wid, $unit + ($great ? 60 : 0), $amt, ${'u'.$unit}['pop'], $each, 0);
}
}
}
+28 -74
View File
@@ -263,68 +263,42 @@ class Units {
private function processReturnTroops($enforce) {
global $database, $generator;
$to = $database->getVillage($enforce['from']);
$Gtribe = "";
if ($database->getUserField($to['owner'],'tribe',0) == '2'){ $Gtribe = "1"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '3'){ $Gtribe = "2"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '4'){ $Gtribe = "3"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '5'){ $Gtribe = "4"; }
$Gtribe = ($tribe = $database->getUserField($to['owner'], 'tribe',0)) == 1 ? "" : $tribe - 1;
$start = ($database->getUserField($to['owner'],'tribe',0)-1)*10+1;
$end = ($database->getUserField($to['owner'],'tribe',0)*10);
$start = ($database->getUserField($to['owner'], 'tribe', 0) - 1) * 10 + 1;
$end = ($database->getUserField($to['owner'] ,'tribe', 0) * 10);
$from = $database->getVillage($enforce['from']);
$fromcoor = $database->getCoor($enforce['from']);
$tocoor = $database->getCoor($enforce['vref']);
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
$fromCor = ['x' => $tocoor['x'], 'y' => $tocoor['y']];
$toCor = ['x' => $fromcoor['x'], 'y' => $fromcoor['y']];
$speeds = array();
$speeds = [];
//find slowest unit.
for($i=$start;$i<=$end;$i++){
for($i = $start; $i <= $end; $i++){
if(intval($enforce['u'.$i]) > 0){
if($unitarray) { reset($unitarray); }
$unitarray = $GLOBALS["u".$i];
$speeds[] = $unitarray['speed'];
}else{
$enforce['u'.$i]='0';
$enforce['u'.$i] = 0;
}
}
if( intval($enforce['hero']) > 0){
if(intval($enforce['hero']) > 0){
$hero_unit = $database->getHeroField($from['owner'], 'unit');
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
}else{
$enforce['hero']='0';
}
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($enforce['from'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 0){
$fastertroops = 2;
}else if($artefact2 > 0){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),$enforce['from'])/$fastertroops);
$foolartefact2 = $database->getFoolArtefactInfo(2,$enforce['from'],$from['owner']);
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'],$enforce['u'.$start],$enforce['u'.($start+1)],$enforce['u'.($start+2)],$enforce['u'.($start+3)],$enforce['u'.($start+4)],$enforce['u'.($start+5)],$enforce['u'.($start+6)],$enforce['u'.($start+7)],$enforce['u'.($start+8)],$enforce['u'.($start+9)],$enforce['hero'],2,0,0,0,0);
$database->addMovement(4,$enforce['vref'],$enforce['from'],$reference,time(),($time+time()));
else $enforce['hero'] = 0;
$troopsTime = $generator->procDistanceTime($fromCor, $toCor, min($speeds), $enforce['from']);
$time = $database->getArtifactsValueInfluence($from['owner'], $enforce['from'], 2, $troopsTime);
$reference = $database->addAttack($enforce['from'], $enforce['u'.$start], $enforce['u'.($start + 1)], $enforce['u'.($start + 2)], $enforce['u'.($start + 3)], $enforce['u'.($start + 4)], $enforce['u'.($start + 5)], $enforce['u'.($start + 6)], $enforce['u'.($start + 7)], $enforce['u'.($start + 8)], $enforce['u'.($start + 9)], $enforce['hero'], 2, 0, 0, 0, 0);
$database->addMovement(4, $enforce['vref'], $enforce['from'], $reference, time(), ($time + time()));
$database->deleteReinf($enforce['id']);
}
@@ -427,29 +401,15 @@ class Units {
}
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
$to_owner = $database->getVillageField($data['to_vid'], "owner");
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
// Check if have WW owner have artefact Rivals great confusion or Artefact of the unique fool with that effect
// If is a WW village you can target on WW , if is not a WW village catapults will target randomly.
// Like it says : Exceptions are the WW which can always be targeted and the treasure chamber which can always be targeted, except with the unique artifact.
// Fixed by Advocaite and Shadow - Optimized by iopietro
$isThere = $database->getFieldLevelInVillage($data['to_vid'], 40);
$iswwvilla = $isThere > 0 ? 1 : 0;
$good_artefact = 0;
$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));
$foolartefact2 = $database->getFoolArtefactInfo(7, $data['to_vid'], $to_owner);
if(count($foolartefact2) > 0) {
foreach ($foolartefact2 as $arte) {
if ($arte['bad_effect'] == 0) {
$good_artefact = 1;
}
}
}
$to_owner = $database->getVillageField($data['to_vid'], "owner");
$rivalsGreatConfusion = $database->getArtifactsSumByKind($to_owner, $data['to_vid'], 7);
$rallyPointLevel = ($village->resarray)['f39'];
$invalidBuildings = [];
@@ -486,24 +446,18 @@ class Units {
}
}
//TODO: Check those strings I do think they're wrong
if (isset($post['ctar1'])) {
if ($artefact_2 > 0 || $artefact1_2 > 0 || $artefact2_2 > 0 || $good_artefact == 1) {
if ($post['ctar1'] != 40 || $post['ctar1'] != 27 && $iswwvilla == 1) {
$post['ctar1'] = 99;
} else {
$post['ctar1'] = 99;
if(isset($post['ctar1'])) {
if($rivalsGreatConfusion['totals'] > 0) {
if($post['ctar1'] != 40 && ($post['ctar1'] != 27 || ($post['ctar1'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar1'] = 0;
}
}
}
else $post['ctar1'] = 0;
if(isset( $post['ctar2'])) {
if ($artefact_2 > 0 || $artefact1_2 > 0 || $artefact2_2 > 0 || $good_artefact == 1) {
if ($post['ctar2'] != 40 || $post['ctar2'] != 27 && $iswwvilla == 1) {
$post['ctar2'] = 99;
} else {
if(isset($post['ctar2']) && $post['ctar2'] > 0) {
if($rivalsGreatConfusion['totals'] > 0) {
if ($post['ctar2'] != 40 && ($post['ctar2'] != 27 || ($post['ctar2'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar2'] = 99;
}
}
@@ -645,7 +599,7 @@ class Units {
else $post['t11'] = 0;
$troopsTime = $generator->procDistanceTime($fromCor, $toCor, min($speeds), 1);
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
$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() ) );
+1 -1
View File
@@ -139,7 +139,7 @@ class Village {
$normalA = $database->getOwnArtefactInfoByType($_SESSION['wid'],4);
$largeA = $database->getOwnUniqueArtefactInfo($session->uid,4,2);
$uniqueA = $database->getOwnUniqueArtefactInfo($session->uid,4,3);
$upkeep = $technology->getUpkeep($this->unitall,0,$this->wid);
$upkeep = $technology->getUpkeep($this->unitall, 0, $this->wid);
$this->production['wood'] = $this->getWoodProd();
$this->production['clay'] = $this->getClayProd();
$this->production['iron'] = $this->getIronProd();
+4 -12
View File
@@ -5,6 +5,7 @@ $units = $database->getMovement("34",$village->wid,1);
$total_for = count($units);
$send = $database->getMovement("1",$village->wid,1);
$total_for2 = count($send);
$artifactsSum = $database->getArtifactsSumByKind($session->uid, $village->wid, 3);
for($y=0;$y < $total_for;$y++){
for($i=0;$i < $total_for2;$i++){
if($units[$y]['ref'] == $send[$i]['ref2']){
@@ -61,14 +62,9 @@ if ($units[$y]['sort_type']==3){
echo $units[$y]['t'.$i]."</td>";
}
}}else{
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,3,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,3,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,3,2,0));
$foolartefact = count($database->getFoolArtefactInfo(3,$village->wid,$session->uid));
$total_artefact = $artefact + $artefact1 + $artefact2 + $foolartefact;
if($total_artefact == 0){
if($artifactsSum['totals'] == 0){
echo "<td class=\"none\">?</td>";
}else{
}else{
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}else{
@@ -273,11 +269,7 @@ $to = $database->getOMInfo($oasis[$y]['to']);
echo $oasis[$y]['t'.$i]."</td>";
}
}}else{
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,3,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,3,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,3,2,0));
$total_artefact = $artefact + $artefact1 + $artefact2;
if($totalunits > $building->getTypeLevel(16) && $total_artefact == 0){
if($artifactsSum['totals'] == 0){
echo "<td class=\"none\">?</td>";
}else{
if($oasis[$y]['t'.$i] == 0) {
+6 -44
View File
@@ -1,20 +1,4 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$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)) {
@@ -26,20 +10,9 @@ echo "<tr><td class=\"desc\">
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood'])."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay'])."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron'])."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop'])."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
@@ -62,20 +35,9 @@ echo "<tr><td class=\"desc\">
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood'])."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay'])."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron'])."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop'])."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
+1 -2
View File
@@ -20,7 +20,7 @@
<tbody>
<?php
if($session->tribe != 4){
include("20_".$session->tribe.".tpl");
include("20_train.tpl");
}
?>
</tbody>
@@ -36,7 +36,6 @@
}
$trainlist = $technology->getTrainingList(2);
if(count($trainlist) > 0) {
//$timer = 2*count($trainlist);
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
-60
View File
@@ -1,60 +0,0 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
for($i=15;$i<=16;$i++) {
if($technology->getTech($i)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u$i\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
echo "</div></td>
<td class=\"val\">
<input type=\"text\" class=\"text\" name=\"t$i\" value=\"0\" maxlength=\"10\">
</td>
<td class=\"max\">
<a href=\"#\" onClick=\"document.snd.t$i.value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a>
</td>
</tr>";
$success += 1;
}
}
if($success == 0) {
echo "<tr><td class=\"none\" colspan=\"3\">".AVAILABLE_ACADEMY."</td></tr>";
}
?>
-61
View File
@@ -1,61 +0,0 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
for($i=23;$i<=26;$i++) {
if($technology->getTech($i)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u$i\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
echo "</div></td>
<td class=\"val\">
<input type=\"text\" class=\"text\" name=\"t$i\" value=\"0\" maxlength=\"10\">
</td>
<td class=\"max\">
<a href=\"#\" onClick=\"document.snd.t$i.value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a>
</td>
</tr>";
$success += 1;
}
}
if($success == 0) {
echo "<tr><td class=\"none\" colspan=\"3\">".AVAILABLE_ACADEMY."</td></tr>";
}
?>
-61
View File
@@ -1,61 +0,0 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
for($i=35;$i<=36;$i++) {
if($technology->getTech($i)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u$i\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
echo "</div></td>
<td class=\"val\">
<input type=\"text\" class=\"text\" name=\"t$i\" value=\"0\" maxlength=\"10\">
</td>
<td class=\"max\">
<a href=\"#\" onClick=\"document.snd.t$i.value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a>
</td>
</tr>";
$success += 1;
}
}
if($success == 0) {
echo "<tr><td class=\"none\" colspan=\"3\">".AVAILABLE_ACADEMY."</td></tr>";
}
?>
-54
View File
@@ -1,54 +0,0 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
for($i=45;$i<=46;$i++) {
if($technology->getTech($i)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u$i\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
echo "</div></td>
<td class=\"val\">
<input type=\"text\" class=\"text\" name=\"t$i\" value=\"0\" maxlength=\"10\">
</td>
<td class=\"max\">
<a href=\"#\" onClick=\"document.snd.t$i.value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a>
</td>
</tr>";
$success += 1;
}
}
if($success == 0) {
echo "<tr><td class=\"none\" colspan=\"3\">".AVAILABLE_ACADEMY."</td></tr>";
}
?>
@@ -1,22 +1,9 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
for($i=4;$i<=6;$i++) {
$start = ($session->tribe - 1) * 10 + 4 - (($session->tribe == 3) ? 1 : 0) + (($session->tribe == 2) ? 1 : 0);
$end = $session->tribe * 10 - 4;
for($i = $start; $i <= $end; $i++) {
if($technology->getTech($i)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u$i\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
@@ -27,20 +14,9 @@ for($i=4;$i<=6;$i++) {
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".(${'u'.$i}['pop'])."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
}
$dur=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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / SPEED));
echo $generator->getTimeFormat($dur);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
+2 -30
View File
@@ -18,22 +18,6 @@
</thead>
<tbody>
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
$start = ($session->tribe == 1)? 7 : (($session->tribe == 2)? 17 : 27);
if ($session->tribe == 1){
@@ -52,20 +36,8 @@
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid21[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
+1 -2
View File
@@ -46,8 +46,7 @@ for($i=32;$i<=39;$i++) {
echo "<td class=\"none\">
".RESEARCH_IN_PROGRESS."</td></tr>";
}
else {
else if($session->access != BANNED){
else if($session->access != BANNED){
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"build.php?id=$id&amp;a=$i&amp;c=".$session->mchecker."\">".RESEARCH."</a></td></tr>";
+9 -65
View File
@@ -1,83 +1,27 @@
<?php
include("next.tpl");
$artefact_2 = count($database->getOwnUniqueArtefactInfo2($session->uid,7,3,0));
$artefact1_2 = count($database->getOwnUniqueArtefactInfo2($village->wid,7,1,1));
$artefact2_2 = count($database->getOwnUniqueArtefactInfo2($session->uid,7,2,0));
if($artefact_2 > 0){
$artefact_bouns = 6;
}else if($artefact1_2 > 0){
$artefact_bouns = 3;
}else if($artefact2_2 > 0){
$artefact_bouns = 2;
}else{
$artefact_bouns = 1;
}
$good_effect = $bad_effect = 1;
$foolartefact = $database->getFoolArtefactInfo(7,$village->wid,$session->uid);
if(count($foolartefact) > 0){
foreach($foolartefact as $arte){
if($arte['bad_effect'] == 1){
$bad_effect = $arte['effect2'];
}else{
$good_effect = $arte['effect2'];
}
}
}
$multiplier = (($session->tribe == 3) ? 2 : 1) * CRANNY_CAPACITY;
$actualLevel = $village->resarray['f'.$id];
$level = min($actualLevel + 1 + $loopsame + $doublebuild + $master, 10);
?>
<div id="build" class="gid23"><a href="#" onClick="return Popup(23,4);" class="build_logo">
<img class="building g23" src="img/x.gif" alt="Cranny" title="<?php echo CRANNY; ?>" />
</a>
<h1><?php echo CRANNY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo CRANNY_DESC; ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_HIDDEN_UNITS; ?></th>
<?php
if($session->tribe == 3) {
?>
<td><b><?php echo $bid23[$village->resarray['f'.$id]]['attri']*2*CRANNY_CAPACITY; ?></b> <?php echo UNITS; ?></td>
<?php
}else{
?>
<td><b><?php echo $bid23[$village->resarray['f'.$id]]['attri']*CRANNY_CAPACITY; ?></b> <?php echo UNITS; ?></td>
<?php
}
?>
<td><b><?php echo $database->getArtifactsValueInfluence($session->uid, $village->wid, 7, $bid23[$village->resarray['f'.$id]]['attri'] * $multiplier); ?></b> <?php echo UNITS; ?></td>
</tr>
<?php if($actualLevel < 10){?>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
if($next<=10){
?>
<th><?php echo HIDDEN_UNITS_LEVEL; ?> <?php echo $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; ?>:</th>
<?php
if($session->tribe == 3) {
?>
<td><b><?php echo $bid23[$village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master]['attri']*2*CRANNY_CAPACITY*$artefact_bouns*$good_effect/$bad_effect; ?></b> <?php echo UNITS; ?></td>
<?php
}else{
?>
<td><b><?php echo $bid23[$village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master]['attri']*CRANNY_CAPACITY*$artefact_bouns*$good_effect/$bad_effect; ?></b> <?php echo UNITS; ?></td>
<?php
}}else{
?>
<th><?php echo HIDDEN_UNITS_LEVEL; ?> 20:</th>
<?php
if($session->tribe == 3) {
?>
<td><b><?php echo $bid23[10]['attri']*2*CRANNY_CAPACITY*$artefact_bouns*$good_effect/$bad_effect; ?></b> <?php echo UNITS; ?></td>
<?php
}else{
?>
<td><b><?php echo $bid23[10]['attri']*CRANNY_CAPACITY*$artefact_bouns*$good_effect/$bad_effect; ?></b> <?php echo UNITS; ?></td>
<?php
}}}
?>
<th><?php echo HIDDEN_UNITS_LEVEL; ?> <?php echo $level; ?>:</th>
<td><b><?php echo $database->getArtifactsValueInfluence($session->uid, $village->wid, 7, $bid23[$level]['attri'] * $multiplier); ?></b> <?php echo UNITS; ?></td>
</tr>
<?php } ?>
</table>
<?php
include("upgrade.tpl");
?>
</p></div>
</div>
+3 -31
View File
@@ -1,20 +1,4 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
@@ -27,7 +11,7 @@
$slots = $database->getAvailableExpansionTraining();
if ($slots['settlers']+$slots['chiefs']>0) { ?>
if ($slots['settlers'] + $slots['chiefs']>0) { ?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
@@ -52,20 +36,8 @@ echo "<tr><td class=\"desc\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
$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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid25[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
+2 -14
View File
@@ -52,20 +52,8 @@ echo "<tr><td class=\"desc\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
$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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid26[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
+1 -1
View File
@@ -52,8 +52,8 @@ switch($kind){
$betterorbadder = $artefactBadEffect ? SPIES_INCREASE : SPIES_DECRESE;
break;
}
$bonus = isset($betterorbadder) ? $betterorbadder." (<b>".str_replace(["(", ")"], "" , $effecty)."</b>)" : "<b>Not yet active</b>";
$bonus = $betterorbadder." (<b>".str_replace(["(", ")"], "" , $effecty)."</b>)";
?>
<div class="artefact image-<?php echo str_replace(['type', '.gif'], '', $artefact['img']); ?>">
+2 -30
View File
@@ -1,20 +1,4 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
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)) {
@@ -25,20 +9,8 @@ echo "<tr><td class=\"desc\">
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood']*3)."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay']*3)."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron']*3)."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop']*3)."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid29[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
+7 -31
View File
@@ -1,23 +1,8 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
for ($i=($session->tribe-1)*10+3;$i<=($session->tribe-1)*10+6;$i++) {
if ($i <> 3 && $i <> 13 && $i <> 14 && $technology->getTech($i)) {
$success ++;
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
@@ -25,20 +10,8 @@ echo "<tr><td class=\"desc\">
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood']*3)."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay']*3)."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron']*3)."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop']*3)."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".(${'u'.$i}['pop']-($building->getTypeLevel(41)>=1?1:0))."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid30[$village->resarray['f'.$id]]['attri'] * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
@@ -52,4 +25,7 @@ echo "</div>
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i,true)."; return false;\">(".$technology->maxUnit($i,true).")</a></td></tr></tbody>";
}
}
if($success == 0) {
echo "<tr><td colspan=\"3\"><div class=\"none\" align=\"center\">".AVAILABLE_ACADEMY."</div></td></tr>";
}
?>
+7 -30
View File
@@ -1,22 +1,8 @@
<?php
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
if($artefact > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact1 > 0){
$artefact_bonus = 2;
$artefact_bonus2 = 1;
}else if($artefact2 > 0){
$artefact_bonus = 4;
$artefact_bonus2 = 3;
}else{
$artefact_bonus = 1;
$artefact_bonus2 = 1;
}
$success = 0;
for ($i=($session->tribe-1)*10+7;$i<=($session->tribe-1)*10+8;$i++) {
if ($technology->getTech($i)) {
$success++;
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
@@ -24,20 +10,8 @@ echo "<tr><td class=\"desc\">
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood']*3)."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay']*3)."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron']*3)."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop']*3)."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur=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;
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid42[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
@@ -51,4 +25,7 @@ echo "</div>
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i,true)."; return false;\">(".$technology->maxUnit($i,true).")</a></td></tr></tbody>";
}
}
if($success == 0) {
echo "<tr><td colspan=\"3\"><div class=\"none\" align=\"center\">".AVAILABLE_ACADEMY."</div></td></tr>";
}
?>
+1 -1
View File
@@ -312,7 +312,7 @@ $end = $tribe * 10;
$to = ['x' => $coor['x'], 'y' => $coor['y']];
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
?>
<td colspan="<?php echo !empty($process['t11']) ? 11 : 10; ?>">
+6 -29
View File
@@ -8,36 +8,13 @@ $newvillage = $database->getMInfo($_GET['id']);
$eigen = $database->getCoor($village->wid);
$from = array('x'=>$eigen['x'], 'y'=>$eigen['y']);
$to = array('x'=>$newvillage['x'], 'y'=>$newvillage['y']);
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 0){
$fastertroops = 2;
}else if($artefact2 > 0){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($generator->procDistanceTime($from,$to,300,0)/$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);
}
}
}
$troopsTime = $generator->procDistanceTime($from, $to, 300, 0);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
//-- Prevent user from founding a new village if there are not enough settlers
//-- fix by AL-Kateb
$tempunits = $database->getUnit($village->coor['id']);
$settler_key = "u" . $session->userinfo['tribe'] . "0";
$settlers = (int)$tempunits[$settler_key];
if($settlers < 3){
//-- fix by AL-Kateb - Semplified by iopietro
if($village->unitarray['u'.$session->tribe.'0'] < 3){
header("location: dorf1.php");
exit;
}
+1 -1
View File
@@ -146,7 +146,7 @@ $end = $att_tribe * 10;
}
$troopsTime = $generator->procDistanceTime($fromCor, $toCor, min($speeds), 1);
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
?>
<td colspan="10">
+6 -37
View File
@@ -85,44 +85,13 @@
}
}
}
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
$time = $database->getArtifactsValueInfluence($getFLData['owner'], $getFLData['wref'], 2, $troopsTime);
$artefact = count( $database->getOwnUniqueArtefactInfo2( $getFLData['owner'], 2, 3, 0 ) );
$artefact1 = count( $database->getOwnUniqueArtefactInfo2( $getFLData['wref'], 2, 1, 1 ) );
$artefact2 = count( $database->getOwnUniqueArtefactInfo2( $getFLData['owner'], 2, 2, 0 ) );
if ( $artefact > 0 ) {
$fastertroops = 3;
} else if ( $artefact1 > 0 ) {
$fastertroops = 2;
} else if ( $artefact2 > 0 ) {
$fastertroops = 1.5;
} else {
$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 );
}
}
}
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'] );
$ctar1 = $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'] );
$totalunits = $data['u1'] + $data['u2'] + $data['u3'] + $data['u4'] + $data['u5'] + $data['u6'] + $data['u7'] + $data['u8'] + $data['u9'] + $data['u10'] + $data['u11'];
$units = [];
+1 -1
View File
@@ -203,7 +203,7 @@ if(isset($_GET['o'])) {
}
$troopsTime = $automation->procDistanceTime($p_to, $p_from, min($p_speeds), 1);
$p_time = $database->getTroopsWalkingTime($p_owner, $prisoner['from'], 2, $troopsTime);
$p_time = $database->getArtifactsValueInfluence($p_owner, $prisoner['from'], 2, $troopsTime);
$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()));