49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
|
|
namespace mt;
|
|
|
|
|
|
class LevelUp
|
|
{
|
|
const USER_LEVEL_CHIP_LIMIT = 2;
|
|
const USER_LEVEL_EMOJI_LIMIT = 3;
|
|
const USER_LEVEL_PIECE_LIMIT = 4;
|
|
const USER_LEVEL_PVE_MATCH_LIMIT = 5;
|
|
const USER_LEVEL_RANK_MATCH_LIMIT = 7;
|
|
const USER_LEVEL_PARACHUTE_MATCH_LIMIT = 9;
|
|
const USER_LEVEL_CHIP_PAGE1_MATCH_LIMIT = 10;
|
|
const USER_LEVEL_CHIP_PAGE2_MATCH_LIMIT = 11;
|
|
|
|
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;
|
|
|
|
} |