|
@@ -14,6 +14,7 @@ namespace loyalsoft;
|
|
* @author c'y'zhao
|
|
* @author c'y'zhao
|
|
*/
|
|
*/
|
|
class TaskProc {
|
|
class TaskProc {
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 逻辑分发
|
|
* 逻辑分发
|
|
* 所有的Proc中必须有这样一个方法
|
|
* 所有的Proc中必须有这样一个方法
|
|
@@ -24,57 +25,133 @@ class TaskProc {
|
|
case CmdCode::cmd_task_getInfo: # 6201
|
|
case CmdCode::cmd_task_getInfo: # 6201
|
|
return TaskProc::getTaskInfo();
|
|
return TaskProc::getTaskInfo();
|
|
case CmdCode::cmd_task_getReward: # 6202
|
|
case CmdCode::cmd_task_getReward: # 6202
|
|
- return TaskProc::getReward();
|
|
|
|
|
|
+ return TaskProc::getReward();
|
|
case CmdCode::cmd_task_getAchieveReward: # 6203 领取成就奖励
|
|
case CmdCode::cmd_task_getAchieveReward: # 6203 领取成就奖励
|
|
- return TaskProc::getAchieveReward();
|
|
|
|
-
|
|
|
|
|
|
+ return TaskProc::getAchieveReward();
|
|
|
|
+ case CmdCode::cmd_task_receiveActiveTaskReward: # 6204 领取活动任务奖励
|
|
|
|
+ return TaskProc::receiveActiveTaskReward();
|
|
|
|
+ case CmdCode::cmd_task_receiveActivePointBoxReward: # 6205 领取活跃点宝箱奖励
|
|
|
|
+ return TaskProc::receiveActivePointBoxReward();
|
|
default:
|
|
default:
|
|
Err(ErrCode::cmd_err);
|
|
Err(ErrCode::cmd_err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 6205 领取活跃点宝箱奖励
|
|
|
|
+ */
|
|
|
|
+ public static function receiveActivePointBoxReward(){
|
|
|
|
+ list($type,$typeId) = req()->paras;
|
|
|
|
+
|
|
|
|
+ $point= 0;
|
|
|
|
+ switch ($type) {
|
|
|
|
+ case Enum_ActiveTaskType::Day7:
|
|
|
|
+ $point = ctx()->task->day7Point;
|
|
|
|
+ break;
|
|
|
|
+ case Enum_ActiveTaskType::DailyTask:
|
|
|
|
+ $point = ctx()->task->dailyTaskPoint;
|
|
|
|
+ break;
|
|
|
|
+ case Enum_ActiveTaskType::WeekTask:
|
|
|
|
+ $point = ctx()->task->weekTaskPoint;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ my_Assert($typeId >= $point, ErrCode::task_CanotPriceReviced);
|
|
|
|
+
|
|
|
|
+ $mo = GameConfig::activepointreward_getItem($type,$typeId);
|
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
|
+
|
|
|
|
+ StoreProc::AddMultiItemInStore($mo->reward);
|
|
|
|
+ $strId = $type."-".$typeId;
|
|
|
|
+ ctx()->task->activePointReceived[] = $strId;
|
|
|
|
+
|
|
|
|
+ UserProc::updateUserInfo();
|
|
|
|
+ return Resp::ok(array("task" => ctx()->task,
|
|
|
|
+ "store" => ctx()->store,
|
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 6204 领取活动任务奖励
|
|
|
|
+ * @return type
|
|
|
|
+ */
|
|
|
|
+ public static function receiveActiveTaskReward() {
|
|
|
|
+ list($uid) = req()->paras;
|
|
|
|
+
|
|
|
|
+ my_Assert(StlUtil::dictHasProperty(ctx()->task->activeTaskInfo, $uid), ErrCode::task_NoExist);
|
|
|
|
+
|
|
|
|
+ $ins_activeTaskInfo = new Ins_TaskStep_Active(ctx()->task->activeTaskInfo->$uid);
|
|
|
|
+ my_Assert($ins_activeTaskInfo->cur >= $ins_activeTaskInfo->max(), ErrCode::task_CanotPriceReviced);
|
|
|
|
+ my_Assert($ins_activeTaskInfo->state == Enum_TaskCardStateType::finish, ErrCode::task_CanotPriceReviced);
|
|
|
|
+
|
|
|
|
+ StoreProc::AddMultiItemInStore($ins_activeTaskInfo->mo()->prizes);
|
|
|
|
+ ctx()->task->activeTaskInfo->$uid->state = Enum_TaskCardStateType::finish;
|
|
|
|
+
|
|
|
|
+ switch ($ins_activeTaskInfo->mo()->type) {
|
|
|
|
+ case Enum_ActiveTaskType::Day7:
|
|
|
|
+ ctx()->task->day7Point += $ins_activeTaskInfo->mo()->activePoint;
|
|
|
|
+ break;
|
|
|
|
+ case Enum_ActiveTaskType::DailyTask:
|
|
|
|
+ ctx()->task->dailyTaskPoint += $ins_activeTaskInfo->mo()->activePoint;
|
|
|
|
+ break;
|
|
|
|
+ case Enum_ActiveTaskType::WeekTask:
|
|
|
|
+ ctx()->task->weekTaskPoint += $ins_activeTaskInfo->mo()->activePoint;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ UserProc::updateUserInfo();
|
|
|
|
+ return Resp::ok(array("task" => ctx()->task,
|
|
|
|
+ "store" => ctx()->store,
|
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 6203 领取成就奖励
|
|
* 6203 领取成就奖励
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
public static function getAchieveReward() {
|
|
public static function getAchieveReward() {
|
|
list($typeId) = req()->paras;
|
|
list($typeId) = req()->paras;
|
|
-
|
|
|
|
|
|
+
|
|
$mo = GameConfig::achieve_getItem($typeId);
|
|
$mo = GameConfig::achieve_getItem($typeId);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
-
|
|
|
|
|
|
+
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->task->achieveDic, $typeId), ErrCode::err_const_no);
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->task->achieveDic, $typeId), ErrCode::err_const_no);
|
|
$achieveDic = ctx()->task->achieveDic->$typeId;
|
|
$achieveDic = ctx()->task->achieveDic->$typeId;
|
|
-
|
|
|
|
|
|
+
|
|
$list = explode(',', $mo->condition);
|
|
$list = explode(',', $mo->condition);
|
|
$length = count($list);
|
|
$length = count($list);
|
|
- my_Assert($achieveDic->val>= $achieveDic->max, ErrCode::task_CanotPriceReviced);
|
|
|
|
|
|
+ my_Assert($achieveDic->val >= $achieveDic->max, ErrCode::task_CanotPriceReviced);
|
|
my_Assert($achieveDic->received < $achieveDic->max, ErrCode::task_PriceRepeatReviced);
|
|
my_Assert($achieveDic->received < $achieveDic->max, ErrCode::task_PriceRepeatReviced);
|
|
-
|
|
|
|
|
|
+
|
|
$index = 0;
|
|
$index = 0;
|
|
- foreach ($list as $k =>$num) {
|
|
|
|
- if($num == $achieveDic->max){
|
|
|
|
|
|
+ foreach ($list as $k => $num) {
|
|
|
|
+ if ($num == $achieveDic->max) {
|
|
$index = $k;
|
|
$index = $k;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
//领取奖励
|
|
//领取奖励
|
|
$pList = explode(';', $mo->reward);
|
|
$pList = explode(';', $mo->reward);
|
|
StoreProc::AddMultiItemInStore($pList[$index]);
|
|
StoreProc::AddMultiItemInStore($pList[$index]);
|
|
-
|
|
|
|
|
|
+
|
|
//下一个max
|
|
//下一个max
|
|
- if($index +1 < $length){
|
|
|
|
- $achieveDic->max = $list[$index+1];
|
|
|
|
|
|
+ if ($index + 1 < $length) {
|
|
|
|
+ $achieveDic->max = $list[$index + 1];
|
|
}
|
|
}
|
|
ctx()->task->achieveDic->$typeId = $achieveDic;
|
|
ctx()->task->achieveDic->$typeId = $achieveDic;
|
|
-
|
|
|
|
- UserProc::updateUserInfo();
|
|
|
|
|
|
+
|
|
|
|
+ UserProc::updateUserInfo();
|
|
return Resp::ok(array(
|
|
return Resp::ok(array(
|
|
- "achieve"=>ctx()->task->achieveDic,
|
|
|
|
- "cash"=> ctx()->baseInfo->cash,
|
|
|
|
- ));
|
|
|
|
|
|
+ "achieve" => ctx()->task->achieveDic,
|
|
|
|
+ "cash" => ctx()->baseInfo->cash,
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 初始化成就信息
|
|
* 初始化成就信息
|
|
*/
|
|
*/
|
|
@@ -100,86 +177,79 @@ class TaskProc {
|
|
// }
|
|
// }
|
|
// ctx()->task->achieveDic = $achieveDic;
|
|
// ctx()->task->achieveDic = $achieveDic;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
//检测成就条件
|
|
//检测成就条件
|
|
- public static function CheckAchieveConditions($arg) {
|
|
|
|
|
|
+ public static function CheckAchieveConditions($arg) {
|
|
$achieveDic = ctx()->task->achieveDic;
|
|
$achieveDic = ctx()->task->achieveDic;
|
|
foreach ($achieveDic as $key => $value) {
|
|
foreach ($achieveDic as $key => $value) {
|
|
$achieve = new Ins_Achieve($value);
|
|
$achieve = new Ins_Achieve($value);
|
|
$tag = false;
|
|
$tag = false;
|
|
- if($achieve->cmd == $arg->taskType){
|
|
|
|
- $mo = $achieve->getAchieveMo();
|
|
|
|
- if($mo->paras == $arg->paras[0]){//暂定,若有多个参数,在进行解析
|
|
|
|
|
|
+ if ($achieve->cmd == $arg->taskType) {
|
|
|
|
+ $mo = $achieve->getAchieveMo();
|
|
|
|
+ if ($mo->paras == $arg->paras[0]) {//暂定,若有多个参数,在进行解析
|
|
$tag = true;
|
|
$tag = true;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- if($tag){//找到正确数据
|
|
|
|
|
|
+
|
|
|
|
+ if ($tag) {//找到正确数据
|
|
switch ($arg->ope) {
|
|
switch ($arg->ope) {
|
|
case Enum_PropelType::set:
|
|
case Enum_PropelType::set:
|
|
- $achieve->val = $arg->val;
|
|
|
|
|
|
+ $achieve->val = $arg->val;
|
|
break;
|
|
break;
|
|
case Enum_PropelType::add:
|
|
case Enum_PropelType::add:
|
|
- $achieve->val += $arg->val;
|
|
|
|
|
|
+ $achieve->val += $arg->val;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
ctx()->task->achieveDic = $achieveDic;
|
|
ctx()->task->achieveDic = $achieveDic;
|
|
- UserProc::updateUserInfo();
|
|
|
|
-
|
|
|
|
|
|
+ UserProc::updateUserInfo();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
//-------------------成就条件检测
|
|
//-------------------成就条件检测
|
|
//单件装备等级达到X级
|
|
//单件装备等级达到X级
|
|
- static function accumulateEquiplevel_one($lv) {
|
|
|
|
- $taskEventArg = new Ins_TaskEventArgs(Enum_AchieveType::equiplevel_one, Enum_PropelType::set,$lv, array());
|
|
|
|
|
|
+ static function accumulateEquiplevel_one($lv) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_AchieveType::equiplevel_one, Enum_PropelType::set, $lv, array());
|
|
//self::CheckAchieveConditions($taskEventArg);
|
|
//self::CheckAchieveConditions($taskEventArg);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
//累计消耗X钻石
|
|
//累计消耗X钻石
|
|
- static function accumulateCostCash($num) {
|
|
|
|
- $taskEventArg = new Ins_TaskEventArgs(Enum_AchieveType::accumulateCostCash, Enum_PropelType::add,$num, array());
|
|
|
|
|
|
+ static function accumulateCostCash($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_AchieveType::accumulateCostCash, Enum_PropelType::add, $num, array());
|
|
//self::CheckAchieveConditions($taskEventArg);
|
|
//self::CheckAchieveConditions($taskEventArg);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
//------------------------------------------------------
|
|
//------------------------------------------------------
|
|
-
|
|
|
|
|
|
+
|
|
public static function getTaskInfo() {
|
|
public static function getTaskInfo() {
|
|
- list($type) = req()->paras;//武器uid
|
|
|
|
-
|
|
|
|
- return Resp::ok(array("task"=>ctx()->task,
|
|
|
|
- ));
|
|
|
|
|
|
+ list($type) = req()->paras; //武器uid
|
|
|
|
+
|
|
|
|
+ return Resp::ok(array("task" => ctx()->task,
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 领取任务奖励
|
|
* 领取任务奖励
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
public static function ReceiveTaskReward() {
|
|
public static function ReceiveTaskReward() {
|
|
- list($type,$uid) = req()->paras;//uid
|
|
|
|
-
|
|
|
|
|
|
+ list($type, $uid) = req()->paras; //uid
|
|
|
|
+
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->task->taskcards, $uid), ErrCode::task_NoExist);
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->task->taskcards, $uid), ErrCode::task_NoExist);
|
|
$task = ctx()->task->taskcards->$uid;
|
|
$task = ctx()->task->taskcards->$uid;
|
|
$mo = GameConfig::taskcard_getItem($task->taskId);
|
|
$mo = GameConfig::taskcard_getItem($task->taskId);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
-
|
|
|
|
|
|
+
|
|
$taskstepsMo = GameConfig::task_step_getItem($mo->tasksteps);
|
|
$taskstepsMo = GameConfig::task_step_getItem($mo->tasksteps);
|
|
my_Assert($taskstepsMo != null, ErrCode::err_const_no);
|
|
my_Assert($taskstepsMo != null, ErrCode::err_const_no);
|
|
-
|
|
|
|
|
|
+
|
|
$taskStep = $task->curSteps;
|
|
$taskStep = $task->curSteps;
|
|
my_Assert($taskStep->cur >= $taskstepsMo->num, ErrCode::task_CanotPriceReviced);
|
|
my_Assert($taskStep->cur >= $taskstepsMo->num, ErrCode::task_CanotPriceReviced);
|
|
my_Assert($task->state == Enum_TaskCardStateType::finish, ErrCode::task_CanotPriceReviced);
|
|
my_Assert($task->state == Enum_TaskCardStateType::finish, ErrCode::task_CanotPriceReviced);
|
|
-
|
|
|
|
|
|
+
|
|
switch ($type) {
|
|
switch ($type) {
|
|
case Enum_TaskType::DailyTask:
|
|
case Enum_TaskType::DailyTask:
|
|
ctx()->task->dailyTaskAccumulate += $mo->score;
|
|
ctx()->task->dailyTaskAccumulate += $mo->score;
|
|
@@ -192,145 +262,222 @@ class TaskProc {
|
|
}
|
|
}
|
|
$task->state = Enum_TaskCardStateType::drawed;
|
|
$task->state = Enum_TaskCardStateType::drawed;
|
|
ctx()->task->taskcards->$uid = $task;
|
|
ctx()->task->taskcards->$uid = $task;
|
|
-
|
|
|
|
|
|
+
|
|
StoreProc::AddMultiItemInStore($mo->reward);
|
|
StoreProc::AddMultiItemInStore($mo->reward);
|
|
-
|
|
|
|
- return Resp::ok(array("task"=>ctx()->task,
|
|
|
|
- "store"=> ctx()->store,
|
|
|
|
- ));
|
|
|
|
|
|
+
|
|
|
|
+ return Resp::ok(array("task" => ctx()->task,
|
|
|
|
+ "store" => ctx()->store,
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function ResetTask() {
|
|
static function ResetTask() {
|
|
- self::ResetTask_Daily();
|
|
|
|
-
|
|
|
|
|
|
+ //self::ResetTask_Daily();
|
|
|
|
+ self::DailyTaskReset();
|
|
|
|
+ self::Day7TaskReset();
|
|
$week = date("w");
|
|
$week = date("w");
|
|
- if($week == 1){//每周一 第一次登录的时候刷新
|
|
|
|
- self::ResetTask_Week();
|
|
|
|
|
|
+ if ($week == 1) {//每周一 第一次登录的时候刷新
|
|
|
|
+ //self::ResetTask_Week();
|
|
|
|
+ self::WeekTaskReset();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 7日狂欢数据重置
|
|
|
|
+ */
|
|
|
|
+ static function Day7TaskReset() {
|
|
|
|
+ $mo = GameConfig::activity_getItem(10);
|
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
|
+
|
|
|
|
+ $startDay = TimeUtil::totalDays($mo->startts);
|
|
|
|
+ $endDay = TimeUtil::totalDays($mo->endts);
|
|
|
|
+ $curDay = TimeUtil::totalDays();
|
|
|
|
+ if ($curDay > $endDay) {
|
|
|
|
+ self::ClearActiveTask(Enum_ActiveTaskType::Day7);
|
|
|
|
+ } else {
|
|
|
|
+ if ($curDay >= $startDay) {
|
|
|
|
+ $tag = true;
|
|
|
|
+ foreach (ctx()->task->activeTaskInfo as $uid => $val) {
|
|
|
|
+ $taskMo = GameConfig::activeTask_getItem($val->typeId);
|
|
|
|
+ if ($taskMo->type == 1) {
|
|
|
|
+ $tag = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($tag) {//7日的数据初始化
|
|
|
|
+ self::initActiveTask(Enum_ActiveTaskType::Day7);
|
|
|
|
+ ctx()->task->day7Point = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static function ClearActiveTask($type) {
|
|
|
|
+ $arr = array();
|
|
|
|
+ foreach (ctx()->task->activeTaskInfo as $uid => $val) {
|
|
|
|
+ $taskMo = GameConfig::activeTask_getItem($val->typeId);
|
|
|
|
+ if ($taskMo->type == $type) {
|
|
|
|
+ $arr[] = $uid;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (count($arr) > 0) {
|
|
|
|
+ foreach ($arr as $uid) {
|
|
|
|
+ StlUtil::dictRemove(ctx()->task->activeTaskInfo, $uid);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static function initActiveTask($type) {
|
|
|
|
+ $day7List = GameConfig::activeTask_type_getItemArray($type);
|
|
|
|
+ $length = ctx()->task->activeTaskLength;
|
|
|
|
+ foreach ($day7List as $key => $task) {
|
|
|
|
+ $length += 1;
|
|
|
|
+ $ins_TaskStep_Active = new Ins_TaskStep_Active($task);
|
|
|
|
+ ctx()->task->activeTaskInfo->$length = $ins_TaskStep_Active;
|
|
|
|
+ }
|
|
|
|
+ ctx()->task->activeTaskLength = $length;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 日常
|
|
|
|
+ */
|
|
|
|
+ static function DailyTaskReset() {
|
|
|
|
+ self::ClearActiveTask(Enum_ActiveTaskType::DailyTask);
|
|
|
|
+ self::initActiveTask(Enum_ActiveTaskType::DailyTask);
|
|
|
|
+ ctx()->task->dailyTaskPoint = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 周常
|
|
|
|
+ */
|
|
|
|
+ static function WeekTaskReset() {
|
|
|
|
+ self::ClearActiveTask(Enum_ActiveTaskType::WeekTask);
|
|
|
|
+ self::initActiveTask(Enum_ActiveTaskType::WeekTask);
|
|
|
|
+ ctx()->task->weekTaskPoint = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 每日任务重置
|
|
* 每日任务重置
|
|
*/
|
|
*/
|
|
static function ResetTask_Daily() {
|
|
static function ResetTask_Daily() {
|
|
$dic = GameConfig::taskcard();
|
|
$dic = GameConfig::taskcard();
|
|
-
|
|
|
|
|
|
+
|
|
$retDic = new \stdClass();
|
|
$retDic = new \stdClass();
|
|
$taskcards = ctx()->task->taskcards;
|
|
$taskcards = ctx()->task->taskcards;
|
|
-
|
|
|
|
|
|
+
|
|
$dailyCards = array();
|
|
$dailyCards = array();
|
|
foreach ($dic as $id => $mo) {
|
|
foreach ($dic as $id => $mo) {
|
|
- if($mo->type == 1){
|
|
|
|
|
|
+ if ($mo->type == 1) {
|
|
foreach ($taskcards as $uid => $card) {
|
|
foreach ($taskcards as $uid => $card) {
|
|
- if($card->typeId == $mo->typeId){
|
|
|
|
|
|
+ if ($card->typeId == $mo->typeId) {
|
|
$dailyCards[] = $uid;
|
|
$dailyCards[] = $uid;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$retDic->$id = $mo;
|
|
$retDic->$id = $mo;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
foreach ($dailyCards as $uid) {
|
|
foreach ($dailyCards as $uid) {
|
|
unset($taskcards->$uid);
|
|
unset($taskcards->$uid);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$retDic = (array) $retDic;
|
|
$retDic = (array) $retDic;
|
|
- if(count($retDic) <= 0){
|
|
|
|
|
|
+ if (count($retDic) <= 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
ksort($retDic);
|
|
ksort($retDic);
|
|
$index = ctx()->task->taskIndex;
|
|
$index = ctx()->task->taskIndex;
|
|
foreach ($retDic as $id => $mo) {
|
|
foreach ($retDic as $id => $mo) {
|
|
$index += 1;
|
|
$index += 1;
|
|
$task = new Ins_TaskCard($id);
|
|
$task = new Ins_TaskCard($id);
|
|
- $taskcards->$index = $task;
|
|
|
|
|
|
+ $taskcards->$index = $task;
|
|
}
|
|
}
|
|
ctx()->task->taskIndex = $index;
|
|
ctx()->task->taskIndex = $index;
|
|
ctx()->task->taskcards = $taskcards;
|
|
ctx()->task->taskcards = $taskcards;
|
|
-
|
|
|
|
- UserProc::updateUserInfo();
|
|
|
|
|
|
+
|
|
|
|
+ UserProc::updateUserInfo();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 每周任务重置
|
|
* 每周任务重置
|
|
*/
|
|
*/
|
|
static function ResetTask_Week() {
|
|
static function ResetTask_Week() {
|
|
$dic = GameConfig::taskcard();
|
|
$dic = GameConfig::taskcard();
|
|
-
|
|
|
|
|
|
+
|
|
$retDic = new \stdClass();
|
|
$retDic = new \stdClass();
|
|
$taskcards = ctx()->task->taskcards;
|
|
$taskcards = ctx()->task->taskcards;
|
|
-
|
|
|
|
|
|
+
|
|
$dailyCards = array();
|
|
$dailyCards = array();
|
|
foreach ($dic as $id => $mo) {
|
|
foreach ($dic as $id => $mo) {
|
|
- if($mo->type == 2){
|
|
|
|
|
|
+ if ($mo->type == 2) {
|
|
foreach ($taskcards as $uid => $card) {
|
|
foreach ($taskcards as $uid => $card) {
|
|
- if($card->typeId == $mo->typeId){
|
|
|
|
|
|
+ if ($card->typeId == $mo->typeId) {
|
|
$dailyCards[] = $uid;
|
|
$dailyCards[] = $uid;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$retDic->$id = $mo;
|
|
$retDic->$id = $mo;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
foreach ($dailyCards as $uid) {
|
|
foreach ($dailyCards as $uid) {
|
|
unset($taskcards->$uid);
|
|
unset($taskcards->$uid);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$retDic = (array) $retDic;
|
|
$retDic = (array) $retDic;
|
|
- if(count($retDic) <= 0){
|
|
|
|
|
|
+ if (count($retDic) <= 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
ksort($retDic);
|
|
ksort($retDic);
|
|
$index = ctx()->task->taskIndex;
|
|
$index = ctx()->task->taskIndex;
|
|
foreach ($retDic as $id => $mo) {
|
|
foreach ($retDic as $id => $mo) {
|
|
$index += 1;
|
|
$index += 1;
|
|
$task = new Ins_TaskCard($id);
|
|
$task = new Ins_TaskCard($id);
|
|
- $taskcards->$index = $task;
|
|
|
|
|
|
+ $taskcards->$index = $task;
|
|
}
|
|
}
|
|
ctx()->task->taskIndex = $index;
|
|
ctx()->task->taskIndex = $index;
|
|
ctx()->task->taskcards = $taskcards;
|
|
ctx()->task->taskcards = $taskcards;
|
|
-
|
|
|
|
- UserProc::updateUserInfo();
|
|
|
|
|
|
+
|
|
|
|
+ UserProc::updateUserInfo();
|
|
}
|
|
}
|
|
|
|
|
|
//---------------------
|
|
//---------------------
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 每日登陆
|
|
* 每日登陆
|
|
*/
|
|
*/
|
|
- static function OnUserLogin() {
|
|
|
|
|
|
+ static function OnUserLogin() {
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyLogin, Enum_PropelType::set, 1, array());
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyLogin, Enum_PropelType::set, 1, array());
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 参与主线关卡X次
|
|
* 参与主线关卡X次
|
|
*/
|
|
*/
|
|
- static function OnChallengeZhuXianGate() {
|
|
|
|
|
|
+ static function OnChallengeZhuXianGate() {
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::ChallengeZhuXianGate, Enum_PropelType::add, 1, array());
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::ChallengeZhuXianGate, Enum_PropelType::add, 1, array());
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 参与日常关卡1次
|
|
* 参与日常关卡1次
|
|
*/
|
|
*/
|
|
- static function OnChallengeDailyGate() {
|
|
|
|
|
|
+ static function OnChallengeDailyGate() {
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::ChallengeDailyGate, Enum_PropelType::add, 1, array());
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::ChallengeDailyGate, Enum_PropelType::add, 1, array());
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 每日商店购买物品1次
|
|
* 每日商店购买物品1次
|
|
*/
|
|
*/
|
|
- static function OnDailyShopBuyNum() {
|
|
|
|
|
|
+ static function OnDailyShopBuyNum() {
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyShopBuyNum, Enum_PropelType::add, 1, array());
|
|
$taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyShopBuyNum, Enum_PropelType::add, 1, array());
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
self::CheckTaskCardConditions($taskEventArg); # 检查日常任务
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
static function CheckTaskCardConditions($taskParam) {
|
|
static function CheckTaskCardConditions($taskParam) {
|
|
$bUpdate = false;
|
|
$bUpdate = false;
|
|
$tasks = ctx()->task->taskcards;
|
|
$tasks = ctx()->task->taskcards;
|
|
@@ -351,7 +498,7 @@ class TaskProc {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if ($task->IsFinish()) { # 检查后添加后续任务
|
|
if ($task->IsFinish()) { # 检查后添加后续任务
|
|
$arr = array();
|
|
$arr = array();
|
|
foreach ($task->curSteps as &$tsp) { # 初期里面只有一个任务
|
|
foreach ($task->curSteps as &$tsp) { # 初期里面只有一个任务
|
|
@@ -375,7 +522,7 @@ class TaskProc {
|
|
NormalEventProc::OnTaskCard_Finish($task->uid, null); # 广播卡完成事件
|
|
NormalEventProc::OnTaskCard_Finish($task->uid, null); # 广播卡完成事件
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if ($bUpdate) { # 带回数据到客户端
|
|
if ($bUpdate) { # 带回数据到客户端
|
|
ctx()->task->taskcards = $tasks;
|
|
ctx()->task->taskcards = $tasks;
|
|
UserProc::updateUserInfo(); # 更新玩家数据
|
|
UserProc::updateUserInfo(); # 更新玩家数据
|
|
@@ -383,7 +530,7 @@ class TaskProc {
|
|
|
|
|
|
return $bUpdate;
|
|
return $bUpdate;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 自动修复状态型任务
|
|
* 自动修复状态型任务
|
|
*/
|
|
*/
|
|
@@ -396,7 +543,7 @@ class TaskProc {
|
|
|| $task->state == Enum_TaskCardStateType::finish) {
|
|
|| $task->state == Enum_TaskCardStateType::finish) {
|
|
foreach ($task->curSteps as &$tsp) { # 初期里面只有一个任务
|
|
foreach ($task->curSteps as &$tsp) { # 初期里面只有一个任务
|
|
$tsp = new Ins_TaskStep($tsp);
|
|
$tsp = new Ins_TaskStep($tsp);
|
|
- $tsp->autoCalcStatusCur();
|
|
|
|
|
|
+ $tsp->autoCalcStatusCur();
|
|
}
|
|
}
|
|
if ($task->state == Enum_TaskCardStateType::finish) { # 检查是否任务卡的所有步骤都已完成
|
|
if ($task->state == Enum_TaskCardStateType::finish) { # 检查是否任务卡的所有步骤都已完成
|
|
if (!$task->IsFinish()) {
|
|
if (!$task->IsFinish()) {
|
|
@@ -408,6 +555,288 @@ class TaskProc {
|
|
// Clog::info("更新状态统计类的任务卡!");
|
|
// Clog::info("更新状态统计类的任务卡!");
|
|
ctx()->task->taskcards = $tasks;
|
|
ctx()->task->taskcards = $tasks;
|
|
}
|
|
}
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
+// <editor-fold defaultstate="collapsed" desc="不同活动任务监测信息-">
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 登录
|
|
|
|
+ */
|
|
|
|
+ static function OnLogin_Daily() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::DailyLogin, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 登录第X天
|
|
|
|
+ */
|
|
|
|
+ static function OnLogin_day7($day) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::DailyShopBuyNum, Enum_PropelType::set, $day, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通关第X关
|
|
|
|
+ */
|
|
|
|
+ static function OnPassGate_X($gateId) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::PassGate_X, Enum_PropelType::add, 1, array($gateId));
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 参与主线关卡1次
|
|
|
|
+ */
|
|
|
|
+ static function OnFightNumMainGate() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::FightNumMainGate, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 参与挑战副本1次
|
|
|
|
+ */
|
|
|
|
+ static function OnFightNumChallengeGate() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::FightNumChallengeGate, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 参与竞速副本1次
|
|
|
|
+ */
|
|
|
|
+ static function OnFightNumRaceGate() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::FightNumRaceGate, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通关竞速副本5次
|
|
|
|
+ */
|
|
|
|
+ static function OnPassNumRaceGate() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::PassNumRaceGate, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 完成5次启灵
|
|
|
|
+ */
|
|
|
|
+ static function OnCompleteNumQiLing() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::CompleteNumQiLing, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 完成1次关键启灵
|
|
|
|
+ */
|
|
|
|
+ static function OnCompleteNumSpecialQiLing() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::CompleteNumSpecialQiLing, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 镶嵌3个普通品质以上宝石
|
|
|
|
+ */
|
|
|
|
+ static function OnSetSpecialQualGem() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::SetSpecialQualGem, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 合成宝石2次
|
|
|
|
+ */
|
|
|
|
+ static function OnComposeNumGem() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::ComposeNumGem, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 任意1个法术等级达到2
|
|
|
|
+ */
|
|
|
|
+ static function OnAnySkillUpLevel_X() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::AnySkillUpLevel_X, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 任意1件装备等级达到2
|
|
|
|
+ */
|
|
|
|
+ static function OnAnyEquipUpLevel_X() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::AnyEquipUpLevel_X, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 全身装备等级达到3级以上
|
|
|
|
+ */
|
|
|
|
+ static function OnAllEquipUpLevel_X() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::AllEquipUpLevel_X, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 任意装备等级升级1次
|
|
|
|
+ */
|
|
|
|
+ static function OnEquipLevelUpNum() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::EquipLevelUpNum, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 击败怪物总数达到1000
|
|
|
|
+ */
|
|
|
|
+ static function OnKillCommonNumMonster($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::KillCommonNumMonster, Enum_PropelType::add, $num, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 击败领袖怪物总数达到1000
|
|
|
|
+ */
|
|
|
|
+ static function OnKillleaderNumMonster($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::KillleaderNumMonster, Enum_PropelType::add, $num, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 累计获取10000金币
|
|
|
|
+ */
|
|
|
|
+ static function OnAccumulateGoldNum($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::AccumulateGoldNum, Enum_PropelType::add, $num, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 累计获取10000体力
|
|
|
|
+ */
|
|
|
|
+ static function OnAccumulateTiliNum($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::AccumulateTiliNum, Enum_PropelType::add, $num, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 累计获取10000钻石
|
|
|
|
+ */
|
|
|
|
+ static function OnAccumulateCashNum($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::AccumulateCashNum, Enum_PropelType::add, $num, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 开启1次璀璨宝石箱
|
|
|
|
+ */
|
|
|
|
+ static function OnOpenNumBrightBox($boxId, $num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::OpenNumBrightBox, Enum_PropelType::add, $num, array($boxId));
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 每日商店购买物品1次
|
|
|
|
+ */
|
|
|
|
+ static function OnBuyNumDailyShop() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::BuyNumDailyShop, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 开任意宝箱X次
|
|
|
|
+ */
|
|
|
|
+ static function OnOpenNumAnyBox($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::OpenNumAnyBox, Enum_PropelType::add, $num, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 购买或观看广告获得体力X次
|
|
|
|
+ */
|
|
|
|
+ static function OnBuyTiliOrLookGuanggao() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::BuyTiliOrLookGuanggao, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 任意充值X次
|
|
|
|
+ */
|
|
|
|
+ static function OnRecharge() {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::Recharge, Enum_PropelType::add, 1, array());
|
|
|
|
+ self::CheckActiveTaskConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// </editor-fold>
|
|
|
|
+//
|
|
|
|
+// <editor-fold defaultstate="collapsed" desc="活动任务是否完成的检测-">
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 检测任务是否完成
|
|
|
|
+ * @param Ins_TaskEventArgs $taskParam
|
|
|
|
+ */
|
|
|
|
+ static function CheckActiveTaskConditions($taskParam) {
|
|
|
|
+ $activeTaskDic = ctx()->task->activeTaskInfo;
|
|
|
|
+ foreach ($activeTaskDic as $uid => &$task) {
|
|
|
|
+ $ins_TaskStep_Active = new Ins_TaskStep_Active($task);
|
|
|
|
+ if ($ins_TaskStep_Active->state > Enum_TaskCardStateType::ing) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($ins_TaskStep_Active->mo()->cmd == $taskParam->taskType) {
|
|
|
|
+ if ($ins_TaskStep_Active->isStatusType()) {//校验状态类的
|
|
|
|
+ $cur = $ins_TaskStep_Active->calcStatusCur();
|
|
|
|
+ if ($cur != $ins_TaskStep_Active->cur) {
|
|
|
|
+ $ins_TaskStep_Active->cur = $cur;
|
|
|
|
+ if ($ins_TaskStep_Active->cur >= $ins_TaskStep_Active->max()) {
|
|
|
|
+ $ins_TaskStep_Active->cur = $ins_TaskStep_Active->max();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ $tag = true;
|
|
|
|
+ if ($ins_TaskStep_Active->mo()->cmd == Enum_ActiveTaskCmdType::AnySkillUpLevel_X && count($taskParam->paras) > 0 && $ins_TaskStep_Active->mo()->paras != null) {
|
|
|
|
+ $parasArr = $taskParam->paras;
|
|
|
|
+ $lvArr = explode(',', $ins_TaskStep_Active->mo()->paras);
|
|
|
|
+ $needLv = $lvArr[0];
|
|
|
|
+ $num = 0;
|
|
|
|
+ foreach ($parasArr as $lv) {
|
|
|
|
+ if ($lv > $needLv) {
|
|
|
|
+ $num += 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $ins_TaskStep_Active->cur = $num;
|
|
|
|
+ if ($ins_TaskStep_Active->cur >= $ins_TaskStep_Active->max()) {
|
|
|
|
+ $ins_TaskStep_Active->cur = $ins_TaskStep_Active->max();
|
|
|
|
+ }
|
|
|
|
+ $tag = false;
|
|
|
|
+ } else {
|
|
|
|
+ if ($ins_TaskStep_Active->mo()->paras != null) {
|
|
|
|
+ $parasArr = $taskParam->paras;
|
|
|
|
+ if (count($parasArr) > 0) {
|
|
|
|
+ $arr = explode(',', $ins_TaskStep_Active->mo()->paras);
|
|
|
|
+ $index = 0;
|
|
|
|
+ foreach ($arr as $s) {
|
|
|
|
+ if ($s != $parasArr[$index]) {
|
|
|
|
+ $tag = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ $index += 1;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ $tag = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($tag) {
|
|
|
|
+ $ins_TaskStep_Active->propel($taskParam);
|
|
|
|
+ if ($ins_TaskStep_Active->cur >= $ins_TaskStep_Active->max()) {
|
|
|
|
+ $ins_TaskStep_Active->cur = $ins_TaskStep_Active->max();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($ins_TaskStep_Active->isFinish()) {
|
|
|
|
+ $ins_TaskStep_Active->state = Enum_TaskCardStateType::finish;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ctx()->task->activeTaskInfo = $activeTaskDic;
|
|
|
|
+ UserProc::updateUserInfo(); # 更新玩家数据
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// </editor-fold>
|
|
|
|
+//
|
|
|
|
+}
|