Skip to content
Browse files

big update

  • Loading branch information...
1 parent 8de9d72 commit b578e44608adab03b963c17ca42f1f816c180a77 unknown committed Jul 3, 2012
Showing with 1,001 additions and 228 deletions.
  1. +9 −1 Admin/Templates/msg.tpl
  2. +1 −2 Admin/function.php
  3. +199 −51 GameEngine/Automation.php
  4. +83 −43 GameEngine/Battle.php
  5. +5 −1 GameEngine/Building.php
  6. +86 −17 GameEngine/Database/db_MYSQL.php
  7. +7 −7 GameEngine/Ranking.php
  8. +34 −1 GameEngine/Technology.php
  9. +1 −1 Templates/Alliance/overview.tpl
  10. +77 −0 Templates/Build/16.tpl
  11. +5 −1 Templates/Build/16_incomming.tpl
  12. +7 −7 Templates/Build/27_1.tpl
  13. +10 −1 Templates/Build/37_hero.tpl
  14. +0 −12 Templates/Build/avaliable.tpl
  15. +22 −1 Templates/Notice/1.tpl
  16. +24 −2 Templates/Notice/1x.tpl
  17. +22 −1 Templates/Notice/2.tpl
  18. +24 −2 Templates/Notice/2x.tpl
  19. +18 −1 Templates/Notice/3.tpl
  20. +15 −0 Templates/Notice/3x.tpl
  21. +22 −1 Templates/Notice/4.tpl
  22. +24 −2 Templates/Notice/4x.tpl
  23. +22 −1 Templates/Notice/5.tpl
  24. +24 −2 Templates/Notice/5x.tpl
  25. +22 −1 Templates/Notice/6.tpl
  26. +24 −2 Templates/Notice/6x.tpl
  27. +22 −0 Templates/Notice/7.tpl
  28. +24 −2 Templates/Notice/7x.tpl
  29. +1 −1 Templates/Profile/overview.tpl
  30. +8 −8 Templates/Simulator/att_1.tpl
  31. +8 −8 Templates/Simulator/att_2.tpl
  32. +8 −8 Templates/Simulator/def_1.tpl
  33. +8 −8 Templates/Simulator/def_2.tpl
  34. +8 −8 Templates/Simulator/def_3.tpl
  35. +18 −3 Templates/Simulator/def_end.tpl
  36. +3 −3 Templates/a2b/attack.tpl
  37. +5 −5 Templates/a2b/attack_5.tpl
  38. +4 −5 Templates/menu.tpl
  39. +0 −1 Templates/text.tpl
  40. +58 −1 a2b.php
  41. BIN gpack/travian_default/img/q/l0.jpg
  42. BIN gpack/travian_default/img/q/l0g.jpg
  43. BIN gpack/travian_default/img/q/l4.jpg
  44. BIN gpack/travian_default/img/q/l4g.jpg
  45. BIN gpack/travian_default/img/q/l5.jpg
  46. BIN gpack/travian_default/img/q/l5g.jpg
  47. +2 −3 index.php
  48. +29 −0 install/data/sql.sql
  49. +8 −3 massmessage.php
