From 3a02badc591bfd47f07bef9cf303fc86ea441f66 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 14 Oct 2022 19:09:20 +0800 Subject: [PATCH] 1 --- webapp/models/Hero.php | 6 ++---- webapp/mt/HeroLevelAttr.php | 11 +++++++---- webapp/mt/HeroQuality.php | 9 +++++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index fca4b2b4..dce080b6 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -184,9 +184,6 @@ class Hero extends BaseModel { } $heroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($row['quality']); $dto = array( - 'rand_attr' => $row['rand_attr'], - 'attr_pro1' => $attrPro1, - 'attr_pro2' => $attrPro2, 'idx' => $row['idx'], 'token_id' => $row['token_id'], 'hero_uniid' => $row['idx'], @@ -519,9 +516,10 @@ class Hero extends BaseModel { private static function getAttrProByLevel($row,$baseAttr,$attr){ $attrPro1 = []; $coefficient_level = mt\HeroLevelAttr::getCoefficientByLevel($row['hero_lv'],$row['hero_id']); + foreach ($baseAttr as $val){ - $coef_level = mt\HeroLevelAttr::getByCoefficient($coefficient_level,$val['attr_id']); foreach ($attr as $v){ + $coef_level = mt\HeroLevelAttr::getByCoefficient($coefficient_level,$val['attr_id']); // if ($val['attr_id'] == $v['attr_id'] && $val['attr_id'] == kHAT_Atk){ //18 //18.941564456287 //20.847692307692 // array_push($attrPro1,[ // 'attr_id' => $val['attr_id'], diff --git a/webapp/mt/HeroLevelAttr.php b/webapp/mt/HeroLevelAttr.php index 95143232..4a1f5dcf 100644 --- a/webapp/mt/HeroLevelAttr.php +++ b/webapp/mt/HeroLevelAttr.php @@ -24,8 +24,11 @@ class HeroLevelAttr { public static function getByCoefficient($data,$index) { - self::mustBeCoefficientHash($data); - return getXVal(self::$coefficientHash, $index, null); + foreach ($data as $val){ + if ($val['attr_id'] == $index){ + return $val; + } + } } public static function getCoefficientByLevel($level,$hero_id){ @@ -198,7 +201,7 @@ class HeroLevelAttr { } } - protected static function mustBeCoefficientHash($list) + protected static function mustBeCoefficientHash($list) { if (!self::$coefficientHash) { self::$coefficientHash = array(); @@ -211,6 +214,6 @@ class HeroLevelAttr { protected static $metaList; protected static $levelHash; - protected static $coefficientHash; + protected static $coefficientHash; } diff --git a/webapp/mt/HeroQuality.php b/webapp/mt/HeroQuality.php index 1be5c0f7..d9930c9e 100644 --- a/webapp/mt/HeroQuality.php +++ b/webapp/mt/HeroQuality.php @@ -19,8 +19,13 @@ class HeroQuality { public static function getByCoefficient($data,$index) { - self::mustBeCoefficientHash($data); - return getXVal(self::$coefficientHash, $index, null); + foreach ($data as $val){ + if ($val['attr_id'] == $index){ + return $val; + } + } +// self::mustBeCoefficientHash($data); +// return getXVal(self::$coefficientHash, $index, null); } public static function getCoefficientByQuality($quality,$hero_id){