game2005api/webapp/mt/GunTalentGrow.php
aozhiwei 555a63e576 1
2021-11-29 15:48:42 +08:00

69 lines
1.5 KiB
PHP

<?php
namespace mt;
use phpcommon;
class GunTalentGrow {
public static function get($id)
{
return getXVal(self::getMetaList(), $id, null);
}
public static function getCostList($meta)
{
$costList = array();
$strArr = explode("|", $meta["cost"]);
foreach ($strArr as $str) {
$strArr2 = explode(":", $str);
array_push(
$costList,
array(
'item_id' => (int)$strArr2[0],
'item_num' => (int)$strArr2[1],
)
);
}
return $costList;
}
public static function isFullLv($meta, $talentLv)
{
$fullLvMeta = self::getFullLvMeta($meta);
return $fullLvMeta && $talentLv >= $fullLvMeta['lv'];
}
public static function getFullLvMeta($meta)
{
$currMeta = $meta;
while ($currMeta['nextid'] > 0) {
$currMeta = self::get($currMeta['nextid']);
}
return $currMeta;
}
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()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('gunTalentGrow@gunTalentGrow.php');
}
return self::$metaList;
}
protected static $metaList;
}