This commit is contained in:
hujiabin 2023-03-27 16:45:35 +08:00
parent 89bcfdeecd
commit 9ac15bd37c
9 changed files with 115 additions and 32 deletions

View File

@ -18,12 +18,11 @@ define('TN_SHOP', 8003);
define('TN_RECHARGE_UPGRADE_TIMES', 8004);
define('TN_SHARE_GAMES', 8005);
define('TN_HERO_LEVEL_UP', 8006);
define('TN_HERO_QUALITY_UP', 8007);
define('TN_HERO_MAX_LEVEL', 8008);
define('TN_HERO_MAX_QUALITY', 8009);
define('TN_GUN_MAX_QUALITY', 80009);
define('TN_RANK_STATUS', 99999);
define('TN_END', 8007);
define('TN_HERO_MAX_LEVEL', 8008);
define('TN_LAST_RANKING_TIME', 8009);
define('TN_RANK_STATUS', 99999);
define('TN_DAILY_BEGIN', 9001);
define('TN_DAILY_LOGINS', 9001);

View File

@ -82,6 +82,29 @@ class BaseAuthedController extends BaseController {
die();
}
}
$userInfo = $this->_getOrmUserInfo();
switch (getReqVal('c', '')){
case 'ChipPage': {
if ($userInfo['level'] < \mt\LevelUp::USER_LEVEL_CHIP_LIMIT){
$this->_rspErr(1,'Not agreed terms');
die();
}
}
break;
case 'Emoji' : {
if ($userInfo['level'] < \mt\LevelUp::USER_LEVEL_EMOJI_LIMIT){
$this->_rspErr(1,'Not agreed terms');
die();
}
}
break;
case 'Parachute' : {
if ($userInfo['level'] < \mt\LevelUp::USER_LEVEL_PARACHUTE_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
die();
}
}
}
/*if (SERVER_ENV == _ONLINE) {
if (phpcommon\cmpVersion(getReqVal('_version', ''), '0.2.0') > 0) {
if (!$this->isWhiteList() || myself()->_getChannel() != BC_CHANNEL) {

View File

@ -37,6 +37,23 @@ class ChipPageController extends BaseAuthedController
}
public function addChipPage(){
$userInfo = $this->_getOrmUserInfo();
if (ChipPage::getCount() == 3){
if ($userInfo['level'] < \mt\LevelUp::USER_LEVEL_CHIP_PAGE1_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
return ;
}
}
if (ChipPage::getCount() == 4){
if ($userInfo['level'] < \mt\LevelUp::USER_LEVEL_CHIP_PAGE2_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
return ;
}
}
if (ChipPage::getCount() == 5){
$this->_rspErr(1,'Maximum');
return ;
}
ChipPage::addChipPage();
$this->_rspOk();
}

View File

@ -52,6 +52,10 @@ class TeamController extends BaseAuthedController {
//验证pve_instance_id合法性
if ($pveInstanceId){
if ($userDb['level'] < \mt\LevelUp::USER_LEVEL_PVE_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
return;
}
$pveGame = \mt\PveGemini::get($pveInstanceId);
if (!$pveGame){
$this->_rspErr(1, 'pve_instance_id error');
@ -61,16 +65,12 @@ class TeamController extends BaseAuthedController {
$this->_rspErr(1, "You can't challenge beyond your level");
return;
}
// $temp = array();
// Hero::getHeroList(function ($row) use ($pveGame,&$temp) {
// if ($row['quality']>=$pveGame['gemini_lv']){
// array_push($temp,$row);
// }
// });
// if (count($temp)<1){
// $this->_rspErr(1, 'Lack of qualified heroes');
// return;
// }
}
if ($matchMode == self::MATCH_MODE_RANK){
if ($userDb['level'] < \mt\LevelUp::USER_LEVEL_RANK_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
return;
}
}
$userDto = User::toPreset($userDb);
$userDto['is_leader'] = 1;
@ -116,10 +116,18 @@ class TeamController extends BaseAuthedController {
$this->_rspErr(1, 'The team has been disbanded');
return;
}
// if (count($teamDb['member_list']) >= $teamDb['slot_num']) {
// $this->_rspErr(2, 'The team is full');
// return;
// }
$userDb = $this->_getOrmUserInfo();
if ($teamDb['match_mode'] == self::MATCH_MODE_RANK &&
$userDb['level'] < \mt\LevelUp::USER_LEVEL_RANK_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
return;
}
if ($teamDb['match_mode'] == self::MATCH_MODE_PVE &&
$userDb['level'] < \mt\LevelUp::USER_LEVEL_PVE_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
return;
}
foreach ($teamDb['member_list'] as $member) {
if ($member['account_id'] == $this->_getAccountId()) {
$this->_rspData(array(
@ -136,17 +144,10 @@ class TeamController extends BaseAuthedController {
$this->_rspErr(1, 'No challenge');
return;
}
$pveGame = \mt\PveGemini::get($teamDb['pve_instance_id']);
// $temp = array();
// Hero::getHeroList(function ($row) use ($pveGame,&$temp) {
// if ($row['quality']>=$pveGame['gemini_lv']){
// array_push($temp,$row);
// }
// });
// if (count($temp)<1){
// $this->_rspErr(1, 'Lack of qualified heroes');
// return;
// }
if ($userDb['level'] < \mt\LevelUp::USER_LEVEL_PVE_MATCH_LIMIT){
$this->_rspErr(1,'Not agreed terms');
return;
}
}
$userDto = User::toPreset($userDb);

View File

@ -51,7 +51,7 @@ class UserController extends BaseAuthedController {
$userInfo = $this->_getOrmUserInfo();
$this->_setV(TN_RANK_STATUS, 0, 1);
}
//elo 衰减
//elo score 衰减
$this->dampingElo($userInfo);
$userInfo = $this->_getOrmUserInfo();
//跟新登录时间
@ -762,13 +762,31 @@ class UserController extends BaseAuthedController {
}
private function dampingElo($userInfo){
//每天elo衰减
$time_diff = myself()->_getNowTime()-$userInfo['last_login_time'];
if ($userInfo['elo'] > 1500 && floor($time_diff/86400) > 0){
$newElo = min(round(pow(log10(floor($time_diff/86400)),1.5)*350),450);
$this->_updateUserInfo(array(
'elo' => $userInfo['elo'] - $newElo
));
// $userInfo = $this->_getOrmUserInfo();
}
//7天未打排位扣排位分
$last_ranking_time = $this->_getV(TN_LAST_RANKING_TIME,0);
if ($last_ranking_time && floor((myself()->_getNowTime()-$last_ranking_time)/86400) >= 7){
$userDb = $this->_getOrmUserInfo();
$rank_key = mt\Rank::getRankById($userDb['rank'])?mt\Rank::getRankById($userDb['rank'])['rank_order2']:0;
$paramMeta = mt\Parameter::getByName('rank_pass_point');
if ($paramMeta){
$valArr = explode('|',$paramMeta['param_value']);
$deductScore = $valArr[$rank_key-1];
$newRank = $userDb['rank'];
$newScore = $userDb['score'] - $deductScore;
mt\Rank::calcNewRankAndScore( $newRank, $newScore);
$this->_updateUserInfo(array(
'rank' => $newRank,
'score' => $newScore,
));
}
}
}

View File

@ -222,4 +222,19 @@ class ChipPage extends BaseModel
$info
);
}
public static function getCount(){
$rows = SqlHelper::ormSelect(
myself()->_getSelfMysql(),
't_chip_page',
array(
'account_id'=> myself()->_getAccountId()
)
);
$count = 0;
if ($rows){
$count = count($rows);
}
return $count;
}
}

View File

@ -40,6 +40,7 @@ class Emoji extends BaseModel
$value = explode('|',$row['value']) ;
}else{
$value= self::defaultUseEmoji();
self::updateEmoji(implode('|',$value));
}
return $value;
}

View File

@ -6,6 +6,14 @@ namespace mt;
class LevelUp
{
const USER_LEVEL_CHIP_LIMIT = 2;
const USER_LEVEL_EMOJI_LIMIT = 3;
const USER_LEVEL_PVE_MATCH_LIMIT = 4;
const USER_LEVEL_RANK_MATCH_LIMIT = 6;
const USER_LEVEL_PARACHUTE_MATCH_LIMIT = 8;
const USER_LEVEL_CHIP_PAGE1_MATCH_LIMIT = 9;
const USER_LEVEL_CHIP_PAGE2_MATCH_LIMIT = 10;
public static function getExpByLv(&$lv,&$exp){
$meta = self::getMetaList();
if ($exp > 0){

View File

@ -376,6 +376,7 @@ class TameBattleDataService extends BaseService {
$newScore = $this->userInfo['score'];
if ($pvp_mode == self::MATCH_MODE_RANK){
myself()->_setV(TN_LAST_RANKING_TIME,0,getXVal($this->battleInfo,'game_time', 0));
$winningPro = $this->celWinningPro($this->userInfo);
if ($winningPro){