mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-26 22:46:09 +00:00
Add in ACP T4 Resource Level
Add in ACP T4 Resource Level
This commit is contained in:
@@ -54,7 +54,10 @@ if (isset($_POST['id'], $_POST['hid'])) {
|
||||
|
||||
// Input curat - cast individual, NU escape global
|
||||
$hunit = (int)($_POST['hunit'] ?? 0);
|
||||
$hlvl = max(0, min(100, (int)($_POST['hlvl'] ?? 0)));
|
||||
// plafonul vine din tabelul de niveluri (ultimul index e santinela), ca sa
|
||||
// urmeze automat extinderea facuta pentru al 6-lea atribut
|
||||
$hMaxLevel = isset($hero_levels) ? max(array_keys($hero_levels)) - 1 : 119;
|
||||
$hlvl = max(0, min($hMaxLevel, (int)($_POST['hlvl'] ?? 0)));
|
||||
$exp = (int)($_POST['exp'] ?? 0);
|
||||
$hhealth = (float)($_POST['hhealth'] ?? 100);
|
||||
$hatk = (int)($_POST['hatk'] ?? 0);
|
||||
@@ -62,6 +65,22 @@ if (isset($_POST['id'], $_POST['hid'])) {
|
||||
$hob = (int)($_POST['hob'] ?? 0);
|
||||
$hdb = (int)($_POST['hdb'] ?? 0);
|
||||
$hrege = (int)($_POST['hrege'] ?? 0);
|
||||
$hres = (int)($_POST['hres'] ?? 0);
|
||||
$hrestype = (int)($_POST['hrestype'] ?? 0);
|
||||
|
||||
// atributele nu pot depasi 100 fiecare (la fel ca in joc)
|
||||
foreach (['hatk','hdef','hob','hdb','hrege','hres'] as $hAttr) {
|
||||
if ($$hAttr < 0) { $$hAttr = 0; }
|
||||
if ($$hAttr > 100) { $$hAttr = 100; }
|
||||
}
|
||||
|
||||
if ($hrestype < 0 || $hrestype > 4) { $hrestype = 0; }
|
||||
|
||||
// Coloanele T4 se scriu doar daca exista: pe un server care nu a rulat
|
||||
// add-hero-resources.sql, interogarea ar esua si s-ar pierde TOATA salvarea.
|
||||
$hHasResCols = false;
|
||||
$hColCheck = mysqli_query($database->dblink, "SHOW COLUMNS FROM " . TB_PREFIX . "hero LIKE 'resources'");
|
||||
if ($hColCheck && mysqli_num_rows($hColCheck) > 0) { $hHasResCols = true; }
|
||||
|
||||
$experience = isset($hero_levels[$hlvl]) ? (int)$hero_levels[$hlvl] : 0;
|
||||
$hnameEsc = $database->escape($hname);
|
||||
@@ -77,7 +96,11 @@ if (isset($_POST['id'], $_POST['hid'])) {
|
||||
defence = $hdef,
|
||||
attackbonus = $hob,
|
||||
defencebonus = $hdb,
|
||||
regeneration = $hrege
|
||||
regeneration = $hrege"
|
||||
. ($hHasResCols ? ",
|
||||
resources = $hres,
|
||||
res_type = $hrestype" : "")
|
||||
. "
|
||||
WHERE heroid = $hid AND uid = $id";
|
||||
|
||||
$return = $database->query($q);
|
||||
|
||||
@@ -204,10 +204,19 @@ trait AutomationHero {
|
||||
$herolevel = $hdata['level'];
|
||||
$newLevel = - 1;
|
||||
$scorePoints = false;
|
||||
for ($i = $herolevel + 1; $i < 100; $i++){
|
||||
// Nivelul maxim se ia din tabelul de experienta, nu mai e scris in cod:
|
||||
// ultimul index e o santinela care repeta valoarea nivelului maxim real.
|
||||
// Asa, extinderea tabelului (facuta pentru al 6-lea atribut, "Resources")
|
||||
// ridica automat si plafonul de nivel.
|
||||
$maxLevel = max(array_keys($hero_levels)) - 1;
|
||||
|
||||
for ($i = $herolevel + 1; $i <= $maxLevel; $i++){
|
||||
if($hdata['experience'] >= $hero_levels[$i]){
|
||||
$newLevel = $i;
|
||||
if ($i < 99) $scorePoints = true;
|
||||
// punctele se acorda pentru FIECARE nivel, inclusiv ultimul:
|
||||
// 5 initiale + 119 niveluri x 5 = 600, adica exact cat trebuie
|
||||
// pentru 6 atribute duse la maximul de 100
|
||||
$scorePoints = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
## --------------------------------------------------------------------------- ##
|
||||
#################################################################################
|
||||
|
||||
$hero_levels = array(0 => 0, 100, 300, 600, 1000, 1500, 2100, 2800, 3600, 4500, 5500, 6600, 7800, 9100, 10500, 12000, 13600, 15300, 17100, 19000, 21000, 23100, 25300, 27600, 30000, 32500, 35100, 37800, 40600, 43500, 46500, 49600, 52800, 56100, 59500, 63000, 66600, 70300, 74100, 78000, 82000, 86100, 90300, 94600, 99000, 103500, 108100, 112800, 117600, 122500, 127500, 132600, 137800, 143100, 148500, 154000, 159600, 165300, 171100, 177000, 183000, 189100, 195300, 201600, 208000, 214500, 221100, 227800,
|
||||
234600, 241500, 248500, 255600, 262800, 270100, 277500, 285000, 292600, 300300, 308100, 316000, 324000, 332100, 340300, 348600, 357000, 365500, 374100, 382800, 391600, 400500, 409500, 418600, 427800, 437100, 446500, 456000, 465600, 475300, 485100, 495000, 495000);
|
||||
$hero_levels = array(0 => 0, 100, 300, 600, 1000, 1500, 2100, 2800, 3600, 4500, 5500, 6600, 7800, 9100, 10500, 12000, 13600, 15300, 17100, 19000, 21000, 23100, 25300, 27600, 30000, 32500, 35100, 37800, 40600, 43500, 46500, 49600, 52800, 56100, 59500, 63000, 66600, 70300, 74100, 78000, 82000, 86100, 90300, 94600, 99000, 103500, 108100, 112800, 117600, 122500, 127500, 132600, 137800, 143100, 148500, 154000, 159600, 165300, 171100, 177000, 183000, 189100, 195300, 201600, 208000, 214500, 221100, 227800, 234600, 241500, 248500, 255600, 262800, 270100, 277500, 285000, 292600, 300300, 308100, 316000, 324000, 332100, 340300, 348600, 357000, 365500, 374100, 382800, 391600, 400500, 409500, 418600, 427800, 437100, 446500, 456000, 465600, 475300, 485100, 495000, 505000, 515100, 525300, 535600, 546000, 556500, 567100, 577800, 588600, 599500, 610500, 621600, 632800, 644100, 655500, 667000, 678600, 690300, 702100, 714000, 714000);
|
||||
|
||||
|
||||
//ROMAN UNITS
|
||||
|
||||
Reference in New Issue
Block a user