This commit is contained in:
aozhiwei 2024-08-05 17:09:31 +08:00
commit 35b367b224
3 changed files with 37 additions and 4 deletions

View File

@ -272,6 +272,7 @@ class Hero(object):
['hero_tili', 0, '英雄体力'],
['state', 0, '0已购买 1免费GIFT标签'],
['skin_id', 0, '英雄皮肤id'],
['skin_uniid', 0, '英雄皮肤uniid'],
['quality', 0, '品阶'],
['skill_lv1', 0, '主动技能等级'],
['skill_lv2', 0, '被动技能等级'],
@ -292,6 +293,10 @@ class Hero(object):
['ability_addition', Ability(), '属性-加成'],
['lucky', 0, '幸运值'],
['wealth', 0, '财富值'],
['lucky_base', 0, '英雄自身幸运值'],
['wealth_base', 0, '英雄自身财富值'],
['lucky', 0, '英雄最大幸运值'],
['wealth', 0, '英雄最大财富值'],
['seal_type', 0, '0:未封存 1已封存'],
['unseal_time', 0, '解封时间'],
['valid_time', 0, '最大有效时间'],

View File

@ -291,6 +291,7 @@ class Hero extends BaseModel {
'hero_tili' => $row['hero_tili'],
'state' => $row['state'],
'skin_id' => $skinDb?$skinDb['skin_id']:0,
'skin_uniid' => $skinDb?$skinDb['idx']:0,
'quality' => $row['quality'],
'skill_lv1' => $row['skill_lv1'],
'skill_lv2' => $row['skill_lv2'],
@ -309,9 +310,11 @@ class Hero extends BaseModel {
'tags' => isset($row['tags'])?$row['tags']:'',
'is_select' => $isSelect,
'lucky' => self::getHeroLucky($row),
'lucky_base' => self::getHeroLuckyBase($row),
'wealth' => self::getHeroWealth($row),
'ability' => $baseAbility,
'ability_addition' => $addAbility,
'wealth_base' => self::getHeroWealthBase($row),
'seal_type' => $row['seal_type'],
'unseal_time' => $row['unseal_time'],
'valid_lefttime' => max(0,
@ -359,8 +362,8 @@ class Hero extends BaseModel {
'skill_lv1' => $row['skill_lv1'],
'skill_lv2' => $row['skill_lv2'],
'rand_attr' => $attr,
'lucky' => self::getHeroLucky($row),
'wealth' => self::getHeroWealth($row),
'lucky' => self::getHeroLuckyBase($row),
'wealth' => self::getHeroWealthBase($row),
'ability' => self::abilityInfo($row),
'valid_time' => max(0,
86400 * $heroAtteMeta['validTime']),
@ -368,6 +371,32 @@ class Hero extends BaseModel {
"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){

View File

@ -401,9 +401,8 @@ class HashRateService extends BaseService
foreach ($this->hashRateTask as $item){
if (is_array($item)){
foreach ($item as $task){
$taskMeta = AchievementsPower::find($task['task_id']);
$taskDb = HashRate::find($task['task_id'],$period);
$taskDto = $this->hashRateTaskDto($taskMeta,$taskDb,$period);
$taskDto = $this->hashRateTaskDto($task,$taskDb,$period);
if ($taskDto['state'] == self::FINISHED_STATE){
return true;
}