1
This commit is contained in:
parent
6b79ebf012
commit
3125a78dbf
@ -21,6 +21,7 @@ class Activity(object):
|
|||||||
['income_start_time', 0, '宝箱掉落阶段开始时间'],
|
['income_start_time', 0, '宝箱掉落阶段开始时间'],
|
||||||
['income_end_time', 0, '宝箱掉落阶段结束时间'],
|
['income_end_time', 0, '宝箱掉落阶段结束时间'],
|
||||||
['status', 0, '0:任务进行时 1:4v4完成任务 2:pvp完成任务 '],
|
['status', 0, '0:任务进行时 1:4v4完成任务 2:pvp完成任务 '],
|
||||||
|
['drop_state', 0, ' 宝箱掉落模式 1:4v4 2:pvp '],
|
||||||
['!taskDtoList1', [serverTask()], '4v4任务列表'],
|
['!taskDtoList1', [serverTask()], '4v4任务列表'],
|
||||||
['!taskDtoList2', [serverTask()], 'pvp任务列表'],
|
['!taskDtoList2', [serverTask()], 'pvp任务列表'],
|
||||||
]
|
]
|
||||||
|
@ -10,7 +10,7 @@ class ActivityController extends BaseAuthedController {
|
|||||||
public function serverTask(){
|
public function serverTask(){
|
||||||
$currentMeta = \mt\ServerTaskTime::getCurrentTime();
|
$currentMeta = \mt\ServerTaskTime::getCurrentTime();
|
||||||
if (! $currentMeta){
|
if (! $currentMeta){
|
||||||
myself()->_setV(TN_SERVER_TASK_STATE,0,0);
|
myself()->_setV(TN_SERVER_TASK_STATE,0,\mt\ServerTask::NOT_ACCOMPLISH_STATE);
|
||||||
$this->_rspErr(111, 'The activity has not started yet');
|
$this->_rspErr(111, 'The activity has not started yet');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -47,12 +47,14 @@ class ActivityController extends BaseAuthedController {
|
|||||||
if ($pvpCount == count($taskDtoList2)){
|
if ($pvpCount == count($taskDtoList2)){
|
||||||
myself()->_setV(TN_SERVER_TASK_STATE,0,\mt\ServerTask::ACCOMPLISH_PVP_STATE);
|
myself()->_setV(TN_SERVER_TASK_STATE,0,\mt\ServerTask::ACCOMPLISH_PVP_STATE);
|
||||||
}
|
}
|
||||||
|
$drop_state = $hashRateService->getServerASKBoxMode();
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'obtain_start_time' => strtotime($currentMeta['obtain_start_time']),
|
'obtain_start_time' => strtotime($currentMeta['obtain_start_time']),
|
||||||
'obtain_end_time' => strtotime($currentMeta['obtain_end_time']),
|
'obtain_end_time' => strtotime($currentMeta['obtain_end_time']),
|
||||||
'income_start_time' => strtotime($currentMeta['income_start_time']),
|
'income_start_time' => strtotime($currentMeta['income_start_time']),
|
||||||
'income_end_time' => strtotime($currentMeta['income_end_time']),
|
'income_end_time' => strtotime($currentMeta['income_end_time']),
|
||||||
'status' => myself()->_getV(TN_SERVER_TASK_STATE,0),
|
'status' => myself()->_getV(TN_SERVER_TASK_STATE,0),
|
||||||
|
'drop_state' => $drop_state,
|
||||||
'taskDtoList1' => $taskDtoList1,
|
'taskDtoList1' => $taskDtoList1,
|
||||||
'taskDtoList2' => $taskDtoList2,
|
'taskDtoList2' => $taskDtoList2,
|
||||||
));
|
));
|
||||||
|
@ -129,14 +129,16 @@ class BattleController extends BaseAuthedController {
|
|||||||
$teamBattleDataService = new services\TameBattleDataService();
|
$teamBattleDataService = new services\TameBattleDataService();
|
||||||
$teamBattleDataService->calStarNum();
|
$teamBattleDataService->calStarNum();
|
||||||
$mode = getReqVal('room_mode', 0);
|
$mode = getReqVal('room_mode', 0);
|
||||||
$status = myself()->_getV(TN_SERVER_TASK_STATE,0);
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$currentMeta = \mt\ServerTaskTime::getCurrentTime();
|
$currentMeta = \mt\ServerTaskTime::getCurrentTime();
|
||||||
if ($currentMeta &&
|
if ($currentMeta &&
|
||||||
myself()->_getNowTime() >= strtotime($currentMeta['income_start_time']) &&
|
myself()->_getNowTime() >= strtotime($currentMeta['income_start_time']) &&
|
||||||
myself()->_getNowTime() < strtotime($currentMeta['income_end_time'])){
|
myself()->_getNowTime() < strtotime($currentMeta['income_end_time'])){
|
||||||
|
$hashRateService = new services\HashRateService();
|
||||||
|
$hashRateService->init();
|
||||||
|
$status = $hashRateService->getServerASKBoxMode();
|
||||||
switch ($status){
|
switch ($status){
|
||||||
case \mt\ServerTask::ACCOMPLISH_MOBA_STATE :{
|
case \mt\ServerTask::MOBA_DROP_STATE :{
|
||||||
if ($mode == \services\TameBattleDataService::ROOM_MODE_PVP){
|
if ($mode == \services\TameBattleDataService::ROOM_MODE_PVP){
|
||||||
array_push($item,array(
|
array_push($item,array(
|
||||||
"item_id" => 300001,
|
"item_id" => 300001,
|
||||||
@ -146,7 +148,7 @@ class BattleController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case \mt\ServerTask::ACCOMPLISH_PVP_STATE : {
|
case \mt\ServerTask::PVP_DROP_STATE : {
|
||||||
if ($mode == \services\TameBattleDataService::ROOM_MODE_MOBA){
|
if ($mode == \services\TameBattleDataService::ROOM_MODE_MOBA){
|
||||||
array_push($item,array(
|
array_push($item,array(
|
||||||
"item_id" => 300001,
|
"item_id" => 300001,
|
||||||
|
@ -13,10 +13,14 @@ class ServerTask {
|
|||||||
const MOBA_TYPE = 1;
|
const MOBA_TYPE = 1;
|
||||||
const PVP_TYPE = 2;
|
const PVP_TYPE = 2;
|
||||||
|
|
||||||
|
const NOT_ACCOMPLISH_STATE = 0;
|
||||||
const ACCOMPLISH_MOBA_STATE = 1;
|
const ACCOMPLISH_MOBA_STATE = 1;
|
||||||
const ACCOMPLISH_PVP_STATE = 2;
|
const ACCOMPLISH_PVP_STATE = 2;
|
||||||
|
|
||||||
|
const NOT_DROP_STATE = 0;
|
||||||
|
const MOBA_DROP_STATE = 1;
|
||||||
|
const PVP_DROP_STATE = 2;
|
||||||
|
|
||||||
public static function getCustomTypeMetaList($type)
|
public static function getCustomTypeMetaList($type)
|
||||||
{
|
{
|
||||||
$metaList = array();
|
$metaList = array();
|
||||||
|
@ -76,6 +76,8 @@ class HashRateService extends BaseService
|
|||||||
$this->mobaBattleDataServerTask = $this->serverTaskData['mobaData'];
|
$this->mobaBattleDataServerTask = $this->serverTaskData['mobaData'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function hashRateTaskDto($taskMate ,$currentPeriod){
|
public function hashRateTaskDto($taskMate ,$currentPeriod){
|
||||||
$taskDto = array(
|
$taskDto = array(
|
||||||
'task_id' => $taskMate['id'],
|
'task_id' => $taskMate['id'],
|
||||||
@ -265,4 +267,54 @@ class HashRateService extends BaseService
|
|||||||
return $battleData ? $battleData : array();
|
return $battleData ? $battleData : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getServerASKBoxMode(){
|
||||||
|
$currentServerTask = \mt\ServerTaskTime::getCurrentTime();
|
||||||
|
if (myself()->_getNowTime() < strtotime($currentServerTask['income_start_time'])){
|
||||||
|
return \mt\ServerTask::NOT_DROP_STATE;
|
||||||
|
}
|
||||||
|
$taskList1 = array();
|
||||||
|
$taskList2 = array();
|
||||||
|
$taskListMeta = \mt\ServerTask::getMetaList();
|
||||||
|
foreach ($taskListMeta as $taskMeta){
|
||||||
|
if ($taskMeta['type'] == \mt\ServerTask::MOBA_TYPE){
|
||||||
|
$taskDto = $this->serverTaskDto($taskMeta);
|
||||||
|
array_push($taskList1,$taskDto);
|
||||||
|
}
|
||||||
|
if ($taskMeta['type'] == \mt\ServerTask::PVP_TYPE){
|
||||||
|
$taskDto = $this->serverTaskDto($taskMeta);
|
||||||
|
array_push($taskList2,$taskDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$mobaCount = 0;
|
||||||
|
$pvpCount = 0;
|
||||||
|
foreach ($taskList1 as $taskDto){
|
||||||
|
if ($taskDto['state'] == \services\HashRateService::FINISHED_STATE){
|
||||||
|
$mobaCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($taskList2 as $taskDto){
|
||||||
|
if ($taskDto['state'] == \services\HashRateService::FINISHED_STATE){
|
||||||
|
$pvpCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($mobaCount == count($taskList1)){
|
||||||
|
return \mt\ServerTask::MOBA_DROP_STATE;
|
||||||
|
}elseif ($pvpCount == count($taskList2)){
|
||||||
|
return \mt\ServerTask::PVP_DROP_STATE;
|
||||||
|
}else{
|
||||||
|
if ($mobaCount > $pvpCount){
|
||||||
|
return \mt\ServerTask::MOBA_DROP_STATE;
|
||||||
|
}elseif ($mobaCount < $pvpCount){
|
||||||
|
return \mt\ServerTask::PVP_DROP_STATE;
|
||||||
|
}else{
|
||||||
|
if (getXVal($this->mobaBattleDataServerTask,"modifytime", 0) < getXVal($this->pvpBattleDataServerTask,"modifytime", 0)){
|
||||||
|
return \mt\ServerTask::MOBA_DROP_STATE;
|
||||||
|
}else{
|
||||||
|
return \mt\ServerTask::PVP_DROP_STATE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1352,6 +1352,11 @@ class TameBattleDataService extends BaseService {
|
|||||||
$this->incValue($battleData, 'use_skill_times', getXVal($this->battleInfo,'use_skill_times', 0));
|
$this->incValue($battleData, 'use_skill_times', getXVal($this->battleInfo,'use_skill_times', 0));
|
||||||
//道具使用
|
//道具使用
|
||||||
$this->procWeaponsSlot($battleData);
|
$this->procWeaponsSlot($battleData);
|
||||||
|
|
||||||
|
if (!isset($battleData['createtime'])) {
|
||||||
|
$battleData['createtime'] = myself()->_getNowTime();
|
||||||
|
}
|
||||||
|
$battleData['modifytime'] = myself()->_getNowTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user