game2006api/webapp/mt/LevelUp.php
2023-02-13 14:22:45 +08:00

37 lines
894 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 ($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;
}