game2006api/webapp/mt/HeroLevel.php
aozhiwei b9249a651b 1
2022-06-13 19:54:31 +08:00

45 lines
914 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;
}