game2006api/webapp/mt/HeroLevel.php
aozhiwei c63bacb4c9 1
2022-06-14 10:16:18 +08:00

45 lines
913 B
PHP

<?php
namespace mt;
require_once('mt/StrHelper.php');
require_once('mt/AttrHelper.php');
use phpcommon;
class HeroLevel {
public static function get($id)
{
return getXVal(self::getMetaList(), $id);
}
public static function getByLevel($level)
{
self::mustBeLevelHash();
return getXVal(self::$levelHash, $level, null);
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('heroLevel@heroLevel.php');
}
return self::$metaList;
}
protected static function mustBeLevelHash()
{
if (!self::$levelHash) {
self::$levelHash = array();
foreach (self::getMetaList() as $meta) {
self::$levelHash[$meta['level']] = $meta;
}
}
}
protected static $metaList;
protected static $levelHash;
}