1
This commit is contained in:
parent
39dbbaa7e2
commit
421acd9abe
@ -66,4 +66,32 @@ class AttrHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getAbsVal($randAttr, $attrId)
|
||||||
|
{
|
||||||
|
if (!$randAttr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
foreach ($randAttr as $attr){
|
||||||
|
if ($attr['attr_id'] == $attrId &&
|
||||||
|
$attr['type'] == kHAT_ABS_VAL) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRateVal($randAttr, $attrId)
|
||||||
|
{
|
||||||
|
if (!$randAttr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
foreach ($randAttr as $attr){
|
||||||
|
if ($attr['attr_id'] == $attrId &&
|
||||||
|
$attr['type'] == kHAT_RATE_VAL) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ require_once('mt/RankReward.php');
|
|||||||
require_once('mt/KillReward.php');
|
require_once('mt/KillReward.php');
|
||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
require_once('mt/HeroQuality.php');
|
require_once('mt/HeroQuality.php');
|
||||||
|
require_once('mt/AttrHelper.php');
|
||||||
|
|
||||||
require_once('models/Season.php');
|
require_once('models/Season.php');
|
||||||
require_once('models/Battle.php');
|
require_once('models/Battle.php');
|
||||||
@ -340,8 +341,13 @@ class BattleDataService extends BaseService {
|
|||||||
|
|
||||||
private function rewardGold($heroDb)
|
private function rewardGold($heroDb)
|
||||||
{
|
{
|
||||||
|
$heroMeta = mt\Item::get($heroDb['hero_id']);
|
||||||
|
if (!$heroMeta) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$killMeta = mt\KillReward::get(getReqVal('kills', 0));
|
$killMeta = mt\KillReward::get(getReqVal('kills', 0));
|
||||||
$rankMeta = mt\RankReward::get(getReqVal('ranked', 0));
|
$rankMeta = mt\RankReward::get(getReqVal('ranked', 0));
|
||||||
|
$gold = 0;
|
||||||
$gold += $killMeta ? $killMeta['parameter'] : 0;
|
$gold += $killMeta ? $killMeta['parameter'] : 0;
|
||||||
$gold += $rankMeta ? $rankMeta['parameter'] : 0;
|
$gold += $rankMeta ? $rankMeta['parameter'] : 0;
|
||||||
$addGold = 0;
|
$addGold = 0;
|
||||||
@ -352,9 +358,13 @@ class BattleDataService extends BaseService {
|
|||||||
$heroQualityMeta = mt\HeroQuality::getByQuality($heroDb['quality']);
|
$heroQualityMeta = mt\HeroQuality::getByQuality($heroDb['quality']);
|
||||||
if ($heroQualityMeta) {
|
if ($heroQualityMeta) {
|
||||||
$goldLimit = $heroMeta['gold_limit'];
|
$goldLimit = $heroMeta['gold_limit'];
|
||||||
$attr = getXVal($heroDb['attr'], kHAT_LUCKY, null);
|
$randAttr = emptyReplace(json_decode($row['rand_attr'], true),
|
||||||
if ($attr && $attr['type'] == 1) {
|
array());
|
||||||
$goldLimit += $attr['val'];
|
if ($randAttr) {
|
||||||
|
$attr = mt\AttrHelper::getAbsVal($randAttr, kHAT_LUCKY);
|
||||||
|
if ($attr) {
|
||||||
|
$goldLimit += $attr['val'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$newGold = min($goldLimit, $heroDb['today_get_gold'] + $addGold);
|
$newGold = min($goldLimit, $heroDb['today_get_gold'] + $addGold);
|
||||||
Hero::update($heroDb['hero_uniid'],
|
Hero::update($heroDb['hero_uniid'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user