42 lines
951 B
PHP
42 lines
951 B
PHP
<?php
|
|
|
|
namespace mt;
|
|
|
|
use phpcommon;
|
|
|
|
class HeroLevel {
|
|
|
|
public static function get($id)
|
|
{
|
|
return getXVal(self::getMetaList(), $id);
|
|
}
|
|
|
|
public static function getByQualityLevel($quality, $level)
|
|
{
|
|
self::mustBeQualityLevelHash();
|
|
return getXVal(self::$qualityLevelHash, $quality . '_' . $level, null);
|
|
}
|
|
|
|
protected static function getMetaList()
|
|
{
|
|
if (!self::$metaList) {
|
|
self::$metaList = getMetaTable('heroLevel@heroLevel.php');
|
|
}
|
|
return self::$metaList;
|
|
}
|
|
|
|
protected static function mustBeQualityLevelHash()
|
|
{
|
|
if (!self::$qualityLevelHash) {
|
|
self::$qualityLevelHash = array();
|
|
foreach (self::getMetaList() as $meta) {
|
|
self::$qualityLevelHash[$meta['quality'] . '_' . $meta['level']] = $meta;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected static $metaList;
|
|
protected static $qualityLevelHash;
|
|
|
|
}
|