修改排位ceg公式、取消新用户领取免费武器与英雄

This commit is contained in:
hujiabin 2023-06-29 18:01:16 +08:00
parent 67e157de8a
commit 0141acc251
3 changed files with 72 additions and 86 deletions

View File

@ -54,6 +54,7 @@ class UserController extends BaseAuthedController {
$this->createNewUserV2($userName);
$this->_addFreeItem(); //送 50 Test_CEG
$userInfo = $this->_getOrmUserInfo();
$this->_setBattleHero($userInfo);
$this->_setV(TN_RANK_STATUS, 0, 1);
//初始化芯片页
$chipPageObj = new services\ChipPageService();
@ -82,66 +83,22 @@ class UserController extends BaseAuthedController {
$this->_incDailyV(TN_DAILY_LOGINS, 0, 1);
}
private function _addFreeItem2(){
//添加芯片
$chipMeta = \mt\Item::getMetaListByType(\mt\Item::CHIP_TYPE);
$chip1 = array();
$chip2 = array();
$chip3 = array();
foreach ($chipMeta as $row){
if ($row['sub_type'] == 1){
array_push($chip1,$row);
}else if($row['sub_type'] == 2){
array_push($chip2,$row);
}else if($row['sub_type'] == 3){
array_push($chip3,$row);
}
private function _setBattleHero($userInfo){
$heroUniId = 0;
$heroId = 0;
Hero::randHero($heroUniId,$heroId);
$heroMeta = mt\Item::get($heroId);
$headList = emptyReplace(json_decode($userInfo['head_list'], true), array());
if ($heroMeta['hero_head'] && !in_array($heroMeta['hero_head'],$headList)){
array_push($headList,$heroMeta['hero_head']);
}
for ($i=1;$i<=20;$i++){
$row1 = $chip1[array_rand($chip1)];
Chip::addChip($row1);
$row2 = $chip2[array_rand($chip2)];
Chip::addChip($row2);
$row3 = $chip3[array_rand($chip3)];
Chip::addChip($row3);
}
//添加枪械和Gold
$addItems =array();
foreach (mt\Parameter::getListValue('creator_present_items') as $itemsStr) {
list($itemId, $itemNum) = explode(':', $itemsStr);
if ($itemNum > 0) {
array_push($addItems,
array(
'item_id' => $itemId,
'item_num' => $itemNum
));
}
}
array_push($addItems,
array(
'item_id' => V_ITEM_GOLD,
'item_num' => 100000
));
array_push($addItems,
array(
'item_id' => V_ITEM_DIAMOND,
'item_num' => 100000
));
$awardService = new services\AwardService();
$propertyChgService = new services\PropertyChgService();
$this->_addItems($addItems, $awardService, $propertyChgService);
//添加英雄和皮肤
$itemIds = array(30100,30200, 30300, 30400,30500,30600,30700,30900,31000,40701,40702,40901,40902,41001,40102);
$addItems2 =array();
foreach ($itemIds as $row){
array_push($addItems2,
array(
'item_id' => $row,
'item_num' => 1
));
}
$this->_addItems($addItems2, $awardService, $propertyChgService);
User::update(array(
'hero_id' => $heroUniId,
'head_id' => $heroMeta['hero_head'],
'head_frame' => 60000,
'head_list' => json_encode($headList),
'head_frame_list' => json_encode(array(60000)),
));
}
private function _addFreeItem(){

View File

@ -65,16 +65,27 @@ class User extends BaseModel {
$next_star_num = mt\StarLevel::getNextNeedStarNum($current_star_num,$currSeasonMeta['id']);
}
$heroDb = Hero::find($row['hero_id']);
if ($heroDb){
$heroId = $heroDb['hero_id'];
}else{
$heroUniId = 0;
$heroId = 0;
Hero::randHero($heroUniId,$heroId);
self::update(array(
'hero_id' => $heroUniId
));
}
$heroId = $heroDb['hero_id'];
// if ($heroDb){
// $heroId = $heroDb['hero_id'];
// }else{
// $heroUniId = 0;
// $heroId = 0;
// Hero::randHero($heroUniId,$heroId);
// $heroMeta = mt\Item::get($heroId);
// $headList = emptyReplace(json_decode($row['head_list'], true), array());
// if ($heroMeta['hero_head'] && !in_array($heroMeta['hero_head'],$headList)){
// array_push($headList,$heroMeta['hero_head']);
// }
// self::update(array(
// 'hero_id' => $heroUniId,
// 'head_id' => $heroMeta['hero_head'],
// 'head_frame' => 60000,
// 'head_list' => json_encode($headList),
// 'head_frame_list' => json_encode(array(60000)),
// ));
// $row = myself()->_getOrmUserInfo();
// }
return array(
'activated' => $row['activated'],
'rename_count' => $row['rename_count'],
@ -126,16 +137,27 @@ class User extends BaseModel {
$next_star_num = mt\StarLevel::getNextNeedStarNum($current_star_num,$currSeasonMeta['id']);
}
$heroDb = Hero::findByAccountId($row['account_id'],$row['hero_id']);
if ($heroDb){
$heroId = $heroDb['hero_id'];
}else{
$heroUniId = 0;
$heroId = 0;
Hero::randHero($heroUniId,$heroId);
self::update(array(
'hero_id' => $heroUniId
));
}
$heroId = $heroDb['hero_id'];
// if ($heroDb){
// $heroId = $heroDb['hero_id'];
// }else{
// $heroUniId = 0;
// $heroId = 0;
// Hero::randHero($heroUniId,$heroId);
// $heroMeta = mt\Item::get($heroId);
// $headList = emptyReplace(json_decode($row['head_list'], true), array());
// if ($heroMeta['hero_head'] && !in_array($heroMeta['hero_head'],$headList)){
// array_push($headList,$heroMeta['hero_head']);
// }
// self::update(array(
// 'hero_id' => $heroUniId,
// 'head_id' => $heroMeta['hero_head'],
// 'head_frame' => 60000,
// 'head_list' => json_encode($headList),
// 'head_frame_list' => json_encode(array(60000)),
// ));
// $row = myself()->_getOrmUserInfo();
// }
return array(
'activated' => $row['activated'],

View File

@ -826,20 +826,25 @@ class FormulaService extends BaseService {
//排位赛最大分配金额
public static function calcCECMaxSum(){
//当月排位赛最大分配金额=ROUND(40000000/(12*(1+0.7^1+0.7^2+0.7^3+0.7^4+0.7^5+0.7^6+0.7^7))*0.7^(CEILING(月份数/12-0.01,1)-1),0)*70%
//当月排位赛最大分配金额=ROUND(4*10000*10000/(12*(1+0.7^1+0.7^2+0.7^3+0.7^4+0.7^5+0.7^6+0.7^7))*0.7^(CEILING(月份数/12-0.01,1)-1),0)*70%
$month = date('m',myself()->_getNowTime());
return round(40000000/(12*(1+pow(0.7,1)+pow(0.7,2)+pow(0.7,3)+pow(0.7,4)
//return round(40000000/(12*(1+pow(0.7,1)+pow(0.7,2)+pow(0.7,3)+pow(0.7,4)
// +pow(0.7,5)+pow(0.7,6)+pow(0.7,7)))*pow(0.7,ceil($month/12-0.01)-1),0)*0.7;
return round(4*10000*10000/(12*(1+pow(0.7,1)+pow(0.7,2)+pow(0.7,3)+pow(0.7,4)
+pow(0.7,5)+pow(0.7,6)+pow(0.7,7)))*pow(0.7,ceil($month/12-0.01)-1),0)*0.7;
}
//排位赛参与分配人数
private function calcPeopleCapita($kingCount){
//MIN(当月王者及以上用户数ROUND(LOG10(当月王者及以上用户数+2)^3*1.5,1)*100)
return min($kingCount,round(pow(log10($kingCount+2),3)*1.5,1)*100);
//排位赛参与分配人数=MIN(当月王者用户数ROUND(LOG10(当月王者用户数+1)^3*1.5,0)*100
// return min($kingCount,round(pow(log10($kingCount+2),3)*1.5,1)*100);
return min($kingCount,round(pow(log10($kingCount+1),3)*1.5,0)*100);
}
//排位赛人数%
private static function calcPeopleCapitaPer($kingCount){
//MIN(ROUND(0.31*MIN(当月王者及以上用户数,ROUND(LOG10(当月王者及以上用户数+1)^3*1.5,2)*100)^0.226,2),2)
return min(round(0.31*pow(min($kingCount,round(pow(log10($kingCount+1),3)*1.5,2)*100),0.226),2),2);
//return min(round(0.31*pow(min($kingCount,round(pow(log10($kingCount+1),3)*1.5,2)*100),0.226),2),2);
//排位赛人数%=MAX(ROUND(5.8-0.85*(1+MIN(当月王者用户数,ROUND(LOG10(当月王者用户数+1)^3*1.5,0)*100))^0.2,2),2)
return max(round(5.8-0.85*pow(1+min($kingCount,round(pow(log10($kingCount+1),3)*1.5,0)*100),0.2),2),2);
}
//TopX梯队
public static function echelonTopX($top){
@ -867,13 +872,15 @@ class FormulaService extends BaseService {
//TopX梯队最高值
private static function maxTopX($topTd){
//TopX梯队最高值=ROUND(2000*0.6^(TopX梯队-1)*0.9^(TopX梯队-1),0)
return round(2000*pow(0.6,$topTd-1)*pow(0.9,$topTd-1),0);
// return round(2000*pow(0.6,$topTd-1)*pow(0.9,$topTd-1),0);
return round(20000*pow(0.6,$topTd-1)*pow(0.9,$topTd-1),0);
}
//TopX梯队最低值
private static function minTopX($topTd){
//TopX梯队最低值=ROUND(2000*0.6^(TopX梯队)*0.9^(TopX梯队-1),0)
return round(2000*pow(0.6,$topTd)*pow(0.9,$topTd-1),0);
// return round(2000*pow(0.6,$topTd)*pow(0.9,$topTd-1),0);
return round(20000*pow(0.6,$topTd)*pow(0.9,$topTd-1),0);
}
//TopX排位赛标准分配额
public static function standardTopX($top,$topTd){