game2006api/webapp/mt/LevelUp.php
hujiabin b04a53dcbb 1
2023-03-24 16:48:36 +08:00

40 lines
980 B
PHP

<?php
namespace mt;
class LevelUp
{
public static function getExpByLv(&$lv,&$exp){
$meta = self::getMetaList();
if ($exp > 0){
for ($i=1;$i<=count($meta);$i++){
if ($exp >= $meta[count($meta)]['total_exp']){
$exp = min($exp, $meta[count($meta)]['total_exp']);
$lv = $meta[count($meta)]['id'];
}else{
if ($i<count($meta)){
if ($exp >= $meta[$i]['total_exp'] &&
$exp < $meta[$i+1]['total_exp'])
{
$lv = $meta[$i]['id'];
}
}
}
}
}
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('levelup@levelup.php');
}
return self::$metaList;
}
protected static $metaList;
}