escape(stripslashes($_POST['name'])); mysqli_query($database->dblink, "UPDATE " . TB_PREFIX . "hero SET `name`='" . $_POST['name'] . "' where `uid`='" . $database->escape($session->uid) . "' AND dead = 0") or die("ERROR:" . mysqli_error($database->dblink)); $hero_info['name'] = $_POST['name']; echo "" . NAME_CHANGED . ""; } // Explicit lookup: action from URL (?add=...) => column from `hero` table. // Used for both "(+)" links in the table and for the update // in the DB below. Single source of truth instead of 5 identical blocks. $heroStatColumns = [ 'off' => 'attack', 'deff' => 'defence', 'obonus' => 'attackbonus', 'dbonus' => 'defencebonus', 'reg' => 'regeneration', ]; // Atributul "Resources" apartine sistemului de erou T4: apare si poate primi // puncte doar cand functiile T4 sunt pornite. Tot flag-ul asta decide si daca // productia se aplica (vezi Village::loadHeroProd), deci cele doua nu pot ajunge // in dezacord - altfel jucatorii ar investi in ceva care nu produce nimic. // In plus, cu flag-ul stins interogarile de mai jos nu mai ating coloanele // `resources` / `res_type`, deci pagina merge si pe un server care inca nu a // rulat scriptul add-hero-resources.sql. $t4HeroRes = defined('NEW_FUNCTIONS_HERO_T4') && NEW_FUNCTIONS_HERO_T4; if ($t4HeroRes) { $heroStatColumns['res'] = 'resources'; } // Render the "(+)" link for a stat, or "(+)" uneditable // if the hero has no more points or the stat is already at the top (100). // Identical behavior to the original 5 if/else blocks. $renderAddLink = function ($action) use ($hero_info, $id, $heroStatColumns) { $field = $heroStatColumns[$action]; if ($hero_info['points'] > 0 && $hero_info[$field] < 100) { // class + data-* pentru JS; linkul ramane un GET valid, deci fara JS // pagina se comporta exact ca inainte (un punct per click, cu refresh). return "(+)"; } return "(+)"; }; ?>
| uid."\">"; }else{ echo "".$hero_info['name'].""; } ?> ( getUnitName($hero_info['unit'])."\" title=\"".$technology->getUnitName($hero_info['unit'])."\" /> ".$technology->getUnitName($hero_info['unit']); ?> ) | |||||||||
|---|---|---|---|---|---|---|---|---|---|
![]() |
|||||||||
" title="" /> |
|||||||||
| % | ![]() |
||||||||
| % | ![]() |
||||||||
| / | ![]() |
||||||||
'r1', 2 => 'r2', 3 => 'r3', 4 => 'r4'];
if ($t4ResType >= 1 && $t4ResType <= 4) {
echo ' ';
echo (int) round($t4ResPoints * $t4PerOne * SPEED);
} else {
foreach ($t4ResIcons as $t4Ico) {
echo ' '
. (int) round($t4ResPoints * $t4PerAll * SPEED) . ' ';
}
}
?>
/ |
![]() |
||||||||
| : | % | ![]() |
: | 100% | ![]() |
||||