mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-13 23:01:02 +00:00
Reports refactor Part 2
+Heroes are now divided by tribes in battle reports +Added to every report the support to read heroes from the battle report data Automation.php: +Added the hero data, to every battle reports +Fixed a bug that didn't count own dead defensive troops for general attacks, top 10 attackers, attackers and hero xp +Fixed a bug that didn't permit to add the rat enforcement to the village, from quest number 8 Battle.php: +Fixed a bug with catapults/rams that permitted to destroy level 1 buildings with only one catapults (even against 1000000 defensive troops) +Added a new function, for more readability +General minor improovementes and bug fixing
This commit is contained in:
+129
-143
@@ -1660,11 +1660,15 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// and the defender(s) heroid
|
// and the defender(s) heroid
|
||||||
$DefendersHeroID = array();
|
$DefendersHeroID = [];
|
||||||
|
$herosend_def = 0;
|
||||||
|
|
||||||
// check if our hero is defending the village, if so, add it to the list
|
// check if our hero is defending the village, if so, add it to the list
|
||||||
if (isset($Defender['hero']) && $Defender['hero'] > 0) {
|
if (isset($Defender['hero']) && $Defender['hero'] > 0) {
|
||||||
$DefendersHeroID[] = $database->getHeroField($DefenderID, "heroid");
|
$DefendersHeroID[] = $database->getHeroField($DefenderID, "heroid");
|
||||||
|
|
||||||
|
// collecting information for the battle report
|
||||||
|
$herosend_def += $Defender['hero'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if there are other heroes defending the village
|
// check if there are other heroes defending the village
|
||||||
@@ -1696,17 +1700,26 @@ class Automation {
|
|||||||
$unitssend_att_check=$unitssend_att;
|
$unitssend_att_check=$unitssend_att;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Resetting the enforcements array
|
//Resetting the enforcement arrays
|
||||||
for($i = 1; $i <= 50; $i++) $DefenderEnf['u'.$i] = 0;
|
for($i = 1; $i <= 50; $i++) {
|
||||||
|
$DefenderEnf['u'.$i] = 0;
|
||||||
|
if($i <= 5) $DefenderHeroesTotArray[$i] = 0;
|
||||||
|
if($i <= 5) $DefenderHeroesDeadArray[$i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// our reinforcements count could have changed at this point, thus the re-select
|
// our reinforcements count could have changed at this point, thus the re-select
|
||||||
$enforcementarray2 = $database->getEnforceVillage($data['to'], 0);
|
$enforcementarray2 = $database->getEnforceVillage($data['to'], 0);
|
||||||
if(count($enforcementarray2) > 0) {
|
if(count($enforcementarray2) > 0) {
|
||||||
foreach($enforcementarray2 as $enforce2) {
|
foreach($enforcementarray2 as $enforce2) {
|
||||||
//TODO: Heroes must be divided by tribe
|
|
||||||
$Defender['hero'] += $enforce2['hero'];
|
|
||||||
for($i = 1; $i <= 50; $i++) {
|
for($i = 1; $i <= 50; $i++) {
|
||||||
$DefenderEnf['u'.$i] += $enforce2['u'.$i];
|
$DefenderEnf['u'.$i] += $enforce2['u'.$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Divide heroes by tribe
|
||||||
|
if($enforce2['hero'] > 0) {
|
||||||
|
$reinfTribe = ($enforce2['from'] == 0) ? 4 : $database->getUserField($database->getVillageField($enforce2['from'], "owner"), "tribe", 0);
|
||||||
|
$DefenderHeroesTotArray[$reinfTribe] += $enforce2['hero'];
|
||||||
|
$Defender['hero'] += $enforce2['hero'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1717,22 +1730,21 @@ class Automation {
|
|||||||
//Own troops
|
//Own troops
|
||||||
$ownTroops = array_slice($Defender, ($targettribe - 1) * 10 + 1, 10);
|
$ownTroops = array_slice($Defender, ($targettribe - 1) * 10 + 1, 10);
|
||||||
$totalsend_alldef = array_sum($ownTroops);
|
$totalsend_alldef = array_sum($ownTroops);
|
||||||
|
|
||||||
|
//Collecting informations for the report
|
||||||
$unitssend_def[0] = implode(",", $ownTroops);
|
$unitssend_def[0] = implode(",", $ownTroops);
|
||||||
|
$unitssend_deff[0] = '?,?,?,?,?,?,?,?,?,?,';
|
||||||
//Reinforcements
|
|
||||||
for($i = 1; $i <= 5; $i++){
|
for($i = 1; $i <= 5; $i++){
|
||||||
|
//Reinforcements
|
||||||
$reinfTroops = array_slice($DefenderEnf, ($i - 1) * 10, 10);
|
$reinfTroops = array_slice($DefenderEnf, ($i - 1) * 10, 10);
|
||||||
$totalsend_alldef += array_sum($reinfTroops);
|
$totalsend_alldef += array_sum($reinfTroops);
|
||||||
|
|
||||||
|
//Collecting informations for the report
|
||||||
$unitssend_def[$i] = implode(",", $reinfTroops);
|
$unitssend_def[$i] = implode(",", $reinfTroops);
|
||||||
|
$unitssend_deff[$i] = $unitssend_deff[0];
|
||||||
}
|
}
|
||||||
|
$totalsend_alldef += $Defender['hero'];
|
||||||
$unitssend_deff[0] = '?,?,?,?,?,?,?,?,?,?,';
|
|
||||||
$unitssend_deff[1] = '?,?,?,?,?,?,?,?,?,?,';
|
|
||||||
$unitssend_deff[2] = '?,?,?,?,?,?,?,?,?,?,';
|
|
||||||
$unitssend_deff[3] = '?,?,?,?,?,?,?,?,?,?,';
|
|
||||||
$unitssend_deff[4] = '?,?,?,?,?,?,?,?,?,?,';
|
|
||||||
$unitssend_deff[5] = '?,?,?,?,?,?,?,?,?,?,';
|
|
||||||
//how many troops died? for battleraport
|
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
################FIXED BY SONGER################
|
################FIXED BY SONGER################
|
||||||
@@ -1769,10 +1781,11 @@ class Automation {
|
|||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
$dead=array();
|
$dead = [];
|
||||||
$owndead=array();
|
$owndead = [];
|
||||||
$alldead=array();
|
$alldead = [];
|
||||||
$heroAttackDead=$dead11;
|
for($i = 1; $i <= 50; $i++) $alldead[$i] = 0;
|
||||||
|
$heroAttackDead = $dead11;
|
||||||
//kill own defence
|
//kill own defence
|
||||||
$unitlist = $database->getUnit($data['to'], false);
|
$unitlist = $database->getUnit($data['to'], false);
|
||||||
$start = ($targettribe-1)*10+1;
|
$start = ($targettribe-1)*10+1;
|
||||||
@@ -1814,7 +1827,7 @@ class Automation {
|
|||||||
// ... once again, units could have changed, so we need to reselect
|
// ... once again, units could have changed, so we need to reselect
|
||||||
$enforcementarray3 = $database->getEnforceVillage($data['to'],0);
|
$enforcementarray3 = $database->getEnforceVillage($data['to'],0);
|
||||||
foreach ($enforcementarray3 as $enforce) {
|
foreach ($enforcementarray3 as $enforce) {
|
||||||
$life=''; $notlife=''; $wrong='0';
|
$life=''; $notlife=''; $wrong = false;
|
||||||
if($enforce['from'] != 0){
|
if($enforce['from'] != 0){
|
||||||
$tribe = $database->getUserArray($database->getVillageField($enforce['from'],"owner"), 1)["tribe"];
|
$tribe = $database->getUserArray($database->getVillageField($enforce['from'],"owner"), 1)["tribe"];
|
||||||
}
|
}
|
||||||
@@ -1835,8 +1848,8 @@ class Automation {
|
|||||||
default: $natar = 1; break;
|
default: $natar = 1; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$enforceModificationsById = [];
|
$enforceModificationsById = [];
|
||||||
for ($i = $start; $i <= $end; $i++){ //($i=$start;$i<=($start+9);$i++) {
|
for ($i = $start; $i <= $end; $i++){
|
||||||
if($enforce['u'.$i]>'0'){
|
if($enforce['u'.$i]>'0'){
|
||||||
if (!isset($enforceModificationsById[$enforce['id']])) {
|
if (!isset($enforceModificationsById[$enforce['id']])) {
|
||||||
$enforceModificationsById[$enforce['id']] = [
|
$enforceModificationsById[$enforce['id']] = [
|
||||||
@@ -1850,20 +1863,14 @@ class Automation {
|
|||||||
$enforceModificationsById[$enforce['id']]['modes'][] = 0;
|
$enforceModificationsById[$enforce['id']]['modes'][] = 0;
|
||||||
$dead[$i] = (isset($battlepart[2]) ? round($battlepart[2]*$enforce['u'.$i]) : 0);
|
$dead[$i] = (isset($battlepart[2]) ? round($battlepart[2]*$enforce['u'.$i]) : 0);
|
||||||
$checkpoint = (isset($battlepart[2]) ? round($battlepart[2]*$enforce['u'.$i]) : 0);
|
$checkpoint = (isset($battlepart[2]) ? round($battlepart[2]*$enforce['u'.$i]) : 0);
|
||||||
if (!isset($alldead[$i])) {
|
|
||||||
$alldead[$i] = 0;
|
|
||||||
}
|
|
||||||
$alldead[$i]+=$dead[$i];
|
|
||||||
if (!isset($enforce['u'.$i])) {
|
|
||||||
$enforce['u'.$i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($checkpoint!=$enforce['u'.$i]){
|
if (!isset($enforce['u'.$i])) $enforce['u'.$i] = 0;
|
||||||
$wrong='1';
|
|
||||||
}
|
$alldead[$i] += $dead[$i];
|
||||||
} else {
|
|
||||||
$dead[$i]='0';
|
$wrong = $checkpoint != $enforce['u'.$i];
|
||||||
}
|
}
|
||||||
|
else $dead[$i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($enforce['hero'] > 0) {
|
if($enforce['hero'] > 0) {
|
||||||
@@ -1871,11 +1878,13 @@ class Automation {
|
|||||||
$enforceModificationsById[$enforce['id']]['amounts'][] = $battlepart['deadheroref'][$enforce['id']];
|
$enforceModificationsById[$enforce['id']]['amounts'][] = $battlepart['deadheroref'][$enforce['id']];
|
||||||
$enforceModificationsById[$enforce['id']]['modes'][] = 0;
|
$enforceModificationsById[$enforce['id']]['modes'][] = 0;
|
||||||
|
|
||||||
$dead['hero']=$battlepart['deadheroref'][$enforce['id']];
|
$dead['hero'] = $battlepart['deadheroref'][$enforce['id']];
|
||||||
$alldead['hero']+=$dead['hero'];
|
$alldead['hero'] += $dead['hero'];
|
||||||
if($dead['hero']!=$enforce['hero']){
|
$wrong = $dead['hero'] != $enforce['hero'];
|
||||||
$wrong='1';
|
|
||||||
}
|
//Collecting information for the report
|
||||||
|
$reinfTribe = ($enforce['from'] == 0) ? 4 : $database->getUserField($database->getVillageField($enforce['from'], "owner"), "tribe", 0);
|
||||||
|
$DefenderHeroesDeadArray[$reinfTribe] += $dead['hero'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// modify enforce in DB
|
// modify enforce in DB
|
||||||
@@ -1904,58 +1913,42 @@ class Automation {
|
|||||||
$database->addNotice($database->getVillageField( $enforce['from'], "owner" ),$from['wref'],$ownally,17,'Reinforcement in '.addslashes($to['name']).' was attacked',$data2,$AttackArrivalTime);
|
$database->addNotice($database->getVillageField( $enforce['from'], "owner" ),$from['wref'],$ownally,17,'Reinforcement in '.addslashes($to['name']).' was attacked',$data2,$AttackArrivalTime);
|
||||||
}
|
}
|
||||||
//delete reinf sting when its killed all.
|
//delete reinf sting when its killed all.
|
||||||
if($wrong=='0'){ $database->deleteReinf($enforce['id']); }
|
if(!$wrong) $database->deleteReinf($enforce['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$totalsend_att = $data['t1']+$data['t2']+$data['t3']+$data['t4']+$data['t5']+$data['t6']+$data['t7']+$data['t8']+$data['t9']+$data['t10']+$data['t11'];
|
$totalsend_att = $data['t1']+$data['t2']+$data['t3']+$data['t4']+$data['t5']+$data['t6']+$data['t7']+$data['t8']+$data['t9']+$data['t10']+$data['t11'];
|
||||||
|
|
||||||
for ($i = 1; $i <= 50; $i++) {
|
$DefenderHeroesTot = implode(",", $DefenderHeroesTotArray);
|
||||||
if (!isset($alldead[$i])) {
|
$DefenderHeroesDead = implode(",", $DefenderHeroesDeadArray);
|
||||||
$alldead[$i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$unitsdead_def[0] = implode(",", $owndead);
|
|
||||||
$unitsdead_def[1] = ''.$alldead['1'].','.$alldead['2'].','.$alldead['3'].','.$alldead['4'].','.$alldead['5'].','.$alldead['6'].','.$alldead['7'].','.$alldead['8'].','.$alldead['9'].','.$alldead['10'].'';
|
|
||||||
$unitsdead_def[2] = ''.$alldead['11'].','.$alldead['12'].','.$alldead['13'].','.$alldead['14'].','.$alldead['15'].','.$alldead['16'].','.$alldead['17'].','.$alldead['18'].','.$alldead['19'].','.$alldead['20'].'';
|
|
||||||
$unitsdead_def[3] = ''.$alldead['21'].','.$alldead['22'].','.$alldead['23'].','.$alldead['24'].','.$alldead['25'].','.$alldead['26'].','.$alldead['27'].','.$alldead['28'].','.$alldead['29'].','.$alldead['30'].'';
|
|
||||||
$unitsdead_def[4] = ''.$alldead['31'].','.$alldead['32'].','.$alldead['33'].','.$alldead['34'].','.$alldead['35'].','.$alldead['36'].','.$alldead['37'].','.$alldead['38'].','.$alldead['39'].','.$alldead['40'].'';
|
|
||||||
$unitsdead_def[5] = ''.$alldead['41'].','.$alldead['42'].','.$alldead['43'].','.$alldead['44'].','.$alldead['45'].','.$alldead['46'].','.$alldead['47'].','.$alldead['48'].','.$alldead['49'].','.$alldead['50'].'';
|
|
||||||
|
|
||||||
//No troops returned
|
if (empty($alldead['hero'])) $alldead['hero'] = 0;
|
||||||
|
if (empty($owndead['hero'])) $owndead['hero'] = 0;
|
||||||
|
$deadhero = $owndead['hero'];
|
||||||
|
|
||||||
|
//Counting own total dead troops
|
||||||
|
$ownDeadTroops = array_slice($owndead, 0, 10);
|
||||||
|
$totaldead_alldef = array_sum($ownDeadTroops);
|
||||||
|
|
||||||
|
//Collecting informations for the report
|
||||||
|
$unitsdead_def[0] = implode(",", $ownDeadTroops);
|
||||||
$unitsdead_deff[0] = '?,?,?,?,?,?,?,?,?,?,';
|
$unitsdead_deff[0] = '?,?,?,?,?,?,?,?,?,?,';
|
||||||
$unitsdead_deff[1] = '?,?,?,?,?,?,?,?,?,?,';
|
for($i = 1; $i <= 5; $i++){
|
||||||
$unitsdead_deff[2] = '?,?,?,?,?,?,?,?,?,?,';
|
//Counting reinforcements total dead troops
|
||||||
$unitsdead_deff[3] = '?,?,?,?,?,?,?,?,?,?,';
|
$deadTroops = array_slice($alldead, ($i - 1) * 10, 10);
|
||||||
$unitsdead_deff[4] = '?,?,?,?,?,?,?,?,?,?,';
|
$totaldead_alldef += array_sum($deadTroops);
|
||||||
$unitsdead_deff[5] = '?,?,?,?,?,?,?,?,?,?,';
|
//Collecting informations for the report
|
||||||
|
$unitsdead_def[$i] = implode(",", $deadTroops);
|
||||||
if (empty($alldead['hero'])) {
|
$unitsdead_deff[$i] = $unitsdead_deff[0];
|
||||||
$alldead['hero'] = 0;
|
|
||||||
}
|
}
|
||||||
|
$totaldead_alldef += ($deadhero + $alldead['hero']);
|
||||||
|
|
||||||
if (empty($owndead['hero'])) {
|
if (!isset($totalattackdead)) $totalattackdead = 0;
|
||||||
$owndead['hero'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$deadhero = $alldead['hero']+$owndead['hero'];
|
|
||||||
|
|
||||||
$totaldead_alldef_tmp[1] = $alldead['1']+$alldead['2']+$alldead['3']+$alldead['4']+$alldead['5']+$alldead['6']+$alldead['7']+$alldead['8']+$alldead['9']+$alldead['10'];
|
|
||||||
$totaldead_alldef_tmp[2] = $alldead['11']+$alldead['12']+$alldead['13']+$alldead['14']+$alldead['15']+$alldead['16']+$alldead['17']+$alldead['18']+$alldead['19']+$alldead['20'];
|
|
||||||
$totaldead_alldef_tmp[3] = $alldead['21']+$alldead['22']+$alldead['23']+$alldead['24']+$alldead['25']+$alldead['26']+$alldead['27']+$alldead['28']+$alldead['29']+$alldead['30'];
|
|
||||||
$totaldead_alldef_tmp[4] = $alldead['31']+$alldead['32']+$alldead['33']+$alldead['34']+$alldead['35']+$alldead['36']+$alldead['37']+$alldead['38']+$alldead['39']+$alldead['40'];
|
|
||||||
$totaldead_alldef_tmp[5] = $alldead['41']+$alldead['42']+$alldead['43']+$alldead['44']+$alldead['45']+$alldead['46']+$alldead['47']+$alldead['48']+$alldead['49']+$alldead['50'];
|
|
||||||
|
|
||||||
$totaldead_alldef = $totaldead_alldef_tmp[1]+$totaldead_alldef_tmp[2]+$totaldead_alldef_tmp[3]+$totaldead_alldef_tmp[4]+$totaldead_alldef_tmp[5]+$deadhero;
|
|
||||||
if (!isset($totalattackdead)) {
|
|
||||||
$totalattackdead = 0;
|
|
||||||
}
|
|
||||||
$totalattackdead += $totaldead_alldef;
|
$totalattackdead += $totaldead_alldef;
|
||||||
|
|
||||||
// Set units returning from attack
|
// Set units returning from attack
|
||||||
|
|
||||||
$p_units = [];
|
$p_units = [];
|
||||||
for ($i=1; $i <= 11; $i++) {
|
for ($i = 1; $i <= 11; $i++) {
|
||||||
if (!isset(${'dead'.$i})) {
|
if (!isset(${'dead'.$i})) {
|
||||||
${'dead'.$i} = 0;
|
${'dead'.$i} = 0;
|
||||||
}
|
}
|
||||||
@@ -1969,14 +1962,11 @@ class Automation {
|
|||||||
|
|
||||||
$database->modifyAttack3($data['ref'],implode(', ', $p_units));
|
$database->modifyAttack3($data['ref'],implode(', ', $p_units));
|
||||||
|
|
||||||
$unitsdead_att = ''.$dead1.','.$dead2.','.$dead3.','.$dead4.','.$dead5.','.$dead6.','.$dead7.','.$dead8.','.$dead9.','.$dead10.'';
|
$unitsdead_att = $dead1.','.$dead2.','.$dead3.','.$dead4.','.$dead5.','.$dead6.','.$dead7.','.$dead8.','.$dead9.','.$dead10;
|
||||||
$unitstraped_att = ''.$traped1.','.$traped2.','.$traped3.','.$traped4.','.$traped5.','.$traped6.','.$traped7.','.$traped8.','.$traped9.','.$traped10.','.$traped11.'';
|
$unitstraped_att = $traped1.','.$traped2.','.$traped3.','.$traped4.','.$traped5.','.$traped6.','.$traped7.','.$traped8.','.$traped9.','.$traped10.','.$traped11;
|
||||||
if ($herosend_att>0){
|
|
||||||
$unitsdead_att_check = $unitsdead_att.','.$dead11;
|
if($herosend_att > 0) $unitsdead_att_check = $unitsdead_att.','.$dead11;
|
||||||
}else{
|
else $unitsdead_att_check = $unitsdead_att;
|
||||||
$unitsdead_att_check = $unitsdead_att;
|
|
||||||
}
|
|
||||||
//$unitsdead_def = ''.$dead11.','.$dead12.','.$dead13.','.$dead14.','.$dead15.','.$dead16.','.$dead17.','.$dead18.','.$dead19.','.$dead20.'';
|
|
||||||
|
|
||||||
|
|
||||||
//top 10 attack and defence update
|
//top 10 attack and defence update
|
||||||
@@ -1993,44 +1983,41 @@ class Automation {
|
|||||||
$troopsdead9 = $dead9+1;
|
$troopsdead9 = $dead9+1;
|
||||||
$troopsdead10 = $dead10;
|
$troopsdead10 = $dead10;
|
||||||
$troopsdead11 = $dead11;
|
$troopsdead11 = $dead11;
|
||||||
for($i=1;$i<=50;$i++) {
|
|
||||||
if(!empty($unitarray)) { reset($unitarray); }
|
$totaldead_def = 0;
|
||||||
|
$totalpoint_att = 0;
|
||||||
|
|
||||||
|
for($i = 1 ;$i <= 50; $i++) {
|
||||||
$unitarray = $GLOBALS["u".$i];
|
$unitarray = $GLOBALS["u".$i];
|
||||||
|
|
||||||
if (!isset($totaldead_def)) {
|
//Reinforcements dead troops
|
||||||
$totaldead_def = 0;
|
$totaldead_def += $alldead[$i];
|
||||||
|
$totalpoint_att += ($alldead[$i] * $unitarray['pop']);
|
||||||
|
|
||||||
|
//Own dead troops
|
||||||
|
if($i >= ($targettribe - 1) * 10 + 1 && $i <= $targettribe * 10){
|
||||||
|
$totaldead_def += $owndead[$i];
|
||||||
|
$totalpoint_att += ($owndead[$i] * $unitarray['pop']);
|
||||||
}
|
}
|
||||||
$totaldead_def += $alldead[''.$i.''];
|
|
||||||
|
|
||||||
if (!isset($totalpoint_att)) {
|
|
||||||
$totalpoint_att = 0;
|
|
||||||
}
|
|
||||||
$totalpoint_att += ($alldead[''.$i.'']*$unitarray['pop']);
|
|
||||||
}
|
}
|
||||||
$totalpoint_att += ((isset($alldead['hero']) ? $alldead['hero'] : 0)*6);
|
$totalpoint_att += ((isset($alldead['hero']) ? $alldead['hero'] : 0) * 6);
|
||||||
|
$totalpoint_att += ((isset($owndead['hero']) ? $owndead['hero'] : 0) * 6);
|
||||||
if ($Attacker['uhero'] != 0){
|
|
||||||
|
if ($Attacker['uhero'] > 0){
|
||||||
$heroxp = $totalpoint_att;
|
$heroxp = $totalpoint_att;
|
||||||
$database->modifyHeroXp("experience",$heroxp,$AttackerHeroID);
|
$database->modifyHeroXp("experience", $heroxp, $AttackerHeroID);
|
||||||
}
|
}
|
||||||
|
|
||||||
for($i=1;$i<=10;$i++){
|
for($i = 1; $i <= 10; $i++){
|
||||||
if($unitarray) { reset($unitarray); }
|
$unitarray = $GLOBALS["u".(($att_tribe - 1) * 10 + $i)];
|
||||||
$unitarray = $GLOBALS["u".(($att_tribe-1)*10+$i)];
|
|
||||||
if (!isset($totalpoint_def)) {
|
|
||||||
$totalpoint_def = 0;
|
|
||||||
}
|
|
||||||
$totalpoint_def += (${'dead'.$i}*$unitarray['pop']);
|
$totalpoint_def += (${'dead'.$i}*$unitarray['pop']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($totalpoint_def)) {
|
|
||||||
$totalpoint_def = 0;
|
|
||||||
}
|
|
||||||
$totalpoint_def += $dead11*6;
|
$totalpoint_def += $dead11*6;
|
||||||
|
|
||||||
if($Defender['hero'] > 0){
|
if($Defender['hero'] > 0){
|
||||||
//counting heroxp
|
//counting heroxp
|
||||||
$defheroxp=intval($totalpoint_def/count($DefendersHeroID));
|
$defheroxp = intval($totalpoint_def / count($DefendersHeroID));
|
||||||
foreach($DefendersHeroID as $HeroID){
|
foreach($DefendersHeroID as $HeroID){
|
||||||
$database->modifyHeroXp("experience",$defheroxp,$HeroID);
|
$database->modifyHeroXp("experience",$defheroxp,$HeroID);
|
||||||
}
|
}
|
||||||
@@ -2423,9 +2410,8 @@ class Automation {
|
|||||||
} elseif (($data['t7']-$traped7)>0) {
|
} elseif (($data['t7']-$traped7)>0) {
|
||||||
$info_ram = "".$ram_pic.",Hint: The ram does not work during a raid.";
|
$info_ram = "".$ram_pic.",Hint: The ram does not work during a raid.";
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
$can_destroy = 0;
|
|
||||||
}
|
}
|
||||||
|
else $can_destroy = 0;
|
||||||
|
|
||||||
//chiefing village
|
//chiefing village
|
||||||
//there are senators
|
//there are senators
|
||||||
@@ -2646,19 +2632,16 @@ class Automation {
|
|||||||
$database->setVillageLevel($data['to'], $newLevels_fieldNames, $newLevels_fieldValues);
|
$database->setVillageLevel($data['to'], $newLevels_fieldNames, $newLevels_fieldValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$info_chief = "".$chief_pic.",You cant take over this village.";
|
|
||||||
}
|
}
|
||||||
} else {
|
else $info_chief = "".$chief_pic.",You cant take over this village.";
|
||||||
$info_chief = "".$chief_pic.",You cant take over this village.";
|
|
||||||
}
|
}
|
||||||
} else {
|
else $info_chief = "".$chief_pic.",You cant take over this village.";
|
||||||
$info_chief = "".$chief_pic.",Not enough culture points.";
|
|
||||||
}
|
}
|
||||||
|
else $info_chief = "".$chief_pic.",Not enough culture points.";
|
||||||
unset($plevel);
|
unset($plevel);
|
||||||
}else{
|
|
||||||
$info_chief = "".$chief_pic.",Could not reduce cultural points during raid";
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$info_chief = "".$chief_pic.",Could not reduce cultural points during raid";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($data['t11']-$dead11-$traped11)> 0){ //hero
|
if(($data['t11']-$dead11-$traped11)> 0){ //hero
|
||||||
@@ -2759,7 +2742,7 @@ class Automation {
|
|||||||
else $info_spy = "".$spy_pic.", There are no informations to show";
|
else $info_spy = "".$spy_pic.", There are no informations to show";
|
||||||
}
|
}
|
||||||
|
|
||||||
$data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.',0,0,0,0,0,'.$to['owner'].','.$to['wref'].','.addslashes($to['name']).',,,'.$targettribe.','.$unitssend_def[0].','.$unitsdead_def[0].','.$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;
|
$data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.',0,0,0,0,0,'.$to['owner'].','.$to['wref'].','.addslashes($to['name']).',,,,'.$targettribe.','.$unitssend_def[0].','.$unitsdead_def[0].','.$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].','.$DefenderHeroesTot.','.$DefenderHeroesDead.','.$info_ram.','.$info_cat.','.$info_chief.','.$info_spy.',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.','.$unitstraped_att;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(isset($village_destroyed) && $village_destroyed == 1 && $can_destroy==1){
|
if(isset($village_destroyed) && $village_destroyed == 1 && $can_destroy==1){
|
||||||
@@ -2769,17 +2752,16 @@ class Automation {
|
|||||||
<img class=\"unit u".$catp_pic."\" src=\"img/x.gif\" alt=\"Catapult\" title=\"Catapult\" /> The village has been destroyed.</td></tr></tbody>";
|
<img class=\"unit u".$catp_pic."\" src=\"img/x.gif\" alt=\"Catapult\" title=\"Catapult\" /> The village has been destroyed.</td></tr></tbody>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$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.','.$unitssend_def[0].','.$unitsdead_def[0].','.$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.','.(isset($info_spy) ? $info_spy : '').',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.','.$unitstraped_att;
|
$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.','.$unitssend_def[0].','.$unitsdead_def[0].','.$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].','.$DefenderHeroesTot.','.$DefenderHeroesDead.','.$info_ram.','.$info_cat.','.$info_chief.','.(isset($info_spy) ? $info_spy : '').',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.','.$unitstraped_att;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When all troops die, sends no info...send info
|
// When all troops die, sends no info...send info
|
||||||
$info_troop= "None of your soldiers have returned";
|
$info_troop= "None of your soldiers have returned";
|
||||||
$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.','.$unitssend_deff[0].','.$unitsdead_deff[0].','.$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.',,'.$info_ram.','.$info_cat.','.$info_chief.','.$info_troop.','.$info_hero;
|
$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.','.$unitssend_deff[0].','.$unitsdead_deff[0].','.$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].','.$DefenderHeroesTot.','.$DefenderHeroesDead.',,,'.$data['t11'].','.$dead11.','.$unitstraped_att.',,'.$info_ram.','.$info_cat.','.$info_chief.','.$info_troop.','.$info_hero;
|
||||||
|
|
||||||
//Undetected and detected in here.
|
//Undetected and detected in here.
|
||||||
if(!empty($scout)){
|
if(!empty($scout)){
|
||||||
|
for($i = 1;$i <= 10; $i++){
|
||||||
for($i=1;$i<=10;$i++){
|
|
||||||
if($battlepart['casualties_attacker'][$i]){
|
if($battlepart['casualties_attacker'][$i]){
|
||||||
if($from['owner'] == 3){
|
if($from['owner'] == 3){
|
||||||
$database->addNotice($to['owner'],$to['wref'],$targetally,20,''.addslashes($from['name']).' scouts '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
|
$database->addNotice($to['owner'],$to['wref'],$targetally,20,''.addslashes($from['name']).' scouts '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
|
||||||
@@ -2795,12 +2777,12 @@ class Automation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($type == 3 && $totalsend_att - ($totaldead_att+$totaltraped_att) > 0){
|
if($type == 3 && $totalsend_att - ($totaldead_att + $totaltraped_att) > 0){
|
||||||
$prisoners = $database->getPrisoners($to['wref'], 0);
|
$prisoners = $database->getPrisoners($to['wref'], 0);
|
||||||
if(count($prisoners) > 0){
|
if(count($prisoners) > 0){
|
||||||
|
|
||||||
$anothertroops = 0;
|
$anothertroops = 0;
|
||||||
$mytroops=0;
|
$mytroops = 0;
|
||||||
$prisoners2delete = [];
|
$prisoners2delete = [];
|
||||||
$movementType = [];
|
$movementType = [];
|
||||||
$movementFrom = [];
|
$movementFrom = [];
|
||||||
@@ -2825,10 +2807,10 @@ class Automation {
|
|||||||
$p_alliance = $database->getUserField($p_owner,"alliance",0);
|
$p_alliance = $database->getUserField($p_owner,"alliance",0);
|
||||||
$friendarray = $database->getAllianceAlly($p_alliance,1);
|
$friendarray = $database->getAllianceAlly($p_alliance,1);
|
||||||
$neutralarray = $database->getAllianceAlly($p_alliance,2);
|
$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';
|
$friend = ($friendarray[0]['alli1'] > 0 && $friendarray[0]['alli2'] > 0 && $p_alliance > 0) && ($friendarray[0]['alli1'] == $ownally || $friendarray[0]['alli2'] == $ownally) && ($ownally != $p_alliance && $ownally && $p_alliance);
|
||||||
$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';
|
$neutral = ($neutralarray[0]['alli1'] > 0 && $neutralarray[0]['alli2'] > 0 && $p_alliance > 0) && ($neutralarray[0]['alli1'] == $ownally || $neutralarray[0]['alli2'] == $ownally) && ($ownally != $p_alliance && $ownally && $p_alliance);
|
||||||
|
|
||||||
if($p_alliance == $ownally or $friend == 1 or $neutral == 1){
|
if($p_alliance == $ownally || $friend || $neutral){
|
||||||
$p_tribe = $database->getUserField($p_owner,"tribe",0);
|
$p_tribe = $database->getUserField($p_owner,"tribe",0);
|
||||||
|
|
||||||
$p_eigen = $database->getCoor($prisoner['wref']);
|
$p_eigen = $database->getCoor($prisoner['wref']);
|
||||||
@@ -2840,9 +2822,9 @@ class Automation {
|
|||||||
$p_speeds = array();
|
$p_speeds = array();
|
||||||
|
|
||||||
//find slowest unit.
|
//find slowest unit.
|
||||||
for($i=1;$i<=10;$i++){
|
for($i = 1; $i <= 10; $i++){
|
||||||
if ($prisoner['t'.$i]){
|
if ($prisoner['t'.$i]){
|
||||||
if($prisoner['t'.$i] != '' && $prisoner['t'.$i] > 0){
|
if(!empty($prisoner['t'.$i]) && $prisoner['t'.$i] > 0){
|
||||||
if($p_unitarray) { reset($p_unitarray); }
|
if($p_unitarray) { reset($p_unitarray); }
|
||||||
$p_unitarray = $GLOBALS["u".(($p_tribe-1)*10+$i)];
|
$p_unitarray = $GLOBALS["u".(($p_tribe-1)*10+$i)];
|
||||||
$p_speeds[] = $p_unitarray['speed'];
|
$p_speeds[] = $p_unitarray['speed'];
|
||||||
@@ -2850,7 +2832,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($prisoner['t11']>0){
|
if ($prisoner['t11'] > 0){
|
||||||
$p_hero_unit = $database->getHeroField($p_owner, 'unit');
|
$p_hero_unit = $database->getHeroField($p_owner, 'unit');
|
||||||
$p_speeds[] = $GLOBALS['u'.$p_hero_unit]['speed'];
|
$p_speeds[] = $GLOBALS['u'.$p_hero_unit]['speed'];
|
||||||
}
|
}
|
||||||
@@ -3092,7 +3074,7 @@ class Automation {
|
|||||||
$database->setMovementProc($data['moveid']);
|
$database->setMovementProc($data['moveid']);
|
||||||
$database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],$AttackArrivalTime,$endtime);
|
$database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],$AttackArrivalTime,$endtime);
|
||||||
$peace = PEACE;
|
$peace = PEACE;
|
||||||
$data2 = ''.$from['owner'].','.$from['wref'].','.$to['owner'].','.$owntribe.','.$unitssend_att.','.$peace.'';
|
$data2 = $from['owner'].','.$from['wref'].','.$to['owner'].','.$owntribe.','.$unitssend_att.','.$peace;
|
||||||
$database->addNotice($from['owner'],$to['wref'],$ownally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
|
$database->addNotice($from['owner'],$to['wref'],$ownally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
|
||||||
$database->addNotice($to['owner'],$to['wref'],$targetally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
|
$database->addNotice($to['owner'],$to['wref'],$targetally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
|
||||||
}
|
}
|
||||||
@@ -3141,6 +3123,10 @@ class Automation {
|
|||||||
$Attacker
|
$Attacker
|
||||||
,$Defender
|
,$Defender
|
||||||
,$DefenderEnf
|
,$DefenderEnf
|
||||||
|
,$DefenderHeroesTotArray
|
||||||
|
,$DefenderHeroesDeadArray
|
||||||
|
,$DefenderHeroesTot
|
||||||
|
,$DefenderHeroesDead
|
||||||
,$enforce
|
,$enforce
|
||||||
,$unitssend_att
|
,$unitssend_att
|
||||||
,$unitssend_def
|
,$unitssend_def
|
||||||
@@ -3367,13 +3353,13 @@ class Automation {
|
|||||||
$conqureby=$toF['conqured'];
|
$conqureby=$toF['conqured'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data['from']==0){
|
if($data['from'] == 0){
|
||||||
$DefenderID = $database->getVillageField($data['to'],"owner");
|
$DefenderID = $database->getVillageField($data['to'], "owner");
|
||||||
$database->addEnforce($data);
|
$database->addEnforce($data);
|
||||||
$reinf = $database->getEnforce($data['from'],$data['to']);
|
$reinf = $database->getEnforce($data['to'], $data['from']);
|
||||||
$database->modifyEnforce($reinf['id'],31,1,1);
|
$database->modifyEnforce($reinf['id'], 31, 1, 1);
|
||||||
$data_fail = '0,0,4,1,0,0,0,0,0,0,0,0,0,0';
|
$data_fail = '0,0,4,1,0,0,0,0,0,0,0,0,0,0';
|
||||||
$database->addNotice($to['owner'],$to['wref'],(isset($targetally) ? $targetally : 0),8,'village of the elders reinforcement '.addslashes($to['name']).'',$data_fail,$AttackArrivalTime);
|
$database->addNotice($to['owner'], $to['wref'], (isset($targetally) ? $targetally : 0), 8, 'village of the elders reinforcement '.addslashes($to['name']), $data_fail, $AttackArrivalTime);
|
||||||
$movementProcIDs[] = $data['moveid'];
|
$movementProcIDs[] = $data['moveid'];
|
||||||
}else{
|
}else{
|
||||||
//set base things
|
//set base things
|
||||||
|
|||||||
+21
-9
@@ -873,17 +873,29 @@ class Battle {
|
|||||||
if($moral < 1) $moral = 1;
|
if($moral < 1) $moral = 1;
|
||||||
elseif($moral > 3) $moral = 3;
|
elseif($moral > 3) $moral = 3;
|
||||||
|
|
||||||
$needMax = round(($moral * (pow($actualLevel, 2) + $actualLevel + 1) / ($upDown == 0 ? 1 : 8 * $upDown)) + 0.5);
|
$needMax = round($this->CalculateNeededCatapults($moral, $upDown, $actualLevel));
|
||||||
for($i = $actualLevel-1; $i >= 1; $i--)
|
if($needMax <= $realAttackers) return 0;
|
||||||
|
for($i = $actualLevel - 1; $i >= 1; $i--)
|
||||||
{
|
{
|
||||||
$need = ($moral * (pow($i, 2) + $i + 1) / ($upDown == 0 ? 1 : 8 * $upDown)) + 0.5;
|
$need = $this->CalculateNeededCatapults($moral, $upDown, $i);
|
||||||
if(min($realAttackers, $totalAttackers) / ($needMax - $need) <= 1) {
|
if(min($realAttackers, $totalAttackers) / ($needMax - $need) <= 1) return ++$i;
|
||||||
$i++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $i;
|
return $actualLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the needed catapults/rams to completely destroy a building/wall
|
||||||
|
*
|
||||||
|
* @param float $moral The catapults/rams battle moral
|
||||||
|
* @param int $upDown (Upgrades / Downgrades) ratio of catapults/rams made in the Blacksmith
|
||||||
|
* @param int $actualLevel The level of the building before the battle
|
||||||
|
* @return float Returns the needed catapults/rams to destroy a building/wall
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function CalculateNeededCatapults($moral, $upDown, $actualLevel)
|
||||||
|
{
|
||||||
|
return ($moral * (pow($actualLevel, 2) + $actualLevel + 1) / ($upDown == 0 ? 1 : 8 * $upDown)) + 0.5;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ if ($ironL<2 || $clayL<2 || $woodL<2 || $cropL<2){?>
|
|||||||
<?php } elseif($_SESSION['qst']== 10){
|
<?php } elseif($_SESSION['qst']== 10){
|
||||||
//comming soon
|
//comming soon
|
||||||
//Check rat is in villa
|
//Check rat is in villa
|
||||||
$rat = $database->getEnforce(0, $village->wid);
|
$rat = $database->getEnforce($village->wid, 0);
|
||||||
if ($rat['u31'] < 1){?>
|
if ($rat['u31'] < 1){?>
|
||||||
{"markup":"\n\t\t<div id=\"qstd\"><h1> <img class=\"point\" src=\"img\/x.gif\" alt=\"\" title=\"\"\/> <?php echo Q25_10; ?><\/h1><br \/><i>”<?php echo Q25_10_DESC; ?>”<\/i><br \/><br \/><div class=\"rew\"><p class=\"ta_aw\"><?php echo Q25_10_ORDER; ?><\/div><br \/><span id=\"qst_accpt\"><\/span><\/div>\n\t\t<div id=\"qstbg\" class=\"army\"><\/div>\n\t\t","number":-10,"reward":false,"qgsrc":"q_l<?php echo $session->userinfo['tribe'];?>","msrc":"<?php echo $messagelol; ?>","altstep":99}
|
{"markup":"\n\t\t<div id=\"qstd\"><h1> <img class=\"point\" src=\"img\/x.gif\" alt=\"\" title=\"\"\/> <?php echo Q25_10; ?><\/h1><br \/><i>”<?php echo Q25_10_DESC; ?>”<\/i><br \/><br \/><div class=\"rew\"><p class=\"ta_aw\"><?php echo Q25_10_ORDER; ?><\/div><br \/><span id=\"qst_accpt\"><\/span><\/div>\n\t\t<div id=\"qstbg\" class=\"army\"><\/div>\n\t\t","number":-10,"reward":false,"qgsrc":"q_l<?php echo $session->userinfo['tribe'];?>","msrc":"<?php echo $messagelol; ?>","altstep":99}
|
||||||
<?php $_SESSION['qstnew']='0'; }else{ $_SESSION['qstnew']='1'; ?>
|
<?php $_SESSION['qstnew']='0'; }else{ $_SESSION['qstnew']='1'; ?>
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ if ($units[$y]['sort_type']==3){
|
|||||||
<td colspan=\"10\">";
|
<td colspan=\"10\">";
|
||||||
echo "<a>".VILLAGE_OF_THE_ELDERS_TROOPS."</a>";
|
echo "<a>".VILLAGE_OF_THE_ELDERS_TROOPS."</a>";
|
||||||
echo "</td></tr></thead><tbody class=\"units\">";
|
echo "</td></tr></thead><tbody class=\"units\">";
|
||||||
$tribe = $session->tribe;
|
$tribe = 4;
|
||||||
$start = ($tribe-1)*10+1;
|
$start = ($tribe-1)*10+1;
|
||||||
$end = ($tribe*10);
|
$end = ($tribe*10);
|
||||||
echo "<tr><th> </th>";
|
echo "<tr><th> </th>";
|
||||||
|
|||||||
+43
-42
@@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$dataarray = explode(",",$message->readingNotice['data']);
|
$dataarray = explode(",",$message->readingNotice['data']);
|
||||||
$colspan = (isset($dataarray[168]) && $dataarray[168] > 0) ? 11 : 10;
|
$colspan = (isset($dataarray[178]) && $dataarray[178] > 0) ? 11 : 10;
|
||||||
$colspan2 = (isset($dataarray[170]) && $dataarray[170] > 0) ? 11 : 10;
|
$spy = !empty($dataarray[177]) && !empty($dataarray[176]) && empty($dataarray[195]);
|
||||||
$spy = !empty($dataarray[167]) && !empty($dataarray[166]) && empty($dataarray[185]);
|
|
||||||
|
|
||||||
//Attacker
|
//Attacker
|
||||||
if ($database->getUserField($dataarray[0], 'username', 0) != "[?]") {
|
if ($database->getUserField($dataarray[0], 'username', 0) != "[?]") {
|
||||||
@@ -62,7 +61,7 @@ $start = ($tribe - 1) * 10 + 1;
|
|||||||
for($i = $start; $i <= ($start + 9); $i++) {
|
for($i = $start; $i <= ($start + 9); $i++) {
|
||||||
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
|
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
|
||||||
}
|
}
|
||||||
if (isset($dataarray[168]) && $dataarray[168] > 0){
|
if (isset($dataarray[178]) && $dataarray[178] > 0){
|
||||||
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
||||||
}
|
}
|
||||||
echo "</tr><tr><th>Troops</th>";
|
echo "</tr><tr><th>Troops</th>";
|
||||||
@@ -72,8 +71,8 @@ for($i = 3; $i <= 12; $i++) {
|
|||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($dataarray[168]) && $dataarray[168] > 0){
|
if (isset($dataarray[178]) && $dataarray[178] > 0){
|
||||||
echo "<td>$dataarray[168]</td>";
|
echo "<td>$dataarray[178]</td>";
|
||||||
}
|
}
|
||||||
echo "<tr><th>Casualties</th>";
|
echo "<tr><th>Casualties</th>";
|
||||||
|
|
||||||
@@ -82,88 +81,90 @@ for($i = 13; $i <= 22; $i++) {
|
|||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($dataarray[168]) && $dataarray[168] > 0){
|
if(isset($dataarray[178]) && $dataarray[178] > 0){
|
||||||
if ($dataarray[169] == 0) $tdclass='class="none"'; else $tdclass='';
|
if ($dataarray[179] == 0) $tdclass='class="none"'; else $tdclass='';
|
||||||
echo "<td $tdclass>$dataarray[169]</td>";
|
echo "<td $tdclass>$dataarray[179]</td>";
|
||||||
}
|
}
|
||||||
if(!$spy && ($dataarray[172] > 0 || $dataarray[173] > 0 || $dataarray[174] > 0 || $dataarray[175] > 0 || $dataarray[176] > 0 || $dataarray[177] > 0 || $dataarray[178] > 0 || $dataarray[179] > 0 || $dataarray[180] > 0 || $dataarray[181] > 0 || $dataarray[182] > 0)){
|
if(!$spy && array_sum(array_slice($dataarray, 182, 11)) > 0){
|
||||||
echo "</tr><tr><th>Prisoners</th>";
|
echo "</tr><tr><th>Prisoners</th>";
|
||||||
for($i = 172; $i <= 181; $i++) {
|
for($i = 182; $i <= 191; $i++) {
|
||||||
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
if(isset($dataarray[168]) && $dataarray[168] > 0){
|
if(isset($dataarray[178]) && $dataarray[178] > 0){
|
||||||
if ($dataarray[182] == 0) $tdclass='class="none"'; else $tdclass='';
|
if ($dataarray[192] == 0) $tdclass='class="none"'; else $tdclass='';
|
||||||
echo "<td $tdclass>$dataarray[182]</td>";
|
echo "<td $tdclass>$dataarray[192]</td>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "</tr></tbody>";
|
echo "</tr></tbody>";
|
||||||
if (!empty($dataarray[160]) && !empty($dataarray[161])){ //ram
|
if (!empty($dataarray[170]) && !empty($dataarray[171])){ //ram
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[160]; ?>" src="img/x.gif" alt="Ram" title="Ram" />
|
<img class="unit u<?php echo $dataarray[170]; ?>" src="img/x.gif" alt="Ram" title="Ram" />
|
||||||
<?php echo $dataarray[161]; ?>
|
<?php echo $dataarray[171]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if (!empty($dataarray[162]) && !empty($dataarray[163])){ //cata
|
if (!empty($dataarray[172]) && !empty($dataarray[173])){ //cata
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[162]; ?>" src="img/x.gif" alt="Catapult" title="Catapult" />
|
<img class="unit u<?php echo $dataarray[172]; ?>" src="img/x.gif" alt="Catapult" title="Catapult" />
|
||||||
<?php echo $dataarray[163]; ?>
|
<?php echo $dataarray[173]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if (!empty($dataarray[164]) && !empty($dataarray[165])){ //chief
|
if (!empty($dataarray[174]) && !empty($dataarray[175])){ //chief
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[164]; ?>" src="img/x.gif" alt="Chief" title="Chief" />
|
<img class="unit u<?php echo $dataarray[174]; ?>" src="img/x.gif" alt="Chief" title="Chief" />
|
||||||
<?php echo $dataarray[165]; ?>
|
<?php echo $dataarray[175]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if ($spy){ //spy
|
if ($spy){ //spy
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
|
|
||||||
<?php echo $dataarray[167]; ?>
|
<?php echo $dataarray[177]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if (!empty($dataarray[183])){ //release prisoners
|
if (!empty($dataarray[193])){ //release prisoners
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
|
|
||||||
<?php echo $dataarray[183]; ?>
|
<?php echo $dataarray[193]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if (!empty($dataarray[186]) && !empty($dataarray[187])){ //hero
|
if (!empty($dataarray[196]) && !empty($dataarray[197])){ //hero
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[186]; ?>" src="img/x.gif" alt="Hero" title="Hero" />
|
<img class="unit u<?php echo $dataarray[196]; ?>" src="img/x.gif" alt="Hero" title="Hero" />
|
||||||
<?php echo $dataarray[187]; ?>
|
<?php echo $dataarray[197]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if(isset($dataarray[185]) && !empty($dataarray[185])){ //No troops returned
|
if(isset($dataarray[195]) && !empty($dataarray[195])){ //No troops returned
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<?php echo $dataarray[185]; ?>
|
<?php echo $dataarray[195]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }elseif(empty($dataarray[166]) && empty($dataarray[167])){?>
|
<?php }elseif(empty($dataarray[176]) && empty($dataarray[177])){?>
|
||||||
<tbody class="goods"><tr><th>Bounty</th><td colspan="<?php echo $colspan; ?>">
|
<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>
|
<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>
|
||||||
</td></tr></tbody></table>
|
</td></tr></tbody></table>
|
||||||
<?php } //Defender(s)
|
<?php } //Defender(s)
|
||||||
$defArray = [1, $dataarray[55], $dataarray[76], $dataarray[97], $dataarray[118], $dataarray[139]];
|
$defArray = [1, $dataarray[55], $dataarray[76], $dataarray[97], $dataarray[118], $dataarray[139]];
|
||||||
$targetTribe = $dataarray[33];
|
$targetTribe = $dataarray[34];
|
||||||
foreach($defArray as $index => $value){
|
foreach($defArray as $index => $value){
|
||||||
if($value == 0) continue;
|
if($value == 0) continue;
|
||||||
|
$heroIndex = ($index == 0 ? 180 : 160 + ($index - 1));
|
||||||
|
$heroDeadIndex = ($index == 0 ? 1 : 5);
|
||||||
|
|
||||||
$target = ($index == 0 ? $targetTribe : $index) - 1;
|
$target = ($index == 0 ? $targetTribe : $index) - 1;
|
||||||
$start = $target * 10 + 1;
|
$start = $target * 10 + 1;
|
||||||
$troopsStart = $index * 21 + 35 - ($index == 0 ? 1 : 0);
|
$troopsStart = $index * 21 + 35;
|
||||||
?>
|
?>
|
||||||
<table cellpadding="1" cellspacing="1" class="defender">
|
<table cellpadding="1" cellspacing="1" class="defender">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="role">Defender</td>
|
<td class="role">Defender</td>
|
||||||
<td colspan="<?php echo $colspan2; ?>"><?php echo ($index == 0) ? $defuser_url." from the village ".$deffrom_url : "Reinforcement"; ?></td>
|
<td colspan="<?php echo $dataarray[$heroIndex] > 0 ? 11 : 10; ?>"><?php echo ($index == 0) ? $defuser_url." from the village ".$deffrom_url : "Reinforcement"; ?></td>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
<tbody class="units">
|
<tbody class="units">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -173,7 +174,7 @@ foreach($defArray as $index => $value){
|
|||||||
for($i = $start; $i <= ($start + 9); $i++) {
|
for($i = $start; $i <= ($start + 9); $i++) {
|
||||||
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
|
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
|
||||||
}
|
}
|
||||||
if(isset($dataarray[170]) && $dataarray[170] > 0){
|
if(isset($dataarray[$heroIndex]) && $dataarray[$heroIndex] > 0){
|
||||||
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
||||||
}
|
}
|
||||||
echo "</tr><tr><th>Troops</th>";
|
echo "</tr><tr><th>Troops</th>";
|
||||||
@@ -183,8 +184,8 @@ for($i = $troopsStart; $i <= $troopsStart + 9; $i++) {
|
|||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($dataarray[170]) && $dataarray[170] > 0){
|
if(isset($dataarray[$heroIndex]) && $dataarray[$heroIndex] > 0){
|
||||||
echo "<td>$dataarray[170]</td>";
|
echo "<td>".$dataarray[$heroIndex]."</td>";
|
||||||
}
|
}
|
||||||
echo "<tr><th>Casualties</th>";
|
echo "<tr><th>Casualties</th>";
|
||||||
|
|
||||||
@@ -193,9 +194,9 @@ for($i = $troopsStart + 10; $i <= $troopsStart + 19; $i++) {
|
|||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($dataarray[170]) && $dataarray[170] > 0){
|
if(isset($dataarray[$heroIndex]) && $dataarray[$heroIndex] > 0){
|
||||||
if ($dataarray[171] == 0){$tdclass1='class="none"';}
|
if ($dataarray[$heroIndex + $heroDeadIndex] == 0) $tdclass1 = 'class="none"';
|
||||||
echo "<td $tdclass1>$dataarray[171]</td>";
|
echo "<td $tdclass1>".$dataarray[$heroIndex + $heroDeadIndex]."</td>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
//reinforcement is underattack
|
//reinforcement is underattack
|
||||||
$dataarray = explode(",",$message->readingNotice['data']);
|
$dataarray = explode(",",$message->readingNotice['data']);
|
||||||
$colspan = (isset($dataarray[24]) && $dataarray[24] > 0) ? 10 : 11;
|
$colspan = (isset($dataarray[24]) && $dataarray[24] > 0) ? 11 : 10;
|
||||||
if ($database->getUserField($dataarray[0], 'username', 0) != "[?]") {
|
if ($database->getUserField($dataarray[0], 'username', 0) != "[?]") {
|
||||||
$user_url = "<a href=\"spieler.php?uid=".$database->getUserField($dataarray[0], 'id', 0)."\">".$database->getUserField($dataarray[0], 'username', 0)."</a>";
|
$user_url = "<a href=\"spieler.php?uid=".$database->getUserField($dataarray[0], 'id', 0)."\">".$database->getUserField($dataarray[0], 'username', 0)."</a>";
|
||||||
}
|
}
|
||||||
@@ -46,23 +46,23 @@ for($i = $start; $i <= ($start + 9); $i++) {
|
|||||||
if(isset($dataarray[24]) && $dataarray[24] > 0){
|
if(isset($dataarray[24]) && $dataarray[24] > 0){
|
||||||
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
||||||
}
|
}
|
||||||
echo "</tr><tr><th>Troops</th>";
|
|
||||||
|
|
||||||
|
echo "</tr><tr><th>Troops</th>";
|
||||||
for($i = 4; $i <= 13; $i++) {
|
for($i = 4; $i <= 13; $i++) {
|
||||||
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($dataarray[24]) && $dataarray[24] > 0){
|
if(isset($dataarray[24]) && $dataarray[24] > 0){
|
||||||
echo "<td>$dataarray[24]</td>";
|
echo "<td>$dataarray[24]</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<tr><th>Casualties</th>";
|
echo "<tr><th>Casualties</th>";
|
||||||
for($i = 14; $i <= 23; $i++) {
|
for($i = 14; $i <= 23; $i++) {
|
||||||
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
if(isset($dataarray[24]) && $dataarray[24] > 0){
|
if(isset($dataarray[24]) && $dataarray[24] > 0){
|
||||||
if ($dataarray[25] == 0){$tdclass = 'class="none"';}
|
if ($dataarray[25] == 0) $tdclass = 'class="none"';
|
||||||
echo "<td $tdclass>$dataarray[25]</td>";
|
echo "<td $tdclass>$dataarray[25]</td>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
+27
-27
@@ -6,7 +6,7 @@
|
|||||||
## TRAVIANZ ##
|
## TRAVIANZ ##
|
||||||
############################################################
|
############################################################
|
||||||
$dataarray = explode(",",$message->readingNotice['data']);
|
$dataarray = explode(",",$message->readingNotice['data']);
|
||||||
$colspan = (isset($dataarray[173]) && $dataarray[173] > 0) ? 11 : 10;
|
$colspan = (isset($dataarray[184]) && $dataarray[184] > 0) ? 11 : 10;
|
||||||
$colspan2 = 10;
|
$colspan2 = 10;
|
||||||
|
|
||||||
//Attacker
|
//Attacker
|
||||||
@@ -66,7 +66,7 @@ $start = ($tribe - 1) * 10 + 1;
|
|||||||
for($i = $start; $i <= ($start + 9); $i++) {
|
for($i = $start; $i <= ($start + 9); $i++) {
|
||||||
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
|
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
|
||||||
}
|
}
|
||||||
if(isset($dataarray[173]) && $dataarray[173] > 0){
|
if(isset($dataarray[184]) && $dataarray[184] > 0){
|
||||||
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
|
||||||
}
|
}
|
||||||
echo "</tr><tr><th>Troops</th>";
|
echo "</tr><tr><th>Troops</th>";
|
||||||
@@ -76,70 +76,70 @@ for($i = 3; $i <= 12; $i++) {
|
|||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($dataarray[173]) && $dataarray[173] > 0){
|
if(isset($dataarray[184]) && $dataarray[184] > 0){
|
||||||
echo "<td>$dataarray[173]</td>";
|
echo "<td>$dataarray[184]</td>";
|
||||||
}
|
}
|
||||||
echo "<tr><th>Casualties</th>";
|
echo "<tr><th>Casualties</th>";
|
||||||
for($i = 13; $i <= 22; $i++) {
|
for($i = 13; $i <= 22; $i++) {
|
||||||
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
if(isset($dataarray[173]) && $dataarray[173] > 0){
|
if(isset($dataarray[184]) && $dataarray[184] > 0){
|
||||||
if ($dataarray[174] == 0) $tdclass='class="none"'; else $tdclass='';
|
if ($dataarray[185] == 0) $tdclass='class="none"'; else $tdclass='';
|
||||||
echo "<td $tdclass>$dataarray[174]</td>";
|
echo "<td $tdclass>$dataarray[185]</td>";
|
||||||
}
|
}
|
||||||
if($dataarray[175] > 0 || $dataarray[176] > 0 || $dataarray[177] > 0 || $dataarray[178] > 0 || $dataarray[179] > 0 || $dataarray[180] > 0 || $dataarray[181] > 0 || $dataarray[182] > 0 || $dataarray[183] > 0 || $dataarray[184] > 0 || $dataarray[185] > 0){
|
if(array_sum(array_slice($dataarray, 186, 11)) > 0){
|
||||||
echo "</tr><tr><th>Prisoners</th>";
|
echo "</tr><tr><th>Prisoners</th>";
|
||||||
|
|
||||||
for($i = 175; $i <= 184; $i++) {
|
for($i = 186; $i <= 195; $i++) {
|
||||||
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
||||||
else echo "<td>".$dataarray[$i]."</td>";
|
else echo "<td>".$dataarray[$i]."</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($dataarray[173]) && $dataarray[173] > 0){
|
if(isset($dataarray[184]) && $dataarray[184] > 0){
|
||||||
if ($dataarray[185]==0) $tdclass='class="none"'; else $tdclass='';
|
if ($dataarray[196] == 0) $tdclass='class="none"'; else $tdclass='';
|
||||||
echo "<td $tdclass>$dataarray[185]</td>";
|
echo "<td $tdclass>$dataarray[196]</td>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($dataarray[187]) && !empty($dataarray[188])){ //ram
|
if (!empty($dataarray[198]) && !empty($dataarray[199])){ //ram
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[187]; ?>" src="img/x.gif" alt="Ram" title="Ram" />
|
<img class="unit u<?php echo $dataarray[198]; ?>" src="img/x.gif" alt="Ram" title="Ram" />
|
||||||
<?php echo $dataarray[188]; ?>
|
<?php echo $dataarray[199]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if (!empty($dataarray[189]) && !empty($dataarray[190])){ //cata
|
if (!empty($dataarray[200]) && !empty($dataarray[201])){ //cata
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[189]; ?>" src="img/x.gif" alt="Catapult" title="Catapult" />
|
<img class="unit u<?php echo $dataarray[200]; ?>" src="img/x.gif" alt="Catapult" title="Catapult" />
|
||||||
<?php echo $dataarray[190]; ?>
|
<?php echo $dataarray[201]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if (!empty($dataarray[191]) && !empty($dataarray[192])){ //chief
|
if (!empty($dataarray[202]) && !empty($dataarray[203])){ //chief
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[191]; ?>" src="img/x.gif" alt="Chief" title="Chief" />
|
<img class="unit u<?php echo $dataarray[202]; ?>" src="img/x.gif" alt="Chief" title="Chief" />
|
||||||
<?php echo $dataarray[192]; ?>
|
<?php echo $dataarray[203]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if (!empty($dataarray[194]) && !empty($dataarray[195])){ //hero
|
if (!empty($dataarray[205]) && !empty($dataarray[206])){ //hero
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<img class="unit u<?php echo $dataarray[194]; ?>" src="img/x.gif" alt="Hero" title="Hero" />
|
<img class="unit u<?php echo $dataarray[205]; ?>" src="img/x.gif" alt="Hero" title="Hero" />
|
||||||
<?php echo $dataarray[195]; ?>
|
<?php echo $dataarray[206]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }
|
<?php }
|
||||||
if(isset($dataarray[193]) && !empty($dataarray[193])){ //No troops returned
|
if(isset($dataarray[204]) && !empty($dataarray[204])){ //No troops returned
|
||||||
?>
|
?>
|
||||||
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
<tbody class="goods"><tr><th>Information</th><td colspan="<?php echo $colspan; ?>">
|
||||||
<?php echo $dataarray[193]; ?>
|
<?php echo $dataarray[204]; ?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
<?php }?>
|
<?php }?>
|
||||||
</td></tr></tbody>
|
</td></tr></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$target = $dataarray[33] - 1;
|
$target = $dataarray[34] - 1;
|
||||||
$start = ($target * 10) + 1;
|
$start = ($target * 10) + 1;
|
||||||
$troopsStart = ($target * 21) + 35;
|
$troopsStart = ($target * 21) + 35;
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user