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
+518 -836
View File
File diff suppressed because it is too large Load Diff
+15 -5
View File
@@ -3383,11 +3383,15 @@ class Automation {
$varray = $database->getDemolition();
foreach($varray as $vil) {
if ($vil['lvl'] < 0) {
$database->delDemolition($vil['vref'], true);
continue;
}
if ($vil['timetofinish'] <= time()) {
$type = $database->getFieldType($vil['vref'],$vil['buildnumber']);
$level = $database->getFieldLevel($vil['vref'],$vil['buildnumber']);
if ($level < 0) $level = 0;
$newLevel = max(0, $level - 1);
$buildarray = $GLOBALS["bid".$type];
@@ -3395,7 +3399,7 @@ class Automation {
$database->query("
UPDATE ".TB_PREFIX."vdata
SET
`maxstore` = IF(`maxstore` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxstore` - ".$buildarray[$level]['attri']."),
`maxstore` = IF(`maxstore` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxstore` - ".$buildarray[$level]['attri'].")
WHERE
wref=".(int) $vil['vref']);
}
@@ -3404,7 +3408,7 @@ class Automation {
$database->query("
UPDATE ".TB_PREFIX."vdata
SET
`maxcrop` = IF(`maxcrop` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxcrop` - ".$buildarray[$level]['attri']."),
`maxcrop` = IF(`maxcrop` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxcrop` - ".$buildarray[$level]['attri'].")
WHERE
wref=".(int) $vil['vref']);
}
@@ -3414,10 +3418,16 @@ class Automation {
if ($database->getVillageField($vil['vref'], 'natar') == 1 && $type == 40) $clear = ""; //fix by ronix - fixed by iopietro
$q = "UPDATE ".TB_PREFIX."fdata SET f".$vil['buildnumber']."=".(($level - 1 >= 0) ? $level - 1 : 0).$clear." WHERE vref=".(int) $vil['vref'];
$q = "
UPDATE ".TB_PREFIX."fdata
SET
f".$vil['buildnumber']."=".$newLevel."
".$clear."
WHERE
vref=".(int)$vil['vref'];
$database->query($q);
$pop = $this->getPop($type, $level - 1);
$pop = $this->getPop($type, $newLevel);
$database->modifyPop($vil['vref'], $pop[0], 1);
$this->procClimbers($database->getVillageField($vil['vref'], 'owner'));
$database->delDemolition($vil['vref'], true);
+1 -1
View File
@@ -2022,4 +2022,4 @@ class Building {
}
};
?>
?>
+8 -1
View File
@@ -4774,7 +4774,14 @@ References: User ID/Message ID, Mode
$q = "DELETE FROM ".TB_PREFIX."bdata WHERE field=$field AND wid=$wid";
mysqli_query($this->dblink,$q);
$uprequire = $building->resourceRequired($field,$village->resarray['f'.$field.'t'],0);
$q = "INSERT INTO ".TB_PREFIX."demolition VALUES (".$wid.",".$field.",".($fLevel-1).",".(time()+floor($uprequire['time']/2)).")";
$newLevel = max(0, $fLevel - 1);
$q = "INSERT INTO ".TB_PREFIX."demolition VALUES (
".$wid.",
".$field.",
".$newLevel.",
".(time() + floor($uprequire['time'] / 2))."
)";
mysqli_query($this->dblink,$q);
return true;