1
This commit is contained in:
parent
555a63e576
commit
a89b04db72
@ -53,6 +53,7 @@ class GunController extends BaseAuthedController {
|
||||
$typeId = getReqVal('type_id', 0);
|
||||
$talentId = getReqVal('talent_id', 0);
|
||||
$talentDb = GunTalent::find($typeId, $talentId);
|
||||
$currLv = isset($talentDb) ? $talentDb['talent_lv'] : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,31 +28,26 @@ class GunTalentGrow {
|
||||
return $costList;
|
||||
}
|
||||
|
||||
public static function isFullLv($meta, $talentLv)
|
||||
public static function getByIdLv($talentId, $talentLv)
|
||||
{
|
||||
$fullLvMeta = self::getFullLvMeta($meta);
|
||||
return $fullLvMeta && $talentLv >= $fullLvMeta['lv'];
|
||||
self::mustBeIdLvHash();
|
||||
$idMeta = getXVal($idLvHash, $talentId, null);
|
||||
return $idMeta ? getXVal($idMeta, $talentLv, null) : null;
|
||||
}
|
||||
|
||||
public static function getFullLvMeta($meta)
|
||||
protected static function mustBeIdLvHash()
|
||||
{
|
||||
$currMeta = $meta;
|
||||
while ($currMeta['nextid'] > 0) {
|
||||
$currMeta = self::get($currMeta['nextid']);
|
||||
if (!self::$idLvHash) {
|
||||
self::$idLvHash = array();
|
||||
foreach (self::getMetaList() as $meta) {
|
||||
$idMeta = getXVal($idLvHash, $talentId, null);
|
||||
if (!$idMeta) {
|
||||
$idMeta = array();
|
||||
$idLvHash[$meta['id']] = $idMeta;
|
||||
}
|
||||
return $currMeta;
|
||||
$idLvHash[$meta['id']][$meta['talent_lv']] = $meta;
|
||||
}
|
||||
|
||||
public static function getByLv($meta, $talentLv)
|
||||
{
|
||||
$currMeta = $meta;
|
||||
while ($currMeta) {
|
||||
if ($currMeta['lv'] == $talentLv) {
|
||||
return $currMeta;
|
||||
}
|
||||
$currMeta = self::get($currMeta['nextid']);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static function getMetaList()
|
||||
@ -63,6 +58,7 @@ class GunTalentGrow {
|
||||
return self::$metaList;
|
||||
}
|
||||
|
||||
protected static $idLvHash;
|
||||
protected static $metaList;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user