1
This commit is contained in:
parent
e85baea89c
commit
6e6eeaaf4a
@ -184,6 +184,7 @@ class BattleController extends BaseAuthedController {
|
||||
foreach ($teamData['members'] as $member){
|
||||
$member['pvp_team_rank'] = getXVal($teamData,'pvp_team_rank', 0);
|
||||
$member['victory'] = getXVal($teamData,'victory', 0);
|
||||
$member['room_mode'] = getXVal($teamData,'room_mode', 0);
|
||||
if ($member['account_id'] && !myself()->_isAndroidAccountId($member['account_id'])){
|
||||
$this->switchAccount($member['account_id']);
|
||||
$teamBattleDataService->battleInfo = $member;
|
||||
|
@ -31,6 +31,7 @@ class AchievementsPower {
|
||||
|
||||
const MOBA_SCENE = 1;
|
||||
const PVP_SCENE = 2;
|
||||
const All_SCENE = 5;
|
||||
|
||||
const TYPE1 = 1;
|
||||
const TYPE2 = 2;
|
||||
|
@ -387,6 +387,7 @@ class HashRateService extends BaseService
|
||||
if ($task['task_id'] == $taskMate['id']){
|
||||
$taskList[$k] = array(
|
||||
'task_id' => $metas[$key]['id'],
|
||||
'current' => 0,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
);
|
||||
@ -523,62 +524,84 @@ class HashRateService extends BaseService
|
||||
}
|
||||
|
||||
private static function _computeTaskProgress(&$tasks,$battleData){
|
||||
$room_mode = getXVal($battleData,'room_mode', 0);
|
||||
foreach ($tasks as &$task){
|
||||
$taskMeta = AchievementsPower::find($task['task_id']);
|
||||
switch ($taskMeta['Completion_type']){
|
||||
case AchievementsPower::TOTAL_WINS_TIMES : {
|
||||
if (getXVal($battleData,'victory', 0)){
|
||||
$task['current'] += 1;
|
||||
|
||||
switch ($taskMeta['scene']){
|
||||
case AchievementsPower::MOBA_SCENE :{
|
||||
if ($room_mode == TameBattleDataService::ROOM_MODE_MOBA){
|
||||
self::_getXVal($taskMeta,$battleData,$task);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::TOTAL_KILL_TIMES : {
|
||||
$task['current'] += getXVal($battleData,'kills', 0);
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::USE_ITEM_TIMES : {
|
||||
$task['current'] += self::_procWeaponsSlot($battleData,$taskMeta['condition']);
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::NOMINAL_TIME_BATTLE_END : {
|
||||
$duration = getXVal($battleData,'game_duration', 0);
|
||||
if ($duration && floor($duration / 60) < $taskMeta['condition']){
|
||||
$task['current'] += 1;
|
||||
case AchievementsPower::PVP_SCENE :{
|
||||
if ($room_mode == TameBattleDataService::MATCH_MODE_PVP){
|
||||
self::_getXVal($taskMeta,$battleData,$task);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::IN_BATTLE_UP_LV : {
|
||||
$fullLv = getXVal($battleData,'full_level_idx', 0);
|
||||
if ($fullLv == 1){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
case AchievementsPower::All_SCENE :{
|
||||
self::_getXVal($taskMeta,$battleData,$task);
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::TOTAL_BATTLE_TIMES : {
|
||||
if (! getXVal($battleData,'is_run_away', 0)){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::TOTAL_LAST_RUNNER : {
|
||||
$ranked = getXVal($battleData,'pvp_personal_rank', 0);
|
||||
if ($ranked == 20){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::RESCUE_TEAMMATE_TIMES : {
|
||||
$task['current'] += getXVal($battleData,'rescue_teammate_times', 0);
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::WALKING_DISTANCE : {
|
||||
$task['current'] += getXVal($battleData,'move_distance', 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function _getXVal($taskMeta,$battleData,&$task){
|
||||
switch ($taskMeta['Completion_type']){
|
||||
case AchievementsPower::TOTAL_WINS_TIMES : {
|
||||
if (getXVal($battleData,'victory', 0)){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::TOTAL_KILL_TIMES : {
|
||||
$task['current'] += getXVal($battleData,'kills', 0);
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::USE_ITEM_TIMES : {
|
||||
$task['current'] += self::_procWeaponsSlot($battleData,$taskMeta['condition']);
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::NOMINAL_TIME_BATTLE_END : {
|
||||
$duration = getXVal($battleData,'game_duration', 0);
|
||||
if ($duration && floor($duration / 60) < $taskMeta['condition']){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::IN_BATTLE_UP_LV : {
|
||||
$fullLv = getXVal($battleData,'full_level_idx', 0);
|
||||
if ($fullLv == 1){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::TOTAL_BATTLE_TIMES : {
|
||||
if (! getXVal($battleData,'is_run_away', 0)){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::TOTAL_LAST_RUNNER : {
|
||||
$ranked = getXVal($battleData,'pvp_personal_rank', 0);
|
||||
if ($ranked == 20){
|
||||
$task['current'] += 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::RESCUE_TEAMMATE_TIMES : {
|
||||
$task['current'] += getXVal($battleData,'rescue_teammate_times', 0);
|
||||
}
|
||||
break;
|
||||
case AchievementsPower::WALKING_DISTANCE : {
|
||||
$task['current'] += getXVal($battleData,'move_distance', 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static function _procWeaponsSlot($battleData,$condition)
|
||||
{
|
||||
$useCount = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user