|
@@ -25,11 +25,135 @@ class TaskProc {
|
|
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 领取成就奖励
|
|
|
|
+ return TaskProc::getAchieveReward();
|
|
|
|
+
|
|
default:
|
|
default:
|
|
Err(ErrCode::cmd_err);
|
|
Err(ErrCode::cmd_err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 6203 领取成就奖励
|
|
|
|
+ * @return type
|
|
|
|
+ */
|
|
|
|
+ public static function getAchieveReward() {
|
|
|
|
+ list($typeId) = req()->paras;
|
|
|
|
+
|
|
|
|
+ $mo = GameConfig::achieve_getItem($typeId);
|
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
|
+
|
|
|
|
+ my_Assert(StlUtil::dictHasProperty(ctx()->task->achieveDic, $typeId), ErrCode::err_const_no);
|
|
|
|
+ $achieveDic = ctx()->task->achieveDic->$typeId;
|
|
|
|
+
|
|
|
|
+ $list = explode(',', $mo->condition);
|
|
|
|
+ $length = count($list);
|
|
|
|
+ my_Assert($achieveDic->val>= $achieveDic->max, ErrCode::task_CanotPriceReviced);
|
|
|
|
+ my_Assert($achieveDic->received < $achieveDic->max, ErrCode::task_PriceRepeatReviced);
|
|
|
|
+
|
|
|
|
+ $index = 0;
|
|
|
|
+ foreach ($list as $k =>$num) {
|
|
|
|
+ if($num == $achieveDic->max){
|
|
|
|
+ $index = $k;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //领取奖励
|
|
|
|
+ $pList = explode(';', $mo->reward);
|
|
|
|
+ StoreProc::AddMultiItemInStore($pList[$index]);
|
|
|
|
+
|
|
|
|
+ //下一个max
|
|
|
|
+ if($index +1 < $length){
|
|
|
|
+ $achieveDic->max = $list[$index+1];
|
|
|
|
+ }
|
|
|
|
+ ctx()->task->achieveDic->$typeId = $achieveDic;
|
|
|
|
+
|
|
|
|
+ UserProc::updateUserInfo();
|
|
|
|
+ return Resp::ok(array(
|
|
|
|
+ "achieve"=>ctx()->task->achieveDic,
|
|
|
|
+ "cash"=> ctx()->baseInfo->cash,
|
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 初始化成就信息
|
|
|
|
+ */
|
|
|
|
+ public static function initAchieveData() {
|
|
|
|
+ $dic = GameConfig::achieve();
|
|
|
|
+ if($dic == null){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $achieveDic = ctx()->task->achieveDic;
|
|
|
|
+ if(count((array)$achieveDic) > 0){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach ($dic as $key => $value) {
|
|
|
|
+ $item = new Ins_Achieve();
|
|
|
|
+ $typeId = $value->typeId;
|
|
|
|
+ $item->typeId = $typeId;
|
|
|
|
+ $item->cmd = $value->cmd;
|
|
|
|
+ $item->max = explode(',', $value->condition)[0];
|
|
|
|
+ $achieveDic->$typeId = $item;
|
|
|
|
+ }
|
|
|
|
+ ctx()->task->achieveDic = $achieveDic;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //检测成就条件
|
|
|
|
+ public static function CheckAchieveConditions($arg) {
|
|
|
|
+ $achieveDic = ctx()->task->achieveDic;
|
|
|
|
+ foreach ($achieveDic as $key => $value) {
|
|
|
|
+ $achieve = new Ins_Achieve($value);
|
|
|
|
+ $tag = false;
|
|
|
|
+ if($achieve->cmd == $arg->taskType){
|
|
|
|
+ $mo = $achieve->getAchieveMo();
|
|
|
|
+ if($mo->paras == $arg->paras[0]){//暂定,若有多个参数,在进行解析
|
|
|
|
+ $tag = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($tag){//找到正确数据
|
|
|
|
+ switch ($arg->ope) {
|
|
|
|
+ case Enum_PropelType::set:
|
|
|
|
+ $achieve->val = $arg->val;
|
|
|
|
+ break;
|
|
|
|
+ case Enum_PropelType::add:
|
|
|
|
+ $achieve->val += $arg->val;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ctx()->task->achieveDic = $achieveDic;
|
|
|
|
+ UserProc::updateUserInfo();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //-------------------成就条件检测
|
|
|
|
+ //单件装备等级达到X级
|
|
|
|
+ static function accumulateEquiplevel_one($lv) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_AchieveType::equiplevel_one, Enum_PropelType::set,$lv, array());
|
|
|
|
+ self::CheckAchieveConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //累计消耗X钻石
|
|
|
|
+ static function accumulateCostCash($num) {
|
|
|
|
+ $taskEventArg = new Ins_TaskEventArgs(Enum_AchieveType::accumulateCostCash, Enum_PropelType::add,$num, array());
|
|
|
|
+ self::CheckAchieveConditions($taskEventArg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //------------------------------------------------------
|
|
|
|
+
|
|
public static function getTaskInfo() {
|
|
public static function getTaskInfo() {
|
|
list($type) = req()->paras;//武器uid
|
|
list($type) = req()->paras;//武器uid
|
|
|
|
|