mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +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'";
|
||||
mysqli_query($this->dblink,$q);
|
||||
self::clearReinforcementsCache();
|
||||
}
|
||||
|
||||
function updateResource($vid, $what, $number) {
|
||||
@@ -5604,6 +5605,15 @@ class MYSQLi_DB implements IDbConnection {
|
||||
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
|
||||
function getVillageMovement($id) {
|
||||
list($id) = $this->escape_input($id);
|
||||
|
||||
@@ -820,16 +820,18 @@ private function trainUnit($unit,$amt,$great=false) {
|
||||
return $generator->procMtime($reqtime);
|
||||
}
|
||||
|
||||
public function checkReinf($id) {
|
||||
public function checkReinf($id, $use_cache = true) {
|
||||
global $database;
|
||||
$enforce=$database->getEnforceArray($id,0);
|
||||
$fail='0';
|
||||
for($i=1; $i<50; $i++){
|
||||
if($enforce['u'.$i.'']>0){
|
||||
$fail='1';
|
||||
}
|
||||
}
|
||||
if ($enforce['hero']>0) $fail='1';
|
||||
$enforce=$database->getEnforceArray($id, 0, $use_cache);
|
||||
$fail=0;
|
||||
|
||||
for ($i=1; $i<50; $i++) {
|
||||
if($enforce['u'.$i.'']>0){
|
||||
$fail=1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($enforce['hero']>0) $fail=1;
|
||||
if($fail==0){
|
||||
$database->deleteReinf($id);
|
||||
}
|
||||
|
||||
+17
-6
@@ -320,7 +320,7 @@ class Units {
|
||||
}
|
||||
$reference = $database->addAttack($enforce['from'],$enforce['u'.$start],$enforce['u'.($start+1)],$enforce['u'.($start+2)],$enforce['u'.($start+3)],$enforce['u'.($start+4)],$enforce['u'.($start+5)],$enforce['u'.($start+6)],$enforce['u'.($start+7)],$enforce['u'.($start+8)],$enforce['u'.($start+9)],$enforce['hero'],2,0,0,0,0);
|
||||
$database->addMovement(4,$enforce['vref'],$enforce['from'],$reference,time(),($time+time()));
|
||||
$database->deleteReinf($enforce['id']);
|
||||
$database->deleteReinf($enforce['id']);
|
||||
}
|
||||
|
||||
private function sendTroops($post) {
|
||||
@@ -620,12 +620,23 @@ class Units {
|
||||
$start = ( $database->getUserField( $to['owner'], 'tribe', 0 ) - 1 ) * 10 + 1;
|
||||
$end = ( $database->getUserField( $to['owner'], 'tribe', 0 ) * 10 );
|
||||
|
||||
$j = '1';
|
||||
$units = [];
|
||||
$amounts = [];
|
||||
$modes = [];
|
||||
|
||||
$j = 1;
|
||||
for ( $i = $start; $i <= $end; $i ++ ) {
|
||||
$database->modifyEnforce( $post['ckey'], $i, $post[ 't' . $j . '' ], 0 );
|
||||
$units[] = $i;
|
||||
$amounts[] = $post[ 't' . $j . '' ];
|
||||
$modes[] = 0;
|
||||
$j ++;
|
||||
}
|
||||
$database->modifyEnforce( $post['ckey'], 'hero', $post['t11'], 0 );
|
||||
|
||||
$units[] = 'hero';
|
||||
$amounts[] = $post['t11'];
|
||||
$modes[] = 0;
|
||||
|
||||
$database->modifyEnforce( $post['ckey'], $units, $amounts, $modes );
|
||||
$j ++;
|
||||
//get cord
|
||||
$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 );
|
||||
$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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;?>" />
|
||||
</a>
|
||||
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
|
||||
@@ -31,7 +35,7 @@ if($units_incoming > 0 or $settlers_incoming > 0 or $oasis_incoming > 0){
|
||||
<?php include("16_incomming.tpl");
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<h4><?php echo TROOPS_IN_THE_VILLAGE;?></h4>
|
||||
<table class="troop_details" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user