mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Artifacts fixes part 3
+Fixed the artifact of the fool, it will now work and reduce/increase troops speed +Optimized some templates file and deleted some useless files +Added a method to Database.php which permits to calculate things related to artifacts (it's not general yet, it only works for troops speed) -Removed artifact of the fool "Account" type, because it shouldn't exist
This commit is contained in:
+23
-73
@@ -2063,6 +2063,7 @@ class Automation {
|
||||
}
|
||||
|
||||
//cranny efficiency
|
||||
//TODO: Needs to be connected to a function
|
||||
$atk_bonus = ($owntribe == 2)? (4/5) : 1;
|
||||
$def_bonus = ($targettribe == 3)? 2 : 1;
|
||||
$to_owner = $database->getVillageField($data['to'],"owner");
|
||||
@@ -2922,31 +2923,9 @@ class Automation {
|
||||
//to here
|
||||
// If the dead units not equal the ammount sent they will return and report
|
||||
if($totalsend_att - ($totaldead_att + (isset($totaltraped_att) ? $totaltraped_att : 0)) > 0)
|
||||
{
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($from['wref'],2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$endtime = round($this->procDistanceTime($from,$to,min($speeds),1)/$fastertroops);
|
||||
$foolartefact2 = $database->getFoolArtefactInfo(2,$from['wref'],$from['owner']);
|
||||
if(count($foolartefact2) > 0){
|
||||
foreach($foolartefact2 as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$endtime *= $arte['effect2'];
|
||||
}else{
|
||||
$endtime /= $arte['effect2'];
|
||||
$endtime = round($endtime);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
$troopsTime = $this->procDistanceTime($from, $to, min($speeds), 1);
|
||||
$endtime = $database->getTroopsWalkingTime($from['owner'], $from['wref'], 2, $troopsTime);
|
||||
$endtime += $AttackArrivalTime;
|
||||
if($type == 1) {
|
||||
if($from['owner'] == 3) { //fix natar report by ronix
|
||||
@@ -3026,54 +3005,29 @@ class Automation {
|
||||
$herosend_att = $data['t11'];
|
||||
$unitssend_att= $unitssend_att1.','.$herosend_att;
|
||||
|
||||
$speeds = array();
|
||||
$speeds = [];
|
||||
|
||||
//find slowest unit.
|
||||
for($i=1;$i<=10;$i++)
|
||||
//TODO: Needs to be made as a function
|
||||
for($i = 1; $i <= 10; $i++)
|
||||
{
|
||||
if ($data['t'.$i] > 0) {
|
||||
if($unitarray) { reset($unitarray); }
|
||||
$unitarray = $GLOBALS["u".(($owntribe-1)*10+$i)];
|
||||
$speeds[] = $unitarray['speed'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($herosend_att>0){
|
||||
if ($herosend_att > 0){
|
||||
$hero_unit = $database->getHeroField($from['owner'], 'unit');
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($from['vref'],2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
|
||||
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
|
||||
$endtime = round($this->procDistanceTime($from,$to,min($speeds),1)/$fastertroops);
|
||||
$foolartefact3 = $database->getFoolArtefactInfo(2,$from['wref'],$from['owner']);
|
||||
|
||||
if(count($foolartefact3) > 0){
|
||||
foreach($foolartefact3 as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$endtime *= $arte['effect2'];
|
||||
}else{
|
||||
$endtime /= $arte['effect2'];
|
||||
$endtime = round($endtime);
|
||||
}
|
||||
}
|
||||
}
|
||||
$troopsTime = $this->procDistanceTime($from, $to, min($speeds), 1);
|
||||
$endtime = $database->getTroopsWalkingTime($from['owner'], $from['wref'], 2, $troopsTime);
|
||||
$endtime += $AttackArrivalTime;
|
||||
//$endtime += microtime(true);
|
||||
|
||||
$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;
|
||||
$data2 = $from['owner'].','.$from['wref'].','.$to['owner'].','.$owntribe.','.$unitssend_att.','.$peace;
|
||||
$time = time();
|
||||
@@ -5863,37 +5817,33 @@ class Automation {
|
||||
private function artefactOfTheFool() {
|
||||
global $database;
|
||||
$time = time();
|
||||
$q = "SELECT id, size FROM " . TB_PREFIX . "artefacts where type = 8 and active = 1 and lastupdate <= ".($time - 86400);
|
||||
$q = "SELECT id, size FROM " . TB_PREFIX . "artefacts where type = 8 AND active = 1 AND lastupdate <= ".($time - (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED))));
|
||||
$array = $database->query_return($q);
|
||||
if ($array) {
|
||||
foreach($array as $artefact) {
|
||||
$kind = rand(1,7);
|
||||
$kind = rand(1, 7);
|
||||
while($kind == 6){
|
||||
$kind = rand(1,7);
|
||||
}
|
||||
if($artefact['size'] != 3){
|
||||
$bad_effect = rand(0,1);
|
||||
}else{
|
||||
$bad_effect = 0;
|
||||
$kind = rand(1, 7);
|
||||
}
|
||||
if($artefact['size'] != 3) $bad_effect = rand(0, 1);
|
||||
else $bad_effect = 0;
|
||||
|
||||
switch($kind) {
|
||||
case 1:
|
||||
$effect = rand(1,5);
|
||||
$effect = rand(1, 5);
|
||||
break;
|
||||
case 2:
|
||||
$effect = rand(1,3);
|
||||
$effect = rand(1, 3);
|
||||
break;
|
||||
case 3:
|
||||
$effect = rand(3,10);
|
||||
$effect = rand(3, 10);
|
||||
break;
|
||||
case 4:
|
||||
$effect = rand(2,4);
|
||||
break;
|
||||
case 5:
|
||||
$effect = rand(2,4);
|
||||
$effect = rand(2, 4);
|
||||
break;
|
||||
case 7:
|
||||
$effect = rand(1,6);
|
||||
$effect = rand(1, 6);
|
||||
break;
|
||||
}
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."artefacts SET kind = ". (int) $kind. ", bad_effect = $bad_effect, effect2 = $effect, lastupdate = $time WHERE id = ".(int) $artefact['id']);
|
||||
|
||||
+53
-5
@@ -3504,7 +3504,11 @@ class MYSQLi_DB implements IDbConnection {
|
||||
IF(
|
||||
f40t IN ($fieldType),
|
||||
f40,
|
||||
0
|
||||
IF(
|
||||
f99t IN ($fieldType),
|
||||
f99,
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3635,7 +3639,7 @@ class MYSQLi_DB implements IDbConnection {
|
||||
OR
|
||||
f40t IN ($fieldType)
|
||||
OR
|
||||
f99 IN ($fieldType))
|
||||
f99t IN ($fieldType))
|
||||
LIMIT 1
|
||||
");
|
||||
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
@@ -6942,6 +6946,50 @@ References: User ID/Message ID, Mode
|
||||
return $slots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates how much time troops spend to walk from a village to another, counting artifacts
|
||||
*
|
||||
* @param int $uid The User ID
|
||||
* @param int $vid The village ID
|
||||
* @param int $time The old time, without multipliers
|
||||
* @return int Returns the new time, multiplied or divided by artifacts bonus or malus
|
||||
*/
|
||||
|
||||
function getTroopsWalkingTime($uid, $vid, $kind, $time){
|
||||
list($uid, $vid, $time) = $this->escape_input((int) $uid,(int) $vid, $time);
|
||||
|
||||
$artefacts = $foolArefacts = [];
|
||||
$multiplier = [2, 3, 1.5];
|
||||
|
||||
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($vid, $kind, 1, 1)); //Village effect
|
||||
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($uid, $kind, 3, 0)); //Unique effect
|
||||
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($uid, $kind, 2, 0)); //Account effect
|
||||
|
||||
$fasterTroops = 1;
|
||||
for($i = 0; $i < count($artefacts); $i++)
|
||||
{
|
||||
if($artefacts[$i] > 0) {
|
||||
$fasterTroops = $multiplier[$i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$foolArefacts[] = $this->getOwnUniqueArtefactInfo2($vid, 8, 1, 1); //Village effect
|
||||
$foolArefacts[] = $this->getOwnUniqueArtefactInfo2($uid, 8, 3, 0); //Unique effect
|
||||
|
||||
$foolEffect = 1;
|
||||
for($i = 0; $i < count($foolArefacts); $i++)
|
||||
{
|
||||
if(count($foolArefacts[$i]) > 0 && $foolArefacts[$i]['kind'] == $kind)
|
||||
{
|
||||
$foolEffect = $foolArefacts[$i]['bad_effect'] == 1 ? $foolArefacts[$i]['effect2'] : 1 / $foolArefacts[$i]['effect2'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return round(($time / $fasterTroops) * $foolEffect);
|
||||
}
|
||||
|
||||
function addArtefact($vref, $owner, $type, $size, $name, $desc, $effect, $img) {
|
||||
list($vref, $owner, $type, $size, $name, $desc, $effect, $img) = $this->escape_input($vref, $owner, $type, $size, $name, $desc, $effect, $img);
|
||||
|
||||
@@ -7067,8 +7115,8 @@ References: User ID/Message ID, Mode
|
||||
return (isset(self::$artefactDataCache[$id.$mode][$size.$type]) ? self::$artefactDataCache[$id.$mode][$size.$type] : []);
|
||||
}
|
||||
|
||||
function getFoolArtefactInfo($type,$vid,$uid, $use_cache = true) {
|
||||
list($type,$vid,$uid) = $this->escape_input((int) $type,(int) $vid,(int) $uid);
|
||||
function getFoolArtefactInfo($type, $vid, $uid, $use_cache = true) {
|
||||
list($type, $vid, $uid) = $this->escape_input((int) $type, (int) $vid, (int) $uid);
|
||||
|
||||
// first of all, check if we should be using cache and whether the field
|
||||
// required is already cached
|
||||
@@ -7199,7 +7247,7 @@ References: User ID/Message ID, Mode
|
||||
function getInactiveArtifacts($time){
|
||||
list($time) = $this->escape_input($time);
|
||||
|
||||
$q = "SELECT * FROM ".TB_PREFIX."artefacts WHERE active = 0 AND owner > 5 AND conquered < $time ORDER BY conquered ASC, size ASC";
|
||||
$q = "SELECT * FROM ".TB_PREFIX."artefacts WHERE active = 0 AND owner > 5 AND conquered <= $time ORDER BY conquered ASC, size ASC";
|
||||
$result = mysqli_query($this->dblink, $q);
|
||||
return $this->mysqli_fetch_all($result);
|
||||
}
|
||||
|
||||
+78
-166
@@ -332,62 +332,42 @@ class Units {
|
||||
global $form, $database, $village, $generator, $session;
|
||||
|
||||
$data = $database->getA2b( $post['timestamp_checksum'], $post['timestamp'] );
|
||||
$Gtribe = "";
|
||||
$Gtribe = ($session->tribe == 1) ? "" : $session->tribe - 1;
|
||||
|
||||
if ( $session->tribe == '2' ) {
|
||||
$Gtribe = "1";
|
||||
} else if ( $session->tribe == '3' ) {
|
||||
$Gtribe = "2";
|
||||
} else if ( $session->tribe == '4' ) {
|
||||
$Gtribe = "3";
|
||||
} else if ( $session->tribe == '5' ) {
|
||||
$Gtribe = "4";
|
||||
}
|
||||
for ($i = 1; $i < 10; $i++) {
|
||||
if (isset($data['u'.$i])) {
|
||||
|
||||
for ( $i = 1; $i < 10; $i ++ ) {
|
||||
if ( isset( $data[ 'u' . $i ] ) ) {
|
||||
|
||||
if ( $data[ 'u' . $i ] > $village->unitarray[ 'u' . $Gtribe . $i ] ) {
|
||||
$form->addError( "error", "You can't send more units than you have" );
|
||||
if ($data['u'.$i] > $village->unitarray['u'.$Gtribe.$i]) {
|
||||
$form->addError("error", "You can't send more units than you have");
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $data[ 'u' . $i ] < 0 ) {
|
||||
$form->addError( "error", "You can't send negative units." );
|
||||
if ($data[ 'u'.$i ] < 0) {
|
||||
$form->addError("error", "You can't send negative units.");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data['u11'] > $village->unitarray['hero'] ) {
|
||||
$form->addError( "error", "You can't send more units than you have" );
|
||||
if ($data['u11'] > $village->unitarray['hero']) {
|
||||
$form->addError( "error", "You can't send more units than you have");
|
||||
}
|
||||
|
||||
if ( $data['u11'] < 0 ) {
|
||||
$form->addError( "error", "You can't send negative units." );
|
||||
if ($data['u11'] < 0) {
|
||||
$form->addError( "error", "You can't send negative units.");
|
||||
}
|
||||
|
||||
if($data['type'] != 1 && $post['spy'] != 0) $post['spy'] = 0;
|
||||
|
||||
if ( $form->returnErrors() > 0 ) {
|
||||
if ($form->returnErrors() > 0) {
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header( "Location: a2b.php" );
|
||||
exit;
|
||||
} else {
|
||||
if ( $session->access != BANNED ) {
|
||||
if ( $session->tribe == 1 ) {
|
||||
$u = "";
|
||||
} elseif ( $session->tribe == 2 ) {
|
||||
$u = "1";
|
||||
} elseif ( $session->tribe == 3 ) {
|
||||
$u = "2";
|
||||
} elseif ( $session->tribe == 4 ) {
|
||||
$u = "3";
|
||||
} else {
|
||||
$u = "4";
|
||||
}
|
||||
if ($session->access != BANNED) {
|
||||
$u = ($session->tribe == 1) ? "" : $session->tribe - 1;
|
||||
|
||||
$database->modifyUnit(
|
||||
$village->wid,
|
||||
@@ -417,7 +397,7 @@ class Units {
|
||||
$data['u10'],
|
||||
$data['u11']
|
||||
),
|
||||
array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
|
||||
array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
);
|
||||
|
||||
$fromcoor = $database->getCoor( $village->wid );
|
||||
@@ -427,84 +407,49 @@ class Units {
|
||||
$speeds = [];
|
||||
|
||||
//find slowest unit.
|
||||
for ( $i = 1; $i <= 10; $i ++ ) {
|
||||
if ( isset( $data[ 'u' . $i ] ) ) {
|
||||
if ( $data[ 'u' . $i ] != '' && $data[ 'u' . $i ] > 0 ) {
|
||||
if ( $unitarray ) {
|
||||
reset( $unitarray );
|
||||
for ($i = 1; $i <= 10; $i ++) {
|
||||
if (isset( $data['u'.$i] ) ) {
|
||||
if (!empty($data['u'.$i]) && $data['u'.$i] > 0) {
|
||||
if ($unitarray) {
|
||||
reset($unitarray);
|
||||
}
|
||||
$unitarray = $GLOBALS[ "u" . ( ( $session->tribe - 1 ) * 10 + $i ) ];
|
||||
$unitarray = $GLOBALS["u".(($session->tribe - 1) * 10 + $i)];
|
||||
$speeds[] = $unitarray['speed'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( isset( $data['u11'] ) ) {
|
||||
if ( $data['u11'] != '' && $data['u11'] > 0 ) {
|
||||
$heroarray = $database->getHero( $session->uid );
|
||||
$herodata = $GLOBALS[ "u" . $heroarray[0]['unit'] ];
|
||||
if (isset($data['u11'])) {
|
||||
if (!empty($data['u11']) && $data['u11'] > 0) {
|
||||
$heroarray = $database->getHero( $session->uid);
|
||||
$herodata = $GLOBALS['u'.$heroarray[0]['unit']];
|
||||
$speeds[] = $herodata['speed'];
|
||||
}
|
||||
}
|
||||
$artefact = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 2, 3, 0 ) );
|
||||
$artefact1 = count( $database->getOwnUniqueArtefactInfo2( $village->wid, 2, 1, 1 ) );
|
||||
$artefact2 = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 2, 2, 0 ) );
|
||||
if ( $artefact > 0 ) {
|
||||
$fastertroops = 3;
|
||||
} else if ( $artefact1 > 0 ) {
|
||||
$fastertroops = 2;
|
||||
} else if ( $artefact2 > 0 ) {
|
||||
$fastertroops = 1.5;
|
||||
} else {
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round( $generator->procDistanceTime( $from, $to, min( $speeds ), 1 ) / $fastertroops );
|
||||
$foolartefact = $database->getFoolArtefactInfo( 2, $village->wid, $session->uid );
|
||||
if ( count( $foolartefact ) > 0 ) {
|
||||
foreach ( $foolartefact as $arte ) {
|
||||
if ( $arte['bad_effect'] == 1 ) {
|
||||
$time *= $arte['effect2'];
|
||||
} else {
|
||||
$time /= $arte['effect2'];
|
||||
$time = round( $time );
|
||||
}
|
||||
}
|
||||
}
|
||||
$to_owner = $database->getVillageField( $data['to_vid'], "owner" );
|
||||
|
||||
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
|
||||
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
$to_owner = $database->getVillageField($data['to_vid'], "owner");
|
||||
|
||||
// Check if have WW owner have artefact Rivals great confusion or Artefact of the unique fool with that effect
|
||||
// If is a WW village you can target on WW , if is not a WW village catapults will target randomly.
|
||||
// Like it says : Exceptions are the WW which can always be targeted and the treasure chamber which can always be targeted, except with the unique artifact.
|
||||
// Fixed by Advocaite and Shadow
|
||||
$q = mysqli_fetch_array( mysqli_query( $database->dblink, "SELECT Count(*) as Total FROM " . TB_PREFIX . "fdata WHERE f99t = '40' AND vref = " . (int) $data['to_vid'] ), MYSQLI_ASSOC );
|
||||
$isThere = $q['Total'];
|
||||
if ( $isThere > 0 ) {
|
||||
$iswwvilla = 1;
|
||||
$artefact_2 = count( $database->getOwnUniqueArtefactInfo2( $to_owner, 7, 3, 0 ) );
|
||||
$artefact1_2 = count( $database->getOwnUniqueArtefactInfo2( $data['to_vid'], 7, 1, 1 ) );
|
||||
$artefact2_2 = count( $database->getOwnUniqueArtefactInfo2( $to_owner, 7, 2, 0 ) );
|
||||
$foolartefact2 = $database->getFoolArtefactInfo( 7, $data['to_vid'], $to_owner );
|
||||
$good_artefact = 0;
|
||||
if ( count( $foolartefact2 ) > 0 ) {
|
||||
foreach ( $foolartefact2 as $arte ) {
|
||||
if ( $arte['bad_effect'] == 0 ) {
|
||||
$good_artefact = 1;
|
||||
}
|
||||
// Fixed by Advocaite and Shadow - Optimized by iopietro
|
||||
|
||||
$isThere = $database->getFieldLevelInVillage($data['to_vid'], 40);
|
||||
$iswwvilla = $isThere > 0 ? 1 : 0;
|
||||
$good_artefact = 0;
|
||||
$artefact_2 = count($database->getOwnUniqueArtefactInfo2($to_owner, 7, 3, 0));
|
||||
$artefact1_2 = count($database->getOwnUniqueArtefactInfo2($data['to_vid'], 7, 1, 1));
|
||||
$artefact2_2 = count($database->getOwnUniqueArtefactInfo2($to_owner, 7, 2, 0));
|
||||
$foolartefact2 = $database->getFoolArtefactInfo(7, $data['to_vid'], $to_owner);
|
||||
if(count($foolartefact2) > 0) {
|
||||
foreach ($foolartefact2 as $arte) {
|
||||
if ($arte['bad_effect'] == 0) {
|
||||
$good_artefact = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$artefact_2 = count( $database->getOwnUniqueArtefactInfo2( $to_owner, 7, 3, 0 ) );
|
||||
$artefact1_2 = count( $database->getOwnUniqueArtefactInfo2( $data['to_vid'], 7, 1, 1 ) );
|
||||
$artefact2_2 = count( $database->getOwnUniqueArtefactInfo2( $to_owner, 7, 2, 0 ) );
|
||||
$foolartefact2 = $database->getFoolArtefactInfo( 7, $data['to_vid'], $to_owner );
|
||||
$iswwvilla = 0;
|
||||
$good_artefact = 0;
|
||||
if ( count( $foolartefact2 ) > 0 ) {
|
||||
foreach ( $foolartefact2 as $arte ) {
|
||||
if ( $arte['bad_effect'] == 0 ) {
|
||||
$good_artefact = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rallyPointLevel = ($village->resarray)['f39'];
|
||||
$invalidBuildings = [];
|
||||
@@ -540,61 +485,59 @@ class Units {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Check those strings I do think they're wrong
|
||||
|
||||
//TODO: check those instructions, i think that they're wrong
|
||||
if ( isset( $post['ctar1'] ) ) {
|
||||
if ( $artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0 or $good_artefact == 1 ) {
|
||||
if ( $post['ctar1'] != 40 or $post['ctar1'] != 27 and $iswwvilla == 1 ) {
|
||||
if (isset($post['ctar1'])) {
|
||||
if ($artefact_2 > 0 || $artefact1_2 > 0 || $artefact2_2 > 0 || $good_artefact == 1) {
|
||||
if ($post['ctar1'] != 40 || $post['ctar1'] != 27 && $iswwvilla == 1) {
|
||||
$post['ctar1'] = 99;
|
||||
} else {
|
||||
$post['ctar1'] = 99;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$post['ctar1'] = 0;
|
||||
}
|
||||
}
|
||||
else $post['ctar1'] = 0;
|
||||
|
||||
if ( isset( $post['ctar2'] ) ) {
|
||||
if ( $artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0 or $good_artefact == 1 ) {
|
||||
if ( $post['ctar2'] != 40 or $post['ctar2'] != 27 and $iswwvilla == 1 ) {
|
||||
if(isset( $post['ctar2'])) {
|
||||
if ($artefact_2 > 0 || $artefact1_2 > 0 || $artefact2_2 > 0 || $good_artefact == 1) {
|
||||
if ($post['ctar2'] != 40 || $post['ctar2'] != 27 && $iswwvilla == 1) {
|
||||
$post['ctar2'] = 99;
|
||||
} else {
|
||||
$post['ctar2'] = 99;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$post['ctar2'] = 0;
|
||||
}
|
||||
else $post['ctar2'] = 0;
|
||||
|
||||
if (!isset($post['spy'])) {
|
||||
$post['spy'] = 0;
|
||||
}
|
||||
$abdata = $database->getABTech( $village->wid );
|
||||
$reference = $database->addAttack( ( $village->wid ), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $post['ctar1'], $post['ctar2'], $post['spy'], $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8'] );
|
||||
$checkexist = $database->checkVilExist( $data['to_vid'] );
|
||||
$checkoexist = $database->checkOasisExist( $data['to_vid'] );
|
||||
if ( $checkexist or $checkoexist ) {
|
||||
$database->addMovement( 3, $village->wid, $data['to_vid'], $reference, time(), ( $time + time() ) );
|
||||
if ( ( $database->hasBeginnerProtection( $village->wid ) == 1 ) && ( $checkexist ) ) {
|
||||
mysqli_query( $database->dblink, "UPDATE " . TB_PREFIX . "users SET protect = 0 WHERE id = " . (int) $session->uid );
|
||||
if(!isset($post['spy'])) $post['spy'] = 0;
|
||||
|
||||
$abdata = $database->getABTech($village->wid);
|
||||
$reference = $database->addAttack(($village->wid), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $post['ctar1'], $post['ctar2'], $post['spy'], $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8']);
|
||||
$checkexist = $database->checkVilExist($data['to_vid']);
|
||||
$checkoexist = $database->checkOasisExist($data['to_vid']);
|
||||
if($checkexist || $checkoexist) {
|
||||
$database->addMovement(3, $village->wid, $data['to_vid'], $reference, time(), ($time + time()));
|
||||
if ($database->hasBeginnerProtection($village->wid) == 1 && $checkexist) {
|
||||
mysqli_query($database->dblink, "UPDATE " . TB_PREFIX . "users SET protect = 0 WHERE id = ".(int) $session->uid);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $form->returnErrors() > 0 ) {
|
||||
if($form->returnErrors() > 0) {
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header( "Location: a2b.php" );
|
||||
header("Location: a2b.php" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// prevent re-use of the same attack via re-POSTing the same data
|
||||
$database->remA2b($data['id']);
|
||||
|
||||
header( "Location: build.php?id=39" );
|
||||
header("Location: build.php?id=39");
|
||||
exit;
|
||||
|
||||
} else {
|
||||
header( "Location: banned.php" );
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -607,16 +550,7 @@ class Units {
|
||||
$enforceoasis = $database->getOasisEnforceArray( $post['ckey'], 0 );
|
||||
if ( ( $enforce['from'] == $village->wid ) || ( $enforce['vref'] == $village->wid ) || ( $enforceoasis['conqured'] == $village->wid ) ) {
|
||||
$to = $database->getVillage( $enforce['from'] );
|
||||
$Gtribe = "";
|
||||
if ( $database->getUserField( $to['owner'], 'tribe', 0 ) == '2' ) {
|
||||
$Gtribe = "1";
|
||||
} else if ( $database->getUserField( $to['owner'], 'tribe', 0 ) == '3' ) {
|
||||
$Gtribe = "2";
|
||||
} else if ( $database->getUserField( $to['owner'], 'tribe', 0 ) == '4' ) {
|
||||
$Gtribe = "3";
|
||||
} else if ( $database->getUserField( $to['owner'], 'tribe', 0 ) == '5' ) {
|
||||
$Gtribe = "4";
|
||||
}
|
||||
$Gtribe = ($ownerTribe = $database->getUserField( $to['owner'], 'tribe', 0)) == 1 ? "" : $ownerTribe - 1;
|
||||
|
||||
for ( $i = 1; $i < 10; $i ++ ) {
|
||||
if ( isset( $post[ 't' . $i ] ) ) {
|
||||
@@ -705,36 +639,14 @@ class Units {
|
||||
if ( $post['t11'] != '' && $post['t11'] > 0 ) {
|
||||
$hero_unit = $database->getHeroField($from['owner'], 'unit');
|
||||
$speeds[] = $GLOBALS[ 'u' . $hero_unit ]['speed'];
|
||||
} else {
|
||||
$post['t11'] = '0';
|
||||
}
|
||||
} else {
|
||||
$post['t11'] = '0';
|
||||
}
|
||||
$artefact = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 2, 3, 0 ) );
|
||||
$artefact1 = count( $database->getOwnUniqueArtefactInfo2( $village->wid, 2, 1, 1 ) );
|
||||
$artefact2 = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 2, 2, 0 ) );
|
||||
if ( $artefact > 0 ) {
|
||||
$fastertroops = 3;
|
||||
} else if ( $artefact1 > 0 ) {
|
||||
$fastertroops = 2;
|
||||
} else if ( $artefact2 > 0 ) {
|
||||
$fastertroops = 1.5;
|
||||
} else {
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round( $generator->procDistanceTime( $fromCor, $toCor, min( $speeds ), 1 ) / $fastertroops );
|
||||
$foolartefact2 = $database->getFoolArtefactInfo( 2, $village->wid, $session->uid );
|
||||
if ( count( $foolartefact2 ) > 0 ) {
|
||||
foreach ( $foolartefact2 as $arte ) {
|
||||
if ( $arte['bad_effect'] == 1 ) {
|
||||
$time *= $arte['effect2'];
|
||||
} else {
|
||||
$time /= $arte['effect2'];
|
||||
$time = round( $time );
|
||||
}
|
||||
}
|
||||
}
|
||||
else $post['t11'] = 0;
|
||||
}
|
||||
else $post['t11'] = 0;
|
||||
|
||||
$troopsTime = $generator->procDistanceTime($fromCor, $toCor, min($speeds), 1);
|
||||
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
$reference = $database->addAttack( $enforce['from'], $post['t1'], $post['t2'], $post['t3'], $post['t4'], $post['t5'], $post['t6'], $post['t7'], $post['t8'], $post['t9'], $post['t10'], $post['t11'], 2, 0, 0, 0, 0 );
|
||||
$database->addMovement( 4, $village->wid, $enforce['from'], $reference, time(), ( $time + time() ) );
|
||||
$technology->checkReinf( $post['ckey'], false );
|
||||
|
||||
@@ -53,9 +53,9 @@ echo "".TRADE_ROUTE_TO." <a href=karte.php?d=".$route['wid']."&c=".$generator->g
|
||||
</th>
|
||||
<th colspan="4">
|
||||
<?php $routeid=$routeid == 0? $routeid=0:$routeid; ?>
|
||||
<button type="submit" name="action" value="extendRoute"><?php echo EXTEND;?>*</button>
|
||||
| <button type="submit" name="action" value="editRoute"><?php echo EDIT;?></button>
|
||||
| <button type="submit" name="action" value="delRoute"><?php echo DELETE;?></button>
|
||||
<button type="submit" name="action" value="extendRoute" id="btn_id" class="trav_buttons"><b><?php echo EXTEND;?>*</b></button>
|
||||
| <button type="submit" name="action" value="editRoute" id="btn_id" class="trav_buttons"><b><?php echo EDIT;?></b></button>
|
||||
| <button type="submit" name="action" value="delRoute" id="btn_id" class="trav_buttons"><b><?php echo DELETE;?></b></button>
|
||||
</th></tr></tfoot></table>
|
||||
</form>
|
||||
* <?php echo EXTEND_TRADE_ROUTES;?> <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>
|
||||
|
||||
@@ -53,7 +53,7 @@ switch($kind){
|
||||
break;
|
||||
}
|
||||
|
||||
$bonus = $betterorbadder." ".$effecty;
|
||||
$bonus = $betterorbadder." (<b>".str_replace(["(", ")"], "" , $effecty)."</b>)";
|
||||
?>
|
||||
|
||||
<div class="artefact image-<?php echo str_replace(['type', '.gif'], '', $artefact['img']); ?>">
|
||||
|
||||
+53
-169
@@ -1,107 +1,35 @@
|
||||
<?php
|
||||
// Temp
|
||||
$ckey = $generator->generateRandStr(6);
|
||||
|
||||
$eigen = $database->getCoor($village->wid);
|
||||
if (!isset($process['t1']) || $process['t1'] == ''){ $t1 = 0; }else{ $t1 = $process['t1']; }
|
||||
if (!isset($process['t2']) || $process['t2'] == ''){ $t2 = 0; }else{ $t2 = $process['t2']; }
|
||||
if (!isset($process['t3']) || $process['t3'] == ''){ $t3 = 0; }else{ $t3 = $process['t3']; if ($session->tribe == 3) $scout=1; }
|
||||
if (!isset($process['t4']) || $process['t4'] == ''){ $t4 = 0; }else{ $t4 = $process['t4']; if ($session->tribe == 1 || $session->tribe == 2 || $session->tribe == 4 || $session->tribe == 5) $scout=1; }
|
||||
if (!isset($process['t5']) || $process['t5'] == ''){ $t5 = 0; }else{ $t5 = $process['t5']; }
|
||||
if (!isset($process['t6']) || $process['t6'] == ''){ $t6 = 0; }else{ $t6 = $process['t6']; }
|
||||
if (!isset($process['t7']) || $process['t7'] == ''){ $t7 = 0; }else{ $t7 = $process['t7']; }
|
||||
if (!isset($process['t8']) || $process['t8'] == ''){ $t8 = 0; }else{ $t8 = $process['t8']; }
|
||||
if (!isset($process['t9']) || $process['t9'] == ''){ $t9 = 0; }else{ $t9 = $process['t9']; }
|
||||
if (!isset($process['t10']) || $process['t10'] == ''){ $t10 = 0; }else{ $t10 = $process['t10']; }
|
||||
if (!isset($process['t11']) || $process['t11'] == ''){ $t11 = 0; }else{ $t11 = $process['t11']; $showhero=1; }
|
||||
|
||||
|
||||
$from = array('x'=>$eigen['x'], 'y'=>$eigen['y']);
|
||||
|
||||
$to = array('x'=>$coor['x'], 'y'=>$coor['y']);
|
||||
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($from,$to,300,0)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
for($i = 1; $i <= 11; $i++){
|
||||
$totalunits += (($i != 3 && $session->tribe == 3) ||
|
||||
($i != 4 && $session->tribe != 3)) ? (!empty($process['t'.$i]) ? $process['t'.$i] : 0) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Temp
|
||||
|
||||
$ckey= $generator->generateRandStr(6);
|
||||
|
||||
|
||||
if (!isset($process['t1']) || $process['t1'] == ''){ $t1='0'; }else{ $t1=$process['t1']; }
|
||||
if (!isset($process['t2']) || $process['t2'] == ''){ $t2='0'; }else{ $t2=$process['t2']; }
|
||||
if (!isset($process['t3']) || $process['t3'] == ''){ $t3='0'; }else{ $t3=$process['t3']; if ($session->tribe == 3){ $scout=1; } }
|
||||
if (!isset($process['t4']) || $process['t4'] == ''){ $t4='0'; }else{ $t4=$process['t4']; if ($session->tribe == 1 || $session->tribe == 2 || $session->tribe == 4 || $session->tribe == 5){ $scout=1;} }
|
||||
if (!isset($process['t5']) || $process['t5'] == ''){ $t5='0'; }else{ $t5=$process['t5']; }
|
||||
if (!isset($process['t6']) || $process['t6'] == ''){ $t6='0'; }else{ $t6=$process['t6']; }
|
||||
if (!isset($process['t7']) || $process['t7'] == ''){ $t7='0'; }else{ $t7=$process['t7']; }
|
||||
if (!isset($process['t8']) || $process['t8'] == ''){ $t8='0'; }else{ $t8=$process['t8']; }
|
||||
if (!isset($process['t9']) || $process['t9'] == ''){ $t9='0'; }else{ $t9=$process['t9']; }
|
||||
if (!isset($process['t10']) || $process['t10'] == ''){ $t10='0'; }else{ $t10=$process['t10']; }
|
||||
if (!isset($process['t11']) || $process['t11'] == ''){ $t11='0'; }else{ $t11=$process['t11']; $showhero=1;}
|
||||
if ($session->tribe == 3){
|
||||
$totalunits = (!empty($process['t1']) ? $process['t1'] : 0) +
|
||||
(!empty($process['t2']) ? $process['t2'] : 0) +
|
||||
(!empty($process['t4']) ? $process['t4'] : 0) +
|
||||
(!empty($process['t5']) ? $process['t5'] : 0) +
|
||||
(!empty($process['t6']) ? $process['t6'] : 0) +
|
||||
(!empty($process['t7']) ? $process['t7'] : 0) +
|
||||
(!empty($process['t8']) ? $process['t8'] : 0) +
|
||||
(!empty($process['t9']) ? $process['t9'] : 0) +
|
||||
(!empty($process['t10']) ? $process['t10'] : 0) +
|
||||
(!empty($process['t11']) ? $process['t11'] : 0);
|
||||
|
||||
}else{
|
||||
$totalunits = (!empty($process['t1']) ? $process['t1'] : 0) +
|
||||
(!empty($process['t2']) ? $process['t2'] : 0) +
|
||||
(!empty($process['t3']) ? $process['t3'] : 0) +
|
||||
(!empty($process['t5']) ? $process['t5'] : 0) +
|
||||
(!empty($process['t6']) ? $process['t6'] : 0) +
|
||||
(!empty($process['t7']) ? $process['t7'] : 0) +
|
||||
(!empty($process['t8']) ? $process['t8'] : 0) +
|
||||
(!empty($process['t9']) ? $process['t9'] : 0) +
|
||||
(!empty($process['t10']) ? $process['t10'] : 0) +
|
||||
(!empty($process['t11']) ? $process['t11'] : 0);
|
||||
}
|
||||
|
||||
if (isset($scout) && $scout == 1 && isset($totalunits) && $totalunits == 0 && $process['c'] != 2) {
|
||||
$process['c'] = 1;
|
||||
}
|
||||
$id = $database->addA2b($ckey,time(),$process['0'],$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,$process['c']);
|
||||
$id = $database->addA2b($ckey, time(), $process['0'], $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10, $t11, $process['c']);
|
||||
|
||||
|
||||
|
||||
if ($process['c']==1){
|
||||
|
||||
$actionType = "Scout";
|
||||
|
||||
}else if ($process['c']==2){
|
||||
|
||||
$actionType = "Reinforcement";
|
||||
|
||||
}elseif ($process['c']==3){
|
||||
|
||||
$actionType = "Normal attack";
|
||||
|
||||
}else{
|
||||
|
||||
$actionType = "Raid";
|
||||
|
||||
}
|
||||
$actionType = (["Scout", "Reinforcement", "Normal attack", "Raid"])[$process['c'] - 1];
|
||||
|
||||
$uid = $session->uid;
|
||||
|
||||
$tribe = $session->tribe;
|
||||
$start = ($tribe-1)*10+1;
|
||||
$end = ($tribe*10);
|
||||
$start = ($tribe - 1) * 10 + 1;
|
||||
$end = $tribe * 10;
|
||||
?>
|
||||
|
||||
<h1><?php echo $actionType." to ".$process[1]; ?></h1>
|
||||
@@ -204,12 +132,12 @@ $end = ($tribe*10);
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if(isset($kata) AND $process['c']!='2'){?><tr>
|
||||
<?php if(isset($kata) && $process['c'] != 2){?><tr>
|
||||
|
||||
<?php if($process['c']=='3'){ ?><tbody class="cata">
|
||||
<?php if($process['c']== 3){ ?><tbody class="cata">
|
||||
<tr>
|
||||
<th>Destination:</th>
|
||||
<td colspan="<?php if(!empty($process['t11'])){ echo"11"; }else{ echo"10"; } ?>">
|
||||
<td colspan="<?php echo !empty($process['t11']) ? 11 : 10; ?>">
|
||||
|
||||
<select name="ctar1" class="dropdown">
|
||||
<option value="0">Random</option>
|
||||
@@ -356,86 +284,42 @@ $end = ($tribe*10);
|
||||
|
||||
|
||||
<?php
|
||||
$speeds = array();
|
||||
|
||||
$speeds = [];
|
||||
$scout = 1;
|
||||
|
||||
//find slowest unit.
|
||||
|
||||
for($i=1;$i<=11;$i++)
|
||||
|
||||
{
|
||||
|
||||
if (isset($process['t'.$i]))
|
||||
|
||||
{
|
||||
|
||||
if( $process['t'.$i] != '' && $process['t'.$i] > 0)
|
||||
|
||||
|
||||
//find slowest unit.
|
||||
for($i = 1; $i <= 11; $i++)
|
||||
{
|
||||
if (isset($process['t'.$i]))
|
||||
{
|
||||
if(!empty($process['t'.$i]) && $process['t'.$i] > 0)
|
||||
{
|
||||
if ($i < 11) $speeds[] = ${'u'.(($session->tribe-1) * 10 + $i)}['speed'];
|
||||
else
|
||||
{
|
||||
|
||||
if ($i<11)
|
||||
$speeds[] = ${'u'.(($session->tribe-1)*10+$i)}['speed'];
|
||||
else
|
||||
{
|
||||
$hero_unit = $database->getHeroField($uid, 'unit');
|
||||
$speeds[] = ${'u'.$hero_unit}['speed'];
|
||||
}
|
||||
|
||||
if($i != 4)
|
||||
|
||||
$scout = 0;
|
||||
|
||||
$hero_unit = $database->getHeroField($uid, 'unit');
|
||||
$speeds[] = ${'u'.$hero_unit}['speed'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($i != 4) $scout = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($scout)
|
||||
|
||||
$process['c'] = 1;
|
||||
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($scout) $process['c'] = 1;
|
||||
|
||||
$ownVillage = $database->getCoor($village->wid);
|
||||
$from = ['x' => $ownVillage['x'], 'y' => $ownVillage['y']];
|
||||
$to = ['x' => $coor['x'], 'y' => $coor['y']];
|
||||
|
||||
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
|
||||
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<td colspan="<?php if(!empty($process['t11'])){ echo"11"; }else{ echo"10"; } ?>">
|
||||
<td colspan="<?php echo !empty($process['t11']) ? 11 : 10; ?>">
|
||||
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
|
||||
<div class="at">at <span id="tp2"> <?php echo $generator->procMtime(date('U')+$time,9)?></span><span> hours</span></div>
|
||||
<div class="at">at <span id="tp2"> <?php echo $generator->procMtime(date('U') + $time, 9)?></span><span> hours</span></div>
|
||||
|
||||
</td>
|
||||
|
||||
@@ -457,10 +341,10 @@ $end = ($tribe*10);
|
||||
<input name="c" value="3" type="hidden">
|
||||
|
||||
<?php
|
||||
if(($database->hasBeginnerProtection($village->wid)==1)&&($database->hasBeginnerProtection($process['0'])==0)){
|
||||
echo"<span style=\"color: #DD0000\"><b>Caution:</b> Attacking a player will lose the protection!</span>";
|
||||
if($database->hasBeginnerProtection($village->wid) == 1 && $database->hasBeginnerProtection($process['0']) == 0){
|
||||
echo"<span style=\"color: #DD0000\"><b>Caution:</b> Attacking a player will lose the protection!</span>";
|
||||
}
|
||||
if($database->hasBeginnerProtection($process['0'])==1) {
|
||||
if($database->hasBeginnerProtection($process['0']) == 1) {
|
||||
echo"<b>User presently has beginners protection</b>";
|
||||
} else {
|
||||
?>
|
||||
|
||||
@@ -1,450 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
// Temp
|
||||
|
||||
$eigen = $database->getCoor($village->wid);
|
||||
|
||||
$from = array('x'=>$eigen['x'], 'y'=>$eigen['y']);
|
||||
|
||||
$to = array('x'=>$coor['x'], 'y'=>$coor['y']);
|
||||
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($from,$to,300,0)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Temp
|
||||
|
||||
$ckey= $generator->generateRandStr(6);
|
||||
|
||||
|
||||
if (!isset($process['t1']) || $process['t1'] == ''){ $t1='0'; }else{ $t1=$process['t1']; }
|
||||
if (!isset($process['t2']) || $process['t2'] == ''){ $t2='0'; }else{ $t2=$process['t2']; }
|
||||
if (!isset($process['t3']) || $process['t3'] == ''){ $t3='0'; }else{ $t3=$process['t3']; $scout=1; }
|
||||
if (!isset($process['t4']) || $process['t4'] == ''){ $t4='0'; }else{ $t4=$process['t4']; }
|
||||
if (!isset($process['t5']) || $process['t5'] == ''){ $t5='0'; }else{ $t5=$process['t5']; }
|
||||
if (!isset($process['t6']) || $process['t6'] == ''){ $t6='0'; }else{ $t6=$process['t6']; }
|
||||
if (!isset($process['t7']) || $process['t7'] == ''){ $t7='0'; }else{ $t7=$process['t7']; }
|
||||
if (!isset($process['t8']) || $process['t8'] == ''){ $t8='0'; }else{ $t8=$process['t8']; }
|
||||
if (!isset($process['t9']) || $process['t9'] == ''){ $t9='0'; }else{ $t9=$process['t9']; }
|
||||
if (!isset($process['t10']) || $process['t10'] == ''){ $t10='0'; }else{ $t10=$process['t10']; }
|
||||
if (!isset($process['t11']) || $process['t11'] == ''){ $t11='0'; }else{ $t11=$process['t11']; }
|
||||
$totalunits =$process['t1']+$process['t2']+$process['t4']+$process['t5']+$process['t6']+$process['t7']+$process['t8']+$process['t9']+$process['t10']+$process['t11'];
|
||||
if ($scout==1 && $totalunits==0) {
|
||||
|
||||
$process['c'] = 1;
|
||||
|
||||
}
|
||||
$id = $database->addA2b($ckey,time(),$process['0'],$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,$process['c']);
|
||||
|
||||
|
||||
|
||||
if ($process['c']==1){
|
||||
|
||||
$actionType = "Scout";
|
||||
|
||||
}else if ($process['c']==2){
|
||||
|
||||
|
||||
$actionType = "Normal attack";
|
||||
|
||||
}else{
|
||||
|
||||
$actionType = "Raid";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h1><?php echo $actionType." to ".$process[1]; ?></h1>
|
||||
|
||||
<form method="post" action="a2b.php">
|
||||
|
||||
<table id="short_info" cellpadding="1" cellspacing="1">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Destination:</th>
|
||||
|
||||
<td><a href="karte.php?d=<?php echo $process[0]; ?>&c=<?php echo $generator->getMapCheck($process[0]); ?>"><?php echo $process[1]; ?> (<?php echo $coor['x']; ?>|<?php echo $coor['y']; ?>)</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Owner:</th>
|
||||
|
||||
<td><a href="spieler.php?uid=<?php echo $process['2']; ?>"><?php echo $database->getUserField($process['2'],'username',0); ?></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<td><?php echo $process[1]; ?></td>
|
||||
|
||||
<td colspan="<?php if($process['t11'] != ''){ echo"11"; }else{ echo"10"; } ?>"><?php echo $actionType." to ".$process['1']; ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody class="units">
|
||||
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u41" title="Pikeman" alt="Pikeman"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u42" title="Thorned Warrior" alt="Thorned Warrior"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u43" title="Guardsman" alt="Guardsman"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u44" title="Bird of Prey" alt="Bird of Prey"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u45" title="Axerider" alt="Axerider"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u46" title="Natarian Knight" alt="Natarian Knight"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u47" title="War Elephant" alt="War Elephant"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u48" title="Balista" alt="Balista"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u49" title="Natarian Emperor" alt="Natarian Emperor"></td>
|
||||
|
||||
<td><img src="img/x.gif" class="unit u50" title="Settler" alt="Settler"></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Troops</th>
|
||||
|
||||
<td <?php if (!isset($process['t1']) || $process['t1'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t1'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t2']) || $process['t2'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t2'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t3']) || $process['t3'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t3'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t4']) || $process['t4'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t4'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t5']) || $process['t5'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t5'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t6']) || $process['t6'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t6'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t7']) || $process['t7'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t7'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t8']) || $process['t8'] == ''){ echo "class=\"none\">0"; }else{ $kata='1'; echo ">".$process['t8'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t9']) || $process['t9'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t9'];} ?></td>
|
||||
|
||||
<td <?php if (!isset($process['t10']) || $process['t10'] == ''){ echo "class=\"none\">0"; }else{ echo ">".$process['t10'];} ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
<?php if ($process['c']==1){
|
||||
|
||||
?>
|
||||
<tbody class="options">
|
||||
<tr>
|
||||
<th>Options</th>
|
||||
<td colspan="<?php if($process['t11'] != ''){ echo"11"; }else{ echo"10"; } ?>"><input class="radio" name="spy" value="1" checked="checked" type="radio">Scout resources and troops<br>
|
||||
<input class="radio" name="spy" value="2" type="radio">Scout defences and troops </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if(isset($kata) AND $process['c']!='2'){?><tr>
|
||||
|
||||
<?php if($process['c']=='3'){ ?><tbody class="cata">
|
||||
<tr>
|
||||
<th>Destination:</th>
|
||||
<td colspan="<?php if($process['t11'] != ''){ echo"11"; }else{ echo"10"; } ?>">
|
||||
<?php if($building->getTypeLevel(16) == 20) { ?>
|
||||
<select name="ctar2" class="dropdown">
|
||||
<option value="0">Random</option>
|
||||
<?php if($building->getTypeLevel(16) >= 5) { ?>
|
||||
<optgroup label="Resources">
|
||||
<option value="0">Woodcutter</option>
|
||||
<option value="0">Clay Pit</option>
|
||||
<option value="0">Iron Mine</option>
|
||||
<option value="0">Cropland</option>
|
||||
<option value="5">Sawmill</option>
|
||||
<option value="6">Brickyard</option>
|
||||
|
||||
<option value="7">Iron Foundry</option>
|
||||
<option value="8">Grain Mill</option>
|
||||
<option value="9">Bakery</option>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
<?php if($building->getTypeLevel(16) >= 3) { ?>
|
||||
<optgroup label="Infrastructure">
|
||||
<option value="10">Warehouse</option>
|
||||
<option value="11">Granary</option>
|
||||
<?php if($building->getTypeLevel(16) >= 10) { ?>
|
||||
<option value="15">Main building</option>
|
||||
<option value="17">Marketplace</option>
|
||||
<option value="18">Embassy</option>
|
||||
<option value="24">Townhall</option>
|
||||
<option value="25">Residence</option>
|
||||
<option value="26">Palace</option>
|
||||
|
||||
<option value="27">Treasury</option>
|
||||
<option value="28">Trade office</option>
|
||||
<option value="35">Brewery</option>
|
||||
<?php } ?>
|
||||
<option value="38">Great warehouse</option>
|
||||
<option value="39">Great granary</option>
|
||||
<option value="40">Wonder of the World</option>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
<?php if($building->getTypeLevel(16) >= 10) { ?>
|
||||
<optgroup label="Military">
|
||||
<option value="12">Blacksmith</option>
|
||||
<option value="13">Armoury</option>
|
||||
<option value="14">Tournament square</option>
|
||||
<option value="16">Rally point</option>
|
||||
<option value="19">Barracks</option>
|
||||
<option value="20">Stable</option>
|
||||
<option value="21">Workshop</option>
|
||||
|
||||
<option value="22">Academy</option>
|
||||
<option value="29">Great barracks</option>
|
||||
<option value="30">Great stable</option>
|
||||
<option value="37">Hero's mansion</option>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php }?>
|
||||
<select name="ctar1" class="dropdown">
|
||||
<option value="0">Random</option>
|
||||
<?php if($building->getTypeLevel(16) >= 5) { ?>
|
||||
<optgroup label="Resources">
|
||||
<option value="0">Woodcutter</option>
|
||||
<option value="0">Clay Pit</option>
|
||||
<option value="0">Iron Mine</option>
|
||||
<option value="0">Cropland</option>
|
||||
<option value="5">Sawmill</option>
|
||||
<option value="6">Brickyard</option>
|
||||
|
||||
<option value="7">Iron Foundry</option>
|
||||
<option value="8">Grain Mill</option>
|
||||
<option value="9">Bakery</option>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
<?php if($building->getTypeLevel(16) >= 3) { ?>
|
||||
<optgroup label="Infrastructure">
|
||||
<option value="10">Warehouse</option>
|
||||
<option value="11">Granary</option>
|
||||
<?php if($building->getTypeLevel(16) >= 10) { ?>
|
||||
<option value="15">Main building</option>
|
||||
<option value="17">Marketplace</option>
|
||||
<option value="18">Embassy</option>
|
||||
<option value="24">Townhall</option>
|
||||
<option value="25">Residence</option>
|
||||
<option value="26">Palace</option>
|
||||
|
||||
<option value="27">Treasury</option>
|
||||
<option value="28">Trade office</option>
|
||||
<option value="35">Brewery</option>
|
||||
<?php } ?>
|
||||
<option value="38">Great warehouse</option>
|
||||
<option value="39">Great granary</option>
|
||||
<option value="40">Wonder of the World</option>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
<?php if($building->getTypeLevel(16) >= 10) { ?>
|
||||
<optgroup label="Military">
|
||||
<option value="12">Blacksmith</option>
|
||||
<option value="13">Armoury</option>
|
||||
<option value="14">Tournament square</option>
|
||||
<option value="16">Rally point</option>
|
||||
<option value="19">Barracks</option>
|
||||
<option value="20">Stable</option>
|
||||
<option value="21">Workshop</option>
|
||||
|
||||
<option value="22">Academy</option>
|
||||
<option value="29">Great barracks</option>
|
||||
<option value="30">Great stable</option>
|
||||
<option value="37">Hero's mansion</option>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<span class="info">(will be attacked by catapult(s))</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody><?PHP
|
||||
}
|
||||
else if($process['c']=='4')
|
||||
{
|
||||
?><tbody class="infos">
|
||||
<tr>
|
||||
<th>Destination:</th>
|
||||
<td colspan="<?php echo !empty($process['t11']) ? 11 : 10; ?>">
|
||||
<?php
|
||||
|
||||
echo"Warning: Catapult will <b>ONLY</b> shoot with a normal attack (they dont shoot with raids!)";
|
||||
?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Arrived:</th>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$att_tribe = 3;
|
||||
|
||||
$start = ($att_tribe == 1)? 1 : (($att_tribe == 2)? 11: 21);
|
||||
|
||||
$end = ($att_tribe == 1)? 10 : (($att_tribe == 2)? 20: 30);
|
||||
|
||||
$speeds = array();
|
||||
|
||||
$scout = 1;
|
||||
|
||||
//find slowest unit.
|
||||
|
||||
for($i=1;$i<=10;$i++)
|
||||
|
||||
{
|
||||
|
||||
if (isset($process['t'.$i]))
|
||||
|
||||
{
|
||||
|
||||
if( $process['t'.$i] != '' && $process['t'.$i] > 0)
|
||||
|
||||
{
|
||||
|
||||
$speeds[] = ${'u'.(($session->tribe-5)*10+$i)}['speed'];
|
||||
|
||||
if($i != 4)
|
||||
|
||||
$scout = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($scout)
|
||||
|
||||
$process['c'] = 1;
|
||||
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<td colspan="<?php if($process['t11'] != ''){ echo"11"; }else{ echo"10"; } ?>">
|
||||
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
|
||||
<div class="at">at <span id="tp2"> <?php echo $generator->procMtime(date('U')+$time,9)?></span><span> hours</span></div>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<input name="timestamp" value="<?php echo time(); ?>" type="hidden">
|
||||
|
||||
<input name="timestamp_checksum" value="<?php echo $ckey; ?>" type="hidden">
|
||||
|
||||
<input name="ckey" value="<?php echo $id; ?>" type="hidden">
|
||||
|
||||
<input name="id" value="39" type="hidden">
|
||||
|
||||
<input name="a" value="533374" type="hidden">
|
||||
<input name="c" value="3" type="hidden">
|
||||
|
||||
<p class="btn"><input value="ok" name="s1" id="btn_ok"
|
||||
|
||||
class="dynamic_img " src="img/x.gif" alt="OK" type="image" onclick="if (this.disabled==false) {document.getElementsByTagName('form')[0].submit();} this.disabled=true;" onLoad="this.disabled=false;"></p>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$fromcoor = $database->getCoor($enforce['from']);
|
||||
$tocoor = $database->getCoor($enforce['vref']);
|
||||
|
||||
$fromCor = ['x'=>$tocoor['x'], 'y'=>$tocoor['y']];
|
||||
$toCor = ['x'=>$fromcoor['x'], 'y'=>$fromcoor['y']];
|
||||
|
||||
$att_tribe = $database->getUserField($to['owner'],'tribe',0);
|
||||
$start = ($att_tribe - 1) * 10 + 1;
|
||||
$end = $att_tribe * 10;
|
||||
?>
|
||||
|
||||
<h1>Send units back</h1>
|
||||
|
||||
<form method="POST" name="snd" action="a2b.php">
|
||||
|
||||
<table id="short_info" cellpadding="1" cellspacing="1">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Destination:</th>
|
||||
|
||||
<td><a href="karte.php?d=<?php echo $generator->getBaseID($fromcoor['x'],$fromcoor['y']); ?>&c=<?php echo $generator->getMapCheck($generator->getBaseID($fromcoor['x'],$fromcoor['y'])); ?>"><?php echo $to['name']; ?> (<?php echo $fromcoor['x']; ?>|<?php echo $fromcoor['y']; ?>)</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Owner:</th>
|
||||
|
||||
<td><a href="spieler.php?uid=<?php echo $to['owner']; ?>"><?php echo $database->getUserField($to['owner'],'username',0); ?></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="10">Send units back to <?php echo $to['name']; ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<table id="troops" cellpadding="1" cellspacing="1">
|
||||
<tbody><tr>
|
||||
<td class="line-first column-first large"><img class="unit u<?php echo $start; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start); ?>" alt="<?php echo $technology->getUnitName($start); ?>"> <input class="text" <?php if ($enforce['u'.$start] <= 0) {echo ' disabled="disabled"';}?> name="t1" value="<?php echo $enforce['u'.$start]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.$start].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="line-first large"><img class="unit u<?php echo $start + 3; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 3); ?>" alt="<?php echo $technology->getUnitName($start + 3); ?>"> <input class="text" <?php if ($enforce['u'.($start + 3)] <= 0) {echo ' disabled="disabled"';}?> name="t4" value="<?php echo $enforce['u'.($start + 3)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 3)].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-first regular"><img class="unit u<?php echo $start + 6; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 6); ?>" alt="<?php echo $technology->getUnitName($start + 6); ?>"> <input class="text" <?php if ($enforce['u'.($start + 6)] <= 0) {echo ' disabled="disabled"';}?> name="t7" value="<?php echo $enforce['u'.($start + 6)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 6)].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<td class="line-first column-last small"><img class="unit u<?php echo $start + 8; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 8); ?>" alt="<?php echo $technology->getUnitName($start + 8); ?>"> <input class="text" <?php if ($enforce['u'.($start + 8)] <= 0) {echo ' disabled="disabled"';}?> name="t9" value="<?php echo $enforce['u'.($start + 8)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 8)].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column-first large"><img class="unit u<?php echo $start + 1; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 1); ?>" alt="<?php echo $technology->getUnitName($start + 1); ?>"> <input class="text" <?php if ($enforce['u'.($start + 1)] <= 0) {echo ' disabled="disabled"';}?> name="t2" value="<?php echo $enforce['u'.($start + 1)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 1)].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="large"><img class="unit u<?php echo $start + 4; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 4); ?>" alt="<?php echo $technology->getUnitName($start + 4); ?>"> <input class="text" <?php if ($enforce['u'.($start + 4)] <= 0) {echo ' disabled="disabled"';}?> name="t5" value="<?php echo $enforce['u'.($start + 4)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 4)].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="regular"><img class="unit u<?php echo $start + 7; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 7); ?>" alt="<?php echo $technology->getUnitName($start + 7); ?>"> <input class="text" <?php if ($enforce['u'.($start + 7)] <= 0) {echo ' disabled="disabled"';}?> name="t8" value="<?php echo $enforce['u'.($start + 7)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 7)].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="column-last small"><img class="unit u<?php echo $start + 9; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 9); ?>" alt="<?php echo $technology->getUnitName($start + 9); ?>"> <input class="text" <?php if ($enforce['u'.($start + 9)] <= 0) {echo ' disabled="disabled"';}?> name="t10" value="<?php echo $enforce['u'.($start + 9)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 9)].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="line-last column-first large"><img class="unit u<?php echo $start + 2; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 2); ?>" alt="<?php echo $technology->getUnitName($start + 2); ?>"> <input class="text" <?php if ($enforce['u'.($start + 2)] <= 0) {echo ' disabled="disabled"';}?> name="t3" value="<?php echo $enforce['u'.($start + 2)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 2)].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-last large"><img class="unit u<?php echo $start + 5; ?>" src="img/x.gif" title="<?php echo $technology->getUnitName($start + 5); ?>" alt="<?php echo $technology->getUnitName($start + 5); ?>"> <input class="text" <?php if ($enforce['u'.($start + 5)] <= 0) {echo ' disabled="disabled"';}?> name="t6" value="<?php echo $enforce['u'.($start + 5)]; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u'.($start + 5)].")</span></td>";
|
||||
if($enforce['hero']>0){
|
||||
?>
|
||||
<td class="line-last large"><img class="unit uhero" src="img/x.gif" title="Hero" alt="Hero"> <input class="text" name="t11" value="<?php echo $enforce['hero']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['hero'].")</span></td>";
|
||||
}
|
||||
?>
|
||||
<td class="line-last regular"></td>
|
||||
<td class="line-last column-last"></td> </tr>
|
||||
</tbody></table>
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<tbody class="infos">
|
||||
<tr>
|
||||
<th>Arrived:</th>
|
||||
|
||||
<?php
|
||||
$speeds = [];
|
||||
//find slowest unit.
|
||||
for($i = $start; $i <= $end; $i++)
|
||||
{
|
||||
if (isset($enforce['u'.$i]))
|
||||
{
|
||||
if(!empty($enforce['u'.$i]) && $enforce['u'.$i] > 0)
|
||||
{
|
||||
$speeds[] = ${'u'.$i}['speed'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($enforce['hero']>0){
|
||||
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
|
||||
$resulth = mysqli_query($database->dblink,$qh);
|
||||
$hero_f=mysqli_fetch_array($resulth);
|
||||
$hero_unit=$hero_f['unit'];
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
|
||||
$troopsTime = $generator->procDistanceTime($fromCor, $toCor, min($speeds), 1);
|
||||
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
|
||||
?>
|
||||
|
||||
<td colspan="10">
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
<div class="at">at <span id="tp2"> <?php echo date("H:i:s",time() + $time)?></span><span> hours</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<input name="ckey" value="<?php echo $ckey; ?>" type="hidden">
|
||||
<input name="id" value="39" type="hidden">
|
||||
<input name="a" value="533374" type="hidden">
|
||||
<input name="c" value="8" type="hidden">
|
||||
|
||||
|
||||
<p class="btn"><input value="ok" name="s1" id="btn_ok" class="dynamic_img " src="img/x.gif" alt="OK" type="image" onclick="if (this.disabled==false) {document.getElementsByTagName('form')[0].submit();} this.disabled=true;" onLoad="this.disabled=false;"></p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,190 +0,0 @@
|
||||
<?php
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$fromcoor = $database->getCoor($enforce['from']);
|
||||
$tocoor = $database->getCoor($enforce['vref']);
|
||||
|
||||
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
|
||||
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
|
||||
?>
|
||||
|
||||
<h1>Send units back</h1>
|
||||
|
||||
<form method="POST" name="snd" action="a2b.php">
|
||||
|
||||
<table id="short_info" cellpadding="1" cellspacing="1">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Destination:</th>
|
||||
|
||||
<td><a href="karte.php?d=<?php echo $generator->getBaseID($fromcoor['x'],$fromcoor['y']); ?>&c=<?php echo $generator->getMapCheck($generator->getBaseID($fromcoor['x'],$fromcoor['y'])); ?>"><?php echo $to['name']; ?> (<?php echo $fromcoor['x']; ?>|<?php echo $fromcoor['y']; ?>)</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Owner:</th>
|
||||
|
||||
<td><a href="spieler.php?uid=<?php echo $to['owner']; ?>"><?php echo $database->getUserField($to['owner'],'username',0); ?></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="10">Send units back to <?php echo $to['name']; ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<table id="troops" cellpadding="1" cellspacing="1">
|
||||
<tbody><tr>
|
||||
<td class="line-first column-first large"><img class="unit u1" src="img/x.gif" title="Legionnaire" alt="Legionnaire"> <input class="text" <?php if ($enforce['u1']<=0) {echo ' disabled="disabled"';}?> name="t1" value="<?php echo $enforce['u1']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u1'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="line-first large"><img class="unit u4" src="img/x.gif" title="Equites Legati" alt="Equites Legati"> <input class="text" <?php if ($enforce['u4']<=0) {echo ' disabled="disabled"';}?> name="t4" value="<?php echo $enforce['u4']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u4'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-first regular"><img class="unit u7" src="img/x.gif" title="Battering Ram" alt="Battering Ram"> <input class="text" <?php if ($enforce['u7']<=0) {echo ' disabled="disabled"';}?> name="t7" value="<?php echo $enforce['u7']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u7'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<td class="line-first column-last small"><img class="unit u9" src="img/x.gif" title="Senator" alt="Senator"> <input class="text" <?php if ($enforce['u9']<=0) {echo ' disabled="disabled"';}?> name="t9" value="<?php echo $enforce['u9']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u9'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column-first large"><img class="unit u2" src="img/x.gif" title="Praetorian" alt="Praetorian"> <input class="text" <?php if ($enforce['u2']<=0) {echo ' disabled="disabled"';}?> name="t2" value="<?php echo $enforce['u2']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u2'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="large"><img class="unit u5" src="img/x.gif" title="Equites Imperatoris" alt="Equites Imperatoris"> <input class="text" <?php if ($enforce['u5']<=0) {echo ' disabled="disabled"';}?> name="t5" value="<?php echo $enforce['u5']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u5'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="regular"><img class="unit u8" src="img/x.gif" title="Fire Catapult" alt="Fire Catapult"> <input class="text" <?php if ($enforce['u8']<=0) {echo ' disabled="disabled"';}?> name="t8" value="<?php echo $enforce['u8']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u8'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="column-last small"><img class="unit u10" src="img/x.gif" title="Settler" alt="Settler"> <input class="text" <?php if ($enforce['u10']<=0) {echo ' disabled="disabled"';}?> name="t10" value="<?php echo $enforce['u10']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u10'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="line-last column-first large"><img class="unit u3" src="img/x.gif" title="Imperian" alt="Imperian"> <input class="text" <?php if ($enforce['u3']<=0) {echo ' disabled="disabled"';}?> name="t3" value="<?php echo $enforce['u3']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u3'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-last large"><img class="unit u6" src="img/x.gif" title="Equites Caesaris" alt="Equites Caesaris"> <input class="text" <?php if ($enforce['u6']<=0) {echo ' disabled="disabled"';}?> name="t6" value="<?php echo $enforce['u6']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u6'].")</span></td>";
|
||||
if($enforce['hero']>0){
|
||||
?>
|
||||
<td class="line-last large"><img class="unit uhero" src="img/x.gif" title="Hero" alt="Hero"> <input class="text" name="t11" value="<?php echo $enforce['hero']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['hero'].")</span></td>";
|
||||
}
|
||||
?>
|
||||
<td class="line-last regular"></td>
|
||||
<td class="line-last column-last"></td> </tr>
|
||||
</tbody></table>
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<tbody class="infos">
|
||||
<tr>
|
||||
<th>Arrived:</th>
|
||||
|
||||
<?php
|
||||
$att_tribe = $database->getUserField($to['owner'],'tribe',0);
|
||||
$start = ($att_tribe-1)*10+1;
|
||||
$end = ($att_tribe*10);
|
||||
$speeds = array();
|
||||
//find slowest unit.
|
||||
for($i=$start;$i<=$end;$i++)
|
||||
{
|
||||
if (isset($enforce['u'.$i]))
|
||||
{
|
||||
if($enforce['u'.$i]!='' && $enforce['u'.$i]>0)
|
||||
{
|
||||
//$speeds[] = $unitspeeds[$i-2];
|
||||
$speeds[] = ${'u'.$i}['speed'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($enforce['hero']>0){
|
||||
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
|
||||
$resulth = mysqli_query($database->dblink,$qh);
|
||||
$hero_f=mysqli_fetch_array($resulth);
|
||||
$hero_unit=$hero_f['unit'];
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<td colspan="10">
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
<div class="at">at <span id="tp2"> <?php echo date("H:i:s",time()+$time)?></span><span> hours</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<input name="ckey" value="<?php echo $ckey; ?>" type="hidden">
|
||||
<input name="id" value="39" type="hidden">
|
||||
<input name="a" value="533374" type="hidden">
|
||||
<input name="c" value="8" type="hidden">
|
||||
|
||||
|
||||
<p class="btn"><input value="ok" name="s1" id="btn_ok" class="dynamic_img " src="img/x.gif" alt="OK" type="image" onclick="if (this.disabled==false) {document.getElementsByTagName('form')[0].submit();} this.disabled=true;" onLoad="this.disabled=false;"></p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,191 +0,0 @@
|
||||
<?php
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$fromcoor = $database->getCoor($enforce['from']);
|
||||
$tocoor = $database->getCoor($enforce['vref']);
|
||||
|
||||
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
|
||||
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
|
||||
?>
|
||||
|
||||
<h1>Send units back</h1>
|
||||
|
||||
<form method="POST" name="snd" action="a2b.php">
|
||||
|
||||
<table id="short_info" cellpadding="1" cellspacing="1">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Destination:</th>
|
||||
|
||||
<td><a href="karte.php?d=<?php echo $generator->getBaseID($fromcoor['x'],$fromcoor['y']); ?>&c=<?php echo $generator->getMapCheck($generator->getBaseID($fromcoor['x'],$fromcoor['y'])); ?>"><?php echo $to['name']; ?> (<?php echo $fromcoor['x']; ?>|<?php echo $fromcoor['y']; ?>)</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Owner:</th>
|
||||
|
||||
<td><a href="spieler.php?uid=<?php echo $to['owner']; ?>"><?php echo $database->getUserField($to['owner'],'username',0); ?></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="10">Send units back to <?php echo $to['name']; ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<table id="troops" cellpadding="1" cellspacing="1">
|
||||
<tbody><tr>
|
||||
<td class="line-first column-first large"><img class="unit u11" src="img/x.gif" title="Clubswinger" alt="Clubswinger"> <input class="text" <?php if ($enforce['u11']<=0) {echo ' disabled="disabled"';}?> name="t1" value="<?php echo $enforce['u11']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u11'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="line-first large"><img class="unit u14" src="img/x.gif" title="Scout" alt="Scout"> <input class="text" <?php if ($enforce['u14']<=0) {echo ' disabled="disabled"';}?> name="t4" value="<?php echo $enforce['u14']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u14'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-first regular"><img class="unit u17" src="img/x.gif" title="Ram" alt="Ram"> <input class="text" <?php if ($enforce['u17']<=0) {echo ' disabled="disabled"';}?> name="t7" value="<?php echo $enforce['u17']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u17'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<td class="line-first column-last small"><img class="unit u19" src="img/x.gif" title="Chief" alt="Chief"> <input class="text" <?php if ($enforce['u19']<=0) {echo ' disabled="disabled"';}?> name="t9" value="<?php echo $enforce['u19']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u19'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column-first large"><img class="unit u12" src="img/x.gif" title="Spearman" alt="Spearman"> <input class="text" <?php if ($enforce['u12']<=0) {echo ' disabled="disabled"';}?> name="t2" value="<?php echo $enforce['u12']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u12'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="large"><img class="unit u15" src="img/x.gif" title="Paladin" alt="Paladin"> <input class="text" <?php if ($enforce['u15']<=0) {echo ' disabled="disabled"';}?> name="t5" value="<?php echo $enforce['u15']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u15'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="regular"><img class="unit u18" src="img/x.gif" title="Catapult" alt="Catapult"> <input class="text" <?php if ($enforce['u18']<=0) {echo ' disabled="disabled"';}?> name="t8" value="<?php echo $enforce['u18']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u18'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="column-last small"><img class="unit u20" src="img/x.gif" title="Settler" alt="Settler"> <input class="text" <?php if ($enforce['u20']<=0) {echo ' disabled="disabled"';}?> name="t10" value="<?php echo $enforce['u20']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u20'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="line-last column-first large"><img class="unit u13" src="img/x.gif" title="Axeman" alt="Axeman"> <input class="text" <?php if ($enforce['u13']<=0) {echo ' disabled="disabled"';}?> name="t3" value="<?php echo $enforce['u13']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u13'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-last large"><img class="unit u16" src="img/x.gif" title="Teutonic Knight" alt="Teutonic Knight"> <input class="text" <?php if ($enforce['u16']<=0) {echo ' disabled="disabled"';}?> name="t6" value="<?php echo $enforce['u16']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u16'].")</span></td>";
|
||||
if($enforce['hero']>0){
|
||||
?>
|
||||
<td class="line-last large"><img class="unit uhero" src="img/x.gif" title="Hero" alt="Hero"> <input class="text" name="t11" value="<?php echo $enforce['hero']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['hero'].")</span></td>";
|
||||
}
|
||||
?>
|
||||
<td class="line-last regular"></td>
|
||||
<td class="line-last column-last"></td> </tr>
|
||||
</tbody></table>
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<tbody class="infos">
|
||||
<tr>
|
||||
<th>Arrived:</th>
|
||||
|
||||
<?php
|
||||
$att_tribe = $database->getUserField($to['owner'],'tribe',0);
|
||||
$start = ($att_tribe-1)*10+1;
|
||||
$end = ($att_tribe*10);
|
||||
$speeds = array();
|
||||
//find slowest unit.
|
||||
for($i=$start;$i<=$end;$i++)
|
||||
{
|
||||
if (isset($enforce['u'.$i]))
|
||||
{
|
||||
if($enforce['u'.$i]!='' && $enforce['u'.$i]>0)
|
||||
{
|
||||
//$speeds[] = $unitspeeds[$i-2];
|
||||
$speeds[] = ${'u'.$i}['speed'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($enforce['hero']>0){
|
||||
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
|
||||
$resulth = mysqli_query($database->dblink,$qh);
|
||||
$hero_f=mysqli_fetch_array($resulth);
|
||||
$hero_unit=$hero_f['unit'];
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<td colspan="10">
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
<div class="at">at <span id="tp2"> <?php echo date("H:i:s",time()+$time)?></span><span> hours</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<input name="ckey" value="<?php echo $ckey; ?>" type="hidden">
|
||||
<input name="id" value="39" type="hidden">
|
||||
<input name="a" value="533374" type="hidden">
|
||||
<input name="c" value="8" type="hidden">
|
||||
|
||||
|
||||
<p class="btn"><input value="ok" name="s1" id="btn_ok" class="dynamic_img " src="img/x.gif" alt="OK" type="image" onclick="if (this.disabled==false) {document.getElementsByTagName('form')[0].submit();} this.disabled=true;" onLoad="this.disabled=false;"></p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,190 +0,0 @@
|
||||
<?php
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$fromcoor = $database->getCoor($enforce['from']);
|
||||
$tocoor = $database->getCoor($enforce['vref']);
|
||||
|
||||
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
|
||||
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
|
||||
?>
|
||||
|
||||
<h1>Send units back</h1>
|
||||
|
||||
<form method="POST" name="snd" action="a2b.php">
|
||||
|
||||
<table id="short_info" cellpadding="1" cellspacing="1">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Destination:</th>
|
||||
|
||||
<td><a href="karte.php?d=<?php echo $generator->getBaseID($fromcoor['x'],$fromcoor['y']); ?>&c=<?php echo $generator->getMapCheck($generator->getBaseID($fromcoor['x'],$fromcoor['y'])); ?>"><?php echo $to['name']; ?> (<?php echo $fromcoor['x']; ?>|<?php echo $fromcoor['y']; ?>)</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Owner:</th>
|
||||
|
||||
<td><a href="spieler.php?uid=<?php echo $to['owner']; ?>"><?php echo $database->getUserField($to['owner'],'username',0); ?></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="10">Send units back to <?php echo $to['name']; ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<table id="troops" cellpadding="1" cellspacing="1">
|
||||
<tbody><tr>
|
||||
<td class="line-first column-first large"><img class="unit u21" src="img/x.gif" title="Phalanx" alt="Phalanx"> <input class="text" <?php if ($enforce['u21']<=0) {echo ' disabled="disabled"';}?> name="t1" value="<?php echo $enforce['u21']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u21'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="line-first large"><img class="unit u24" src="img/x.gif" title="Theutates Thunder" alt="Theutates Thunder"> <input class="text" <?php if ($enforce['u24']<=0) {echo ' disabled="disabled"';}?> name="t4" value="<?php echo $enforce['u24']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u24'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-first regular"><img class="unit u27" src="img/x.gif" title="Ram" alt="Ram"> <input class="text" <?php if ($enforce['u27']<=0) {echo ' disabled="disabled"';}?> name="t7" value="<?php echo $enforce['u27']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u27'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="line-first column-last small"><img class="unit u29" src="img/x.gif" title="Chieftain" alt="Chieftain"> <input class="text" <?php if ($enforce['u29']<=0) {echo ' disabled="disabled"';}?> name="t9" value="<?php echo $enforce['u29']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u29'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column-first large"><img class="unit u22" src="img/x.gif" title="Swordsman" alt="Swordsman"> <input class="text" <?php if ($enforce['u22']<=0) {echo ' disabled="disabled"';}?> name="t2" value="<?php echo $enforce['u22']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u22'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="large"><img class="unit u25" src="img/x.gif" title="Druidrider" alt="Druidrider"> <input class="text" <?php if ($enforce['u25']<=0) {echo ' disabled="disabled"';}?> name="t5" value="<?php echo $enforce['u25']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u25'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="regular"><img class="unit u28" src="img/x.gif" title="Trebuchet" alt="Trebuchet"> <input class="text" <?php if ($enforce['u28']<=0) {echo ' disabled="disabled"';}?> name="t8" value="<?php echo $enforce['u28']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u28'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="column-last small"><img class="unit u30" src="img/x.gif" title="Settler" alt="Settler"> <input class="text" <?php if ($enforce['u30']<=0) {echo ' disabled="disabled"';}?> name="t10" value="<?php echo $enforce['u30']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u30'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="line-last column-first large"><img class="unit u23" src="img/x.gif" title="Pathfinder" alt="Pathfinder"> <input class="text" <?php if ($enforce['u23']<=0) {echo ' disabled="disabled"';}?> name="t3" value="<?php echo $enforce['u23']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u23'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-last large"><img class="unit u26" src="img/x.gif" title="Haeduan" alt="Haeduan"> <input class="text" <?php if ($enforce['u26']<=0) {echo ' disabled="disabled"';}?> name="t6" value="<?php echo $enforce['u26']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u26'].")</span></td>";
|
||||
if($enforce['hero']>0){
|
||||
?>
|
||||
<td class="line-last large"><img class="unit uhero" src="img/x.gif" title="Hero" alt="Hero"> <input class="text" name="t11" value="<?php echo $enforce['hero']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['hero'].")</span></td>";
|
||||
}
|
||||
?>
|
||||
<td class="line-last regular"></td>
|
||||
<td class="line-last column-last"></td> </tr>
|
||||
</tbody></table>
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<tbody class="infos">
|
||||
<tr>
|
||||
<th>Arrived:</th>
|
||||
|
||||
<?php
|
||||
$att_tribe = $database->getUserField($to['owner'],'tribe',0);
|
||||
$start = ($att_tribe-1)*10+1;
|
||||
$end = ($att_tribe*10);
|
||||
$speeds = array();
|
||||
//find slowest unit.
|
||||
for($i=$start;$i<=$end;$i++)
|
||||
{
|
||||
if (isset($enforce['u'.$i]))
|
||||
{
|
||||
if($enforce['u'.$i]!='' && $enforce['u'.$i]>0)
|
||||
{
|
||||
//$speeds[] = $unitspeeds[$i-2];
|
||||
$speeds[] = ${'u'.$i}['speed'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($enforce['hero']>0){
|
||||
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
|
||||
$resulth = mysqli_query($database->dblink,$qh);
|
||||
$hero_f=mysqli_fetch_array($resulth);
|
||||
$hero_unit=$hero_f['unit'];
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<td colspan="10">
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
<div class="at">at <span id="tp2"> <?php echo date("H:i:s",time()+$time)?></span><span> hours</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<input name="ckey" value="<?php echo $ckey; ?>" type="hidden">
|
||||
<input name="id" value="39" type="hidden">
|
||||
<input name="a" value="533374" type="hidden">
|
||||
<input name="c" value="8" type="hidden">
|
||||
|
||||
|
||||
<p class="btn"><input value="ok" name="s1" id="btn_ok" class="dynamic_img " src="img/x.gif" alt="OK" type="image" onclick="if (this.disabled==false) {document.getElementsByTagName('form')[0].submit();} this.disabled=true;" onLoad="this.disabled=false;"></p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,191 +0,0 @@
|
||||
<?php
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$fromcoor = $database->getCoor($enforce['from']);
|
||||
$tocoor = $database->getCoor($enforce['vref']);
|
||||
|
||||
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
|
||||
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
|
||||
?>
|
||||
|
||||
<h1>Send units back</h1>
|
||||
|
||||
<form method="POST" name="snd" action="a2b.php">
|
||||
|
||||
<table id="short_info" cellpadding="1" cellspacing="1">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Destination:</th>
|
||||
|
||||
<td><a href="karte.php?d=<?php echo $generator->getBaseID($fromcoor['x'],$fromcoor['y']); ?>&c=<?php echo $generator->getMapCheck($generator->getBaseID($fromcoor['x'],$fromcoor['y'])); ?>"><?php echo $to['name']; ?> (<?php echo $fromcoor['x']; ?>|<?php echo $fromcoor['y']; ?>)</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Owner:</th>
|
||||
|
||||
<td><a href="spieler.php?uid=<?php echo $to['owner']; ?>"><?php echo $database->getUserField($to['owner'],'username',0); ?></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="10">Send units back to <?php echo $to['name']; ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<table id="troops" cellpadding="1" cellspacing="1">
|
||||
<tbody><tr>
|
||||
<td class="line-first column-first large"><img class="unit u31" src="img/x.gif" title="Clubswinger" alt="Clubswinger"> <input class="text" <?php if ($enforce['u31']<=0) {echo ' disabled="disabled"';}?> name="t1" value="<?php echo $enforce['u31']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u31'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="line-first large"><img class="unit u34" src="img/x.gif" title="Scout" alt="Scout"> <input class="text" <?php if ($enforce['u14']<=0) {echo ' disabled="disabled"';}?> name="t4" value="<?php echo $enforce['u14']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u34'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-first regular"><img class="unit u37" src="img/x.gif" title="Ram" alt="Ram"> <input class="text" <?php if ($enforce['u17']<=0) {echo ' disabled="disabled"';}?> name="t7" value="<?php echo $enforce['u17']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u37'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<td class="line-first column-last small"><img class="unit u39" src="img/x.gif" title="Chief" alt="Chief"> <input class="text" <?php if ($enforce['u19']<=0) {echo ' disabled="disabled"';}?> name="t9" value="<?php echo $enforce['u19']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u39'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column-first large"><img class="unit u32" src="img/x.gif" title="Spearman" alt="Spearman"> <input class="text" <?php if ($enforce['u12']<=0) {echo ' disabled="disabled"';}?> name="t2" value="<?php echo $enforce['u12']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u32'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="large"><img class="unit u35" src="img/x.gif" title="Paladin" alt="Paladin"> <input class="text" <?php if ($enforce['u15']<=0) {echo ' disabled="disabled"';}?> name="t5" value="<?php echo $enforce['u15']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u35'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="regular"><img class="unit u38" src="img/x.gif" title="Catapult" alt="Catapult"> <input class="text" <?php if ($enforce['u18']<=0) {echo ' disabled="disabled"';}?> name="t8" value="<?php echo $enforce['u18']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u38'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="column-last small"><img class="unit u40" src="img/x.gif" title="Settler" alt="Settler"> <input class="text" <?php if ($enforce['u20']<=0) {echo ' disabled="disabled"';}?> name="t10" value="<?php echo $enforce['u20']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u40'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="line-last column-first large"><img class="unit u33" src="img/x.gif" title="Axeman" alt="Axeman"> <input class="text" <?php if ($enforce['u13']<=0) {echo ' disabled="disabled"';}?> name="t3" value="<?php echo $enforce['u13']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u33'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-last large"><img class="unit u36" src="img/x.gif" title="Teutonic Knight" alt="Teutonic Knight"> <input class="text" <?php if ($enforce['u16']<=0) {echo ' disabled="disabled"';}?> name="t6" value="<?php echo $enforce['u16']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u36'].")</span></td>";
|
||||
if($enforce['hero']>0){
|
||||
?>
|
||||
<td class="line-last large"><img class="unit uhero" src="img/x.gif" title="Hero" alt="Hero"> <input class="text" name="t11" value="<?php echo $enforce['hero']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['hero'].")</span></td>";
|
||||
}
|
||||
?>
|
||||
<td class="line-last regular"></td>
|
||||
<td class="line-last column-last"></td> </tr>
|
||||
</tbody></table>
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<tbody class="infos">
|
||||
<tr>
|
||||
<th>Arrived:</th>
|
||||
|
||||
<?php
|
||||
$att_tribe = $database->getUserField($to['owner'],'tribe',0);
|
||||
$start = ($att_tribe-1)*10+1;
|
||||
$end = ($att_tribe*10);
|
||||
$speeds = array();
|
||||
//find slowest unit.
|
||||
for($i=$start;$i<=$end;$i++)
|
||||
{
|
||||
if (isset($enforce['u'.$i]))
|
||||
{
|
||||
if($enforce['u'.$i]!='' && $enforce['u'.$i]>0)
|
||||
{
|
||||
//$speeds[] = $unitspeeds[$i-2];
|
||||
$speeds[] = ${'u'.$i}['speed'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($enforce['hero']>0){
|
||||
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
|
||||
$resulth = mysqli_query($database->dblink,$qh);
|
||||
$hero_f=mysqli_fetch_array($resulth);
|
||||
$hero_unit=$hero_f['unit'];
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<td colspan="10">
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
<div class="at">at <span id="tp2"> <?php echo date("H:i:s",time()+$time)?></span><span> hours</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<input name="ckey" value="<?php echo $ckey; ?>" type="hidden">
|
||||
<input name="id" value="39" type="hidden">
|
||||
<input name="a" value="533374" type="hidden">
|
||||
<input name="c" value="8" type="hidden">
|
||||
|
||||
|
||||
<p class="btn"><input value="ok" name="s1" id="btn_ok" class="dynamic_img " src="img/x.gif" alt="OK" type="image" onclick="if (this.disabled==false) {document.getElementsByTagName('form')[0].submit();} this.disabled=true;" onLoad="this.disabled=false;"></p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,191 +0,0 @@
|
||||
<?php
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$fromcoor = $database->getCoor($enforce['from']);
|
||||
$tocoor = $database->getCoor($enforce['vref']);
|
||||
|
||||
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
|
||||
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
|
||||
?>
|
||||
|
||||
<h1>Send units back</h1>
|
||||
|
||||
<form method="POST" name="snd" action="a2b.php">
|
||||
|
||||
<table id="short_info" cellpadding="1" cellspacing="1">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Destination:</th>
|
||||
|
||||
<td><a href="karte.php?d=<?php echo $generator->getBaseID($fromcoor['x'],$fromcoor['y']); ?>&c=<?php echo $generator->getMapCheck($generator->getBaseID($fromcoor['x'],$fromcoor['y'])); ?>"><?php echo $to['name']; ?> (<?php echo $fromcoor['x']; ?>|<?php echo $fromcoor['y']; ?>)</a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Owner:</th>
|
||||
|
||||
<td><a href="spieler.php?uid=<?php echo $to['owner']; ?>"><?php echo $database->getUserField($to['owner'],'username',0); ?></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="10">Send units back to <?php echo $to['name']; ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<table id="troops" cellpadding="1" cellspacing="1">
|
||||
<tbody><tr>
|
||||
<td class="line-first column-first large"><img class="unit u41" src="img/x.gif" title="Pikeman" alt="Pikeman"> <input class="text" <?php if ($enforce['u41']<=0) {echo ' disabled="disabled"';}?> name="t1" value="<?php echo $enforce['u41']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u41'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="line-first large"><img class="unit u44" src="img/x.gif" title="Bird of Prey" alt="Bird of Prey"> <input class="text" <?php if ($enforce['u44']<=0) {echo ' disabled="disabled"';}?> name="t4" value="<?php echo $enforce['u44']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u44'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-first regular"><img class="unit u47" src="img/x.gif" title="War Elephant" alt="War Elephant"> <input class="text" <?php if ($enforce['u47']<=0) {echo ' disabled="disabled"';}?> name="t7" value="<?php echo $enforce['u47']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u47'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<td class="line-first column-last small"><img class="unit u49" src="img/x.gif" title="Natarian Emperor" alt="Natarian Emperor"> <input class="text" <?php if ($enforce['u49']<=0) {echo ' disabled="disabled"';}?> name="t9" value="<?php echo $enforce['u49']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u49'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column-first large"><img class="unit u42" src="img/x.gif" title="Thorned Warrior" alt="Thorned Warrior"> <input class="text" <?php if ($enforce['u42']<=0) {echo ' disabled="disabled"';}?> name="t2" value="<?php echo $enforce['u42']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u42'].")</span></td>";
|
||||
|
||||
?>
|
||||
|
||||
<td class="large"><img class="unit u45" src="img/x.gif" title="Axerider" alt="Axerider"> <input class="text" <?php if ($enforce['u45']<=0) {echo ' disabled="disabled"';}?> name="t5" value="<?php echo $enforce['u45']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u45'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="regular"><img class="unit u48" src="img/x.gif" title="Balista" alt="Balista"> <input class="text" <?php if ($enforce['u48']<=0) {echo ' disabled="disabled"';}?> name="t8" value="<?php echo $enforce['u48']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u48'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="column-last small"><img class="unit u40" src="img/x.gif" title="Settler" alt="Settler"> <input class="text" <?php if ($enforce['u50']<=0) {echo ' disabled="disabled"';}?> name="t10" value="<?php echo $enforce['u50']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u50'].")</span></td>";
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="line-last column-first large"><img class="unit u43" src="img/x.gif" title="Guardsman" alt="Guardsman"> <input class="text" <?php if ($enforce['u3']<=0) {echo ' disabled="disabled"';}?> name="t3" value="<?php echo $enforce['u3']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u3'].")</span></td>";
|
||||
|
||||
?>
|
||||
<td class="line-last large"><img class="unit u46" src="img/x.gif" title="Natarian Knight" alt="Natarian Knight"> <input class="text" <?php if ($enforce['u6']<=0) {echo ' disabled="disabled"';}?> name="t6" value="<?php echo $enforce['u6']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['u6'].")</span></td>";
|
||||
if($enforce['hero']>0){
|
||||
?>
|
||||
<td class="line-last large"><img class="unit uhero" src="img/x.gif" title="Hero" alt="Hero"> <input class="text" name="t11" value="<?php echo $enforce['hero']; ?>" maxlength="6" type="text">
|
||||
<?php
|
||||
echo"<span class=\"none\">(".$enforce['hero'].")</span></td>";
|
||||
}
|
||||
?>
|
||||
<td class="line-last regular"></td>
|
||||
<td class="line-last column-last"></td> </tr>
|
||||
</tbody></table>
|
||||
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<tbody class="infos">
|
||||
<tr>
|
||||
<th>Arrived:</th>
|
||||
|
||||
<?php
|
||||
$att_tribe = $session->tribe;
|
||||
$start = ($att_tribe-1)*10+1;
|
||||
$end = ($att_tribe*10);
|
||||
$speeds = array();
|
||||
//find slowest unit.
|
||||
for($i=$start;$i<=$end;$i++)
|
||||
{
|
||||
if (isset($enforce['u'.$i]))
|
||||
{
|
||||
if($enforce['u'.$i]!='' && $enforce['u'.$i]>0)
|
||||
{
|
||||
//$speeds[] = $unitspeeds[$i-2];
|
||||
$speeds[] = ${'u'.$i}['speed'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($enforce['hero']>0){
|
||||
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
|
||||
$resulth = mysqli_query($database->dblink,$qh);
|
||||
$hero_f=mysqli_fetch_array($resulth);
|
||||
$hero_unit=$hero_f['unit'];
|
||||
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
|
||||
}
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
|
||||
if($artefact > 0){
|
||||
$fastertroops = 3;
|
||||
}else if($artefact1 > 0){
|
||||
$fastertroops = 2;
|
||||
}else if($artefact2 > 0){
|
||||
$fastertroops = 1.5;
|
||||
}else{
|
||||
$fastertroops = 1;
|
||||
}
|
||||
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops);
|
||||
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
|
||||
if(count($foolartefact) > 0){
|
||||
foreach($foolartefact as $arte){
|
||||
if($arte['bad_effect'] == 1){
|
||||
$time *= $arte['effect2'];
|
||||
}else{
|
||||
$time /= $arte['effect2'];
|
||||
$time = round($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<td colspan="10">
|
||||
<div class="in">in <?php echo $generator->getTimeFormat($time); ?></div>
|
||||
<div class="at">at <span id="tp2"> <?php echo date("H:i:s",time()+$time)?></span><span> hours</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<input name="ckey" value="<?php echo $ckey; ?>" type="hidden">
|
||||
<input name="id" value="39" type="hidden">
|
||||
<input name="a" value="533374" type="hidden">
|
||||
<input name="c" value="8" type="hidden">
|
||||
|
||||
|
||||
<p class="btn"><input value="ok" name="s1" id="btn_ok" class="dynamic_img " src="img/x.gif" alt="OK" type="image" onclick="if (this.disabled==false) {document.getElementsByTagName('form')[0].submit();} this.disabled=true;" onLoad="this.disabled=false;"></p>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -154,7 +154,7 @@ if(isset($_GET['o'])) {
|
||||
if($enforce['vref'] == $village->wid) {
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$ckey = $w;
|
||||
include ("Templates/a2b/sendback_" . $database->getUserField($to['owner'], 'tribe', 0) . ".tpl");
|
||||
include ("Templates/a2b/sendback.tpl");
|
||||
} else {
|
||||
include ("Templates/a2b/units_" . $session->tribe . ".tpl");
|
||||
include ("Templates/a2b/search.tpl");
|
||||
@@ -166,7 +166,7 @@ if(isset($_GET['o'])) {
|
||||
if($enforce['from'] == $village->wid || $enforceoasis['conqured']==$village->wid) {
|
||||
$to = $database->getVillage($enforce['from']);
|
||||
$ckey = $r;
|
||||
include ("Templates/a2b/sendback_" . $database->getUserField($to['owner'], 'tribe', 0) . ".tpl");
|
||||
include ("Templates/a2b/sendback.tpl");
|
||||
} else {
|
||||
include ("Templates/a2b/units_" . $session->tribe . ".tpl");
|
||||
include ("Templates/a2b/search.tpl");
|
||||
@@ -201,20 +201,10 @@ if(isset($_GET['o'])) {
|
||||
$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($automation->procDistanceTime($p_to,$p_from,min($p_speeds),1)/$p_fastertroops);
|
||||
|
||||
$troopsTime = $automation->procDistanceTime($p_to, $p_from, min($p_speeds), 1);
|
||||
$p_time = $database->getTroopsWalkingTime($p_owner, $prisoner['from'], 2, $troopsTime);
|
||||
|
||||
$p_reference = $database->addAttack($prisoner['from'],$prisoner['t1'],$prisoner['t2'],$prisoner['t3'],$prisoner['t4'],$prisoner['t5'],$prisoner['t6'],$prisoner['t7'],$prisoner['t8'],$prisoner['t9'],$prisoner['t10'],$prisoner['t11'],3,0,0,0,0,0,0,0,0,0,0,0);
|
||||
$database->addMovement(4,$prisoner['wref'],$prisoner['from'],$p_reference,time(),($p_time+time()));
|
||||
$troops = $prisoner['t1']+$prisoner['t2']+$prisoner['t3']+$prisoner['t4']+$prisoner['t5']+$prisoner['t6']+$prisoner['t7']+$prisoner['t8']+$prisoner['t9']+$prisoner['t10']+$prisoner['t11'];
|
||||
|
||||
+3
-12
@@ -517,15 +517,6 @@ if(isset($_POST['password']) && $_POST['password'] != ""){
|
||||
Artefact($uid, 8, 1, FOOL_SMALL, '' . $vname . '', '' . $desc . '', '' . $effect . '', 'typefool.gif');
|
||||
}
|
||||
|
||||
unset($i);
|
||||
unset($vname);
|
||||
unset($effect);
|
||||
$vname = FOOL_SMALLVILLAGE;
|
||||
$effect = '';
|
||||
for($i = 0; $i < 5; $i++) {
|
||||
Artefact($uid, 8, 2, FOOL_SMALL, '' . $vname . '', '' . $desc . '', '' . $effect . '', 'typefool.gif');
|
||||
}
|
||||
|
||||
unset($i);
|
||||
unset($vname);
|
||||
unset($effect);
|
||||
@@ -534,16 +525,16 @@ if(isset($_POST['password']) && $_POST['password'] != ""){
|
||||
for($i = 0; $i < 1; $i++) {
|
||||
Artefact($uid, 8, 3, FOOL_UNIQUE, '' . $vname . '', '' . $desc . '', '' . $effect . '', 'typefool.gif');
|
||||
}
|
||||
|
||||
$myFile = "Templates/text.tpl";
|
||||
$fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: templates/text.tpl");
|
||||
$text = file_get_contents("Templates/text_format.tpl");
|
||||
$text = preg_replace("'%TEKST%'",ARTEFACT ,$text);
|
||||
fwrite($fh, $text);
|
||||
|
||||
$query="UPDATE ".TB_PREFIX."users SET ok = 1";
|
||||
|
||||
$query = "UPDATE ".TB_PREFIX."users SET ok = 1";
|
||||
echo "Done";
|
||||
}elseif(User::exists($database,'Natars')) {
|
||||
}elseif(User::exists($database, 'Natars')) {
|
||||
?>
|
||||
<p>
|
||||
<span class="c2">Error: Natar account already exist</span>
|
||||
|
||||
Reference in New Issue
Block a user