diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index a71fcd51..2a3f772e 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -221,10 +221,30 @@ class Hero extends BaseModel { public static function toDto($row) { $attr = emptyReplace(json_decode($row['rand_attr'], true), array()); -// if (!$attr){ -// $heroMeta = mt\Hero::get($row['hero_id']); -// $attr = mt\Hero::getHeroAttr($heroMeta); -// } + if (!$attr){ + $heroMeta = mt\Hero::get($row['hero_id']); + $baseAttr = mt\Hero::getHeroAttr($heroMeta); + foreach ($baseAttr as $value){ + if (in_array($value['attr_id'],array(kHAT_Hp,kHAT_Atk,kHAT_Def))){ + array_push($attr,array( + 'attr_id' => $value['attr_id'], + 'val' => $value['val'] , + 'quality' => rand(2,3), + ) + ); + }else{ + array_push($attr,array( + 'attr_id' => $value['attr_id'], + 'val' => $value['val'] , + 'quality' => 0, + ) + ); + } + } + self::update($row['idx'],array( + 'rand_attr'=>json_encode($attr) + )); + } // $lockType = 0; // $unlockTime = 0;