1
This commit is contained in:
parent
b9249a651b
commit
bdca825286
36
webapp/mt/HeroLevelAttr.php
Normal file
36
webapp/mt/HeroLevelAttr.php
Normal 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;
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user