mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-12 06:11:00 +00:00
Some important fix and view
Some important fix and view
This commit is contained in:
+295
-46
@@ -88,6 +88,173 @@ foreach ($t4HeroItems->getInventory($session->uid) as $t4Row) {
|
||||
}
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
/* ---------------------------------------------------------------------------
|
||||
Stiluri locale pentru pagina de licitatii. Toate clasele au prefixul
|
||||
"t4auc-" ca sa nu atinga nimic altceva din interfata.
|
||||
--------------------------------------------------------------------------- */
|
||||
|
||||
/* --- Casa de schimb: cele doua celule egale pe inaltime, continut centrat --- */
|
||||
.t4auc-ex td { vertical-align: middle; }
|
||||
.t4auc-ex-cell { width: 50%; padding: 12px 10px; }
|
||||
|
||||
.t4auc-ex-inner {
|
||||
max-width: 290px;
|
||||
margin: 0 auto; /* centrat pe orizontala in celula */
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.t4auc-balance {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 18px;
|
||||
margin: 0 0 12px 0;
|
||||
padding: 0 0 10px 0;
|
||||
border-bottom: 1px solid #dcd9d3;
|
||||
}
|
||||
|
||||
.t4auc-bal {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.t4auc-bal b { font-size: 13px; }
|
||||
|
||||
/* Aceleasi monede desenate ca in bara de sus (header.tpl) */
|
||||
.t4auc-coin { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
|
||||
.t4auc-coin .t4auc-coinBg { fill: #f6f5f2; stroke: #b8b6b1; stroke-width: 1; }
|
||||
.t4auc-coin-gold .t4auc-coinDisc { fill: #e3b427; stroke: #9a7512; stroke-width: .8; }
|
||||
.t4auc-coin-gold .t4auc-coinShine { fill: #f7e08a; }
|
||||
.t4auc-coin-silver .t4auc-coinDisc { fill: #cdd2d6; stroke: #7e858b; stroke-width: .8; }
|
||||
.t4auc-coin-silver .t4auc-coinShine { fill: #eef1f3; }
|
||||
|
||||
.t4auc-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
margin: 0 0 9px 0;
|
||||
}
|
||||
|
||||
.t4auc-num {
|
||||
width: 76px;
|
||||
padding: 3px 5px;
|
||||
text-align: right;
|
||||
border: 1px solid #b9b6b0;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.t4auc-rate {
|
||||
color: #8a877f;
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.t4auc-hint {
|
||||
margin: 10px 0 0 0;
|
||||
color: #8a877f;
|
||||
font-size: 11px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.t4auc-merchant { max-width: 100%; max-height: 230px; }
|
||||
|
||||
/* --- Butoane --- */
|
||||
.t4auc-btn {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
color: #3f5f22;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
background: #e4f0d0;
|
||||
background: linear-gradient(#fbfdf6, #dcebc6);
|
||||
border: 1px solid #a3bf7c;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.t4auc-btn:hover {
|
||||
background: #d6e8bd;
|
||||
background: linear-gradient(#ffffff, #cfe4b0);
|
||||
border-color: #8bab61;
|
||||
}
|
||||
|
||||
.t4auc-btn:active {
|
||||
background: linear-gradient(#d5e6b8, #e9f3da);
|
||||
border-color: #8bab61;
|
||||
}
|
||||
|
||||
/* --- Tabelul de licitatii deschise ---------------------------------------
|
||||
Latimile sunt stranse la minimul in care incape headerul, ca tabelul sa nu
|
||||
mai depaseasca zona de continut (~505px) si sa nu mai apara scroll
|
||||
orizontal. Total: 78+96+66+46+66+74 = 426px + padding. */
|
||||
.t4auc-tbl th { text-align: center; }
|
||||
|
||||
/* fara white-space:nowrap pe th: "Se incheie in" se rupe pe doua randuri
|
||||
in loc sa forteze latirea coloanei */
|
||||
.t4auc-tbl td, .t4auc-tbl th { padding: 4px 3px; }
|
||||
|
||||
.t4auc-col-item { width: 78px; text-align: center; }
|
||||
.t4auc-col-tier { width: 96px; text-align: center; }
|
||||
.t4auc-col-qty { width: 66px; text-align: center; }
|
||||
.t4auc-col-price { width: 46px; text-align: center; }
|
||||
.t4auc-col-time { width: 66px; text-align: center; }
|
||||
.t4auc-col-bid { width: 74px; text-align: center; }
|
||||
|
||||
/* Obiect: iconita sus, numele dedesubt cu scris palid */
|
||||
.t4auc-itemname {
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
color: #9b978f;
|
||||
font-size: 10px;
|
||||
line-height: 1.3;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
/* Tier: numarul sus, abilitatea dedesubt cu scris mai pal */
|
||||
.t4auc-tier {
|
||||
display: inline-block;
|
||||
min-width: 30px;
|
||||
padding: 1px 6px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
color: #5c5850;
|
||||
background: #eceae5;
|
||||
border: 1px solid #cfccc5;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.t4auc-ability {
|
||||
display: block;
|
||||
margin-top: 3px;
|
||||
color: #9b978f; /* palid, ca sa nu concureze cu numele obiectului */
|
||||
font-size: 9px;
|
||||
line-height: 1.3;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
/* Oferta: casuta SUS, butonul DEDESUBT - una langa alta cereau ~116px,
|
||||
stivuite incap in 74px */
|
||||
.t4auc-bidform { margin: 0; text-align: center; }
|
||||
|
||||
.t4auc-bidnum {
|
||||
display: block;
|
||||
width: 56px;
|
||||
margin: 0 auto 3px auto;
|
||||
padding: 2px 4px;
|
||||
text-align: right;
|
||||
border: 1px solid #b9b6b0;
|
||||
border-radius: 3px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.t4auc-bidform .t4auc-btn { padding: 3px 9px; }
|
||||
</style>
|
||||
|
||||
<?php if ($t4Msg !== '') { ?>
|
||||
<p class="message" style="font-weight:bold;"><?php echo $t4Msg; ?></p>
|
||||
<?php } ?>
|
||||
@@ -100,41 +267,76 @@ $t4Gold = (int) $session->gold;
|
||||
$t4RateG2S = HeroItems::silverPerGold();
|
||||
$t4RateS2G = HeroItems::silverForOneGold();
|
||||
?>
|
||||
<table id="distribution" cellpadding="1" cellspacing="1">
|
||||
<?php
|
||||
/**
|
||||
* Aceleasi monede desenate ca in bara de sus, ca sa nu existe doua
|
||||
* reprezentari diferite pentru aur si argint. Culorile vin din blocul
|
||||
* <style> de mai sus, nu din atribute inline.
|
||||
*/
|
||||
if (!function_exists('t4AucCoin')) {
|
||||
function t4AucCoin($tone, $title)
|
||||
{
|
||||
return '<svg viewBox="0 0 24 24" class="t4auc-coin t4auc-coin-' . $tone . '" role="img">'
|
||||
. '<title>' . htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '</title>'
|
||||
. '<circle cx="12" cy="12" r="11" class="t4auc-coinBg" />'
|
||||
. '<ellipse cx="12" cy="16.1" rx="6.2" ry="2.3" class="t4auc-coinDisc" />'
|
||||
. '<ellipse cx="12" cy="13.1" rx="6.2" ry="2.3" class="t4auc-coinDisc" />'
|
||||
. '<ellipse cx="12" cy="10.1" rx="6.2" ry="2.3" class="t4auc-coinDisc" />'
|
||||
. '<ellipse cx="12" cy="10.1" rx="2.6" ry="0.9" class="t4auc-coinShine" />'
|
||||
. '</svg>';
|
||||
}
|
||||
}
|
||||
|
||||
$t4LblGold = defined('GOLD') ? GOLD : 'Gold';
|
||||
$t4LblSilver = defined('HERO_SILVER') ? HERO_SILVER : 'Silver';
|
||||
?>
|
||||
<table id="distribution" class="t4auc-ex" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr><th colspan="2"><?php echo defined('HERO_EXCHANGE') ? HERO_EXCHANGE : 'Exchange office'; ?></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:290px;vertical-align:top;">
|
||||
<p style="margin:0 0 6px 0;">
|
||||
<b><?php echo HERO_SILVER; ?>:</b> <?php echo $t4Silver; ?>
|
||||
|
||||
<b><?php echo defined('GOLD') ? GOLD : 'Gold'; ?>:</b> <?php echo $t4Gold; ?>
|
||||
</p>
|
||||
<td class="t4auc-ex-cell">
|
||||
<div class="t4auc-ex-inner">
|
||||
|
||||
<form action="" method="POST" style="margin:0 0 5px 0;">
|
||||
<input type="hidden" name="t4action" value="g2s">
|
||||
<input type="number" name="amount" min="1" max="100000" value="1" style="width:70px">
|
||||
<?php echo defined('GOLD') ? GOLD : 'Gold'; ?>
|
||||
<input type="submit" value="<?php echo defined('HERO_EXCHANGE_G2S') ? HERO_EXCHANGE_G2S : 'Gold to silver'; ?>">
|
||||
<small>(1 : <?php echo $t4RateG2S; ?>)</small>
|
||||
</form>
|
||||
<div class="t4auc-balance">
|
||||
<span class="t4auc-bal">
|
||||
<?php echo t4AucCoin('silver', $t4LblSilver); ?>
|
||||
<b><?php echo number_format((int) $t4Silver); ?></b>
|
||||
</span>
|
||||
<span class="t4auc-bal">
|
||||
<?php echo t4AucCoin('gold', $t4LblGold); ?>
|
||||
<b><?php echo number_format((int) $t4Gold); ?></b>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<form action="" method="POST" style="margin:0;">
|
||||
<input type="hidden" name="t4action" value="s2g">
|
||||
<input type="number" name="amount" min="1" max="100000000" value="<?php echo $t4RateS2G; ?>" style="width:70px">
|
||||
<?php echo HERO_SILVER; ?>
|
||||
<input type="submit" value="<?php echo defined('HERO_EXCHANGE_S2G') ? HERO_EXCHANGE_S2G : 'Silver to gold'; ?>">
|
||||
<small>(<?php echo $t4RateS2G; ?> : 1)</small>
|
||||
</form>
|
||||
<form action="" method="POST" class="t4auc-form">
|
||||
<input type="hidden" name="t4action" value="g2s">
|
||||
<input type="number" name="amount" min="1" max="100000" value="1" class="t4auc-num">
|
||||
<?php echo t4AucCoin('gold', $t4LblGold); ?>
|
||||
<button type="submit" class="t4auc-btn"><?php
|
||||
echo defined('HERO_EXCHANGE_G2S') ? HERO_EXCHANGE_G2S : 'Gold to silver';
|
||||
?></button>
|
||||
<span class="t4auc-rate">1 : <?php echo $t4RateG2S; ?></span>
|
||||
</form>
|
||||
|
||||
<p style="margin:6px 0 0 0;color:#777;font-size:11px;">
|
||||
<?php echo defined('HERO_EXCHANGE_HINT') ? HERO_EXCHANGE_HINT
|
||||
: 'You type the amount you give. Silver left over below one unit of gold stays with you.'; ?>
|
||||
</p>
|
||||
<form action="" method="POST" class="t4auc-form">
|
||||
<input type="hidden" name="t4action" value="s2g">
|
||||
<input type="number" name="amount" min="1" max="100000000" value="<?php echo $t4RateS2G; ?>" class="t4auc-num">
|
||||
<?php echo t4AucCoin('silver', $t4LblSilver); ?>
|
||||
<button type="submit" class="t4auc-btn"><?php
|
||||
echo defined('HERO_EXCHANGE_S2G') ? HERO_EXCHANGE_S2G : 'Silver to gold';
|
||||
?></button>
|
||||
<span class="t4auc-rate"><?php echo $t4RateS2G; ?> : 1</span>
|
||||
</form>
|
||||
|
||||
<p class="t4auc-hint">
|
||||
<?php echo defined('HERO_EXCHANGE_HINT') ? HERO_EXCHANGE_HINT
|
||||
: 'You type the amount you give. Silver left over below one unit of gold stays with you.'; ?>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
<td style="text-align:center;vertical-align:middle;">
|
||||
<td class="t4auc-ex-cell" style="text-align:center;">
|
||||
<?php
|
||||
/**
|
||||
* Negustorul casei de licitatii, pe trib.
|
||||
@@ -178,49 +380,96 @@ $t4RateS2G = HeroItems::silverForOneGold();
|
||||
$t4MerchantFile = 'merchant.png';
|
||||
}
|
||||
?>
|
||||
<img src="img/hero/<?php echo $t4MerchantFile; ?>" alt=""
|
||||
style="max-width:280px;max-height:300px;">
|
||||
<img class="t4auc-merchant" src="img/hero/<?php echo $t4MerchantFile; ?>" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table id="distribution" cellpadding="1" cellspacing="1">
|
||||
<?php
|
||||
/**
|
||||
* Tier-ul obiectului vine din catalogul de iteme ($heroItemCatalog), acolo
|
||||
* unde e definit si bonusul - deci o singura sursa de adevar, nu o lista
|
||||
* paralela care s-ar desincroniza la prima modificare de balans.
|
||||
*/
|
||||
if (!function_exists('t4AucItemTier')) {
|
||||
function t4AucItemTier($itemid)
|
||||
{
|
||||
global $heroItemCatalog;
|
||||
|
||||
return isset($heroItemCatalog[(int) $itemid]['tier'])
|
||||
? (int) $heroItemCatalog[(int) $itemid]['tier']
|
||||
: 0;
|
||||
}
|
||||
}
|
||||
|
||||
$t4LblTier = defined('HERO_AUC_TIER') ? HERO_AUC_TIER : 'Tier';
|
||||
|
||||
/**
|
||||
* Eticheta scurta pentru coloana de pret: HERO_AUC_PRICE e "Pret curent" /
|
||||
* "Current price" si latea coloana degeaba. Daca HERO_AUC_PRICE_SHORT nu e
|
||||
* definita inca, ramanem pe cea lunga - nu vrem sa apara brusc engleza
|
||||
* intr-o interfata romaneasca.
|
||||
*/
|
||||
$t4LblPrice = defined('HERO_AUC_PRICE_SHORT') ? HERO_AUC_PRICE_SHORT : HERO_AUC_PRICE;
|
||||
?>
|
||||
<table id="distribution" class="t4auc-tbl" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr><th colspan="5"><?php echo HERO_AUC_OPEN; ?></th></tr>
|
||||
<tr><th colspan="6"><?php echo HERO_AUC_OPEN; ?></th></tr>
|
||||
<tr>
|
||||
<td><b><?php echo HERO_AUC_ITEM; ?></b></td>
|
||||
<td><b><?php echo HERO_QUANTITY; ?></b></td>
|
||||
<td><b><?php echo HERO_AUC_PRICE; ?></b></td>
|
||||
<td><b><?php echo HERO_AUC_TIME_LEFT; ?></b></td>
|
||||
<td><b><?php echo HERO_AUC_BID; ?></b></td>
|
||||
<th class="t4auc-col-item"><?php echo HERO_AUC_ITEM; ?></th>
|
||||
<th class="t4auc-col-tier"><?php echo $t4LblTier; ?></th>
|
||||
<th class="t4auc-col-qty"><?php echo HERO_QUANTITY; ?></th>
|
||||
<th class="t4auc-col-price"><?php echo $t4LblPrice; ?></th>
|
||||
<th class="t4auc-col-time"><?php echo HERO_AUC_TIME_LEFT; ?></th>
|
||||
<th class="t4auc-col-bid"><?php echo HERO_AUC_BID; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($t4Open)) { ?>
|
||||
<?php foreach ($t4Open as $t4A) { ?>
|
||||
<?php
|
||||
$t4ItemId = (int) $t4A['itemid'];
|
||||
$t4Tier = t4AucItemTier($t4ItemId);
|
||||
$t4Ability = heroItemBonusText($t4ItemId);
|
||||
?>
|
||||
<tr>
|
||||
<td title="<?php echo htmlspecialchars(heroItemBonusText((int) $t4A['itemid'])); ?>"><span class="heroT4Item item<?php echo (int) $t4A['itemid']; ?>"></span> <?php echo $t4A['name']; ?>
|
||||
<?php if ((int) $t4A['seller'] === 0) { ?><small>(<?php echo HERO_AUC_SELLER_NPC; ?>)</small><?php } ?>
|
||||
<td class="t4auc-col-item" title="<?php echo htmlspecialchars($t4Ability); ?>">
|
||||
<span class="heroT4Item item<?php echo $t4ItemId; ?>"></span>
|
||||
<span class="t4auc-itemname">
|
||||
<?php echo $t4A['name']; ?><?php if ((int) $t4A['seller'] === 0) { ?> (<?php echo HERO_AUC_SELLER_NPC; ?>)<?php } ?>
|
||||
</span>
|
||||
</td>
|
||||
<td style="text-align:center;"><?php echo (int) $t4A['quantity']; ?></td>
|
||||
<td style="text-align:right;"><?php echo number_format((int) $t4A['silver_current']); ?></td>
|
||||
<td><span id="timer<?php echo ++$session->timer; ?>"><?php echo $generator->getTimeFormat(max(0, $t4A['time_end'] - $t4Now)); ?></span></td>
|
||||
<td style="width:170px;text-align:center;">
|
||||
<td class="t4auc-col-tier" style="text-align:center;">
|
||||
<?php if ($t4Tier > 0) { ?>
|
||||
<span class="t4auc-tier"><?php echo $t4LblTier; ?> <?php echo $t4Tier; ?></span>
|
||||
<?php } else { ?>
|
||||
<span class="t4auc-tier">–</span>
|
||||
<?php } ?>
|
||||
<?php if ($t4Ability !== '') { ?>
|
||||
<span class="t4auc-ability"><?php echo htmlspecialchars($t4Ability); ?></span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td class="t4auc-col-qty"><?php echo (int) $t4A['quantity']; ?></td>
|
||||
<td class="t4auc-col-price"><?php echo number_format((int) $t4A['silver_current']); ?></td>
|
||||
<td class="t4auc-col-time">
|
||||
<span id="timer<?php echo ++$session->timer; ?>"><?php echo $generator->getTimeFormat(max(0, $t4A['time_end'] - $t4Now)); ?></span>
|
||||
</td>
|
||||
<td class="t4auc-col-bid">
|
||||
<?php if ((int) $t4A['seller'] !== $session->uid) { ?>
|
||||
<form action="" method="POST" style="margin:0;">
|
||||
<form action="" method="POST" class="t4auc-bidform">
|
||||
<input type="hidden" name="t4action" value="bid">
|
||||
<input type="hidden" name="aucid" value="<?php echo (int) $t4A['id']; ?>">
|
||||
<input type="text" name="maxbid" size="6" style="text-align:right;"
|
||||
<input type="text" name="maxbid" class="t4auc-bidnum"
|
||||
value="<?php echo (int) $t4A['silver_current'] + ((int) $t4A['bidder'] > 0 ? 1 : 0); ?>">
|
||||
<input type="submit" value="<?php echo HERO_AUC_BID; ?>">
|
||||
<button type="submit" class="t4auc-btn"><?php echo HERO_AUC_BID; ?></button>
|
||||
</form>
|
||||
<?php } else { ?>-<?php } ?>
|
||||
<?php } else { ?>–<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr><td colspan="5"><?php echo HERO_AUC_NONE; ?></td></tr>
|
||||
<tr><td colspan="6"><?php echo HERO_AUC_NONE; ?></td></tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -150,14 +150,37 @@ $renderAddLink = function ($action) use ($hero_info, $id, $heroStatColumns) {
|
||||
|
||||
<table class="t4h-tbl">
|
||||
<?php
|
||||
/**
|
||||
* BUG FIX: Bonus atac / Bonus aparare aratau "1.2%" in loc de "20%".
|
||||
*
|
||||
* 'ob' si 'db' NU sunt procente, ci MULTIPLICATORI de lupta:
|
||||
* ob = 1 + 0.002 * attackbonus
|
||||
* adica 100 de puncte (maximul) inseamna 1.2, deci +20%. Tabelul le
|
||||
* tiparea direct cu semnul %, asa ca multiplicatorul aparea ca procent.
|
||||
*
|
||||
* Doar afisarea era gresita: Battle.php foloseste aceeasi formula
|
||||
* (getBattleHero: 1 + 0.010 * (bonus / 5), identic cu 1 + 0.002 * bonus)
|
||||
* si inmulteste corect atacul/apararea cu ea, deci luptele s-au calculat
|
||||
* mereu bine. Panoul de Admin facea deja conversia asta.
|
||||
*
|
||||
* Rotunjim la o zecimala fiindca 0.002 nu e exact in binar:
|
||||
* (1.2 - 1) * 100 da 19.999999999999996.
|
||||
*/
|
||||
$t4BonusPct = function ($multiplier) {
|
||||
$pct = round(((float) $multiplier - 1) * 100, 1);
|
||||
|
||||
// 20 in loc de 20.0, dar pastram 19.8 cand chiar are zecimala
|
||||
return ($pct == (int) $pct) ? (string) (int) $pct : (string) $pct;
|
||||
};
|
||||
|
||||
// nume afisat, valoarea, punctele investite si cheia pentru (+)
|
||||
$t4Rows = array(
|
||||
array(OFFENCE, $t4ItemStrength > 0
|
||||
? $hero_info['atk'] . ' <span class="t4h-item">+' . number_format($t4ItemStrength) . '</span>'
|
||||
: $hero_info['atk'], (int) $hero_info['attack'], 'off'),
|
||||
array(DEFENCE, $hero_info['dc'] . '/' . $hero_info['di'], (int) $hero_info['defence'], 'deff'),
|
||||
array(OFF_BONUS, $hero_info['ob'] . '%', (int) $hero_info['attackbonus'], 'obonus'),
|
||||
array(DEF_BONUS, $hero_info['db'] . '%', (int) $hero_info['defencebonus'], 'dbonus'),
|
||||
array(OFF_BONUS, $t4BonusPct($hero_info['ob']) . '%', (int) $hero_info['attackbonus'], 'obonus'),
|
||||
array(DEF_BONUS, $t4BonusPct($hero_info['db']) . '%', (int) $hero_info['defencebonus'], 'dbonus'),
|
||||
array(REGENERATION, ($hero_info['regeneration'] * 5 * SPEED) . '/' . DAY, (int) $hero_info['regeneration'], 'reg'),
|
||||
);
|
||||
|
||||
|
||||
+122
-10
@@ -147,10 +147,11 @@ if ($tzHeroExists && $tzCurExp < $tzMaxExp && $tzExpNext > $tzExpCur && $tzHeroL
|
||||
* Metoda are cache static pe uid, deci daca o mai cheama cineva pe aceeasi
|
||||
* pagina nu se duce a doua oara la baza de date.
|
||||
*/
|
||||
$tzHeroAway = '';
|
||||
$tzHeroTarget = 0;
|
||||
$tzHeroEndtime = 0;
|
||||
$tzHeroSort = 0;
|
||||
$tzHeroAway = '';
|
||||
$tzHeroTarget = 0;
|
||||
$tzHeroEndtime = 0;
|
||||
$tzHeroSort = 0;
|
||||
$tzHeroReturning = false;
|
||||
|
||||
if ($tzHeroExists && !$tzHeroDead && !$tzHeroTraining && class_exists('HeroItems')) {
|
||||
|
||||
@@ -158,11 +159,12 @@ if ($tzHeroExists && !$tzHeroDead && !$tzHeroTraining && class_exists('HeroItems
|
||||
|
||||
if (method_exists($tzAwayObject, 'heroLocation')) {
|
||||
|
||||
$tzLoc = $tzAwayObject->heroLocation($tzHeroUid);
|
||||
$tzHeroAway = (string) $tzLoc['reason'];
|
||||
$tzHeroTarget = (int) $tzLoc['target'];
|
||||
$tzHeroEndtime = (int) $tzLoc['endtime'];
|
||||
$tzHeroSort = (int) $tzLoc['sort'];
|
||||
$tzLoc = $tzAwayObject->heroLocation($tzHeroUid);
|
||||
$tzHeroAway = (string) $tzLoc['reason'];
|
||||
$tzHeroTarget = (int) $tzLoc['target'];
|
||||
$tzHeroEndtime = (int) $tzLoc['endtime'];
|
||||
$tzHeroSort = (int) $tzLoc['sort'];
|
||||
$tzHeroReturning = !empty($tzLoc['returning']);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -203,6 +205,13 @@ if (!$tzHeroExists) {
|
||||
$tzHeroState = 'dead';
|
||||
} elseif ($tzHeroTraining) {
|
||||
$tzHeroState = 'training';
|
||||
} elseif ($tzHeroReturning) {
|
||||
/**
|
||||
* O singura stare pentru toate intoarcerile acasa: din aventura, din
|
||||
* atac sau dupa rechemarea dintr-o intarire. Motivul brut ramane in
|
||||
* $tzHeroAway, ca sa alegem textul potrivit mai jos.
|
||||
*/
|
||||
$tzHeroState = 'returning';
|
||||
} elseif ($tzHeroAway !== '') {
|
||||
$tzHeroState = $tzHeroAway;
|
||||
} else {
|
||||
@@ -255,6 +264,38 @@ if ($tzHeroT4 && class_exists('HeroItems')) {
|
||||
$tzHeroSilver = (int) $GLOBALS['t4SilverValue'];
|
||||
}
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------------------------------
|
||||
* 6b. Resursa produsa de erou (atributul T4 "Resources")
|
||||
* ---------------------------------------------------------------------------
|
||||
* Aceleasi formule ca in 37_hero.tpl, ca sa nu apara doua cifre diferite
|
||||
* pentru acelasi lucru:
|
||||
* res_type 0 -> produce din TOATE, cate HERO_RES_PER_POINT_ALL / punct
|
||||
* res_type 1..4 -> o singura resursa, HERO_RES_PER_POINT_ONE / punct
|
||||
* Totul inmultit cu SPEED, ca in pagina Resedintei.
|
||||
*
|
||||
* Coloanele "resources" si "res_type" lipsesc pe serverele care n-au rulat
|
||||
* inca add-hero-resources.sql, de aceea sunt citite cu ?? 0.
|
||||
*/
|
||||
$tzResPoints = $tzHeroExists ? (int) ($tzHeroRow['resources'] ?? 0) : 0;
|
||||
$tzResType = $tzHeroExists ? (int) ($tzHeroRow['res_type'] ?? 0) : 0;
|
||||
|
||||
$tzResPerAll = defined('HERO_RES_PER_POINT_ALL') ? (int) HERO_RES_PER_POINT_ALL : 3;
|
||||
$tzResPerOne = defined('HERO_RES_PER_POINT_ONE') ? (int) HERO_RES_PER_POINT_ONE : 10;
|
||||
$tzResSpeed = defined('SPEED') ? SPEED : 1;
|
||||
|
||||
$tzResSingle = ($tzResType >= 1 && $tzResType <= 4);
|
||||
$tzResAmount = $tzResSingle
|
||||
? (int) round($tzResPoints * $tzResPerOne * $tzResSpeed)
|
||||
: (int) round($tzResPoints * $tzResPerAll * $tzResSpeed);
|
||||
|
||||
$tzResNames = array(
|
||||
1 => (defined('LUMBER') ? LUMBER : 'Lumber'),
|
||||
2 => (defined('CLAY') ? CLAY : 'Clay'),
|
||||
3 => (defined('IRON') ? IRON : 'Iron'),
|
||||
4 => (defined('CROP') ? CROP : 'Crop'),
|
||||
);
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------------------------------
|
||||
* 7. Link-urile catre Resedinta Eroului
|
||||
@@ -375,6 +416,10 @@ $tzTxtAdventure = defined('HERO_HEADER_ADVENTURE') ? HERO_HEADER_ADVENTURE : 'H
|
||||
$tzTxtAttack = defined('HERO_HEADER_ATTACK') ? HERO_HEADER_ATTACK : 'Hero is with the army';
|
||||
$tzTxtReinforce = defined('HERO_HEADER_REINFORCE') ? HERO_HEADER_REINFORCE : 'Hero is reinforcing';
|
||||
$tzTxtIn = defined('HERO_HEADER_IN') ? HERO_HEADER_IN : 'in';
|
||||
$tzTxtRetAdv = defined('HERO_HEADER_RETURN_ADV') ? HERO_HEADER_RETURN_ADV : 'Hero returning from adventure';
|
||||
$tzTxtRetHome = defined('HERO_HEADER_RETURN_HOME') ? HERO_HEADER_RETURN_HOME : 'Hero returning home';
|
||||
$tzTxtResources = defined('RESOURCES') ? RESOURCES : 'Resources';
|
||||
$tzTxtPerHour = defined('HERO_HEADER_PER_HOUR') ? HERO_HEADER_PER_HOUR : 'per hour';
|
||||
$tzTxtVillage = defined('VILLAGE') ? VILLAGE : 'Village';
|
||||
$tzTxtLevel = defined('LEVEL') ? LEVEL : 'Level';
|
||||
$tzTxtHealth = defined('TZ_HEALTH') ? TZ_HEALTH : 'Health';
|
||||
@@ -389,7 +434,18 @@ $tzHeroNameSafe = htmlspecialchars($tzHeroName, ENT_QUOTES, 'UTF-8');
|
||||
$tzHeroVillageSafe = htmlspecialchars($tzHeroVillage, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" href="css/hero_header.css" type="text/css" />
|
||||
<?php
|
||||
/**
|
||||
* ?v=<data fisierului>: fara asta, browserul pastra CSS-ul vechi din cache
|
||||
* dupa fiecare deploy. Efectul e insidios - HTML-ul nou apare, dar regulile
|
||||
* noi lipsesc, asa ca elementele isi pierd pozitia (position:absolute fara
|
||||
* left/top cade in coltul din stanga sus) si SVG-urile raman negre, fiindca
|
||||
* fill-ul vine din CSS. filemtime se schimba singur la fiecare incarcare.
|
||||
*/
|
||||
$tzCssVer = @filemtime('css/hero_header.css');
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="css/hero_header.css<?php echo $tzCssVer ? '?v=' . $tzCssVer : ''; ?>" />
|
||||
|
||||
<div id="tzHeroBox" class="<?php echo $tzHeroDead ? 'tzHeroDeadState' : ''; ?>">
|
||||
|
||||
@@ -438,6 +494,18 @@ $tzHeroVillageSafe = htmlspecialchars($tzHeroVillage, ENT_QUOTES, 'UTF-8');
|
||||
<path d="M12 5.2v14c3.5-1.2 6.1-3.7 6.1-7.3V7.5z" class="tzHeroShieldDark" />
|
||||
</svg>
|
||||
|
||||
<?php } elseif ($tzHeroState === 'returning') { ?>
|
||||
|
||||
<!-- casa cu sageata care intra in ea: eroul e pe drumul spre casa,
|
||||
indiferent daca vine din aventura, din atac sau dintr-o
|
||||
intarire de la care a fost rechemat -->
|
||||
<svg viewBox="0 0 24 24" class="tzHeroIco" aria-hidden="true">
|
||||
<circle cx="12" cy="12" r="11" class="tzHeroIcoBg" />
|
||||
<path class="tzHeroRoof" d="M13.5 5.6 6.9 11.2h1.9v5.9h9.2v-5.9h1.9z" />
|
||||
<rect x="10.4" y="12.1" width="6.3" height="5" class="tzHeroWall" />
|
||||
<path class="tzHeroBackArrow" d="M3.2 13.6h6.4v-2.4l4 3.6-4 3.6v-2.4H3.2z" />
|
||||
</svg>
|
||||
|
||||
<?php } elseif ($tzHeroState === 'training') { ?>
|
||||
|
||||
<!-- clepsidra: eroul e in antrenament, inca nu e disponibil -->
|
||||
@@ -488,6 +556,10 @@ $tzHeroVillageSafe = htmlspecialchars($tzHeroVillage, ENT_QUOTES, 'UTF-8');
|
||||
'attack' => $tzTxtAttack,
|
||||
'reinforcement' => $tzTxtReinforce,
|
||||
'home' => $tzTxtAtHome,
|
||||
// din aventura stim sigur de unde vine; la sort_type 4 nu se
|
||||
// poate deosebi atacul de rechemarea dintr-o intarire, deci
|
||||
// textul ramane generic
|
||||
'returning' => ($tzHeroAway === 'adventure') ? $tzTxtRetAdv : $tzTxtRetHome,
|
||||
];
|
||||
?>
|
||||
<b><?php echo $tzStateLabels[$tzHeroState]; ?></b>
|
||||
@@ -582,6 +654,46 @@ $tzHeroVillageSafe = htmlspecialchars($tzHeroVillage, ENT_QUOTES, 'UTF-8');
|
||||
</span>
|
||||
<?php echo $tzHeroClickable ? '</a>' : '</span>'; ?>
|
||||
|
||||
<!-- ============ STANGA JOS: resursa produsa de erou -> 37.tpl ============ -->
|
||||
<?php echo tzHeroSlotOpen($tzLinkHero, 'tzHeroSlot tzHeroRes', $tzHeroClickable); ?>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Exact aceleasi iconite ca in 37_hero.tpl, ca sa nu existe doua
|
||||
* seturi de grafica pentru acelasi lucru:
|
||||
* - "toate" -> img/hero/res_all.png (iconita combinata)
|
||||
* - 1..4 -> clasele r1..r4, care decupeaza sprite-ul
|
||||
* img/a/res2.gif din graphic pack, peste img/x.gif
|
||||
*/
|
||||
if ($tzResSingle) {
|
||||
echo '<img class="tzHeroResOne r' . $tzResType . '" src="img/x.gif" alt="" />';
|
||||
} else {
|
||||
echo '<img class="tzHeroResAll" src="img/hero/res_all.png" alt="" />';
|
||||
}
|
||||
?>
|
||||
|
||||
<span class="tzHeroTip tzHeroTipRes">
|
||||
<?php if ($tzResPoints <= 0) { ?>
|
||||
<b><?php echo $tzTxtResources; ?>: 0</b>
|
||||
<?php } elseif ($tzResSingle) { ?>
|
||||
<b><?php echo $tzResNames[$tzResType]; ?>:
|
||||
+<?php echo number_format($tzResAmount); ?> <?php echo $tzTxtPerHour; ?></b>
|
||||
<?php } else { ?>
|
||||
<?php
|
||||
/**
|
||||
* res_type 0 inseamna ca eroul produce suma asta din FIECARE
|
||||
* resursa, nu impartita intre ele - de aceea o listam pe fiecare
|
||||
* rand, in loc s-o repetam si in titlu.
|
||||
*/
|
||||
?>
|
||||
<b><?php echo $tzTxtResources; ?> <?php echo $tzTxtPerHour; ?></b>
|
||||
<?php foreach ($tzResNames as $tzResName) { ?>
|
||||
<i><?php echo $tzResName; ?>: +<?php echo number_format($tzResAmount); ?></i>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</span>
|
||||
<?php echo $tzHeroClickable ? '</a>' : '</span>'; ?>
|
||||
|
||||
<!-- ============ DREAPTA JOS: argint -> 37_auction.tpl ============ -->
|
||||
<?php echo tzHeroSlotOpen($tzLinkAuc, 'tzHeroSlot tzHeroSilver', $tzHeroClickable); ?>
|
||||
<!-- Teanc de monede desenat, in acelasi stil ca iconita de casa.
|
||||
|
||||
Reference in New Issue
Block a user