mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-21 02:30:58 +00:00
fix: reinforcements sent back do not hide the reinforcements table
This commit is contained in:
@@ -766,6 +766,7 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
|
|
||||||
$q = "DELETE from " . TB_PREFIX . "enforcement where id = '$id'";
|
$q = "DELETE from " . TB_PREFIX . "enforcement where id = '$id'";
|
||||||
mysqli_query($this->dblink,$q);
|
mysqli_query($this->dblink,$q);
|
||||||
|
self::clearReinforcementsCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateResource($vid, $what, $number) {
|
function updateResource($vid, $what, $number) {
|
||||||
@@ -5604,6 +5605,15 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
return self::$villageReinforcementsCache[$id.$mode];
|
return self::$villageReinforcementsCache[$id.$mode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function clearReinforcementsCache() {
|
||||||
|
self::$reinforcementsCache = [];
|
||||||
|
self::$villageReinforcementsCache = [];
|
||||||
|
self::$villageFromReinforcementsCache = [];
|
||||||
|
self::$oasisArrayReinforcementsCache = [];
|
||||||
|
self::$oasisReinforcementsCache = [];
|
||||||
|
self::$unitsCache = [];
|
||||||
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getVillageMovement($id) {
|
function getVillageMovement($id) {
|
||||||
list($id) = $this->escape_input($id);
|
list($id) = $this->escape_input($id);
|
||||||
|
|||||||
@@ -820,16 +820,18 @@ private function trainUnit($unit,$amt,$great=false) {
|
|||||||
return $generator->procMtime($reqtime);
|
return $generator->procMtime($reqtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReinf($id) {
|
public function checkReinf($id, $use_cache = true) {
|
||||||
global $database;
|
global $database;
|
||||||
$enforce=$database->getEnforceArray($id,0);
|
$enforce=$database->getEnforceArray($id, 0, $use_cache);
|
||||||
$fail='0';
|
$fail=0;
|
||||||
for($i=1; $i<50; $i++){
|
|
||||||
if($enforce['u'.$i.'']>0){
|
for ($i=1; $i<50; $i++) {
|
||||||
$fail='1';
|
if($enforce['u'.$i.'']>0){
|
||||||
}
|
$fail=1;
|
||||||
}
|
}
|
||||||
if ($enforce['hero']>0) $fail='1';
|
}
|
||||||
|
|
||||||
|
if ($enforce['hero']>0) $fail=1;
|
||||||
if($fail==0){
|
if($fail==0){
|
||||||
$database->deleteReinf($id);
|
$database->deleteReinf($id);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-5
@@ -620,12 +620,23 @@ class Units {
|
|||||||
$start = ( $database->getUserField( $to['owner'], 'tribe', 0 ) - 1 ) * 10 + 1;
|
$start = ( $database->getUserField( $to['owner'], 'tribe', 0 ) - 1 ) * 10 + 1;
|
||||||
$end = ( $database->getUserField( $to['owner'], 'tribe', 0 ) * 10 );
|
$end = ( $database->getUserField( $to['owner'], 'tribe', 0 ) * 10 );
|
||||||
|
|
||||||
$j = '1';
|
$units = [];
|
||||||
|
$amounts = [];
|
||||||
|
$modes = [];
|
||||||
|
|
||||||
|
$j = 1;
|
||||||
for ( $i = $start; $i <= $end; $i ++ ) {
|
for ( $i = $start; $i <= $end; $i ++ ) {
|
||||||
$database->modifyEnforce( $post['ckey'], $i, $post[ 't' . $j . '' ], 0 );
|
$units[] = $i;
|
||||||
|
$amounts[] = $post[ 't' . $j . '' ];
|
||||||
|
$modes[] = 0;
|
||||||
$j ++;
|
$j ++;
|
||||||
}
|
}
|
||||||
$database->modifyEnforce( $post['ckey'], 'hero', $post['t11'], 0 );
|
|
||||||
|
$units[] = 'hero';
|
||||||
|
$amounts[] = $post['t11'];
|
||||||
|
$modes[] = 0;
|
||||||
|
|
||||||
|
$database->modifyEnforce( $post['ckey'], $units, $amounts, $modes );
|
||||||
$j ++;
|
$j ++;
|
||||||
//get cord
|
//get cord
|
||||||
$from = $database->getVillage( $enforce['from'] );
|
$from = $database->getVillage( $enforce['from'] );
|
||||||
@@ -688,9 +699,9 @@ class Units {
|
|||||||
}
|
}
|
||||||
$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 );
|
$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() ) );
|
$database->addMovement( 4, $village->wid, $enforce['from'], $reference, time(), ( $time + time() ) );
|
||||||
$technology->checkReinf( $post['ckey'] );
|
$technology->checkReinf( $post['ckey'], false );
|
||||||
|
|
||||||
header( "Location: build.php?id=39" );
|
header( "Location: build.php?id=39&refresh=1" );
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<div id="build" class="gid16"><a href="#" onClick="return Popup(16,4);" class="build_logo">
|
<?php
|
||||||
|
if (isset($_GET['refresh'])) {
|
||||||
|
$village->unitarray = $database->getUnit($village->wid, false);
|
||||||
|
}
|
||||||
|
?><div id="build" class="gid16"><a href="#" onClick="return Popup(16,4);" class="build_logo">
|
||||||
<img class="g16" src="img/x.gif" alt="Rally point" title="<?php echo RALLYPOINT;?>" />
|
<img class="g16" src="img/x.gif" alt="Rally point" title="<?php echo RALLYPOINT;?>" />
|
||||||
</a>
|
</a>
|
||||||
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
|
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user