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