100 lines
2.7 KiB
PHP
100 lines
2.7 KiB
PHP
<?php
|
|
|
|
|
|
namespace mt;
|
|
|
|
|
|
class StarLevel
|
|
{
|
|
const STAR_NUM_CHIP_LIMIT = 150;
|
|
const STAR_NUM_EMOJI_LIMIT = 50;
|
|
const STAR_NUM_PIECE_LIMIT = 150;
|
|
const STAR_NUM_PVE_MATCH_LIMIT = 80;
|
|
const STAR_NUM_RANK_MATCH_LIMIT = 100;
|
|
const STAR_NUM_CHIP_PAGE1_MATCH_LIMIT = 325;
|
|
const STAR_NUM_CHIP_PAGE2_MATCH_LIMIT = 375;
|
|
|
|
public static function get($id){
|
|
return getXVal(self::getMetaList(), $id);
|
|
}
|
|
|
|
public static function getNextNeedStarNum($num,$season_id){
|
|
$metaList = array_merge(self::getDefaultList(),self::getListBySeason($season_id));
|
|
|
|
$maxLen = count($metaList);
|
|
for ($i=0;$i<$maxLen;$i++){
|
|
if ($num >= $metaList[$maxLen-1]['need_star_num']){
|
|
return $metaList[$maxLen-1]['need_star_num'];
|
|
}
|
|
if ($num >= $metaList[$i]['need_star_num'] &&
|
|
$num < $metaList[$i+1]['need_star_num']) {
|
|
return $metaList[$i+1]['need_star_num'];
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static function getMaxSlot($num){
|
|
$metaList = self::getDefaultList();
|
|
$maxSlot = 1;
|
|
foreach ($metaList as $meta){
|
|
if ($num >= $meta['need_star_num'] && $meta['unlock_chip_slot']){
|
|
$maxSlot = $meta['unlock_chip_slot'];
|
|
|
|
}
|
|
}
|
|
return $maxSlot;
|
|
}
|
|
|
|
public static function getDefaultList(){
|
|
$list = array();
|
|
foreach (self::getMetaList() as $meta){
|
|
if ($meta['season_id'] == 0){
|
|
array_push($list,$meta);
|
|
}
|
|
}
|
|
return $list;
|
|
}
|
|
|
|
public static function getListBySeason($season_id){
|
|
$list = array();
|
|
foreach (self::getMetaList() as $meta){
|
|
if ($meta['season_id'] == $season_id){
|
|
array_push($list,$meta);
|
|
}
|
|
}
|
|
return $list;
|
|
}
|
|
|
|
protected static function getMetaList()
|
|
{
|
|
if (!self::$metaList) {
|
|
self::$metaList = getMetaTable('starLevel@starLevel.php');
|
|
}
|
|
return self::$metaList;
|
|
}
|
|
|
|
public static function getCurrentSeason(){
|
|
foreach (self::getMetaListStarRoad() as $meta) {
|
|
if (myself()->_getNowTime() >= strtotime($meta['begin_time']) &&
|
|
myself()->_getNowTime() <= strtotime($meta['end_time'])) {
|
|
return $meta;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
protected static function getMetaListStarRoad()
|
|
{
|
|
if (!self::$metaListStar) {
|
|
self::$metaListStar = getMetaTable('starRoad@starRoad.php');
|
|
}
|
|
return self::$metaListStar;
|
|
}
|
|
|
|
|
|
|
|
protected static $metaList;
|
|
protected static $metaListStar;
|
|
|
|
} |