Fix Command Center Capital Change #329

Fix Command Center Capital Change #329 , Fix forum units, fix trooplist on raidlist,
This commit is contained in:
novgorodschi catalin
2026-07-17 08:24:13 +03:00
parent 47f958c430
commit 3d4d5e5cef
18 changed files with 311 additions and 280 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ if($_POST && $_GET['action'] == 'change_capital' && !$village->capital){
}
}
// 3. DELETE CAPITAL-SPECIFIC BUILDINGS FROM THE NEW CAPITAL
$capitalOnly = [29,30,38,39,42];
$capitalOnly = [29,30,38,39,49]; // Great Workshop mutat de la 42 la 49
for($i = 19; $i <= 40; ++$i){
if(in_array((int)$data3['f'.$i.'t'], $capitalOnly)){
mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'t` = 0, `f'.$i.'` = 0 WHERE `vref` = '.$newWid);
+1
View File
@@ -27,6 +27,7 @@ $level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid31[$level]['attri'] : 0;
?>
<div id="build" class="gid31">
<img class="wall-model" src="gpack/travian_default/img/g/g31.gif" alt="<?php echo CITYWALL;?>" style="float:right;margin:2px 0 10px 14px;max-width:110px;height:auto;" />
<h1><?php echo CITYWALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo CITYWALL_DESC;?></p>
+1
View File
@@ -27,6 +27,7 @@ $level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid32[$level]['attri'] : 0;
?>
<div id="build" class="gid32">
<img class="wall-model" src="gpack/travian_default/img/g/g32.gif" alt="<?php echo EARTHWALL;?>" style="float:right;margin:2px 0 10px 14px;max-width:110px;height:auto;" />
<h1><?php echo EARTHWALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo EARTHWALL_DESC;?></p>
+1
View File
@@ -27,6 +27,7 @@ $level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid33[$level]['attri'] : 0;
?>
<div id="build" class="gid33">
<img class="wall-model" src="gpack/travian_default/img/g/g33.gif" alt="<?php echo PALISADE;?>" style="float:right;margin:2px 0 10px 14px;max-width:110px;height:auto;" />
<h1><?php echo PALISADE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo PALISADE_DESC;?></p>
+1
View File
@@ -27,6 +27,7 @@ $level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid42[$level]['attri'] : 0;
?>
<div id="build" class="gid42">
<img class="wall-model" src="gpack/travian_default/img/g/g42.gif" alt="<?php echo STONEWALL;?>" style="float:right;margin:2px 0 10px 14px;max-width:110px;height:auto;" />
<h1><?php echo STONEWALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo STONEWALL_DESC;?></p>
+1
View File
@@ -27,6 +27,7 @@ $level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid43[$level]['attri'] : 0;
?>
<div id="build" class="gid43">
<img class="wall-model" src="gpack/travian_default/img/g/g43.gif" alt="<?php echo MAKESHIFTWALL;?>" style="float:right;margin:2px 0 10px 14px;max-width:110px;height:auto;" />
<h1><?php echo MAKESHIFTWALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo MAKESHIFTWALL_DESC;?></p>
+84 -6
View File
@@ -7,7 +7,7 @@
## Type : BUILDING TEMPLATE ##
## --------------------------------------------------------------------------- ##
## Created by : Shadow ##
## Designed by : Shadow ##
## Developed by : Shadow ##
## --------------------------------------------------------------------------- ##
## Contact : cata7007@gmail.com ##
## Project : TravianZ ##
@@ -19,7 +19,70 @@
## --------------------------------------------------------------------------- ##
#################################################################################
global $village, $id;
global $village, $id, $session, $database, $building, $automation;
if(time() - (!empty($_SESSION['time_p']) ? $_SESSION['time_p'] : 0) > 5){
$_SESSION['time_p'] = '';
$_SESSION['error_p'] = '';
}
// --- CHANGE CAPITAL LOGIC (Command Center = echivalentul Palatului la Huni) ---
if($_POST && isset($_GET['action']) && $_GET['action'] == 'change_capital' && !$village->capital){
$pass = $_POST['pass'];
$query = mysqli_query($database->dblink, 'SELECT password FROM `'.TB_PREFIX.'users` WHERE `id` = '.(int)$session->uid);
$data = mysqli_fetch_assoc($query);
if(password_verify($pass, $data['password'])){
$query1 = mysqli_query($database->dblink, 'SELECT wref FROM `'.TB_PREFIX.'vdata` WHERE `owner` = '.(int)$session->uid.' AND `capital` = 1');
$data1 = mysqli_fetch_assoc($query1);
$oldWid = (int)$data1['wref'];
$newWid = (int)$village->wid;
if($oldWid != $newWid){
$query2 = mysqli_query($database->dblink, 'SELECT * FROM `'.TB_PREFIX.'fdata` WHERE `vref` = '.$oldWid);
$data2 = mysqli_fetch_assoc($query2);
$query3 = mysqli_query($database->dblink, 'SELECT * FROM `'.TB_PREFIX.'fdata` WHERE `vref` = '.$newWid);
$data3 = mysqli_fetch_assoc($query3);
// 1. campurile de resurse ale vechii capitale coboara la nivel 10
for($i = 1; $i <= 18; ++$i){
if($data2['f'.$i] > 10){
mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'` = 10 WHERE `vref` = '.$oldWid);
}
}
// 2. sterge Stonemason's Lodge (34) din vechea capitala
for($i = 19; $i <= 40; ++$i){
if($data2['f'.$i.'t'] == 34){
mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'t` = 0, `f'.$i.'` = 0 WHERE `vref` = '.$oldWid);
}
}
// 3. sterge cladirile capital-only din noua capitala
// (Great Barracks 29, Great Stable 30, Great Granary 38, Great Warehouse 39, Great Workshop 49)
$capitalOnly = [29,30,38,39,49];
for($i = 19; $i <= 40; ++$i){
if(in_array((int)$data3['f'.$i.'t'], $capitalOnly)){
mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'t` = 0, `f'.$i.'` = 0 WHERE `vref` = '.$newWid);
}
}
$database->changeCapital($oldWid, 0);
$database->changeCapital($newWid);
if(!isset($automation)){
include_once("GameEngine/Automation.php");
}
$automation->recountPop($oldWid, false);
$automation->recountPop($newWid, false);
header("location: build.php?gid=44");
exit;
}
}else{
$error = '<br /><font color="red">'.LOGIN_PW_ERROR.'</font><br />';
$_SESSION['error_p'] = $error;
$_SESSION['time_p'] = time();
echo '<script>location.href="build.php?id='.$building->getTypeField(44).'&confirm=yes";</script>';
exit;
}
}
$level = (int)$village->resarray['f'.$id];
?>
@@ -32,10 +95,6 @@ $level = (int)$village->resarray['f'.$id];
<?php echo COMMANDCENTER_DESC;?>
</p>
<?php if ($village->capital == 1):?>
<p class="act"><?php echo CAPITAL;?></p>
<?php endif;?>
<?php include("25_menu.tpl"); ?>
<?php if ($level >= 10):?>
@@ -44,5 +103,24 @@ $level = (int)$village->resarray['f'.$id];
<div class="c"><?php echo COMMANDCENTER_TRAIN_DESC;?></div>
<?php endif;?>
<?php
// --- CAPITALA: afisare stare / schimbare (identic cu Palatul) ---
if($village->capital == 1) {
echo '<p class="none">'.CAPITAL.'</p>';
} else {
if(empty($_GET['confirm'])) {
print '<p><a href="?id='.$building->getTypeField(44).'&confirm=yes">&raquo; '.CHANGE_CAPITAL.'</a></p>';
} else {
print '<p>Are you sure, that you want to change your capital?<br /><b>You can\'t undo this!</b><br />For security you must enter your password to confirm:<br />
<form method="post" action="build.php?id='.$building->getTypeField(44).'&action=change_capital">
'.(isset($_SESSION['error_p']) ? $_SESSION['error_p'] : '').'
'.PASSWORD.': <input type="password" name="pass" /><br />
<input type="image" id="btn_ok" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="'.TRAIN.'" />
</form>
</p>';
}
}
?>
<?php include("upgrade.tpl");?>
</div>
+1
View File
@@ -27,6 +27,7 @@ $level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid47[$level]['attri'] : 0;
?>
<div id="build" class="gid47">
<img class="wall-model" src="gpack/travian_default/img/g/g47.gif" alt="<?php echo DEFENSIVEWALL;?>" style="float:right;margin:2px 0 10px 14px;max-width:110px;height:auto;" />
<h1><?php echo DEFENSIVEWALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo DEFENSIVEWALL_DESC;?></p>
+1
View File
@@ -27,6 +27,7 @@ $level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid50[$level]['attri'] : 0;
?>
<div id="build" class="gid50">
<img class="wall-model" src="gpack/travian_default/img/g/g50.gif" alt="<?php echo BARRICADE;?>" style="float:right;margin:2px 0 10px 14px;max-width:110px;height:auto;" />
<h1><?php echo BARRICADE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo BARRICADE_DESC;?></p>