战斗后星星获取
This commit is contained in:
parent
880d0fd12e
commit
af4c87b503
@ -43,6 +43,7 @@ define('TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM', 9012);
|
|||||||
define('TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM', 9013);
|
define('TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM', 9013);
|
||||||
define('TN_DAILY_COMPLETE_TASK_NUM', 9014);
|
define('TN_DAILY_COMPLETE_TASK_NUM', 9014);
|
||||||
define('TN_DAILY_USED_GOLD_NUM', 9015);
|
define('TN_DAILY_USED_GOLD_NUM', 9015);
|
||||||
|
define('TN_DAILY_GET_STAR_NUM', 9016);
|
||||||
|
|
||||||
define('TN_WEEKLY_BEGIN', 10001);
|
define('TN_WEEKLY_BEGIN', 10001);
|
||||||
define('TN_WEEKLY_ACTIVE', 10002);
|
define('TN_WEEKLY_ACTIVE', 10002);
|
||||||
|
@ -164,6 +164,10 @@ class BaseAuthedController extends BaseController {
|
|||||||
return phpcommon\extractChannel($this->_getAccountId());
|
return phpcommon\extractChannel($this->_getAccountId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _getAddress(){
|
||||||
|
return $this->_getOpenId();
|
||||||
|
}
|
||||||
|
|
||||||
public function _getSessionId()
|
public function _getSessionId()
|
||||||
{
|
{
|
||||||
return $this->sessionId;
|
return $this->sessionId;
|
||||||
@ -361,6 +365,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
return "star_num + ${itemNum}";
|
return "star_num + ${itemNum}";
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
$this->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$itemNum);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
0
webapp/controller/ChainController.class.php
Normal file
0
webapp/controller/ChainController.class.php
Normal file
@ -144,8 +144,8 @@ class TameBattleDataService extends BaseService {
|
|||||||
|
|
||||||
//记录战斗数据的排行榜
|
//记录战斗数据的排行榜
|
||||||
$this->recordBattleRanking();
|
$this->recordBattleRanking();
|
||||||
//结算用户star数量
|
// //结算用户star数量
|
||||||
// $this->calStarNum();
|
// $this->rewardStarNum();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//PVE模式
|
//PVE模式
|
||||||
@ -168,40 +168,39 @@ class TameBattleDataService extends BaseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//每局战斗结算star数量
|
// //每局战斗结算star数量
|
||||||
private function calStarNum(){
|
// private function rewardStarNum(){
|
||||||
$paramMeta = mt\Parameter::getByName('star_get_num');
|
// $paramMeta = mt\Parameter::getByName('star_get_num');
|
||||||
if ($paramMeta){
|
// if ($paramMeta){
|
||||||
$star_get_num = getXVal($paramMeta,'param_value', 0);
|
// $star_get_num = getXVal($paramMeta,'param_value', 0);
|
||||||
$num_arr = explode('|',$star_get_num);
|
// $num_arr = explode('|',$star_get_num);
|
||||||
$rank = getXVal($this->battleInfo,'pvp_personal_rank', 0);
|
// $rank = getXVal($this->battleInfo,'pvp_personal_rank', 0);
|
||||||
if ($rank>count($num_arr) || $rank<1){
|
// if ($rank>count($num_arr) || $rank<1){
|
||||||
$items = array(
|
// $finalNum = 0;
|
||||||
array(
|
// }else{
|
||||||
'item_id'=>V_ITEM_STAR,
|
// $finalNum = $this->calFinalStarNum($num_arr[$rank-1]);
|
||||||
'item_num'=>0
|
// }
|
||||||
)
|
// $items = array(
|
||||||
);
|
// array(
|
||||||
|
// 'item_id'=>V_ITEM_STAR,
|
||||||
|
// 'item_num'=>$finalNum
|
||||||
|
// )
|
||||||
|
// );print_r($items);
|
||||||
|
// $propertyChgService = new services\PropertyChgService();
|
||||||
|
// $awardService = new services\AwardService();
|
||||||
|
//// myself()->_addItems($items, $awardService,$propertyChgService);
|
||||||
|
// myself()->_incDailyV(TN_DAILY_GET_STAR_NUM, 0,$finalNum);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}else{
|
|
||||||
$items = array(
|
|
||||||
array(
|
|
||||||
'item_id'=>V_ITEM_STAR,
|
|
||||||
'item_num'=>$num_arr[$rank-1]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$propertyChgService = new services\PropertyChgService();
|
|
||||||
$awardService = new services\AwardService();
|
|
||||||
myself()->_addItems($items, $awardService,$propertyChgService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//记录战斗数据的排行榜
|
//记录战斗数据的排行榜
|
||||||
private function recordBattleRanking(){
|
private function recordBattleRanking(){
|
||||||
$account = getXVal($this->battleInfo,'account_id', 0);
|
$account = getXVal($this->battleInfo,'account_id', 0);
|
||||||
//游戏场次 (存活30S算有效场次)
|
//游戏场次 (存活30S算有效场次)
|
||||||
if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 ){
|
if (getXVal($this->battleInfo,'pvp_survia_time', 0)/1000 > 30 &&
|
||||||
|
getXVal($this->battleInfo,'abandon_battle', 0) == 0){
|
||||||
RankBattle::upsert($account,RankBattle::GAME_TIMES,1);
|
RankBattle::upsert($account,RankBattle::GAME_TIMES,1);
|
||||||
}
|
}
|
||||||
//吃鸡数 //pvp_team_rank
|
//吃鸡数 //pvp_team_rank
|
||||||
@ -456,7 +455,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
"room_mode" => getXVal($this->allInfo,'room_mode', 0),
|
"room_mode" => getXVal($this->allInfo,'room_mode', 0),
|
||||||
"pvp_mode" => $pvp_mode,
|
"pvp_mode" => $pvp_mode,
|
||||||
"team_mode" => getXVal($this->allInfo,'team_mode', 0),
|
"team_mode" => getXVal($this->allInfo,'team_mode', 0),
|
||||||
"battle_rank" => getXVal($this->battleInfo,'ranked', 0),
|
"battle_rank" => getXVal($this->battleInfo,'pvp_personal_rank', 0),
|
||||||
"team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0),
|
"team_rank" => getXVal($this->allInfo,'pvp_team_rank', 0),
|
||||||
"team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0),
|
"team_kills" => getXVal($this->allInfo,'pvp_team_kills', 0),
|
||||||
"is_win" => getXVal($this->battleInfo,'pve_boss_killed', 0),
|
"is_win" => getXVal($this->battleInfo,'pve_boss_killed', 0),
|
||||||
@ -598,6 +597,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
{
|
{
|
||||||
//pvp奖励 gold
|
//pvp奖励 gold
|
||||||
if ($userDb){
|
if ($userDb){
|
||||||
|
$this->calStarNum($temp['reward'],getXVal($info,'pvp_personal_rank', 0));
|
||||||
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
|
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
|
||||||
if (!$heroDb){
|
if (!$heroDb){
|
||||||
break;
|
break;
|
||||||
@ -607,6 +607,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
$temp['reward']['hero']['id'] = $heroDto['hero_id'];
|
$temp['reward']['hero']['id'] = $heroDto['hero_id'];
|
||||||
$temp['reward']['hero']['gold_uplimit'] = $heroDto['gold_uplimit'];
|
$temp['reward']['hero']['gold_uplimit'] = $heroDto['gold_uplimit'];
|
||||||
$this->rewardGoldPvp($temp['reward'],$heroDto,$userDb['rank']);
|
$this->rewardGoldPvp($temp['reward'],$heroDto,$userDb['rank']);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -627,6 +628,23 @@ class TameBattleDataService extends BaseService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function calStarNum(&$reward,$pvp_rank){
|
||||||
|
$paramMeta = mt\Parameter::getByName('star_get_num');
|
||||||
|
if ($paramMeta){
|
||||||
|
$star_get_num = getXVal($paramMeta,'param_value', 0);
|
||||||
|
$num_arr = explode('|',$star_get_num);
|
||||||
|
if ($pvp_rank>count($num_arr) || $pvp_rank<1){
|
||||||
|
$finalNum = 0;
|
||||||
|
}else{
|
||||||
|
$finalNum = $this->calFinalStarNum($num_arr[$pvp_rank-1]);
|
||||||
|
}
|
||||||
|
array_push($reward['items'],array(
|
||||||
|
'item_id'=> V_ITEM_STAR,
|
||||||
|
'item_num'=>$finalNum,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function rewardGoldPvp(&$reward,$heroDto,$userRank)
|
private function rewardGoldPvp(&$reward,$heroDto,$userRank)
|
||||||
{
|
{
|
||||||
$heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$userRank);
|
$heroPvpGold = FormulaService::calcHeroPvpGold($heroDto, $this->allInfo,$userRank);
|
||||||
@ -643,6 +661,21 @@ class TameBattleDataService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function calFinalStarNum($num){
|
||||||
|
$finalNum = 0;
|
||||||
|
if ($num <= 0) {
|
||||||
|
return $finalNum;
|
||||||
|
}
|
||||||
|
$paramMeta = mt\Parameter::getByName('starroad_max');
|
||||||
|
$starMax = getXVal($paramMeta,'param_value', 0);
|
||||||
|
if ($starMax){
|
||||||
|
$starNum = myself()->_getDailyV(TN_DAILY_GET_STAR_NUM, 0);
|
||||||
|
$newNum = min($starMax,$starNum + $num);
|
||||||
|
$finalNum = max(0,$newNum-$starNum);
|
||||||
|
}
|
||||||
|
return $finalNum;
|
||||||
|
}
|
||||||
|
|
||||||
private function settlementReward(){
|
private function settlementReward(){
|
||||||
error_log('settlementReward');
|
error_log('settlementReward');
|
||||||
$battle_uuid = getXVal($this->allInfo,'battle_uuid', 0);
|
$battle_uuid = getXVal($this->allInfo,'battle_uuid', 0);
|
||||||
@ -857,12 +890,12 @@ class TameBattleDataService extends BaseService {
|
|||||||
//组队模式战斗次数
|
//组队模式战斗次数
|
||||||
$this->incValue($battleData, 'total_team_battle_times', 1);
|
$this->incValue($battleData, 'total_team_battle_times', 1);
|
||||||
//组队模式前30名次数
|
//组队模式前30名次数
|
||||||
if (getXVal($this->battleInfo,'ranked', 0) <= 30){
|
if (getXVal($this->battleInfo,'pvp_personal_rank', 0) <= 30){
|
||||||
$this->incValue($battleData, 'total_team_top_X_battle_times', 1);
|
$this->incValue($battleData, 'total_team_top_X_battle_times', 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//排名
|
//排名
|
||||||
$ranked = getXVal($this->battleInfo,'ranked', 0);
|
$ranked = getXVal($this->battleInfo,'pvp_team_rank', 0);
|
||||||
if ($ranked == 1) {
|
if ($ranked == 1) {
|
||||||
//吃鸡次数
|
//吃鸡次数
|
||||||
$this->incValue($battleData, 'total_win_times', 1);
|
$this->incValue($battleData, 'total_win_times', 1);
|
||||||
@ -1039,7 +1072,7 @@ class TameBattleDataService extends BaseService {
|
|||||||
$heroInfo[$hero['hero_id']] = array();
|
$heroInfo[$hero['hero_id']] = array();
|
||||||
}
|
}
|
||||||
$this->incValue($heroInfo[$hero['hero_id']], "use_times", 1); //每个英雄使用次数
|
$this->incValue($heroInfo[$hero['hero_id']], "use_times", 1); //每个英雄使用次数
|
||||||
$ranked = getXVal($this->battleInfo,'ranked', 0);
|
$ranked = getXVal($this->battleInfo,'pvp_team_rank', 0);
|
||||||
if ($ranked == 1) {
|
if ($ranked == 1) {
|
||||||
//吃鸡次数
|
//吃鸡次数
|
||||||
$this->incValue($heroInfo[$hero['hero_id']], 'win_times', 1);//使用该英雄吃鸡获胜次数
|
$this->incValue($heroInfo[$hero['hero_id']], 'win_times', 1);//使用该英雄吃鸡获胜次数
|
||||||
|
Loading…
x
Reference in New Issue
Block a user