37 lines
838 B
PHP
37 lines
838 B
PHP
<?php
|
|
|
|
namespace mt;
|
|
|
|
require_once('mt/StrHelper.php');
|
|
require_once('mt/AttrHelper.php');
|
|
|
|
use phpcommon;
|
|
|
|
class HeroLevelAttr {
|
|
|
|
public static function get($id)
|
|
{
|
|
return getXVal(self::getMetaList(), $id);
|
|
}
|
|
|
|
public static function addRandAttr($level, $baseAttrs, &$dbAttrs)
|
|
{
|
|
$nums = explode(':', $levelMeta['rand_attrs_num']);
|
|
$num = rand($nums[0], $nums[1]);
|
|
$cfgAttrs = StrHelper::parseList($levelMeta['rand_attrs'], array('|', ':'));
|
|
AttrHelper::addRandAttrs($cfgAttrs, $num, $baseAttrs, $dbAttrs);
|
|
return true;
|
|
}
|
|
|
|
protected static function getMetaList()
|
|
{
|
|
if (!self::$metaList) {
|
|
self::$metaList = getMetaTable('heroLevelAttr@heroLevelAttr.php');
|
|
}
|
|
return self::$metaList;
|
|
}
|
|
|
|
protected static $metaList;
|
|
|
|
}
|