This commit is contained in:
aozhiwei 2022-06-13 20:06:29 +08:00
parent b9249a651b
commit bdca825286

View File

@ -0,0 +1,36 @@
<?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;
}