mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-28 22:27:15 +00:00
Add in ACP T4 Resource Level
Add in ACP T4 Resource Level
This commit is contained in:
@@ -56,6 +56,13 @@ if(isset($_GET['uid'])){
|
|||||||
.hero-head a:hover{text-decoration:underline;}
|
.hero-head a:hover{text-decoration:underline;}
|
||||||
|
|
||||||
.card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.04);margin-bottom:12px;}
|
.card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.04);margin-bottom:12px;}
|
||||||
|
/* FIX: pe tema inchisa a panoului (admin_dark.css, incarcat ultimul) cardurile
|
||||||
|
albe mosteneau text deschis si deveneau ilizibile. Fortam culori inchise pe
|
||||||
|
tot ce e in interiorul lor. */
|
||||||
|
.card, .card .body, .card .body div, .card .body b, .card .body span,
|
||||||
|
.card .form-row, .card .form-row .field, .card table, .card td, .card th{color:#1f2937;}
|
||||||
|
.card .body{color:#1f2937;}
|
||||||
|
.card .body b{color:#0f172a;}
|
||||||
.card h3{margin:0;padding:9px 14px;background:#f8fafc;border-bottom:1px solid #e5e7eb;font-size:12px;text-transform:uppercase;color:#475569;letter-spacing:.4px;font-weight:600;display:flex;align-items:center;gap:6px;}
|
.card h3{margin:0;padding:9px 14px;background:#f8fafc;border-bottom:1px solid #e5e7eb;font-size:12px;text-transform:uppercase;color:#475569;letter-spacing:.4px;font-weight:600;display:flex;align-items:center;gap:6px;}
|
||||||
.card.body{padding:14px;}
|
.card.body{padding:14px;}
|
||||||
|
|
||||||
@@ -146,12 +153,36 @@ function go_url(url){ location=url; return false; }
|
|||||||
<div class="unit-preview"><span id="unt"><img class="unit u<?php echo $hero['unit'];?>" src="img/x.gif"></span>
|
<div class="unit-preview"><span id="unt"><img class="unit u<?php echo $hero['unit'];?>" src="img/x.gif"></span>
|
||||||
<select name="hunit" onchange="check_unit(this)" style="flex:1;padding:6px 8px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#0f172a;font-size:13px;">
|
<select name="hunit" onchange="check_unit(this)" style="flex:1;padding:6px 8px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#0f172a;font-size:13px;">
|
||||||
<?php
|
<?php
|
||||||
// sloturile care au erou definit in hero_full.php (generic pentru toate triburile)
|
/**
|
||||||
for($i=1;$i<7;$i++){
|
* Unitatile care pot fi erou pentru tribul jucatorului.
|
||||||
$v=$utribe+$i;
|
*
|
||||||
if(!isset(${'h'.$v})) continue;
|
* Inainte se citeau prin variabile dinamice (${'h'.$v}), ceea ce
|
||||||
echo "<option value='$v'".($hero['unit']==$v?' selected':'').">".$unarray[$v]."</option>";
|
* facea greu de vazut ce se intampla si ascundea erorile daca
|
||||||
}?>
|
* lipsea o definitie. Acum construim o lista explicita: un slot
|
||||||
|
* intra doar daca are si datele de erou (hN), si un nume.
|
||||||
|
*/
|
||||||
|
$eHeroUnits = [];
|
||||||
|
|
||||||
|
for ($i = 1; $i < 7; $i++) {
|
||||||
|
$eUnitId = $utribe + $i;
|
||||||
|
|
||||||
|
if (!isset($GLOBALS['h' . $eUnitId]) || !isset($unarray[$eUnitId])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$eHeroUnits[$eUnitId] = $unarray[$eUnitId];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$eHeroUnits) {
|
||||||
|
echo "<option value='" . (int) $hero['unit'] . "'>#" . (int) $hero['unit'] . "</option>";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($eHeroUnits as $eUnitId => $eUnitName) {
|
||||||
|
echo "<option value='" . $eUnitId . "'"
|
||||||
|
. ((int) $hero['unit'] === $eUnitId ? " selected" : "") . ">"
|
||||||
|
. $eUnitName . "</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</select></div>
|
</select></div>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div class="form-row"><label>❤ Health</label><div class="field"><input name="hhealth" type="text" value="<?php echo round($hero['health']);?>" style="width:80px;"> %</div></div>
|
<div class="form-row"><label>❤ Health</label><div class="field"><input name="hhealth" type="text" value="<?php echo round($hero['health']);?>" style="width:80px;"> %</div></div>
|
||||||
@@ -162,11 +193,33 @@ function go_url(url){ location=url; return false; }
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<h3>📈 Current Stats</h3>
|
<h3>📈 Current Stats</h3>
|
||||||
<div class="body" style="font-size:12px;line-height:1.8;">
|
<div class="body" style="font-size:12px;line-height:1.8;">
|
||||||
<div>Level: <b><?php echo $hero['level'];?></b> | Points: <b><?php echo $hero['atk']+$hero['di']+$hero['dc'];?></b></div>
|
<?php
|
||||||
|
// punctele nefolosite, nu suma statisticilor calculate (era gresit)
|
||||||
|
$eMaxLevel = isset($hero_levels) ? max(array_keys($hero_levels)) - 1 : 119;
|
||||||
|
$eUsed = (int)$hero['attack'] + (int)$hero['defence'] + (int)$hero['attackbonus']
|
||||||
|
+ (int)$hero['defencebonus'] + (int)$hero['regeneration'] + (int)($hero['resources'] ?? 0);
|
||||||
|
$eTotal = 5 + ($hero['level'] * 5);
|
||||||
|
$eFree = max(0, $eTotal - $eUsed);
|
||||||
|
?>
|
||||||
|
<div>Level: <b><?php echo $hero['level'];?></b> / <?php echo $eMaxLevel; ?>
|
||||||
|
| Points used: <b><?php echo $eUsed; ?></b> of <b><?php echo $eTotal; ?></b>
|
||||||
|
(free: <b><?php echo $eFree; ?></b>)</div>
|
||||||
<div>Offence: <b><?php echo $hero['atk'];?></b> (Lv <?php echo $hero['attack'];?>)</div>
|
<div>Offence: <b><?php echo $hero['atk'];?></b> (Lv <?php echo $hero['attack'];?>)</div>
|
||||||
<div>Defence: <b><?php echo $hero['di']."/".$hero['dc'];?></b> (Lv <?php echo $hero['defence'];?>)</div>
|
<div>Defence: <b><?php echo $hero['di']."/".$hero['dc'];?></b> (Lv <?php echo $hero['defence'];?>)</div>
|
||||||
<div>Off-Bonus: <b><?php echo ($hero['ob']-1)*100;?>%</b> | Def-Bonus: <b><?php echo ($hero['db']-1)*100;?>%</b></div>
|
<div>Off-Bonus: <b><?php echo ($hero['ob']-1)*100;?>%</b> | Def-Bonus: <b><?php echo ($hero['db']-1)*100;?>%</b></div>
|
||||||
<div>Regen: <b><?php echo $hero['regeneration']*5*SPEED;?>/day</b></div>
|
<div>Regen: <b><?php echo $hero['regeneration']*5*SPEED;?>/day</b></div>
|
||||||
|
<?php if (defined('NEW_FUNCTIONS_HERO_T4') && NEW_FUNCTIONS_HERO_T4) {
|
||||||
|
$eResPts = (int)($hero['resources'] ?? 0);
|
||||||
|
$eResType = (int)($hero['res_type'] ?? 0);
|
||||||
|
$ePerAll = defined('HERO_RES_PER_POINT_ALL') ? (int) HERO_RES_PER_POINT_ALL : 3;
|
||||||
|
$ePerOne = defined('HERO_RES_PER_POINT_ONE') ? (int) HERO_RES_PER_POINT_ONE : 10;
|
||||||
|
$eNames = [0=>'all resources',1=>'lumber',2=>'clay',3=>'iron',4=>'crop'];
|
||||||
|
$eAmount = ($eResType>=1 && $eResType<=4)
|
||||||
|
? (int) round($eResPts * $ePerOne * SPEED)
|
||||||
|
: (int) round($eResPts * $ePerAll * SPEED);
|
||||||
|
?>
|
||||||
|
<div>Resources: <b><?php echo $eAmount; ?>/h</b> (<?php echo $eNames[$eResType] ?? 'all resources'; ?>, Lv <?php echo $eResPts; ?>)</div>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -175,14 +228,25 @@ function go_url(url){ location=url; return false; }
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<?php if($isMax):?>
|
<?php if($isMax):?>
|
||||||
<div style="text-align:center;padding:8px;background:#fef3c7;border:1px solid #fde68a;border-radius:6px;color:#92400e;font-size:12px;margin-bottom:10px;">
|
<div style="text-align:center;padding:8px;background:#fef3c7;border:1px solid #fde68a;border-radius:6px;color:#92400e;font-size:12px;margin-bottom:10px;">
|
||||||
⚠ Hero este Level 99 — nu mai poți adăuga puncte.
|
⚠ Hero is at the maximum level (<?php echo isset($hero_levels) ? max(array_keys($hero_levels)) - 1 : 119; ?>) — no more points can be added.
|
||||||
</div>
|
</div>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
<table class="stat-table">
|
<table class="stat-table">
|
||||||
<thead><tr><th>Attribute</th><th style="width:80px;text-align:center;">Current</th><th style="width:120px;text-align:center;">Add</th><th style="width:60px;text-align:center;">New</th></tr></thead>
|
<thead><tr><th>Attribute</th><th style="width:80px;text-align:center;">Current</th><th style="width:120px;text-align:center;">Add</th><th style="width:60px;text-align:center;">New</th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$attrs=[['hatk','Offence',$hero['attack']],['hdef','Defence',$hero['defence']],['hob','Off-Bonus',$hero['attackbonus']],['hdb','Def-Bonus',$hero['defencebonus']],['hrege','Regeneration',$hero['regeneration']]];
|
$attrs = [
|
||||||
|
['hatk', 'Offence', $hero['attack']],
|
||||||
|
['hdef', 'Defence', $hero['defence']],
|
||||||
|
['hob', 'Off-Bonus', $hero['attackbonus']],
|
||||||
|
['hdb', 'Def-Bonus', $hero['defencebonus']],
|
||||||
|
['hrege', 'Regeneration', $hero['regeneration']],
|
||||||
|
];
|
||||||
|
|
||||||
|
// al 6-lea atribut exista doar cu functiile T4 pornite
|
||||||
|
if (defined('NEW_FUNCTIONS_HERO_T4') && NEW_FUNCTIONS_HERO_T4) {
|
||||||
|
$attrs[] = ['hres', 'Resources', (int)($hero['resources'] ?? 0)];
|
||||||
|
}
|
||||||
foreach($attrs as $a){
|
foreach($attrs as $a){
|
||||||
$plusBtn = $isMax? "<button type='button' class='btn-step' disabled>+</button>" : "<button type='button' class='btn-step' onclick=\"return changeValue(1,'{$a[0]}')\">+</button>";
|
$plusBtn = $isMax? "<button type='button' class='btn-step' disabled>+</button>" : "<button type='button' class='btn-step' onclick=\"return changeValue(1,'{$a[0]}')\">+</button>";
|
||||||
echo '<tr><td>'.$a[1].'</td><td style="text-align:center;">'.$a[2].'</td><td><div class="ctrl"><span id="'.$a[0].'0"><button type="button" class="btn-step" disabled>−</button></span><div class="val-box" id="'.$a[0].'2">0</div><span id="'.$a[0].'1">'.$plusBtn.'</span></div></td><td><input id="'.$a[0].'" name="'.$a[0].'" type="hidden" value="0"><span id="'.$a[0].'2v">0</span></td></tr>';
|
echo '<tr><td>'.$a[1].'</td><td style="text-align:center;">'.$a[2].'</td><td><div class="ctrl"><span id="'.$a[0].'0"><button type="button" class="btn-step" disabled>−</button></span><div class="val-box" id="'.$a[0].'2">0</div><span id="'.$a[0].'1">'.$plusBtn.'</span></div></td><td><input id="'.$a[0].'" name="'.$a[0].'" type="hidden" value="0"><span id="'.$a[0].'2v">0</span></td></tr>';
|
||||||
@@ -190,6 +254,22 @@ function go_url(url){ location=url; return false; }
|
|||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<?php if (defined('NEW_FUNCTIONS_HERO_T4') && NEW_FUNCTIONS_HERO_T4) { ?>
|
||||||
|
<div class="form-row" style="margin-top:10px;">
|
||||||
|
<label>Produced resource</label>
|
||||||
|
<div class="field">
|
||||||
|
<select name="hrestype" style="padding:6px 8px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#0f172a;font-size:13px;">
|
||||||
|
<?php
|
||||||
|
$eResOpts = [0=>'All resources',1=>'Lumber',2=>'Clay',3=>'Iron',4=>'Crop'];
|
||||||
|
$eCur = (int)($hero['res_type'] ?? 0);
|
||||||
|
foreach ($eResOpts as $eVal => $eLabel) {
|
||||||
|
echo "<option value='" . $eVal . "'" . ($eCur === $eVal ? " selected" : "") . ">" . $eLabel . "</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
<div style="text-align:center;margin-top:10px;font-size:12px;">Level nou: <b><span id="hlvl">0</span></b></div>
|
<div style="text-align:center;margin-top:10px;font-size:12px;">Level nou: <b><span id="hlvl">0</span></b></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ $t4SlotNames = [1=>'Helmet',2=>'Body',3=>'Right hand',4=>'Left hand',5=>'Shoes',
|
|||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
.t4a-card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.04);margin-bottom:12px;}
|
.t4a-card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.04);margin-bottom:12px;}
|
||||||
|
/* FIX: pe tema inchisa a panoului (admin_dark.css se incarca ultimul) cardurile
|
||||||
|
albe mosteneau text deschis si nu se citea nimic. Fortam culori inchise. */
|
||||||
|
.t4a-card, .t4a-card div, .t4a-card span, .t4a-card b, .t4a-card label,
|
||||||
|
.t4a-card td, .t4a-card p, .t4a-card li{color:#1f2937;}
|
||||||
|
.t4a-card select, .t4a-card input[type=text], .t4a-card input[type=number]{color:#0f172a;background:#fff;}
|
||||||
|
.t4a-table td{color:#1f2937;}
|
||||||
.t4a-card h3{margin:0;padding:9px 14px;background:#f8fafc;border-bottom:1px solid #e5e7eb;font-size:12px;text-transform:uppercase;color:#475569;letter-spacing:.4px;font-weight:600;}
|
.t4a-card h3{margin:0;padding:9px 14px;background:#f8fafc;border-bottom:1px solid #e5e7eb;font-size:12px;text-transform:uppercase;color:#475569;letter-spacing:.4px;font-weight:600;}
|
||||||
.t4a-card .body{padding:14px;}
|
.t4a-card .body{padding:14px;}
|
||||||
.t4a-table{width:100%;border-collapse:collapse;font-size:13px;}
|
.t4a-table{width:100%;border-collapse:collapse;font-size:13px;}
|
||||||
|
|||||||
@@ -132,16 +132,33 @@ if ($hero !== false) {
|
|||||||
<tr><td>Off-Bonus</td><td><?php echo ($h['ob']-1)*100; ?>%</td><td><?php echo $h['attackbonus']; ?></td></tr>
|
<tr><td>Off-Bonus</td><td><?php echo ($h['ob']-1)*100; ?>%</td><td><?php echo $h['attackbonus']; ?></td></tr>
|
||||||
<tr><td>Def-Bonus</td><td><?php echo ($h['db']-1)*100; ?>%</td><td><?php echo $h['defencebonus']; ?></td></tr>
|
<tr><td>Def-Bonus</td><td><?php echo ($h['db']-1)*100; ?>%</td><td><?php echo $h['defencebonus']; ?></td></tr>
|
||||||
<tr><td>Regeneration</td><td><?php echo min(100,$h['regeneration'])*5*SPEED; ?>/Day</td><td><?php echo $h['regeneration']; ?></td></tr>
|
<tr><td>Regeneration</td><td><?php echo min(100,$h['regeneration'])*5*SPEED; ?>/Day</td><td><?php echo $h['regeneration']; ?></td></tr>
|
||||||
|
<?php if (defined('NEW_FUNCTIONS_HERO_T4') && NEW_FUNCTIONS_HERO_T4) {
|
||||||
|
$hResPoints = (int) ($h['resources'] ?? 0);
|
||||||
|
$hResType = (int) ($h['res_type'] ?? 0);
|
||||||
|
$hPerAll = defined('HERO_RES_PER_POINT_ALL') ? (int) HERO_RES_PER_POINT_ALL : 3;
|
||||||
|
$hPerOne = defined('HERO_RES_PER_POINT_ONE') ? (int) HERO_RES_PER_POINT_ONE : 10;
|
||||||
|
$hResNames = [0 => 'all', 1 => 'lumber', 2 => 'clay', 3 => 'iron', 4 => 'crop'];
|
||||||
|
$hResAmount = ($hResType >= 1 && $hResType <= 4)
|
||||||
|
? (int) round($hResPoints * $hPerOne * SPEED)
|
||||||
|
: (int) round($hResPoints * $hPerAll * SPEED);
|
||||||
|
?>
|
||||||
|
<tr><td>Resources</td><td><?php echo $hResAmount; ?>/h (<?php echo $hResNames[$hResType] ?? 'all'; ?>)</td><td><?php echo $hResPoints; ?></td></tr>
|
||||||
|
<?php } ?>
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
// 1. puncte rămase - nu lăsa negativ
|
// 1. puncte rămase - nu lăsa negativ
|
||||||
$used = (int)$h['attack'] + (int)$h['defence'] + (int)$h['attackbonus'] + (int)$h['defencebonus'] + (int)$h['regeneration'];
|
$used = (int)$h['attack'] + (int)$h['defence'] + (int)$h['attackbonus']
|
||||||
$count_level_exp = max(0, 500 - $used);
|
+ (int)$h['defencebonus'] + (int)$h['regeneration'] + (int)($h['resources'] ?? 0);
|
||||||
|
|
||||||
|
// totalul de puncte vine din tabelul de niveluri: 5 initiale + 5 per nivel
|
||||||
|
$hMaxLevel = isset($hero_levels) ? max(array_keys($hero_levels)) - 1 : 119;
|
||||||
|
$hMaxPoints = 5 + ($hMaxLevel * 5);
|
||||||
|
$count_level_exp = max(0, $hMaxPoints - $used);
|
||||||
if ($h['points'] > $count_level_exp) $h['points'] = $count_level_exp;
|
if ($h['points'] > $count_level_exp) $h['points'] = $count_level_exp;
|
||||||
|
|
||||||
// 2. procent XP - protejat pentru level 100
|
// 2. procent XP - protejat pentru level 100
|
||||||
$level = (int)$h['level'];
|
$level = (int)$h['level'];
|
||||||
if ($level >= 100 || !isset($hero_levels[$level+1])) {
|
if ($level >= $hMaxLevel || !isset($hero_levels[$level+1])) {
|
||||||
$expPct = 100;
|
$expPct = 100;
|
||||||
} else {
|
} else {
|
||||||
$curr = $hero_levels[$level] ?? 0;
|
$curr = $hero_levels[$level] ?? 0;
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ if (isset($_POST['id'], $_POST['hid'])) {
|
|||||||
|
|
||||||
// Input curat - cast individual, NU escape global
|
// Input curat - cast individual, NU escape global
|
||||||
$hunit = (int)($_POST['hunit'] ?? 0);
|
$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);
|
$exp = (int)($_POST['exp'] ?? 0);
|
||||||
$hhealth = (float)($_POST['hhealth'] ?? 100);
|
$hhealth = (float)($_POST['hhealth'] ?? 100);
|
||||||
$hatk = (int)($_POST['hatk'] ?? 0);
|
$hatk = (int)($_POST['hatk'] ?? 0);
|
||||||
@@ -62,6 +65,22 @@ if (isset($_POST['id'], $_POST['hid'])) {
|
|||||||
$hob = (int)($_POST['hob'] ?? 0);
|
$hob = (int)($_POST['hob'] ?? 0);
|
||||||
$hdb = (int)($_POST['hdb'] ?? 0);
|
$hdb = (int)($_POST['hdb'] ?? 0);
|
||||||
$hrege = (int)($_POST['hrege'] ?? 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;
|
$experience = isset($hero_levels[$hlvl]) ? (int)$hero_levels[$hlvl] : 0;
|
||||||
$hnameEsc = $database->escape($hname);
|
$hnameEsc = $database->escape($hname);
|
||||||
@@ -77,7 +96,11 @@ if (isset($_POST['id'], $_POST['hid'])) {
|
|||||||
defence = $hdef,
|
defence = $hdef,
|
||||||
attackbonus = $hob,
|
attackbonus = $hob,
|
||||||
defencebonus = $hdb,
|
defencebonus = $hdb,
|
||||||
regeneration = $hrege
|
regeneration = $hrege"
|
||||||
|
. ($hHasResCols ? ",
|
||||||
|
resources = $hres,
|
||||||
|
res_type = $hrestype" : "")
|
||||||
|
. "
|
||||||
WHERE heroid = $hid AND uid = $id";
|
WHERE heroid = $hid AND uid = $id";
|
||||||
|
|
||||||
$return = $database->query($q);
|
$return = $database->query($q);
|
||||||
|
|||||||
@@ -204,10 +204,19 @@ trait AutomationHero {
|
|||||||
$herolevel = $hdata['level'];
|
$herolevel = $hdata['level'];
|
||||||
$newLevel = - 1;
|
$newLevel = - 1;
|
||||||
$scorePoints = false;
|
$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]){
|
if($hdata['experience'] >= $hero_levels[$i]){
|
||||||
$newLevel = $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,
|
$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);
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
//ROMAN UNITS
|
//ROMAN UNITS
|
||||||
|
|||||||
@@ -221,13 +221,15 @@ $renderAddLink = function ($action) use ($hero_info, $id, $heroStatColumns) {
|
|||||||
<div class="t4h-panel">
|
<div class="t4h-panel">
|
||||||
<table class="t4h-tbl">
|
<table class="t4h-tbl">
|
||||||
<?php
|
<?php
|
||||||
$maxExp = 495000;
|
// plafonul vine din tabelul de niveluri, nu mai e o valoare fixa
|
||||||
|
$t4MaxLevel = max(array_keys($hero_levels)) - 1;
|
||||||
|
$maxExp = $hero_levels[$t4MaxLevel];
|
||||||
$curLevel = (int) $hero_info['level'];
|
$curLevel = (int) $hero_info['level'];
|
||||||
$curExp = (int) $hero_info['experience'];
|
$curExp = (int) $hero_info['experience'];
|
||||||
$expCurrent = $hero_levels[$curLevel] ?? 0;
|
$expCurrent = $hero_levels[$curLevel] ?? 0;
|
||||||
$expNext = $hero_levels[$curLevel + 1] ?? $maxExp;
|
$expNext = $hero_levels[$curLevel + 1] ?? $maxExp;
|
||||||
|
|
||||||
if ($curExp < $maxExp && $expNext > $expCurrent && $curLevel < 100) {
|
if ($curExp < $maxExp && $expNext > $expCurrent && $curLevel < $t4MaxLevel) {
|
||||||
$percent = ($curExp - $expCurrent) / ($expNext - $expCurrent) * 100;
|
$percent = ($curExp - $expCurrent) / ($expNext - $expCurrent) * 100;
|
||||||
$percent = max(0, min(100, $percent));
|
$percent = max(0, min(100, $percent));
|
||||||
} else {
|
} else {
|
||||||
@@ -243,7 +245,7 @@ $renderAddLink = function ($action) use ($hero_info, $id, $heroStatColumns) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="t4h-name"><?php echo defined('TZ_HERO_LEVEL') ? TZ_HERO_LEVEL : 'Hero level'; ?></td>
|
<td class="t4h-name"><?php echo defined('TZ_HERO_LEVEL') ? TZ_HERO_LEVEL : 'Hero level'; ?></td>
|
||||||
<td class="t4h-val"><?php echo $curLevel; ?></td>
|
<td class="t4h-val"><?php echo $curLevel; ?></td>
|
||||||
<td class="t4h-barcell" colspan="3"><div class="t4h-bar"><i style="width:<?php echo max(0, min(100, $curLevel)); ?>%"></i></div></td>
|
<td class="t4h-barcell" colspan="3"><div class="t4h-bar"><i style="width:<?php echo (int) max(0, min(100, $curLevel / max(1, $t4MaxLevel) * 100)); ?>%"></i></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -302,12 +302,16 @@ if ($hour > 1759 || $hour < 500) {
|
|||||||
#goldHeader {
|
#goldHeader {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 380px; /* << AICI ESTE CERCUL VERDE - muta 370-400 daca e nevoie */
|
left: 380px; /* << AICI ESTE CERCUL VERDE - muta 370-400 daca e nevoie */
|
||||||
top: 18px; /* centrat pe bara gri */
|
/* Centrare pe verticala in bara gri: ancoram la mijloc si compensam
|
||||||
|
inaltimea proprie. Asa ramane centrat si acum, cand sunt doua
|
||||||
|
randuri (aur + argint), nu impins spre partea de jos. */
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
width: auto;
|
width: auto;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
height: auto;
|
height: auto;
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
line-height: 22px;
|
line-height: 16px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
Reference in New Issue
Block a user