mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-26 22:46:09 +00:00
Some Additional T4 Hero Fix
Some Additional T4 Hero Fix
This commit is contained in:
@@ -310,20 +310,32 @@ class HeroItems
|
||||
}
|
||||
|
||||
/**
|
||||
* Argint -> aur. $gold = cat aur vrei sa primesti.
|
||||
* Argint -> aur. $silver = cat ARGINT dai (nu cat aur primesti).
|
||||
*
|
||||
* Asta e citirea naturala a campului din interfata si potriveste Travian:
|
||||
* scrii suma pe care o dai, nu pe cea pe care o primesti. Se schimba doar
|
||||
* multiplii intregi ai ratei; restul de argint sub o unitate de aur ramane
|
||||
* la tine, nu se pierde.
|
||||
*/
|
||||
public function exchangeSilverToGold($uid, $gold)
|
||||
public function exchangeSilverToGold($uid, $silver)
|
||||
{
|
||||
$uid = (int) $uid;
|
||||
$gold = (int) $gold;
|
||||
$uid = (int) $uid;
|
||||
$silver = (int) $silver;
|
||||
|
||||
if ($gold <= 0 || $gold > 100000) {
|
||||
if ($silver <= 0 || $silver > 100000000) {
|
||||
return self::EXCHANGE_INVALID;
|
||||
}
|
||||
|
||||
$silver = $gold * self::silverForOneGold();
|
||||
$rate = self::silverForOneGold();
|
||||
$gold = intdiv($silver, $rate);
|
||||
|
||||
return $this->runExchange($uid, $gold, $silver, false);
|
||||
if ($gold <= 0) {
|
||||
// sub rata de schimb nu se poate obtine nici macar o unitate de aur
|
||||
return self::EXCHANGE_NOT_ENOUGH;
|
||||
}
|
||||
|
||||
// consumam exact cat acopera aurul primit, nu toata suma introdusa
|
||||
return $this->runExchange($uid, $gold, $gold * $rate, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2824,7 +2824,7 @@ tz_def('HERO_EXCHANGE_S2G', 'Silver to gold');
|
||||
tz_def('HERO_EXCHANGE_OK', 'Exchange completed.');
|
||||
tz_def('HERO_EXCHANGE_NOTENOUGH', 'You do not have enough for this exchange.');
|
||||
tz_def('HERO_EXCHANGE_FAIL', 'The exchange could not be completed.');
|
||||
tz_def('HERO_EXCHANGE_HINT', 'The amount you type is the gold given or received; silver is calculated at the rate shown.');
|
||||
tz_def('HERO_EXCHANGE_HINT', 'You type the amount you give. Silver left over below one unit of gold stays with you.');
|
||||
tz_def('HERO_RES_PRODUCTION', 'Resources');
|
||||
tz_def('HERO_RES_TYPE', 'Produced resource');
|
||||
tz_def('HERO_RES_ALL', 'All resources');
|
||||
|
||||
@@ -2809,7 +2809,7 @@ tz_def('HERO_EXCHANGE_S2G', 'Argint in aur');
|
||||
tz_def('HERO_EXCHANGE_OK', 'Schimb efectuat.');
|
||||
tz_def('HERO_EXCHANGE_NOTENOUGH', 'Nu ai suficient pentru acest schimb.');
|
||||
tz_def('HERO_EXCHANGE_FAIL', 'Schimbul nu a putut fi efectuat.');
|
||||
tz_def('HERO_EXCHANGE_HINT', 'Valoarea introdusa e aurul dat sau primit; argintul se calculeaza la rata afisata.');
|
||||
tz_def('HERO_EXCHANGE_HINT', 'Introduci suma pe care o dai. Argintul ramas sub o unitate de aur ramane la tine.');
|
||||
tz_def('HERO_RES_PRODUCTION', 'Resurse');
|
||||
tz_def('HERO_RES_TYPE', 'Resursa produsa');
|
||||
tz_def('HERO_RES_ALL', 'Toate resursele');
|
||||
|
||||
Reference in New Issue
Block a user