This commit is contained in:
hujiabin 2024-08-05 16:50:15 +08:00
parent 0882a8eacf
commit d7e36b2fa6
2 changed files with 38 additions and 6 deletions

View File

@ -272,6 +272,7 @@ class Hero(object):
['hero_tili', 0, '英雄体力'], ['hero_tili', 0, '英雄体力'],
['state', 0, '0已购买 1免费GIFT标签'], ['state', 0, '0已购买 1免费GIFT标签'],
['skin_id', 0, '英雄皮肤id'], ['skin_id', 0, '英雄皮肤id'],
['skin_uniid', 0, '英雄皮肤uniid'],
['quality', 0, '品阶'], ['quality', 0, '品阶'],
['skill_lv1', 0, '主动技能等级'], ['skill_lv1', 0, '主动技能等级'],
['skill_lv2', 0, '被动技能等级'], ['skill_lv2', 0, '被动技能等级'],
@ -289,8 +290,10 @@ class Hero(object):
['tags', '', '1Gen状态'], ['tags', '', '1Gen状态'],
['!avatarInfo', [AvatarInfo()], '装饰信息'], ['!avatarInfo', [AvatarInfo()], '装饰信息'],
['ability', Ability(), '属性'], ['ability', Ability(), '属性'],
['lucky', 0, '幸运值'], ['lucky', 0, '英雄自身幸运值'],
['wealth', 0, '财富值'], ['wealth', 0, '英雄自身财富值'],
['luckyMax', 0, '英雄最大幸运值'],
['wealthMax', 0, '英雄最大财富值'],
['seal_type', 0, '0:未封存 1已封存'], ['seal_type', 0, '0:未封存 1已封存'],
['unseal_time', 0, '解封时间'], ['unseal_time', 0, '解封时间'],
['valid_time', 0, '最大有效时间'], ['valid_time', 0, '最大有效时间'],

View File

@ -289,6 +289,7 @@ class Hero extends BaseModel {
'hero_tili' => $row['hero_tili'], 'hero_tili' => $row['hero_tili'],
'state' => $row['state'], 'state' => $row['state'],
'skin_id' => $skinDb?$skinDb['skin_id']:0, 'skin_id' => $skinDb?$skinDb['skin_id']:0,
'skin_uniid' => $skinDb?$skinDb['idx']:0,
'quality' => $row['quality'], 'quality' => $row['quality'],
'skill_lv1' => $row['skill_lv1'], 'skill_lv1' => $row['skill_lv1'],
'skill_lv2' => $row['skill_lv2'], 'skill_lv2' => $row['skill_lv2'],
@ -306,8 +307,10 @@ class Hero extends BaseModel {
'offer_reward_state' => 0, 'offer_reward_state' => 0,
'tags' => isset($row['tags'])?$row['tags']:'', 'tags' => isset($row['tags'])?$row['tags']:'',
'is_select' => $isSelect, 'is_select' => $isSelect,
'lucky' => self::getHeroLucky($row), 'luckyMax' => self::getHeroLucky($row),
'wealth' => self::getHeroWealth($row), 'lucky' => self::getHeroLuckyBase($row),
'wealthMax' => self::getHeroWealth($row),
'wealth' => self::getHeroWealthBase($row),
'ability' => self::abilityInfo($row), 'ability' => self::abilityInfo($row),
'seal_type' => $row['seal_type'], 'seal_type' => $row['seal_type'],
'unseal_time' => $row['unseal_time'], 'unseal_time' => $row['unseal_time'],
@ -356,8 +359,8 @@ class Hero extends BaseModel {
'skill_lv1' => $row['skill_lv1'], 'skill_lv1' => $row['skill_lv1'],
'skill_lv2' => $row['skill_lv2'], 'skill_lv2' => $row['skill_lv2'],
'rand_attr' => $attr, 'rand_attr' => $attr,
'lucky' => self::getHeroLucky($row), 'lucky' => self::getHeroLuckyBase($row),
'wealth' => self::getHeroWealth($row), 'wealth' => self::getHeroWealthBase($row),
'ability' => self::abilityInfo($row), 'ability' => self::abilityInfo($row),
'valid_time' => max(0, 'valid_time' => max(0,
86400 * $heroAtteMeta['validTime']), 86400 * $heroAtteMeta['validTime']),
@ -365,6 +368,32 @@ class Hero extends BaseModel {
"total_times" => $heroAtteMeta['roundPerDay'], "total_times" => $heroAtteMeta['roundPerDay'],
); );
} }
private static function celHeroWealthBase($row){
//最大财富值和幸运值计算
$wealth = 0;
$wealth_rate = 0;
$lucky = 0;
$lucky_rate = 0;
$heroAttrs = emptyReplace(json_decode($row['wealth_attr'], true), array());
$heroResult = \mt\EconomyAttribute::getAttrValue($heroAttrs);
$wealth += $heroResult['wealth'];
$wealth_rate += $heroResult['wealth_rate'];
$lucky += $heroResult['lucky'];
$lucky_rate += $heroResult['lucky_rate'];
return array(
"wealth" => floor($wealth * (1+$wealth_rate)),
"lucky" => floor($lucky * (1+$lucky_rate)),
);
}
public static function getHeroWealthBase($row){
return self::celHeroWealthUpLimit($row)["wealth"];
}
public static function getHeroLuckyBase($row){
return self::celHeroWealthUpLimit($row)["lucky"];
}
private static function celHeroWealthUpLimit($row){ private static function celHeroWealthUpLimit($row){