Refactor + BugFix

1. Fix a bug in Admin Panel that you can edit by yourself your rank, now you cannot edit your rank anymore.

2. Now Alliance Leader can edit his own Position

3. Fix negative value on Demolition Building, now in database at lvl is appear new level not -1

4. Refactor Ajax map, now all is alligned (Ajax folder and Map folder)

5. Fix bug from Palace (when change capital now Automation recount population automaticaly on old capital and new capital)
This commit is contained in:
novgorodschi catalin
2026-05-18 09:18:35 +03:00
parent 2bce101a27
commit 55e6dd60b5
96 changed files with 6176 additions and 6763 deletions
+71 -159
View File
@@ -1,170 +1,82 @@
<?php
$units = $database->getMovement(3,$village->wid,0);
$total_for = count($units);
for($y=0;$y<$total_for;$y++){
$session->timer++;
// RALLY POINT WALKING
if($units[$y]['attack_type'] == 2){
$attack_type = REINFORCEMENTFOR;
}
if($units[$y]['attack_type'] == 1){
$attack_type = SCOUTING;
}
if($units[$y]['attack_type'] == 3){
$attack_type = ATTACK_ON;
}
if($units[$y]['attack_type'] == 4){
$attack_type = RAID_ON;
}
$isoasis = $database->isVillageOases($units[$y]['to']);
if ($isoasis ==0){
$to = $database->getMInfo($units[$y]['to']);
} else {
$to = $database->getOMInfo($units[$y]['to']);}
$outgoing = $database->getMovement(3, $village->wid, 0);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="<?php if($units[$y]['t11'] == 0) {echo"10";}else{echo"11";}?>"><a href="karte.php?d=<?php echo $to['wref']."&c=".$generator->getMapCheck($to['wref']); ?>"><?php echo $attack_type." ".$to['name']; ?></a></td>
</tr>
</thead>
<tbody class="units">
<?php
echo "<tr><th>&nbsp;</th>";
for($i=($session->tribe-1)*10+1;$i<=$session->tribe*10;$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($units[$y]['t11'] != 0) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
?>
</tr>
<tr><th><?php echo TROOPS;?></th>
<?php
if($units[$y]['t11'] != 0) {
$end = 12;
}else{
$end = 11;
}
for($i=1;$i<$end;$i++) {
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">";
}
else {
echo "<td>";
}
echo $units[$y]['t'.$i]."</td>";
}
?>
</tr></tbody>
<?php if(NEW_FUNCTIONS_DISPLAY_CATAPULT_TARGET){
if($units[$y]['t8'] > 0 && $units[$y]['attack_type'] == 3 && !$database->isVillageOases($units[$y]['to'])){ ?>
<tbody>
<tr>
<th><?php echo CATAPULT_TARGET;?></th>
<td style="text-align: center" colspan="5">
<?php echo $units[$y]['ctar1'] == 0 ? "Random" : Building::procResType($units[$y]['ctar1']); ?>
</td>
<td style="text-align: center" colspan="<?php if($units[$y]['t11'] == 0) {echo"5";}else{echo"6";}?>">
<?php echo $units[$y]['ctar2'] == 99 ? "Random" : ($units[$y]['ctar2'] == 0 ? "-" : Building::procResType($units[$y]['ctar2'])); ?>
</td>
</tr>
</tbody>
<?php }
} ?>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="<?php if($units[$y]['t11'] == 0) {echo"10";}else{echo"11";}?>">
<?php
echo "<div class=\"in small\"><span id=timer$session->timer>".$generator->getTimeFormat($units[$y]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
if (($units[$y]['starttime']+90)>time()){
?>
<div class="abort"><a href="build.php?id=<?php echo $_GET['id']."&mode=troops&cancel=1&moveid=".$units[$y]['moveid']; ?>"><img src="img/x.gif" class="del" /></a></div>
<?php } ?>
</div>
</td>
</tr>
</tbody>
</table>
<?php
}
?>
<?php
$settlers = $database->getMovement(5,$village->wid,0);
if($settlers){
$total_for = count($settlers);
for($y=0;$y<$total_for;$y++){
<?php foreach ($outgoing as $m):
$session->timer++;
$atk = (int)$m['attack_type'];
if ($atk == 1) $action = SCOUTING;
elseif ($atk == 2) $action = REINFORCEMENTFOR;
elseif ($atk == 3) $action = ATTACK_ON;
elseif ($atk == 4) $action = RAID_ON;
else $action = '';
$to = $database->isVillageOases($m['to'])? $database->getOMInfo($m['to']) : $database->getMInfo($m['to']);
$colspan = $m['t11']? 11 : 10;
$tribe = $session->tribe;
$start = ($tribe-1)*10+1;
$dt = $generator->procMtime($m['endtime']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="10"><a href="karte.php?d=<?php echo $settlers[$y]['to']."&c=".$generator->getMapCheck($settlers[$y]['to']); ?>"><?php echo FOUNDNEWVILLAGE;?></a></td>
</tr>
</thead>
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $village->wid?>&c=<?= $generator->getMapCheck($village->wid)?>"><?= $village->vname?></a></td>
<td colspan="<?= $colspan?>"><a href="karte.php?d=<?= $to['wref']?>&c=<?= $generator->getMapCheck($to['wref'])?>"><?= $action?> <?= $to['name']?></a></td>
</tr></thead>
<tbody class="units">
<?php
$tribe = $session->tribe;
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<tr><th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
?>
</tr>
<tr><th><?php echo TROOPS;?></th>
<?php
for($x=1;$x<=9;$x++) {
$units[$y]['t'.$x]=0;
}
$units[$y]['t10']=3;
for($i=1;$i<=10;$i++) {
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
echo $units[$y]['t'.$i]."</td>";
}
}
?>
</tr></tbody>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="<?php if($units[$y]['t11'] == 0) {echo"10";}else{echo"11";}?>">
<?php
echo "<div class=\"in small\"><span id=timer$session->timer>".$generator->getTimeFormat($settlers[$y]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($settlers[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
if (($settlers[$y]['starttime']+90)>time()){
?>
<div class="abort"><a href="build.php?id=<?php echo $_GET['id']."&mode=troops&cancel=1&moveid=".$settlers[$y]['moveid']; ?>"><img src="img/x.gif" class="del" /></a></div>
<?php } ?>
</div>
</td>
</tr>
</tbody>
<tr><th>&nbsp;</th>
<?php for($i=$start;$i<$start+10;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>" title="<?= $technology->getUnitName($i)?>"></td><?php endfor;?>
<?php if($m['t11']):?><td><img src="img/x.gif" class="unit uhero" title="Hero"></td><?php endif;?>
</tr>
<tr><th><?= TROOPS?></th>
<?php for($i=1;$i<($m['t11']?12:11);$i++): $v = isset($m['t'.$i])? $m['t'.$i] : 0;?><td class="<?= $v==0?'none':''?>"><?= $v?></td><?php endfor;?>
</tr>
</tbody>
<?php if (defined('NEW_FUNCTIONS_DISPLAY_CATAPULT_TARGET') && NEW_FUNCTIONS_DISPLAY_CATAPULT_TARGET && $m['t8']>0 && $atk==3 &&!$database->isVillageOases($m['to'])):?>
<tbody><tr>
<th><?= CATAPULT_TARGET?></th>
<td style="text-align:center" colspan="5"><?= $m['ctar1']==0?'Random':Building::procResType($m['ctar1'])?></td>
<td style="text-align:center" colspan="<?= $m['t11']?6:5?>"><?= $m['ctar2']==99?'Random':($m['ctar2']==0?'-':Building::procResType($m['ctar2']))?></td>
</tr></tbody>
<?php endif;?>
<tbody class="infos"><tr>
<th><?= ARRIVAL?></th>
<td colspan="<?= $colspan?>">
<div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($m['endtime']-time())?></span> h</div>
<div class="at"><?= $dt[0]!='today'?ON.' '.$dt[0].' ':''?><?= AT?> <?= $dt[1]?></div>
<?php if(($m['starttime']+90)>time()):?>
<div class="abort"><a href="build.php?id=<?= $_GET['id']?>&mode=troops&cancel=1&moveid=<?= $m['moveid']?>"><img src="img/x.gif" class="del"></a></div>
<?php endif;?>
</td>
</tr></tbody>
</table>
<?php
}
}
?>
<?php endforeach;?>
<?php $settlers = $database->getMovement(5, $village->wid, 0);
foreach ($settlers as $s):
$session->timer++; $tribe=$session->tribe; $start=($tribe-1)*10+1; $dt=$generator->procMtime($s['endtime']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $village->wid?>&c=<?= $generator->getMapCheck($village->wid)?>"><?= $village->vname?></a></td>
<td colspan="10"><a href="karte.php?d=<?= $s['to']?>&c=<?= $generator->getMapCheck($s['to'])?>"><?= FOUNDNEWVILLAGE?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>"></td><?php endfor;?></tr>
<tr><th><?= TROOPS?></th><?php for($i=1;$i<=10;$i++): $v=($i==10?3:0);?><td class="<?= $v==0?'none':''?>"><?= $v?></td><?php endfor;?></tr>
</tbody>
<tbody class="infos"><tr>
<th><?= ARRIVAL?></th><td colspan="10">
<div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($s['endtime']-time())?></span> h</div>
<div class="at small"><?= $dt[0]!='today'?ON.' '.$dt[0].' ':''?><?= AT?> <?= $dt[1]?></div>
<?php if(($s['starttime']+90)>time()):?>
<div class="abort"><a href="build.php?id=<?= $_GET['id']?>&mode=troops&cancel=1&moveid=<?= $s['moveid']?>"><img src="img/x.gif" class="del"></a></div>
<?php endif;?>
</td>
</tr></tbody>
</table>
<?php endforeach;?>