View
10 Admin/Templates/msg.tpl
@@ -38,7 +38,15 @@ if($msg)
<div class="clear"></div>
<div class="line"></div>
<div class="message" style="min-height: 10px;">
- <?php echo $msg[0]['message'];?>
+<?php
+$input = $msg[0]['message'];
+$alliance = $msg[0]['alliance'];
+$player = $msg[0]['player'];
+$coor = $msg[0]['coor'];
+$report = $msg[0]['report'];
+include("../GameEngine/BBCode.php");
+ echo stripslashes(nl2br($bbcoded));
+?>
</div>
</div>
<div id="read_foot" class="msg_foot"></div>
View
3 Admin/function.php
@@ -42,8 +42,7 @@ function Act($get){
case addBan:
if($get['time']){$end = time()+$get['time']; }else{$end = '';}
- if(preg_match("/^[0-9]+$/",$get['uid'])){
- //if(eregi("^[0-9]*+$",$get['uid'])){
+ if(is_numeric($get['uid'])){
$get['uid'] = $get['uid'];
}else{
$get['uid'] = $database->getUserField($get['uid'],'id',1);
View
250 GameEngine/Automation.php
@@ -628,9 +628,18 @@ private function buildComplete() {
if($indi['type'] == 40 and ($indi['level'] % 5 == 0 or $indi['level'] > 95) and $indi['level'] != 100){
$this->startNatarAttack($indi['level'], $indi['wid']);
}
-
- $q4 = "UPDATE ".TB_PREFIX."bdata set loopcon = 0 where loopcon = 1 and wid = ".$indi['wid'];
+ if($database->getUserField($database->getVillageField($indi['wid'],"owner"),"tribe",0) != 1){
+ $q4 = "UPDATE ".TB_PREFIX."bdata set loopcon = 0 where loopcon = 1 and master = 0 and wid = ".$indi['wid'];
+ $database->query($q4);
+ }else{
+ if($indi['field'] > 18){
+ $q4 = "UPDATE ".TB_PREFIX."bdata set loopcon = 0 where loopcon = 1 and master = 0 and wid = ".$indi['wid']." and field > 18";
$database->query($q4);
+ }else{
+ $q4 = "UPDATE ".TB_PREFIX."bdata set loopcon = 0 where loopcon = 1 and master = 0 and wid = ".$indi['wid']." and field < 19";
+ $database->query($q4);
+ }
+ }
$q = "DELETE FROM ".TB_PREFIX."bdata where id = ".$indi['id'];
$database->query($q);
}
@@ -780,7 +789,7 @@ private function startNatarAttack($level, $vid) {
$row = mysql_fetch_assoc($query);
// start the attacks
- $endtime = time() + round((60 * 60 * 24) / SPEED);
+ $endtime = time() + round((60 * 60 * 24) / INCREASE_SPEED);
// -.-
mysql_query('INSERT INTO `' . TB_PREFIX . 'ww_attacks` (`vid`, `attack_time`) VALUES (' . $vid . ', ' . $endtime . ')');
@@ -800,7 +809,7 @@ private function checkWWAttacks() {
while ($row = mysql_fetch_assoc($query))
{
// fix for destroyed wws
- $query2 = mysql_query('UPDATE `' . TB_PREFIX . 'fdata` SET `f90t` = 40 WHERE `vref` = ' . $row['vid']);
+ $query2 = mysql_query('UPDATE `' . TB_PREFIX . 'fdata` SET `f99t` = 40 WHERE `vref` = ' . $row['vid']);
// delete the attack
$query3 = mysql_query('DELETE FROM `' . TB_PREFIX . 'ww_attacks` WHERE `vid` = ' . $row['vid'] . ' AND `attack_time` = ' . $row['attack_time']);
@@ -919,7 +928,7 @@ private function sendunitsComplete() {
if(file_exists("GameEngine/Prevention/sendunits.txt")) {
unlink("GameEngine/Prevention/sendunits.txt");
}
- global $bid23,$bid34,$database,$battle,$village,$technology,$logging;
+ global $bid23,$bid34,$database,$battle,$village,$technology,$logging,$generator;
$ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w');
fclose($ourFileHandle);
$time = time();
@@ -1079,25 +1088,24 @@ private function sendunitsComplete() {
$type = 4;
}
- $def_ab = Array (
- "b1" => 0, // Blacksmith level
- "b2" => 0, // Blacksmith level
- "b3" => 0, // Blacksmith level
- "b4" => 0, // Blacksmith level
- "b5" => 0, // Blacksmith level
- "b6" => 0, // Blacksmith level
- "b7" => 0, // Blacksmith level
- "b8" => 0); // Blacksmith level
-
- $att_ab = Array (
- "a1" => 0, // armoury level
- "a2" => 0, // armoury level
- "a3" => 0, // armoury level
- "a4" => 0, // armoury level
- "a5" => 0, // armoury level
- "a6" => 0, // armoury level
- "a7" => 0, // armoury level
- "a8" => 0); // armoury level
+ $att_ab = $database->getABTech($data['from']); // Blacksmith level
+ $att_ab1 = $att_ab['b1'];
+ $att_ab2 = $att_ab['b2'];
+ $att_ab3 = $att_ab['b3'];
+ $att_ab4 = $att_ab['b4'];
+ $att_ab5 = $att_ab['b5'];
+ $att_ab6 = $att_ab['b6'];
+ $att_ab7 = $att_ab['b7'];
+ $att_ab8 = $att_ab['b8'];
+ $def_ab = $database->getABTech($data['to']); // Armory level
+ $att_ab1 = $att_ab['a1'];
+ $att_ab2 = $att_ab['a2'];
+ $att_ab3 = $att_ab['a3'];
+ $att_ab4 = $att_ab['a4'];
+ $att_ab5 = $att_ab['a5'];
+ $att_ab6 = $att_ab['a6'];
+ $att_ab7 = $att_ab['a7'];
+ $att_ab8 = $att_ab['a8'];
//rams attack
if($rams > 0 and $type=='3'){
@@ -1256,8 +1264,33 @@ private function sendunitsComplete() {
$stonemason = "1";
}
+
if(PEACE == 0 || $targettribe == 4 || $targettribe == 5){
- $battlepart = $battle->calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab,$att_ab,$tblevel,$stonemason,$walllevel,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref);
+ $traps = $Defender['u99']-$Defender['u99o'];
+ for($i=1;$i<=11;$i++){
+ $traps1 = $traps;
+ if($data['t'.$i] < $traps1){
+ $traps1 = $data['t'.$i];
+ }
+ ${traped.$i}=$traps1;
+ $traps -= $traps1;
+ $database->modifyUnit($data['to'],array("99o"),array($traps1),array(1));
+ }
+ for($i=$start;$i<=$end;$i++) {
+ $j = $i-$start+1;
+ $Attacker['u'.$i] -= ${traped.$j};
+ }
+ $Attacker['uhero'] -= $traped11;
+ $totaltraped_att = $traped1+$traped2+$traped3+$traped4+$traped5+$traped6+$traped7+$traped8+$traped9+$traped10+$traped11;
+ if($totaltraped_att > 0){
+ $prisoners2 = $database->getPrisoners2($data['to'],$data['from']);
+ if(empty($prisoners2)){
+ $database->addPrisoners($data['to'],$data['from'],$traped1,$traped2,$traped3,$traped4,$traped5,$traped6,$traped7,$traped8,$traped9,$traped10,$traped11);
+ }else{
+ $database->updatePrisoners($data['to'],$data['from'],$traped1,$traped2,$traped3,$traped4,$traped5,$traped6,$traped7,$traped8,$traped9,$traped10,$traped11);
+ }
+ }
+ $battlepart = $battle->calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$tblevel,$stonemason,$walllevel,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref);
//units attack string for battleraport
$unitssend_att = ''.$data['t1'].','.$data['t2'].','.$data['t3'].','.$data['t4'].','.$data['t5'].','.$data['t6'].','.$data['t7'].','.$data['t8'].','.$data['t9'].','.$data['t10'].'';
@@ -1395,6 +1428,8 @@ private function sendunitsComplete() {
}
}
}
+ $totalsend_att = $data['t1']+$data['t2']+$data['t3']+$data['t4']+$data['t5']+$data['t6']+$data['t7']+$data['t8']+$data['t9']+$data['t10']+$data['t11'];
+
$unitsdead_def[1] = ''.$dead['1'].','.$dead['2'].','.$dead['3'].','.$dead['4'].','.$dead['5'].','.$dead['6'].','.$dead['7'].','.$dead['8'].','.$dead['9'].','.$dead['10'].'';
$unitsdead_def[2] = ''.$dead['11'].','.$dead['12'].','.$dead['13'].','.$dead['14'].','.$dead['15'].','.$dead['16'].','.$dead['17'].','.$dead['18'].','.$dead['19'].','.$dead['20'].'';
$unitsdead_def[3] = ''.$dead['21'].','.$dead['22'].','.$dead['23'].','.$dead['24'].','.$dead['25'].','.$dead['26'].','.$dead['27'].','.$dead['28'].','.$dead['29'].','.$dead['30'].'';
@@ -1429,8 +1464,20 @@ private function sendunitsComplete() {
$database->modifyAttack($data['ref'],9,$dead9);
$database->modifyAttack($data['ref'],10,$dead10);
$database->modifyAttack($data['ref'],11,$dead11);
-
$unitsdead_att = ''.$dead1.','.$dead2.','.$dead3.','.$dead4.','.$dead5.','.$dead6.','.$dead7.','.$dead8.','.$dead9.','.$dead10.'';
+
+ $database->modifyAttack($data['ref'],1,$traped1);
+ $database->modifyAttack($data['ref'],2,$traped2);
+ $database->modifyAttack($data['ref'],3,$traped3);
+ $database->modifyAttack($data['ref'],4,$traped4);
+ $database->modifyAttack($data['ref'],5,$traped5);
+ $database->modifyAttack($data['ref'],6,$traped6);
+ $database->modifyAttack($data['ref'],7,$traped7);
+ $database->modifyAttack($data['ref'],8,$traped8);
+ $database->modifyAttack($data['ref'],9,$traped9);
+ $database->modifyAttack($data['ref'],10,$traped10);
+ $database->modifyAttack($data['ref'],11,$traped11);
+ $unitstraped_att = ''.$traped1.','.$traped2.','.$traped3.','.$traped4.','.$traped5.','.$traped6.','.$traped7.','.$traped8.','.$traped9.','.$traped10.','.$traped11.'';
if ($herosend_att>0){
$unitsdead_att_check = $unitsdead_att.','.$dead11;
}else{
@@ -1670,8 +1717,12 @@ private function sendunitsComplete() {
$demolish=$battlepart[8]/$battlepart[7];
$totallvl = round(sqrt(pow(($walllevel+0.5),2)-($battlepart[8]*8)));
+ if($walllevel == $totallvl){
+ $info_ram = "".$ram_pic.",Wall was not damaged.";
+ }else{
$info_ram = "".$ram_pic.",Wall damaged from level <b>".$walllevel."</b> to level <b>".$totallvl."</b>.";
$database->setVillageLevel($data['to'],"f".$wallid."",$totallvl);
+ }
}
}
@@ -2139,7 +2190,7 @@ private function sendunitsComplete() {
else{
$canconquer = 3;
}
- }else if($palacelevel['f'.$i.'t'] == 25){
+ }else if($palacelevel['f'.$plevel.'t'] == 25){
if($palacelevel['f'.$plevel] < 10){
$canconquer = 0;
}
@@ -2309,7 +2360,7 @@ private function sendunitsComplete() {
} else {
$artifact = $database->getOwnArtefactInfo($data['to']);
if ($artifact['vref'] == $data['to']) {
- if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'])) {
+ if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'],$artifact['type'])) {
$database->claimArtefact($data['from'],$data['to'],$database->getVillageField($data['from'],"owner"));
$info_chief = $hero_pic.",Your hero is carrying home a artefact and gained ".$heroxp." XP from the battle";
} else {
@@ -2370,18 +2421,18 @@ private function sendunitsComplete() {
}
- $data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.',0,0,0,0,0,'.$to['owner'].','.$to['wref'].','.addslashes($to['name']).','.$targettribe.',,,'.$rom.','.$unitssend_def[1].','.$unitsdead_def[1].','.$ger.','.$unitssend_def[2].','.$unitsdead_def[2].','.$gal.','.$unitssend_def[3].','.$unitsdead_def[3].','.$nat.','.$unitssend_def[4].','.$unitsdead_def[4].','.$natar.','.$unitssend_def[5].','.$unitsdead_def[5].','.$info_ram.','.$info_cat.','.$info_chief.','.$info_spy.',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.',,';
+ $data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.',0,0,0,0,0,'.$to['owner'].','.$to['wref'].','.addslashes($to['name']).','.$targettribe.',,,'.$rom.','.$unitssend_def[1].','.$unitsdead_def[1].','.$ger.','.$unitssend_def[2].','.$unitsdead_def[2].','.$gal.','.$unitssend_def[3].','.$unitsdead_def[3].','.$nat.','.$unitssend_def[4].','.$unitsdead_def[4].','.$natar.','.$unitssend_def[5].','.$unitsdead_def[5].','.$info_ram.','.$info_cat.','.$info_chief.','.$info_spy.',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.','.$unitstraped_att;
}
else{
- $data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.','.$steal[0].','.$steal[1].','.$steal[2].','.$steal[3].','.$battlepart['bounty'].','.$to['owner'].','.$to['wref'].','.addslashes($to['name']).','.$targettribe.',,,'.$rom.','.$unitssend_def[1].','.$unitsdead_def[1].','.$ger.','.$unitssend_def[2].','.$unitsdead_def[2].','.$gal.','.$unitssend_def[3].','.$unitsdead_def[3].','.$nat.','.$unitssend_def[4].','.$unitsdead_def[4].','.$natar.','.$unitssend_def[5].','.$unitsdead_def[5].','.$info_ram.','.$info_cat.','.$info_chief.','.$info_spy.',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.',,';
+ $data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.','.$steal[0].','.$steal[1].','.$steal[2].','.$steal[3].','.$battlepart['bounty'].','.$to['owner'].','.$to['wref'].','.addslashes($to['name']).','.$targettribe.',,,'.$rom.','.$unitssend_def[1].','.$unitsdead_def[1].','.$ger.','.$unitssend_def[2].','.$unitsdead_def[2].','.$gal.','.$unitssend_def[3].','.$unitsdead_def[3].','.$nat.','.$unitssend_def[4].','.$unitsdead_def[4].','.$natar.','.$unitssend_def[5].','.$unitsdead_def[5].','.$info_ram.','.$info_cat.','.$info_chief.','.$info_spy.',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.','.$unitstraped_att;
}
// When all troops die, sends no info.
- $data_fail = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.','.$steal[0].','.$steal[1].','.$steal[2].','.$steal[3].','.$battlepart['bounty'].','.$to['owner'].','.$to['wref'].','.addslashes($to['name']).','.$targettribe.',,,'.$rom.','.$unitssend_deff[1].','.$unitsdead_deff[1].','.$ger.','.$unitssend_deff[2].','.$unitsdead_deff[2].','.$gal.','.$unitssend_deff[3].','.$unitsdead_deff[3].','.$nat.','.$unitssend_deff[4].','.$unitsdead_deff[4].','.$natar.','.$unitssend_deff[5].','.$unitsdead_deff[5].',,,'.$data['t11'].','.$dead11.',,';
+ $data_fail = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.','.$steal[0].','.$steal[1].','.$steal[2].','.$steal[3].','.$battlepart['bounty'].','.$to['owner'].','.$to['wref'].','.addslashes($to['name']).','.$targettribe.',,,'.$rom.','.$unitssend_deff[1].','.$unitsdead_deff[1].','.$ger.','.$unitssend_deff[2].','.$unitsdead_deff[2].','.$gal.','.$unitssend_deff[3].','.$unitsdead_deff[3].','.$nat.','.$unitssend_deff[4].','.$unitsdead_deff[4].','.$natar.','.$unitssend_deff[5].','.$unitsdead_deff[5].',,,'.$data['t11'].','.$dead11.','.$unitstraped_att.',,';
//Undetected and detected in here.
if($scout){
@@ -2402,6 +2453,99 @@ private function sendunitsComplete() {
}
}
else {
+ if($type == 3 && $totalsend_att - ($totaldead_att+$totaltraped_att) > 0){
+ $prisoners = $database->getPrisoners($to['wref']);
+ if(count($prisoners) > 0){
+ $anothertroops = 0;
+ foreach($prisoners as $prisoner){
+ $p_owner = $database->getVillageField($prisoner['from'],"owner");
+ if($p_owner == $from['owner']){
+ $database->modifyAttack2($data['ref'],1,$prisoner['t1']);
+ $database->modifyAttack2($data['ref'],2,$prisoner['t2']);
+ $database->modifyAttack2($data['ref'],3,$prisoner['t3']);
+ $database->modifyAttack2($data['ref'],4,$prisoner['t4']);
+ $database->modifyAttack2($data['ref'],5,$prisoner['t5']);
+ $database->modifyAttack2($data['ref'],6,$prisoner['t6']);
+ $database->modifyAttack2($data['ref'],7,$prisoner['t7']);
+ $database->modifyAttack2($data['ref'],8,$prisoner['t8']);
+ $database->modifyAttack2($data['ref'],9,$prisoner['t9']);
+ $database->modifyAttack2($data['ref'],10,$prisoner['t10']);
+ $database->modifyAttack2($data['ref'],11,$prisoner['t11']);
+ $mytroops = $prisoner['t1']+$prisoner['t2']+$prisoner['t3']+$prisoner['t4']+$prisoner['t5']+$prisoner['t6']+$prisoner['t7']+$prisoner['t8']+$prisoner['t9']+$prisoner['t10']+$prisoner['t11'];
+ $newtraps = (round($mytroops/3))*2;
+ $database->modifyUnit($data['to'],array("99"),array($newtraps),array(0));
+ $database->modifyUnit($data['to'],array("99o"),array($mytroops),array(0));
+ }else{
+ $p_alliance = $database->getUserField($p_owner,"alliance",0);
+ $friendarray = $database->getAllianceAlly($p_alliance,1);
+ $neutralarray = $database->getAllianceAlly($p_alliance,2);
+ $friend = (($friendarray[0]['alli1']>0 and $friendarray[0]['alli2']>0 and $p_alliance>0) and ($friendarray[0]['alli1']==$ownally or $friendarray[0]['alli2']==$ownally) and ($ownally != $p_alliance and $ownally and $p_alliance)) ? '1':'0';
+ $neutral = (($neutralarray[0]['alli1']>0 and $neutralarray[0]['alli2']>0 and $p_alliance>0) and ($neutralarray[0]['alli1']==$ownally or $neutralarray[0]['alli2']==$ownally) and ($ownally != $p_alliance and $ownally and $p_alliance)) ? '1':'0';
+ if($p_alliance == $ownally or $friend == 1 or $neutral == 1){
+ $p_tribe = $database->getUserField($p_owner,"tribe",0);
+
+ $p_eigen = $database->getCoor($prisoner['wref']);
+ $p_from = array('x'=>$p_eigen['x'], 'y'=>$p_eigen['y']);
+ $p_ander = $database->getCoor($prisoner['from']);
+ $p_to = array('x'=>$p_ander['x'], 'y'=>$p_ander['y']);
+ $p_tribe = $database->getUserField($p_owner,"tribe",0);
+
+ $p_speeds = array();
+
+ //find slowest unit.
+ for($i=1;$i<=10;$i++){
+ if ($prisoner['t'.$i]){
+ if($prisoner['t'.$i] != '' && $prisoner['t'.$i] > 0){
+ if($p_unitarray) { reset($p_unitarray); }
+ $p_unitarray = $GLOBALS["u".(($p_tribe-1)*10+$i)];
+ $p_speeds[] = $p_unitarray['speed'];
+ }
+ }
+ }
+
+ if ($prisoner['t11']>0){
+ $p_qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$p_owner."";
+ $p_resulth = mysql_query($p_qh);
+ $p_hero_f=mysql_fetch_array($p_resulth);
+ $p_hero_unit=$p_hero_f['unit'];
+ $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);
+ $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'];
+ $newtraps = (round($anothertroops/3))*2;
+ $database->modifyUnit($data['to'],array("99"),array($newtraps),array(0));
+ $database->modifyUnit($data['to'],array("99o"),array($anothertroops),array(0));
+ }
+ }
+ $database->deletePrisoners($prisoner['id']);
+ }
+ $trapper_pic = "<img src=\"".GP_LOCATE."img/u/98.gif\" alt=\"Trap\" title=\"Trap\" />";
+ $p_username = $database->getUserField($from['owner'],"username",0);
+ if($mytroops > 0 && $anothertroops > 0){
+ $info_trap = "".$trapper_pic." ".$p_username." released <b>".$mytroops."</b> from his troops and <b>".$anothertroops."</b> friendly troops.";
+ }elseif($mytroops > 0){
+ $info_trap = "".$trapper_pic." ".$p_username." released <b>".$mytroops."</b> from his troops.";
+ }elseif($anothertroops > 0){
+ $info_trap = "".$trapper_pic." ".$p_username." released <b>".$anothertroops."</b> friendly troops.";
+ }
+ }
+ }
+ $data2 = $data2.','.$info_trap.',,';
if($totalsend_alldef == 0){
$database->addNotice($to['owner'],$to['wref'],$targetally,7,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
}else if($totaldead_alldef == 0){
@@ -2413,12 +2557,11 @@ private function sendunitsComplete() {
}
}
//to here
-
// If the dead units not equal the ammount sent they will return and report
- if($unitsdead_att != $unitssend_att or $dead11 != $herosend_att)
+ if($totalsend_att - ($totaldead_att+$totaltraped_att) > 0)
{
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
- $artefact1 = count($database->getOwnUniqueArtefactInfo2($from['vref'],2,1,1));
+ $artefact1 = count($database->getOwnUniqueArtefactInfo2($from['wref'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
@@ -2434,7 +2577,7 @@ private function sendunitsComplete() {
if($type == 1) {
$database->addNotice($from['owner'],$to['wref'],$ownally,18,''.addslashes($from['name']).' scouts '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
}else {
- if ($totaldead_att == 0){
+ if ($totaldead_att == 0 && $totaltraped_att == 0){
$database->addNotice($from['owner'],$to['wref'],$ownally,1,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
}else{
$database->addNotice($from['owner'],$to['wref'],$ownally,2,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
@@ -2593,6 +2736,7 @@ private function sendunitsComplete() {
,$totalsend_att
,$totalsend_alldef
,$totaldead_att
+ ,$totaltraped_att
,$totaldead_def
,$unitsdead_att_check
,$totalattackdead
@@ -3047,6 +3191,20 @@ function getAllUnits($base) {
$ownunit['u'.$i] += $movement['u'.$i];
}
}
+ $prisoners = $database->getPrisoners($base);
+ if(!empty($prisoners)) {
+ foreach($prisoners as $prisoner){
+ $owner = $database->getVillageField($base,"owner");
+ $ownertribe = $database->getUserField($owner,"tribe",0);
+ $start = ($ownertribe-1)*10+1;
+ $end = ($ownertribe*10);
+ for($i=$start;$i<=$end;$i++) {
+ $j = $i-$start+1;
+ $ownunit['u'.$i] += $prisoner['t'.$j];
+ }
+ $ownunit['hero'] += $prisoner['t11'];
+ }
+ }
return $ownunit;
}
@@ -3293,7 +3451,7 @@ private function trainingComplete() {
}
}
- private function procDistanceTime($coor,$thiscoor,$ref,$mode) {
+ public function procDistanceTime($coor,$thiscoor,$ref,$mode) {
global $bid14,$database,$generator;
$resarray = $database->getResourceLevel($generator->getBaseID($coor['x'],$coor['y']));
$xdistance = ABS($thiscoor['x'] - $coor['x']);
@@ -3846,7 +4004,7 @@ private function procClimbers() {
$users = "SELECT * FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8") . "";
$array = $database->query_return($users);
$ranking->procRankArray();
- if(count($ranking->getRank()) > 0){
+ if(mysql_num_rows(mysql_query($users)) > 0){
$q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
$result = mysql_query($q);
if(mysql_num_rows($result)) {
@@ -3856,7 +4014,7 @@ private function procClimbers() {
$week='1';
}
foreach($array as $session){
- $oldrank = $ranking->searchRank($session['username'], "username");
+ $oldrank = $ranking->getUserRank($session['id']);
if($week > 1){
if($session['oldrank'] > $oldrank) {
$totalpoints = $session['oldrank'] - $oldrank;
@@ -3869,8 +4027,8 @@ private function procClimbers() {
$database->updateoldrank($session['id'], $oldrank);
}
}else{
- $totalpoints = count($ranking->getRank()) - $oldrank;
- $database->setclimberrankpop($session['id'], $totalpoints);
+ $totalpoints = mysql_num_rows(mysql_query($users)) - $oldrank;
+ $database->setclimberrankpop($session['id'], $totalpoints+1);
$database->updateoldrank($session['id'], $oldrank);
}
$database->updateoldrank($session['id'], $oldrank);
@@ -3913,17 +4071,7 @@ private function checkBan() {
private function regenerateOasisTroops() {
global $database;
$time = time();
- $max = rand(1,4);
- if($max == 1){
- $max2 = 3600;
- }elseif($max == 2){
- $max2 = 21600;
- }elseif($max == 3){
- $max2 = 43200;
- }elseif($max == 4){
- $max2 = 86400;
- }
- $q = "SELECT * FROM " . TB_PREFIX . "odata where conqured = 0 and $time - lastupdated > $max2";
+ $q = "SELECT * FROM " . TB_PREFIX . "odata where conqured = 0 and $time - lastupdated > 3600";
$array = $database->query_return($q);
foreach($array as $oasis) {
$database->populateOasisUnits($oasis['wref'],$oasis['high']);
View
126 GameEngine/Battle.php
@@ -82,13 +82,11 @@ private function simulate($post) {
// Establecemos los arrays con las unidades del atacante y defensor
$attacker = array('u1'=>0,'u2'=>0,'u3'=>0,'u4'=>0,'u5'=>0,'u6'=>0,'u7'=>0,'u8'=>0,'u9'=>0,'u10'=>0,'u11'=>0,'u12'=>0,'u13'=>0,'u14'=>0,'u15'=>0,'u16'=>0,'u17'=>0,'u18'=>0,'u19'=>0,'u20'=>0,'u21'=>0,'u22'=>0,'u23'=>0,'u24'=>0,'u25'=>0,'u26'=>0,'u27'=>0,'u28'=>0,'u29'=>0,'u30'=>0,'u31'=>0,'u32'=>0,'u33'=>0,'u34'=>0,'u35'=>0,'u36'=>0,'u37'=>0,'u38'=>0,'u39'=>0,'u40'=>0,'u41'=>0,'u42'=>0,'u43'=>0,'u44'=>0,'u45'=>0,'u46'=>0,'u47'=>0,'u48'=>0,'u49'=>0,'u50'=>0);
$start = ($post['a1_v']-1)*10+1;
- $att_ab = array('a1'=>0,'a2'=>0,'a3'=>0,'a4'=>0,'a5'=>0,'a6'=>0,'a7'=>0,'a8'=>0);
- $def_ab = array('b1'=>0,'b2'=>0,'b3'=>0,'b4'=>0,'b5'=>0,'b6'=>0,'b7'=>0,'b8'=>0);
$index = 1;
for($i=$start;$i<=($start+9);$i++) {
$attacker['u'.$i] = $post['a1_'.$index];
if($index <=8) {
- $att_ab['a'.$index] = $post['f1_'.$index];
+ ${att_ab.$index} = $post['f1_'.$index];
}
$index += 1;
}
@@ -106,33 +104,28 @@ private function simulate($post) {
switch($deftribe) {
case 1:
for($i=1;$i<=8;$i++) {
- $def_ab['b'.$i] = $post['f2_'.$i];
+ ${def_ab.$i} = $post['f2_'.$i];
}
- $wall = $post['wall1'];
break;
case 2:
for($i=11;$i<=18;$i++) {
- $def_ab['b'.$i] = $post['f2_'.$i];
+ ${def_ab.$i-10} = $post['f2_'.$i];
}
- $wall = $post['wall2'];
break;
case 3:
for($i=21;$i<=28;$i++) {
- $def_ab['b'.$i] = $post['f2_'.$i];
+ ${def_ab.$i-20} = $post['f2_'.$i];
}
- $wall = $post['wall3'];
break;
case 4:
for($i=31;$i<=38;$i++) {
- $def_ab['b'.$i] = $post['f2_'.$i];
+ ${def_ab.$i-30} = $post['f2_'.$i];
}
- $wall = $post['wall4'];
break;
case 5:
for($i=41;$i<=48;$i++) {
- $def_ab['b'.$i] = $post['f2_'.$i];
+ ${def_ab.$i-40} = $post['f2_'.$i];
}
- $wall = $post['wall5'];
break;
}
if($post['kata'] == "") {
@@ -152,11 +145,27 @@ private function simulate($post) {
}
}
}
-
+ if($post['wall1'] != 0){
+ $walllevel = $post['wall1'];
+ }elseif($post['wall2'] != 0){
+ $walllevel = $post['wall2'];
+ }elseif($post['wall3'] != 0){
+ $walllevel = $post['wall3'];
+ }elseif($post['wall4'] != 0){
+ $walllevel = $post['wall4'];
+ }elseif($post['wall5'] != 0){
+ $walllevel = $post['wall5'];
+ }else{
+ $walllevel = 0;
+ }
+ if($walllevel > 20){
+ $walllevel = 0;
+ }
+ $wall = $walllevel;
if(!$scout)
- return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],$post['ktyp']+3,$def_ab,$att_ab,$post['kata'],1,0,0,0,0);
+ return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],$post['ktyp']+3,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0);
else
- return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],1,$def_ab,$att_ab,$post['kata'],1,0,0,0,0);
+ return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],1,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0);
}
public function getTypeLevel($tid,$vid) {
@@ -207,7 +216,7 @@ public function getTypeLevel($tid,$vid) {
}
//1 raid 0 normal
- function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab,$att_ab,$tblevel,$stonemason,$walllevel,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref) {
+ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab1,$def_ab2,$def_ab3,$def_ab4,$def_ab5,$def_ab6,$def_ab7,$def_ab8,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$tblevel,$stonemason,$walllevel,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref) {
global $bid34,$bid35,$database;
// Definieer de array met de eenheden
$calvary = array(4,5,6,15,16,23,24,25,26,35,36,45,46);
@@ -222,7 +231,30 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
$cap = $ap = $dp = $cdp = $rap = $rdp = 0;
//exit($type);
-
+ $att_artefact = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,3,0));
+ $att_artefact1 = count($database->getOwnUniqueArtefactInfo2($AttackerWref,3,1,1));
+ $att_artefact2 = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,2,0));
+ if($att_artefact > 0){
+ $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;
+ }
if($Attacker['uhero'] != 0)
{
//exit($AttackerID);
@@ -246,24 +278,26 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
// Berekenen het totaal aantal punten van Aanvaller
$start = ($att_tribe-1)*10+1;
$end = ($att_tribe*10);
-
- $abcount = 1;
-
+ if($att_tribe == 3){
+ $abcount = 3;
+ }else{
+ $abcount = 4;
+ }
+
if($type == 1)
{
for($i=$start;$i<=$end;$i++) {
global ${'u'.$i};
+ $j = $i-$start+1;
+ if($abcount <= 8 && ${att_ab.$abcount} > 0) {
- if($abcount <= 8 && $att_ab['a'.$abcount] > 0) {
-
- $ap += (35 + ( 35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, $att_ab['a'.$abcount]) - 1)) * $Attacker['u'.$i];
+ $ap += (35 + ( 35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i] * $attacker_artefact;
}
else {
- $ap += $Attacker['u'.$i] * 35;
+ $ap += ($Attacker['u'.$i] * $Attacker['u'.$i] * $Attacker['u'.$i])/3;
}
- $abcount +=1;
$units['Att_unit'][$i] = $Attacker['u'.$i];
}
@@ -274,15 +308,16 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
}
else
{
+ $abcount = 1;
for($i=$start;$i<=$end;$i++) {
global ${'u'.$i};
-
- if($abcount <= 8 && $att_ab['a'.$abcount] > 0) {
+ $j = $i-$start+1;
+ if($abcount <= 8 && ${att_ab.$abcount} > 0) {
if(in_array($i,$calvary)) {
- $cap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, $att_ab['a'.$abcount]) - 1)) * $Attacker['u'.$i];
+ $cap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i];
}
else {
- $ap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, $att_ab['a'.$abcount]) - 1)) * $Attacker['u'.$i];
+ $ap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i];
}
}
else {
@@ -334,15 +369,16 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
if($y == 4 || $y == 14 || $y == 23 || $y == 44)
{
global ${'u'.$y};
- if($y >= $start && $y <= ($end-2) && $def_ab['b'.$abcount] > 0) {
- $dp += (20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab['b'.$y]) - 1)) * $Defender['u'.$y];
+ if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) {
+ $dp += (20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * (($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4) * $defender_artefact;
$abcount +=1;
}
else {
- $dp += $Defender['u'.$y]*20;
+ $dp += ($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4;
}
$units['Def_unit'][$y] = $Defender['u'.$y];
}
+ }
if ($Defender['hero'] != 0){
$dp += $defenderhero['di'] * 35;
$dp = $dp * $defenderhero['db'];
@@ -355,24 +391,23 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
$dp = $dp * $defhero[$fromvillage]['db'];
}
}
- }
}
else
{
for($y=1;$y<=50;$y++) {
global ${'u'.$y};
- if($y >= $start && $y <= ($end-2) && $def_ab['b'.$abcount] > 0) {
- $dp += (${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab['b'.$y]) - 1)) * $Defender['u'.$y];
- $cdp += (${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab['b'.$y]) - 1)) * $Defender['u'.$y];
- $abcount +=1;
+ if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) {
+ $dp += (${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y];
+ $cdp += (${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y];
}
else {
$dp += $Defender['u'.$y]*${'u'.$y}['di'];
$cdp += $Defender['u'.$y]*${'u'.$y}['dc'];
}
$involve += $Defender['u'.$y];
$units['Def_unit'][$y] = $Defender['u'.$y];
+ $abcount +=1;
}
if($Defender['hero'] != 0)
{
@@ -404,13 +439,13 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
// Factor = 1025 Wall Galliers
$factor = ($def_tribe == 1)? 1.030 : (($def_tribe == 2)? 1.020 : 1.025);
// Defense Infanterie = infanterie * Muur (%)
- $dp *= pow($factor,$def_wall);
+ $dp *= pow($factor,$def_wall)*2;
// Defensa Cavelerie = Cavelerie * Muur (%)
- $cdp *= pow($factor,$def_wall);
+ $cdp *= pow($factor,$def_wall)*2;
// Berekening van de Basic defence bonus "Residence"
- $dp += ((2*(pow($residence,2)))*(pow($factor,$def_wall)));
- $cdp += ((2*(pow($residence,2)))*(pow($factor,$def_wall)));
+ $dp += ((2*(pow($residence,2)))*(pow($factor,$def_wall)))*0.5;
+ $cdp += ((2*(pow($residence,2)))*(pow($factor,$def_wall)))*0.5;
}
else
{
@@ -422,7 +457,11 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
//
// Formule voor het berekenen van punten aanvallers (Infanterie & Cavalry)
//
+ if($AttackerWref != 0){
$rap = ($ap+$cap)+(($ap+$cap)/100*$bid35[$this->getTypeLevel(35,$AttackerWref)]['attri']);
+ }else{
+ $rap = $ap+$cap;
+ }
//
// Formule voor de berekening van Defensive Punten
//
@@ -561,7 +600,7 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
if($ram > 0 && $walllevel != 0) {
$wctp = pow(($rap/$rdp),1.5);
$wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp;
- $wctp *= $ram;
+ $wctp *= $ram/2;
$artowner = $database->getVillageField($DefenderWref,"owner");
$bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0));
$bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1));
@@ -684,6 +723,7 @@ function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$re
$max_bounty = 0;
for($i=$start;$i<=$end;$i++) {
+ $j = $i-$start+1;
$y = $i-(($att_tribe-1)*10);
$max_bounty += ($Attacker['u'.$i]-$result['casualties_attacker'][$y])*${'u'.$i}['cap'];
View
6 GameEngine/Building.php
@@ -29,7 +29,11 @@ public function Building() {
$this->maxConcurrent += PLUS_MAX;
}
$this->LoadBuilding();
-
+ foreach($this->buildArray as $build) {
+ if($build['master']==1){
+ $this->maxConcurrent += 1;
+ }
+ }
}
public function procBuild($get) {
View
103 GameEngine/Database/db_MYSQL.php
@@ -1761,18 +1761,6 @@ function removeBuilding($d) {
if(count($jobs) > 2 && ($jobs[1]['field'] == $jobs[2]['field'])) {
$SameBuildCount = 3;
}
- if(count($jobs) > 2 && ($jobs[0]['field'] == ($jobs[1]['field'] == $jobs[2]['field']))) {
- $SameBuildCount = 4;
- }
- if(count($jobs) > 3 && ($jobs[0]['field'] == ($jobs[1]['field'] == $jobs[3]['field']))) {
- $SameBuildCount = 5;
- }
- if(count($jobs) > 3 && ($jobs[0]['field'] == ($jobs[2]['field'] == $jobs[3]['field']))) {
- $SameBuildCount = 6;
- }
- if(count($jobs) > 3 && ($jobs[1]['field'] == ($jobs[2]['field'] == $jobs[3]['field']))) {
- $SameBuildCount = 7;
- }
if(count($jobs) > 3 && ($jobs[0]['field'] == $jobs[3]['field'])) {
$SameBuildCount = 8;
}
@@ -1782,6 +1770,18 @@ function removeBuilding($d) {
if(count($jobs) > 3 && ($jobs[2]['field'] == $jobs[3]['field'])) {
$SameBuildCount = 10;
}
+ if(count($jobs) > 2 && ($jobs[0]['field'] == $jobs[1]['field'] && $jobs[1]['field'] == $jobs[2]['field'])) {
+ $SameBuildCount = 4;
+ }
+ if(count($jobs) > 3 && ($jobs[0]['field'] == $jobs[1]['field'] && $jobs[1]['field'] == $jobs[3]['field'])) {
+ $SameBuildCount = 5;
+ }
+ if(count($jobs) > 3 && ($jobs[0]['field'] == $jobs[2]['field'] && $jobs[2]['field'] == $jobs[3]['field'])) {
+ $SameBuildCount = 6;
+ }
+ if(count($jobs) > 3 && ($jobs[1]['field'] == $jobs[2]['field'] && $jobs[2]['field'] == $jobs[3]['field'])) {
+ $SameBuildCount = 7;
+ }
if($SameBuildCount > 0) {
if($SameBuildCount > 3){
if($SameBuildCount == 4 or $SameBuildCount == 5){
@@ -2157,6 +2157,12 @@ function modifyAttack($aid, $unit, $amt) {
$q = "UPDATE " . TB_PREFIX . "attacks set $unit = $unit - $amt where id = $aid";
return mysql_query($q, $this->connection);
}
+
+ function modifyAttack2($aid, $unit, $amt) {
+ $unit = 't' . $unit;
+ $q = "UPDATE " . TB_PREFIX . "attacks set $unit = $unit + $amt where id = $aid";
+ return mysql_query($q, $this->connection);
+ }
function getRanking() {
$q = "SELECT id,username,alliance,ap,apall,dp,dpall,access FROM " . TB_PREFIX . "users WHERE tribe<=3 AND access<" . (INCLUDE_ADMIN ? "10" : "8");
@@ -2877,7 +2883,7 @@ public function getAvailableExpansionTraining() {
}
function addArtefact($vref, $owner, $type, $size, $name, $desc, $effect, $img) {
- $q = "INSERT INTO `" . TB_PREFIX . "artefacts` (`vref`, `owner`, `type`, `size`, `conquered`, `name`, `desc`, `effect`, `img`) VALUES ('$vref', '$owner', '$type', '$size', '" . time() . "', '$name', '$desc', '$effect', '$img')";
+ $q = "INSERT INTO `" . TB_PREFIX . "artefacts` (`vref`, `owner`, `type`, `size`, `conquered`, `name`, `desc`, `effect`, `img`, `active`) VALUES ('$vref', '$owner', '$type', '$size', '" . time() . "', '$name', '$desc', '$effect', '$img', '0')";
return mysql_query($q, $this->connection);
}
@@ -2886,6 +2892,18 @@ function getOwnArtefactInfo($vref) {
$result = mysql_query($q, $this->connection);
return mysql_fetch_array($result);
}
+
+ function getOwnArtefactInfo2($vref) {
+ $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function getOwnArtefactInfo3($uid) {
+ $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $uid";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
function getOwnArtefactInfoByType($vref, $type) {
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref AND type = $type order by size";
@@ -2907,9 +2925,9 @@ function getOwnUniqueArtefactInfo($id, $type, $size) {
function getOwnUniqueArtefactInfo2($id, $type, $size, $mode) {
if(!$mode){
- $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $id AND owner != 3 AND type = $type AND size=$size";
+ $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $id AND active = 1 AND type = $type AND size=$size";
}else{
- $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $id AND owner != 3 AND type = $type AND size=$size";
+ $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $id AND active = 1 AND type = $type AND size=$size";
}
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
@@ -2923,11 +2941,19 @@ function getArtefactInfo() {
function claimArtefact($vref, $ovref, $id) {
$time = time();
- $q = "UPDATE " . TB_PREFIX . "artefacts SET vref = $vref, owner = $id, conquered = $time WHERE vref = $ovref";
+ $q = "UPDATE " . TB_PREFIX . "artefacts SET vref = $vref, owner = $id, conquered = $time, active = 1 WHERE vref = $ovref";
return mysql_query($q, $this->connection);
}
- public function canClaimArtifact($from,$vref,$type) {
+ public function canClaimArtifact($from,$vref,$type,$kind) {
+ $type2 = $type3 = 0;
+ if(count($this->getOwnUniqueArtefactInfo2($this->getVillagefield($from,"owner"),2,2,0)) > 0 && $type == 2){
+ $type2 = 1;
+ }
+ if(count($this->getOwnUniqueArtefactInfo2($this->getVillagefield($from,"owner"),2,3,0)) > 0 && $type == 3){
+ $type3 = 1;
+ }
+ if((count($this->getOwnArtefactInfo2($from)) < 3 && $type2 == 0 && $type3 == 0) or $kind == 11){
$DefenderFields = $this->getResourceLevel($vref);
$defcanclaim = TRUE;
for($i=19;$i<=38;$i++) {
@@ -2977,6 +3003,9 @@ public function canClaimArtifact($from,$vref,$type) {
} else {
return FALSE;
}
+ }else{
+ return FALSE;
+ }
}
function getArtefactDetails($id) {
@@ -3217,6 +3246,46 @@ function setVillageEvasion($vid) {
}
return mysql_query($q, $this->connection);
}
+
+ function addPrisoners($wid,$from,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11) {
+ $q = "INSERT INTO " . TB_PREFIX . "prisoners values (0,$wid,$from,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11)";
+ mysql_query($q, $this->connection);
+ return mysql_insert_id($this->connection);
+ }
+
+ function updatePrisoners($wid,$from,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11) {
+ $q = "UPDATE " . TB_PREFIX . "prisoners set t1 = t1 + $t1, t2 = t2 + $t2, t3 = t3 + $t3, t4 = t4 + $t4, t5 = t5 + $t5, t6 = t6 + $t6, t7 = t7 + $t7, t8 = t8 + $t8, t9 = t9 + $t9, t10 = t10 + $t10, t11 = t11 + $t11 where wid = $wid and from = $from";
+ return mysql_query($q, $this->connection) or die(mysql_error());
+ }
+
+ function getPrisoners($wid) {
+ $q = "SELECT * FROM " . TB_PREFIX . "prisoners where wref = $wid";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function getPrisoners2($wid,$from) {
+ $q = "SELECT * FROM " . TB_PREFIX . "prisoners where wref = $wid and " . TB_PREFIX . "prisoners.from = $from";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function getPrisonersByID($id) {
+ $q = "SELECT * FROM " . TB_PREFIX . "prisoners where id = $id";
+ $result = mysql_query($q, $this->connection);
+ return mysql_fetch_array($result);
+ }
+
+ function getPrisoners3($from) {
+ $q = "SELECT * FROM " . TB_PREFIX . "prisoners where " . TB_PREFIX . "prisoners.from = $from";
+ $result = mysql_query($q, $this->connection);
+ return $this->mysql_fetch_all($result);
+ }
+
+ function deletePrisoners($id) {
+ $q = "DELETE from " . TB_PREFIX . "prisoners where id = '$id'";
+ mysql_query($q, $this->connection);
+ }
};
$database = new MYSQL_DB;
View
14 GameEngine/Ranking.php
@@ -18,12 +18,12 @@ public function getRank() {
return $this->rankarray;
}
- public function getUserRank($username) {
+ public function getUserRank($id) {
$ranking = $this->getRank();
$start = $_SESSION['start']+1;
if(count($ranking) > 0) {
for($i=$start;$i<($start+20);$i++) {
- if($ranking[$i]['username'] == $username && $ranking[$i] != "pad") {
+ if($ranking[$i]['userid'] == $id && $ranking[$i] != "pad") {
$myrank = $i;
}
}
@@ -87,7 +87,7 @@ public function procRankReq($get) {
}
} else {
$this->procRankArray();
- $this->getStart($this->searchRank($session->username, "username"));
+ $this->getStart($this->searchRank($session->uid, "userid"));
}
}
@@ -194,7 +194,7 @@ public function procRankArray() {
)allitag
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . "
- ORDER BY totalpop DESC, totalvillages DESC";
+ ORDER BY totalpop DESC, totalvillages DESC, userid DESC";
$result = (mysql_query($q));
@@ -247,7 +247,7 @@ private function procRankRaceArray($race) {
)allitag
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.tribe = $race AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . "
- ORDER BY totalpop DESC, totalvillages DESC";
+ ORDER BY totalpop DESC, totalvillages DESC, userid DESC";
$result = (mysql_query($q));
@@ -306,7 +306,7 @@ private function procAttRankArray() {
)pop
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.apall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " AND " . TB_PREFIX . "users.tribe <= 3
- ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC";
+ ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC, userid DESC";
$result = mysql_query($q) or die(mysql_error());
while($row = mysql_Fetch_assoc($result)) {
$datas[] = $row;
@@ -349,7 +349,7 @@ private function procDefRankArray() {
)pop
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.dpall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . "
- ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC";
+ ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC, userid DESC";
$result = mysql_query($q) or die(mysql_error());
while($row = mysql_Fetch_assoc($result)) {
$datas[] = $row;
View
35 GameEngine/Technology.php
@@ -226,6 +226,20 @@ function getAllUnits($base,$InVillageOnly=False) {
$ownunit['hero'] += $enforce['hero'];
}
}
+ $prisoners = $database->getPrisoners($base);
+ if(!empty($prisoners)) {
+ foreach($prisoners as $prisoner){
+ $owner = $database->getVillageField($base,"owner");
+ $ownertribe = $database->getUserField($owner,"tribe",0);
+ $start = ($ownertribe-1)*10+1;
+ $end = ($ownertribe*10);
+ for($i=$start;$i<=$end;$i++) {
+ $j = $i-$start+1;
+ $ownunit['u'.$i] += $prisoner['t'.$j];
+ }
+ $ownunit['hero'] += $prisoner['t11'];
+ }
+ }
if(!$InVillageOnly) {
$movement = $database->getVillageMovement($base);
if(!empty($movement)) {
@@ -351,7 +365,7 @@ private function procTrain($post,$great=false) {
}
}
- public function getUpkeep($array,$type,$vid=0) {
+ public function getUpkeep($array,$type,$vid=0,$prisoners=0) {
global $database,$session,$village;
if($vid==0) { $vid=$village->wid; }
$buildarray = array();
@@ -384,14 +398,17 @@ public function getUpkeep($array,$type,$vid=0) {
break;
}
for($i=$start;$i<=$end;$i++) {
+ $k = $i-$start+1;
$unit = "u".$i;
+ $unit2 = "t".$k;
global $$unit;
$dataarray = $$unit;
for($j=19;$j<=38;$j++) {
if($buildarray['f'.$j.'t'] == 41) {
$horsedrinking = $j;
}
}
+ if($prisoners == 0){
if(isset($horsedrinking)){
if(($i==4 && $buildarray['f'.$horsedrinking] >= 10)
|| ($i==5 && $buildarray['f'.$horsedrinking] >= 15)
@@ -402,11 +419,27 @@ public function getUpkeep($array,$type,$vid=0) {
}}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));
View
2 Templates/Alliance/overview.tpl
@@ -83,7 +83,7 @@ include("alli_menu.tpl");
//if there is user rank defined, user will be printed
else if($rank != ''){
echo "<tr>";
- echo "<th>".$rank."</th>";
+ echo "<th>".stripslashes($rank)."</th>";
echo "<td><a href='spieler.php?uid=".$member['id']."'>".$name."</td>";
echo "</tr>";
}
View
77 Templates/Build/16.tpl
@@ -150,6 +150,83 @@ if($units_incoming > 0 or $settlers_incoming > 0){
echo "</tbody></table>";
}
}
+ if(count($database->getPrisoners3($village->wid)) > 0) {
+ echo "<h4>Prisoners</h4>";
+ foreach($database->getPrisoners3($village->wid) as $prisoners) {
+ $colspan = 10+$prisoners['t11'];
+ echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
+ <a href=\"karte.php?d=".$prisoners['wref']."&c=".$generator->getMapCheck($prisoners['wref'])."\">".$database->getVillageField($prisoners['wref'],"name")."</a></td>
+ <td colspan=\"$colspan\">";
+ echo "<a href=\"karte.php?d=".$prisoners['wref']."&c=".$generator->getMapCheck($prisoners['wref'])."\">prisoners in ".$database->getVillageField($prisoners['wref'],"name")."</a>";
+ echo "</td></tr></thead><tbody class=\"units\">";
+ $tribe = $database->getUserField($database->getVillageField($prisoners['from'],"owner"),"tribe",0);
+ $start = ($tribe-1)*10+1;
+ $end = ($tribe*10);
+ echo "<tr><th>&nbsp;</th>";
+ for($i=$start;$i<=($end);$i++) {
+ echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
+ }
+ if($prisoners['t11']!=0){
+ echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
+ }
+ echo "</tr><tr><th>Troops</th>";
+ for($i=1;$i<=10;$i++) {
+ if($prisoners['t'.$i] == 0) {
+ echo "<td class=\"none\">";
+ }
+ else {
+ echo "<td>";
+ }
+ echo $prisoners['t'.$i]."</td>";
+ }
+ if($prisoners['t11']!=0){
+ echo "<td>".$prisoners['t11']."</td>";
+ }
+ echo "</tr></tbody>
+ <tbody class=\"infos\"><tr><th>Upkeep</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($prisoners,$tribe,0,1)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />per hour</div><div class='sback'><a href='a2b.php?delprisoners=".$prisoners['id']."'>Kill</a></div></td></tr>";
+
+ echo "</tbody></table>";
+ }
+ }
+ if(count($database->getPrisoners($village->wid)) > 0) {
+ echo "<h4>Prisoners</h4>";
+ foreach($database->getPrisoners($village->wid) as $prisoners) {
+ $colspan = 10+$prisoners['t11'];
+ $colspan2 = 11+$prisoners['t11'];
+ echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
+ <a href=\"karte.php?d=".$prisoners['from']."&c=".$generator->getMapCheck($prisoners['from'])."\">".$database->getVillageField($prisoners['from'],"name")."</a></td>
+ <td colspan=\"$colspan\">";
+ echo "<a href=\"karte.php?d=".$prisoners['from']."&c=".$generator->getMapCheck($prisoners['from'])."\">prisoners from ".$database->getVillageField($prisoners['from'],"name")."</a>";
+ echo "</td></tr></thead><tbody class=\"units\">";
+ $tribe = $database->getUserField($database->getVillageField($prisoners['from'],"owner"),"tribe",0);
+ $start = ($tribe-1)*10+1;
+ $end = ($tribe*10);
+ echo "<tr><th>&nbsp;</th>";
+ for($i=$start;$i<=($end);$i++) {
+ echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
+ }
+ if($prisoners['t11']!=0){
+ echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
+ }
+ echo "</tr><tr><th>Troops</th>";
+ for($i=1;$i<=10;$i++) {
+ if($prisoners['t'.$i] == 0) {
+ echo "<td class=\"none\">";
+ }
+ else {
+ echo "<td>";
+ }
+ echo $prisoners['t'.$i]."</td>";
+ }
+ if($prisoners['t11']!=0){
+ echo "<td>".$prisoners['t11']."</td>";
+ }
+ echo "</tr></tbody>
+ <tbody class=\"infos\"><tr><td colspan=\"11\"><div class='sup'><img class=\"r6\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" /></div><div class='sback'><a href='a2b.php?delprisoners=".$prisoners['id']."'>Send Back</a></div></td></tr>";
+
+ echo "</tbody></table>";
+ }
+ }
?>
<?php
View
6 Templates/Build/16_incomming.tpl
@@ -59,7 +59,11 @@ if ($units[$y]['sort_type']==3){
echo $units[$y]['t'.$i]."</td>";
}
}}else{
- if($totalunits > $building->getTypeLevel(16)){
+ $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){
echo "<td class=\"none\">?</td>";
}else{
if($units[$y]['t'.$i] == 0) {
View
14 Templates/Build/27_1.tpl
@@ -1,10 +1,9 @@
<?php
- $artefact = $database->getOwnArtefactInfo($village->wid);
+ $artefact1 = $database->getOwnArtefactInfo2($village->wid);
$result = mysql_num_rows(mysql_query("SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = " . $village->wid . ""));
$wref = $village->wid;
$coor = $database->getCoor($wref);
- $coor2= $database->getCoor($artefact['vref']);
function getDistance($coorx1, $coory1, $coorx2, $coory2) {
$max = 2 * WORLD_MAX + 1;
$x1 = intval($coorx1);
@@ -33,32 +32,33 @@
</thead>
<tbody>
- <tr>
<?php
if($result == 0) {
- echo '<td colspan="4" class="none">You do not own any artefacts.</td>';
+ echo '<tr><td colspan="4" class="none">You do not own any artefacts.</td></tr>';
} else {
+ foreach($artefact1 as $artefact){
+ $coor2 = $database->getCoor($artefact['vref']);
if($artefact['size'] == 1) {
$reqlvl = 10;
$effect = "village";
} elseif($artefact['size'] == 2 or 3) {
$reqlvl = 20;
$effect = "account";
}
- echo '<td class="icon"><img class="artefact_icon_' . $artefact['type'] . '" src="img/x.gif"></td>';
+ echo '<tr><td class="icon"><img class="artefact_icon_' . $artefact['type'] . '" src="img/x.gif"></td>';
echo '<td class="nam">
<a href="build.php?id=' . $id . '&show='.$artefact['id'].'">' . $artefact['name'] . '</a> <span class="bon">' . $artefact['effect'] . '</span>
<div class="info">
Treasury <b>' . $reqlvl . '</b>, Effect <b>' . $effect . '</b>
</div>
</td>';
echo '<td class="pla"><a href="karte.php?d=' . $artefact['vref'] . '&c=' . $generator->getMapCheck($artefact['vref']) . '">' . $database->getVillageField($artefact['vref'], "name") . '</a></td>';
- echo '<td class="dist">' . date("d/m/Y H:i", $artefact['conquered']) . '</td>';
+ echo '<td class="dist">' . date("d/m/Y H:i", $artefact['conquered']) . '</td></tr>';
}
+ }
?>
- </tr>
</tbody>
</table>
View
11 Templates/Build/37_hero.tpl
@@ -135,10 +135,19 @@ if (isset($_POST['name'])) {
<td colspan="5" class="empty"></td>
</tr>
<tr>
+ <?php if($hero_info['experience'] < 495000){ ?>
<th title="until the next level">Experience:</th>
<td class="val"><?php echo (int) (($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100) ?>%</td>
- <td class="xp"><img class="bar" src="img/x.gif" style="width:<?php echo ($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100*2 ?>px;" alt="<?php echo ($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100 ?>%" title="<?php echo ($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100 ?>%" /></td> <td class="up"></td>
+ <td class="xp"><img class="bar" src="img/x.gif" style="width:<?php echo ($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100*2 ?>px;" alt="<?php echo ($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100 ?>%" title="<?php echo ($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100 ?>%" /></td>
+ <td class="up"></td>
<td class="rem"><?php echo $hero_info['points']; ?></td>
+ <?php }else{ ?>
+ <th title="until the next level">Experience:</th>
+ <td class="val">100%</td>
+ <td class="xp"><img class="bar" src="img/x.gif" style="width:200px;" alt="100%" title="100%" /></td>
+ <td class="up"></td>
+ <td class="rem"><?php echo $hero_info['points']; ?></td>
+ <?php } ?>
</tr>
</tbody>
</table>
View
12 Templates/Build/avaliable.tpl
@@ -42,15 +42,6 @@ $herosmansion = $building->getTypeLevel(37);
$greatwarehouse = $building->getTypeLevel(38);
$greatgranary = $building->getTypeLevel(39);
$greatworkshop = $building->getTypeLevel(42);
-$ww = $building->getTypeLevel(40);
-$wwinbuild = count($database->getBuildingByType($village->wid,40));
-$wwvillages = $database->getVillagesID($session->uid);
-foreach($wwvillages as $wwvillage){
-$plan = count($database->getOwnArtefactInfoByType2($wwvillage,11));
-if($plan > 0){
-$wwbuildingplan += 1;
-}
-}
foreach ($database->getJobs($_SESSION['wid']) as $bdata) {
$UnderConstruction = strtolower(str_replace(array(" ","'"),"",$building->procResType($bdata['type'])));
@@ -61,9 +52,6 @@ foreach ($database->getJobs($_SESSION['wid']) as $bdata) {
?>
<div id="build" class="gid0"><h1>Construct new building</h1>
<?php
-if($ww == 0 && $wwinbuild == 0 && $village->natar == 1 && $wwbuildingplan > 0){
- include("avaliable/ww.tpl");
-}
if($mainbuilding == 0 && $id != 39 && $id != 40) {
include("avaliable/mainbuilding.tpl");
}
View
23 Templates/Notice/1.tpl
@@ -1,6 +1,5 @@
<?php
$dataarray = explode(",",$message->readingNotice['data']);
-//var_dump($dataarray);
if(isset($dataarray[147]) and $dataarray[147]!=0){$colspan="11";}else{$colspan="10";}
if(isset($dataarray[149]) and $dataarray[149]!=0){$colspan2="11";}else{$colspan2="10";}
?>
@@ -66,6 +65,21 @@ if(isset($dataarray[147]) and $dataarray[147]!=0){
if ($dataarray[148]==0){$tdclass='class="none"';}
echo "<td $tdclass>$dataarray[148]</td>";
}
+if($dataarray[151] != 0 or $dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0){
+echo "</tr><tr><th>Prisoners</th>";
+for($i=151;$i<=160;$i++) {
+ if($dataarray[$i] == 0) {
+ echo "<td class=\"none\">0</td>";
+ }
+ else {
+ echo "<td>".$dataarray[$i]."</td>";
+ }
+}
+if(isset($dataarray[161]) and $dataarray[161]!=0){
+ if ($dataarray[161]==0){$tdclass='class="none"';}
+ echo "<td $tdclass>$dataarray[161]</td>";
+}
+}
echo "</tr></tbody>";
if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram
?>
@@ -94,6 +108,13 @@ if ($dataarray[143]!='' and $dataarray[144]!=''){ //chief
<?php echo $dataarray[146]; ?>
</td></tr></tbody>
+<?php }
+if ($dataarray[162]!='' and $dataarray[162]!=''){ //release prisoners
+?>
+ <tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
+
+ <?php echo $dataarray[162]; ?>
+ </td></tr></tbody>
<?php } ?>
<tbody class="goods"><tr><th>Bounty</th><td colspan="<?php echo $colspan; ?>">
<div class="res"><img class="r1" src="img/x.gif" alt="Lumber" title="Lumber" /><?php echo $dataarray[23]; ?> | <img class="r2" src="img/x.gif" alt="Clay" title="Clay" /><?php echo $dataarray[24]; ?> | <img class="r3" src="img/x.gif" alt="Iron" title="Iron" /><?php echo $dataarray[25]; ?> | <img class="r4" src="img/x.gif" alt="Crop" title="Crop" /><?php echo $dataarray[26]; ?></div><div class="carry"><img class="car" src="img/x.gif" alt="carry" title="carry" /><?php echo ($dataarray[23]+$dataarray[24]+$dataarray[25]+$dataarray[26])."/".$dataarray[27]; ?></div>
View
26 Templates/Notice/1x.tpl
@@ -68,6 +68,21 @@ if (isset($dataarray[147]) and $dataarray[147] != 0){
if ($dataarray[148]==0){$tdclass='class="none"';}
echo "<td $tdclass>$dataarray[148]</td>";
}
+if($dataarray[151] != 0 or $dataarray[152] != 0 or $dataarray[153] != 0 or $dataarray[154] != 0 or $dataarray[155] != 0 or $dataarray[156] != 0 or $dataarray[157] != 0 or $dataarray[158] != 0 or $dataarray[159] != 0 or $dataarray[160] != 0){
+echo "</tr><tr><th>Prisoners</th>";
+for($i=151;$i<=160;$i++) {
+ if($dataarray[$i] == 0) {
+ echo "<td class=\"none\">0</td>";
+ }
+ else {
+ echo "<td>".$dataarray[$i]."</td>";
+ }
+}
+if(isset($dataarray[161]) and $dataarray[161]!=0){
+ if ($dataarray[161]==0){$tdclass='class="none"';}
+ echo "<td $tdclass>$dataarray[161]</td>";
+}
+}
echo "</tr></tbody>";
if ($dataarray[139]!='' and $dataarray[140]!=''){ //ram
?>
@@ -89,8 +104,15 @@ if ($dataarray[143]!='' and $dataarray[144]!=''){ //chief
<img class="unit u<?php echo $dataarray[143]; ?>" src="img/x.gif" alt="Chief" title="Chief" />
<?php echo $dataarray[144]; ?>
</td></tr></tbody>
-<?php } ?>
-<?php if ($dataarray[145]!='' and $dataarray[146]!=''){ //spy
+<?php }
+if ($dataarray[145]!='' and $dataarray[146]!=''){ //spy
+?>
+ <tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>"> </