cmd) { // case CmdCode::cmd_task_getInfo: # 6201 刷新任务状态 // return TaskProc::GetTaskInfo(); //// case CmdCode::cmd_task_getReward: # 6202 领取任务奖励 //// return TaskProc::GetTaskReward(); //// case CmdCode::cmd_Task_setAttentionTask: # 6203 设置关注任务 //// return TaskProc::setAttentionTask(); // case CmdCode::cmd_Task_getActiveReward: # 6204 领取日常任务活跃度阶段奖励 // return TaskProc::getActiveReward(); // ////---------------- 任务卡相关通讯 ----------------------------------------------- // case CmdCode::cmd_taskCard_PlotFinish: # 6210 任务卡剧情对话 // return self::PlotFinish(); //// case CmdCode::cmd_taskCard_PlotExchangeTaskCard: # 6211 任务卡兑换奖励 //// Err(ErrCode::err_method_obsoleted); //// return self::PlotExchangeTaskCard($req); //// case CmdCode::cmd_taskCard_PlotPresentTaskCard: # 6212 剧情赠送任务卡 //// Err(ErrCode::err_method_obsoleted); //// return self::PlotPresetTaskCard($req); //// case CmdCode::cmd_taskCard_FinishAndReward: # 6213 任务卡完成,并即时结算 //// Err(ErrCode::err_method_obsoleted); //// return self::ImmetRewardTaskCard($req); // // case CmdCode::cmd_taskCard_onKillMonster: # 6214 杀死怪物事件 // return self::OnKillMonsterEvent(); // // case CmdCode::cmd_taskCard_active: # 6215 激活任务卡 // return self::OnTaskCard_active(); // case CmdCode::cmd_taskCard_reward: # 6216 领取任务卡奖励 // return self::OnTaskCard_reward(); // case CmdCode::cmd_taskCard_info: # 6217 任务卡 - 更新信息 // return self::OnTaskCard_GetInfo(); // case CmdCode::cmd_taskCard_StepActionDone: # 6218 任务步骤 - start/finish action done // return self::OnTaskCard_StepActionDone(); // case CmdCode::cmd_Task_setTracingCard: # 6219 设置当前追踪的任务卡 // return TaskProc::SetTracingCard(); // case CmdCode::cmd_task_StepFallBack: # 6220 任务步骤回撤重置 // return TaskProc::OnTaskStep_FallBack(); //// -------------- 任务卡商城 ----------------------------- // case CmdCode::cmd_taskcard_shop_open: # 6231 任务卡商店 - 开启 // return self::OnTaskCardShopOpen(); // case CmdCode::cmd_taskcard_shop_buy: # 6232 任务卡商店 - 购买 // return self::OnTaskCardShopBuy(); // case CmdCode::cmd_taskcard_shop_refresh: # 6233 任务卡商店 - 手动刷新 // return self::OnTaskCardShopRefresh(); // default: // return Err(ErrCode::cmd_err); // } // } // // // // // /** // * [6231] 任务卡商店 - 开启 // */ // static function OnTaskCardShopOpen() { // $userInfo = ctx(); // if (null == $userInfo->taskCardShop) { # 防御 // $userInfo->taskCardShop = new Info_TaskCard_Shop(); // } // if (null == $userInfo->taskCardShop->curCards || count($userInfo->taskCardShop->curCards) < 1) { // $arr = (array) GameConfig::taskcard_shop(); # 奖池配置 // $arr = self::FilterPrizepool($arr); # 利用玩家等级进行过滤 // $reward = ArrayInit(); // $err = self::Dice($arr, self::TaskCardShop_Refresh_ItemNum, $reward); # 获得随机结果 // my_Assert(ErrCode::ok == $err, $err); // $userInfo->taskCardShop->curCards = $reward; # 更新任务卡列表 // $userInfo->taskCardShop->selled = array(); // ctx($userInfo); // UserProc::updateUserInfo(); # 回写玩家数据 // } // return Resp::ok(array('taskCardShop' => $userInfo->taskCardShop)); # 返回最新任务卡列表 // } // // /** // * [6232] 任务卡商店 - 购买 // */ // static function OnTaskCardShopBuy() { // list($typeId, $num) = req()->paras; # 提取参数: 任务卡类型ID,数量(暂时默认为1) // $shopItemMo = GameConfig::taskcard_shop_getItem($typeId); // my_Assert(null != $shopItemMo, ErrCode::err_const_no); # 常量异常 // my_Assert($num == 1, ErrCode::paras_err); # 数量异常 // $userInfo = ctx(); // $userInfo->taskCardShop = new Info_TaskCard_Shop($userInfo->taskCardShop); // my_Assert(!in_array($typeId, $userInfo->taskCardShop->selled), ErrCode::taskCard_selled); // switch ($shopItemMo->pricetype) { // case 0: # 人民币 // Err(ErrCode::err_method_notimplement); //// my_Assert(Data_UserGame::Consume_Cash($userInfo->baseInfo, $shopItemMo->price), ErrCode::notenough_cash_msg); # 扣除费用 // break; // case 1: # 钻石 // my_Assert($userInfo->base()->Consume_Cash($shopItemMo->price), ErrCode::notenough_cash_msg); # 扣除费用 // break; // case 2: # 金币 // my_Assert($userInfo->base()->Consume_Gold($shopItemMo->price), ErrCode::notenough_gold_msg); # 扣除费用 // break; // default: # 其它 // Err(ErrCode::pay_m_type_err); # 定价类型异常 // break; // } // //// $cid = StoreProc::PutTaskCardInStore($typeId); # 添加任务卡到背包 // StoreProc::PutOverlyingItemInStore($typeId, $num); # 直接进包裹items // StatisticsProc::TargetStatistics(Enum_TargetStatistics::shopTaskId_BuyUserNum, $typeId); // $userInfo->taskCardShop->selled[] = $typeId; # 添加售罄记录 // UserProc::updateUserInfo(); // // self::OnBuyTaskCard($num); # 监控购买任务卡的任务卡[・_・?] // return Resp::ok(array( // 'gold' => ctx()->baseInfo->gold, // 'cash' => ctx()->baseInfo->cash, // 'store' => ctx()->store)); # 返回成功 // } // // /** // * [6233] 任务卡商店 - 手动刷新 // */ // public static function OnTaskCardShopRefresh() { // $cost = GameConfig::globalsettings()->TaskCardShop_Refresh_Cash; # 消耗 // $userInfo = ctx(); //// var_dump(Data_UserGame::Consume_Cash($userInfo->baseInfo, $cost)); // my_Assert($userInfo->base()->Consume_Cash($cost), ErrCode::notenough_cash_msg); # 扣除费用 // // 刷新任务卡 // $arr = (array) GameConfig::taskcard_shop(); # 奖池配置 // $arr = self::FilterPrizepool($arr); # 利用玩家等级进行过滤 // $reward = ArrayInit(); // $err = self::Dice($arr, self::TaskCardShop_Refresh_ItemNum, $reward); # 获得随机结果 // my_Assert(ErrCode::ok == $err, $err); //// if (null == $userInfo->taskCardShop) { # 防御 // $userInfo->taskCardShop = new Info_TaskCard_Shop($userInfo->taskCardShop); //// } // $userInfo->taskCardShop->curCards = $reward; # 更新任务卡列表 // $userInfo->taskCardShop->selled = array(); // ctx($userInfo); // UserProc::updateUserInfo(); # 回写玩家数据 // return Resp::ok(array( // 'gold' => ctx()->baseInfo->gold, // 'cash' => ctx()->baseInfo->cash, // 'taskCardShop' => $userInfo->taskCardShop)); # 返回最新任务卡列表 // } // // /** // * 过滤奖池 // * @param array $arr 奖池 // */ // static function FilterPrizepool($arr) { // $ret = array_filter($arr, function ($value) { // return(ctx()->baseInfo->level >= $value->unlock_level); # 等级限制 // }); // return $ret; // } // // /** // * 投骰子 // * @param assoc_array $arr 抽奖物品概率 // * @param int $number 连抽次数 // * @return array[] itemids // */ // static function Dice($arr, $number, &$reward) { // $max = 0; # 计算物品权重总和 // array_walk($arr, function ($value) use (&$max) { // $max += $value->probability; // }); // my_Assert($max > 0, ErrCode::err_const_no); # 配置数据有问题 // $reward = ArrayInit(); // for ($i = 0; $i < $number;) { // $rnd = CommUtil::random(1, $max); # 投骰子 // $start = 0; // $rew = null; // foreach ($arr as $item) { # 循环判断落入那个物品上 // if ($start < $rnd && $rnd <= $start + $item->probability) { # 落入区间 // $rew = $item; # 记录物品 // break; // } // $start += $item->probability; # 继续判断是否落入下一物品的区间 // } # foreach end // if (!$rew) { // return ErrCode::lottery_noselecteditem; // } // if (!in_array($rew->typeId, $reward)) { # 去除重复卡 // $reward[] = $rew->typeId; // $i++; // } // } # for end // return ErrCode::ok; // } // // // //// //// // // // // // // /** // * [6210]剧情对话-触发任务卡结束条件检测(中间某个step结束,进入下一个step) // */ // static function PlotFinish() { // list($gate_or_npc_id, $stage) = req()->paras; // $bUpdate = self::OnPlotOver($gate_or_npc_id, $stage); # 触发一下任务检查,更新任务状态 // $arr = GameConfig::plot_getItem($gate_or_npc_id, $stage); # 查找对应的剧情 // my_Assert(isset($arr), ErrCode::err_const_no); # 常量存在 // foreach ($arr as $plot) { // isEditor() and $plot = new \sm_plot(); // if (!empty($plot->presentItem)) { // if (strtolower($plot->presentItem) == strtolower("unlockBuild")) { # 特殊处理, 剧情中解锁建筑 // ctx()->privateState->unlockedBuild[] = $plot->presentEffect; # 添加解锁记录 // if ($plot->presentEffect == 1000) { // $college = new Info_College(); // $college->setFunUnluckTs(); // } // StatisticsProc::TargetStatistics(Enum_TargetStatistics::unlockbuidId, $plot->presentEffect); // NormalEventProc::OnUnlockBuild($plot->presentEffect); # 插入解锁事件 // } else if (strtolower($plot->presentItem) == strtolower("rename")) {# 改名 // // 跳过特殊字符串 // } else if (strtolower($plot->presentItem) == strtolower("zhaohuanyanling")) { // // 跳过特殊指令 // } else { # 普通奖励 // StoreProc::AddMultiItemInStore($plot->presentItem); // } // } // if (!empty($plot->recycleItem)) { // $val = explode(",", $plot->recycleItem); // my_Assert(count($val) > 1, "解析回收道具字符串出错"); // StoreProc::removeItemFromStore(ctx()->store, $val[0], $val[1]); // } // } // UserProc::updateUserInfo(); // return Resp::ok(array('store' => ctx()->store, // 'taskCardUpdate' => $bUpdate)); // } // //// //// /** //// * [6211] 任务卡-剧情结束兑换奖励(销毁当前卡,换取新的任务卡) //// * @deprecated since version 2020.12.12 //// * @param type $req //// */ //// static function PlotExchangeTaskCard($req) { //// Err(ErrCode::err_method_notimplement); //// } //// //// //// /** //// * [6212] 任务卡- 剧情对话奖励任务卡 //// * @deprecated since version 2020.12.12 //// * @param req $req //// */ //// static function PlotPresetTaskCard($req) { //// // 发放任务卡 //// list($rwdStr) = $req->paras; //// $err = StoreProc::AddMultiItemInStore($req, $rwdStr); //// my_Assert(ErrCode::ok == $err, $err); //// UserProc::updateUserInfo(); //// return Resp::ok(array('store' => $req->userInfo->game->store)); //// } //// //// /** //// * [6213]任务卡 - 即时奖励型任务卡 //// * @deprecated since version 2020.12.12 //// * @param req $req //// */ //// static function ImmetRewardTaskCard($req) { //// // 销毁任务卡, 发放奖励 //// list($taskCardUID) = $req->paras; //// my_Assert(StlUtil::dictHasProperty($req->userInfo->game->store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御 //// $taskCard = new Ins_TaskCard($req->userInfo->game->store->taskcards->$taskCardUID); # 任务卡对象 //// if (strlen($taskCard->mo()->reward) > 0) { # 防御奖励串为空 //// StoreProc::AddMultiItemInStore($req, $taskCard->mo()->reward); # 发放奖励 //// } //// if (strlen($taskCard->mo()->newTaskCard) > 0) { # 防御新卡串为空 //// StoreProc::AddMultiItemInStore($req, $taskCard->mo()->newTaskCard); # 发放新任务卡 //// } //// StlUtil::dictRemove($req->userInfo->game->store->taskcards, $taskCardUID); # 移除任务卡 //// UserProc::updateUserInfo(); # 回存玩家数据 //// return Resp::ok(array('store' => $req->userInfo->game->store, 'taskCardUpdate' => true)); # 返回值更新背包 //// } //// // // /** // * [6214] 任务卡 - 杀死怪物事件 // */ // static function OnKillMonsterEvent() { // // 触发一下任务检查 // list($monsterID, $num) = req()->paras; // $bUpdate = self::OnKillMonster($monsterID, $num); // return Resp::ok(array('store' => ctx()->store, // 'taskCardUpdate' => $bUpdate)); // } // // /** // * [6215] 任务卡 - 激活任务卡 // */ // static function OnTaskCard_active() { // list($taskCardUID) = req()->paras; # 提取参数: 任务卡实例id // $store = ctx()->store; # 快速访问store // my_Assert(StlUtil::dictHasProperty($store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御找不到实例 // $taskCard = new Ins_TaskCard($store->taskcards->$taskCardUID); # 任务卡对象 // // my_Assert($taskCard->state <= Enum_TaskCardStateType::notopen, ErrCode::taskCard_state); # 任务卡状态异常 // my_Assert(true != self::FindSameIngCard($taskCard->typeId), ErrCode::taskCard_active_multi); # 不可激活多张任务卡 // my_Assert(self::FindIngCardCount() <= self::TaskCard_ActiveMax, ErrCode::taskCard_active_max); # 激活数量上限 // $taskCard->state = Enum_TaskCardStateType::ing; // NormalEventProc::OnTaskCard_Actived($taskCardUID, null); # 带入事件 // foreach ($taskCard->curSteps as &$tsp) { # 初期里面只有一个任务 // $tsp = new Ins_TaskStep($tsp); // if ($tsp->isStatusType()) { # 如果是道具收集类的, 扣除所收集道具 // $tsp->autoCalcStatusCur(); // } //// $tsp->doStartAct(); // } // if ($taskCard->IsFinish()) { # 检查是否任务卡的所有步骤都已完成 // $taskCard->state = Enum_TaskCardStateType::finish; // NormalEventProc::OnTaskCard_Finish($taskCard->uid, null); # 广播卡完成事件 // } // $store->taskcards->$taskCardUID = $taskCard; // // self::autoRecoverTaskTracingState(); # 更新任务追踪. // UserProc::updateUserInfo(); # 回存玩家数据 // return Resp::ok(array( // 'priv' => ctx()->privateState, // 'store' => ctx()->store // )); # 返回值更新背包 // } // // static function FindSameIngCard($typeId) { // $cardDic = ctx()->store->taskcards; // $find = false; // array_walk($cardDic, function ($inst) use ($typeId, &$find) { //// $inst = new Ins_TaskCard($inst); // if ($inst->state == Enum_TaskCardStateType::ing && $inst->typeId == $typeId) { // $find = true; // } // }); // return $find; // } // // static function FindIngCardCount() { // $cardDic = ctx()->store->taskcards; // $num = 0; // array_walk($cardDic, function ($inst) use (&$num) { //// $inst = new Ins_TaskCard($inst); // if ($inst->state == Enum_TaskCardStateType::ing # // && GameConfig::item_taskcard_getItem($inst->typeId)->type != 3) { // $num++; // } // }); // return $num; // } // // /** // * [6216] 任务卡 - 领取任务卡奖励 // */ // static function OnTaskCard_reward() { // // 销毁任务卡, 发放奖励 // list($taskCardUID) = req()->paras; // $store = ctx()->store(); # 快速访问store // my_Assert(StlUtil::dictHasProperty($store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御找不到实例 // $taskCard = new Ins_TaskCard($store->taskcards->$taskCardUID); # 任务卡对象 // // my_Assert($taskCard->IsFinish(), ErrCode::task_progress_not_complete); # 任务卡尚未完成 // my_Assert($taskCard->state < 4, ErrCode::task_reward_geted); # 奖励已经领取过了 // // foreach ($taskCard->curSteps as &$tsp) { # 初期里面只有一个任务 // $tsp = new Ins_TaskStep($tsp); // if ($tsp->mo()->cmd == Enum_TaskCmdType::GainItem) { # 如果是道具收集类的, 扣除所收集道具 // $ok = StoreProc::removeItemFromStore($store, $tsp->mo()->paras, $tsp->mo()->num); // my_Assert(ErrCode::ok == $ok, ErrCode::taskCard_gainItem_no); // } // } // if (strlen($taskCard->mo()->reward) > 0) { # 防御奖励串为空 // StoreProc::AddMultiItemInStore($taskCard->mo()->reward); # 发放奖励 // self::addYaoPing($taskCard->typeId, $taskCard->mo()); // } // if ($taskCard->mo()->exp > 0) { # 任务卡增加了指挥官经验 // ctx()->base()->Add_Exp($taskCard->mo()->exp); # 加指挥官经验 // } // $taskCard->state = Enum_TaskCardStateType::drawed; // //2021-3-4 // $college = ctx()->college(); // $college->modifyTaskCardState($taskCard->typeId, Enum_TaskCardStateType::drawed); // ctx()->college = $college; // // $store->taskcards->$taskCardUID = $taskCard; # 回写任务数据 // // if ($taskCard->typeId == 601100082) { // TaskProc::ResetDailyTaskCards(1); // } // // self::InitdailyTask_HandOver(); #检测每次任务中的交付任务是否需要挂载了 // NormalEventProc::OnTaskCard_Reward($taskCard->mo()->reward, $taskCardUID); # 带入事件 // self::OnFinishTaskCard($taskCard); # 触发检查任务卡的任务卡[・_・?] // if (!empty($taskCard->mo()->newTaskCard)) { # 下一个任务卡存在 // StoreProc::PutTaskCardInStore($taskCard->mo()->newTaskCard); # 放卡入背包 // } // // if($taskCard->mo()->type == 4){ // ctx()->privateData(true)->shopTaskCompleteNum += 1; // } // SystemProc::CompleteSpecialNumXuanShangTask(req()->zoneid, ctx()->baseInfo->name); // if ($taskCard->mo()->type == 2) { // // 日常任务卡,不移除 // } else { // StlUtil::dictRemove($store->taskcards, $taskCardUID); # 移除任务卡 // } // self::autoRecoverStateMissions(); # 重新更新其它状态类的任务卡 // self::autoRecoverTaskTracingState(); # 更新任务追踪. // StatisticsProc::SelfTaskDataCollect($taskCard->typeId); #统计自己的任务完成情况 // StatisticsProc::TaskDataCollect($taskCard->typeId); #统计最新任务 // // if ($taskCard->mo()->type == 1) {//主线 // StatisticsProc::TargetStatistics(Enum_TargetStatistics::mainTaskId_ComUserNum, $taskCard->typeId); // } // // if ($taskCard->mo()->type == 4) {//悬赏 // StatisticsProc::TargetStatistics(Enum_TargetStatistics::shopTaskId_ComUserNum, $taskCard->typeId); // } // // if ($taskCard->mo()->type == 2) {//日常 // StatisticsProc::TargetStatistics(Enum_TargetStatistics::dailyTaskId_ComUserNum, $taskCard->typeId); // } // // if ($taskCard->mo()->type == 3) {//圣哲 // StatisticsProc::TargetStatistics(Enum_TargetStatistics::collegeTaskId_ComUserNum, $taskCard->typeId); // } // // ctx()->college->addScore($taskCard->mo()->score); #圣哲学院的任务是有积分累计的 // # // UserProc::updateUserInfo(); # 回存玩家数据 // return Resp::ok(array( // 'gold' => ctx()->baseInfo->gold, // 'cash' => ctx()->baseInfo->cash, // 'lvl' => ctx()->baseInfo->level, // 'store' => ctx()->store, // 'priv' => ctx()->privateState, // 'college' => ctx()->college,)); # 返回值更新背包 // } // // static function addYaoPing($taskId, $mo) { // if ($taskId == 601100022) { // $str = explode(';', $mo->reward); // $battleItem = ctx()->store->battleItem; // foreach ($str as $item) { // $list = explode(',', $item); // $subType = GameConfig::item_base_getItem($list[0])->subType; // if ($subType == 341 || $subType == 342) { // $tag = 999; // foreach ($battleItem as $index => $val) { // if ($val->id == $list[0]) { // $tag = $index; // break; // } // } // // if ($tag == 999) { // $k = 1; // for ($i = 1; $i <= 4; $i++) { // if (!StlUtil::dictHasProperty($battleItem, $i)) { // $k = $i; // break; // } // } // // $dic = new Ins_battleItem(); // $dic->index = $k; // $dic->id = $list[0]; // $dic->num = $list[1]; // $glctx = GameConfig::globalsettings()->YaoPingAttrInitVal; // $slist = explode(';', $glctx); // $hp = explode(',', $slist[0])[1]; // $mp = explode(',', $slist[1])[1]; // $sType = GameConfig::item_base_getItem($list[0])->subType; // if ($sType == 341) { // $dic->attrVal = $hp; // } else { // $dic->attrVal = $mp; // } // // $battleItem->$k = $dic; // } else { // $battleItem->$tag->num += $list[1]; // } // NormalEventProc::OnHPMPItemConfigChange(); // } // } // // ctx()->store->battleItem = $battleItem; // } // } // // static function checkHandOverDailyTask() { // if (ctx()->store->dailyTask_HandOver > 0) { // return; // } // // $taskcards = ctx()->store->taskcards; // $list = explode(',', glc()->dailyTask_HandOver); // // $num = 0; // // $handOverTask = 0; // foreach ($taskcards as $uid => $task) { // $mo = GameConfig::item_taskcard_getItem($task->typeId); // if ($mo->type == 2) { // if (in_array($task->typeId, $list)) { // $handOverTask = 1; // } // // if ($task->state == 4) { // $num += 1; // } // } // } // // if ($num >= 4 && $handOverTask == 0) {//每日任务全部完成,挂载每日任务--交付任务 // ctx()->store->dailyTask_HandOver = 1; // $count = count($list); // $rand = rand(0, $count - 1); // // StoreProc::PutTaskCardInStore($list[$rand]); // } // } // // /** // * [6217] 任务卡 - 更新信息 // */ // static function OnTaskCard_GetInfo() { // return Resp::ok(array('store' => ctx()->store)); # 返回值更新背包 // } // // /** // * [6218] 任务步骤 - start/finish Action done // */ // static function OnTaskCard_StepActionDone() { // list($taskCardUID, $stepTypeId, $actType) = req()->paras; # 参数提取,卡uid,步骤类型id,actType: 1:start,2:finish. // $store = ctx()->store; # 快速访问store // my_Assert(StlUtil::dictHasProperty($store->taskcards, $taskCardUID), ErrCode::taskCard_no); # 防御找不到实例 // $taskCard = new Ins_TaskCard($store->taskcards->$taskCardUID); # 任务卡对象 // // foreach ($taskCard->curSteps as &$tsp) { # 初期里面只有一个任务 // $tsp = new Ins_TaskStep($tsp); // if ($tsp->typeId == $stepTypeId) { # 找到指定步骤 // if ($actType == 1) { // $tsp->doStartAct(); // } else if ($actType == 2) { // $tsp->doFinishAct(); // } // } // } // $store->taskcards->$taskCardUID = $taskCard; // UserProc::updateUserInfo(); // return Resp::ok(array('store' => ctx()->store)); # 返回值更新背包 // } // // /** // * [6219] 设置当前追踪的任务卡 // */ // static function SetTracingCard() { // // (探索任务暂不开发) // $pri = ctx()->privateData(); # 私有数据 // // 设置追踪 // list($cardType, $cardUID) = req()->paras; # 参数: 任务标签类型(1:主线;2:日程;3:圣哲;4:商店), 任务卡id. // my_default_Obj($pri->taskCardTracing); # 确保 tracing数据结构是否完整. // $pri->taskCardTracing->$cardType = $cardUID; # 更新tracing数据. // UserProc::updateUserInfo(); # 回存 // return Resp::ok($pri->taskCardTracing); # 返回成功 // } // // /** // * [6220] 任务步骤 - 回撤 // */ // static function OnTaskStep_FallBack() { // // 遍历检查是否有任务步骤需要回撤 // $taskCards = ctx()->store->taskcards; # 快速访问store // foreach ($taskCards as $uid => &$card) { # 加了&符号,理论上就能直接修改原始元素 // $card = new Ins_TaskCard($card); # 任务卡对象 // $fallbackID = 0; // $stepArr = array(); // foreach ($card->curSteps as &$tsp) { # 初期里面只有一个任务 // $tsp = new Ins_TaskStep($tsp); // if (!$tsp->isFinish() && $tsp->mo()->fallback > 0) { # 找到需要回撤的步骤,删除此步骤 // $fallbackID = $tsp->mo()->fallback; // } else { // $stepArr[] = $tsp; // } // } // foreach ($stepArr as &$tsp) { # 回撤上一步的进度 // if ($tsp->typeId == $fallbackID) { // $tsp->cur = 0; // NormalEventProc::OnTaskCardStep_Process($card->uid, $tsp->typeId); # 任务进度更新 // } // } // $card->curSteps = $stepArr; # 更新任务步骤集合 // } // ctx()->store->taskcards = $taskCards; # 更新任务卡 // UserProc::updateUserInfo(); // return Resp::ok(); // } // // // //// // // // // /** // * [6204] 领取日常任务活跃度阶段奖励 // */ // static function getActiveReward() { // list($num) = req()->paras; # 提取参数: 领奖的阶段 // $userTask = ctx()->task; // $rewardCfg = GameConfig::task_active_reward_getItem($num); # 查找奖励配置 // my_Assert(null != $rewardCfg, ErrCode::err_const_no); # 防御: 常量丢失 // my_Assert(!in_array($num, $userTask->dailyActiveGetedRewardArr), ErrCode::task_reward_geted); # 判断尚未领取 // my_Assert($userTask->dailyActivePoint >= $num, ErrCode::task_activePoint_notenough); # 判断活跃点数足够 // $ok = StoreProc::AddMultiItemInStore($rewardCfg->reward); # 按照配置发放奖励 // my_Assert($ok == ErrCode::ok, $ok); # 发放成功 // $userTask->dailyActiveGetedRewardArr[] = $num; # 添加领取记录 // UserProc::updateUserInfo(); # 回存数据 // return Resp::ok(array(// # 返回 // "gold" => ctx()->baseInfo->gold, // "cash" => ctx()->baseInfo->cash, // "tili" => ctx()->baseInfo->tili, // "store" => ctx()->store, // "task" => ctx()->task // )); // } // // /** // * [6203] 设置关注任务 // * @deprecated since version 0 废弃,替换为6219.(2021.9.26) // */ // static function setAttentionTask() { //// list($taskId) = req()->paras; //// $userTask = ctx()->task; //// //// my_Assert(StlUtil::dictHasProperty($userTask->taskListPlot, $taskId), ErrCode::task_no); # 任务存在 //// $taskItem = new Ins_TaskInfo($userTask->taskListPlot->$taskId); //// my_Assert($taskItem->rewardGeted < 1, ErrCode::task_reward_geted); # 任务奖励尚未领取 //// $userTask->curTaskId = $taskId; ////// var_dump($userTask); //// UserProc::updateUserInfo(); //// return Resp::ok(array("task" => ctx()->task)); // } // // /** // * [6202]领取任务奖励 问:每日任务奖励和剧情任务奖励领取接口是否为一个? // * @deprecated since version 0 已经更换为领取任务卡奖励. // */ // static function GetTaskReward() { //// list($taskId) = req()->paras; # 提取参数: 任务id //// $userTask = new Info_UserTask(ctx()->task); //// $mask = 100000; # 根据id段来区分任务和每日任务. //// $type = intval($taskId / $mask); # 取出taskId第一位判断任务类型 //// switch ($type) { # //// case 4: # 剧情任务 //// my_Assert(StlUtil::dictHasProperty($userTask->taskListPlot, $taskId), ErrCode::task_no); #判断是否存在指定任务 //// $task = new Ins_TaskInfo($userTask->taskListPlot->$taskId); //// my_Assert($task->progress >= 1, ErrCode::task_progress_not_complete); # 判断任务进度是否已完成>=1f //// my_Assert($task->rewardGeted < 1, ErrCode::task_reward_geted); # 奖励不可重复领取 //// $taskCfg = GameConfig::task_getItem($taskId); # 任务配置数据 //// my_Assert($taskCfg != null, ErrCode::err_const_no); //// $ok = StoreProc::AddMultiItemInStore($taskCfg->reward); # 发放任务奖励 //// my_Assert($ok == ErrCode::ok, $ok); //// $task->rewardGeted = 1; //// $userTask->taskListPlot->$taskId = $task; //// if ($userTask->IsAllPlotTaskOver()) { # 检查当前节点任务是否已经全部清空 //// $userTask->curTaskNode += 1; //// $userTask->taskListPlot = ObjectInit(); //// $userTask->initialize(); //// } //// break; //// case 5: # 每日任务 //// my_Assert(StlUtil::dictHasProperty($userTask->taskListDaily, $taskId), ErrCode::task_no); //// $task = new Ins_TaskInfo($userTask->taskListDaily->$taskId); //// my_Assert($task->progress >= 1, ErrCode::task_progress_not_complete); # 判断任务进度是否已完成>=1f //// my_Assert($task->rewardGeted < 1, ErrCode::task_reward_geted); # 奖励不可重复领取 //// $taskCfg = GameConfig::task_daily_getItem($taskId); # 任务配置数据 //// my_Assert($taskCfg != null, ErrCode::err_const_no); ////// Data_UserGame::Add_Exp(ctx()->baseInfo, $taskCfg->exp); # 发放任务奖励 //// ctx()->base()->Add_Exp($taskCfg->exp); # 发放指挥官经验 //// $userTask->dailyActivePoint += $taskCfg->activePoint; //// $task->rewardGeted = 1; //// $userTask->taskListDaily->$taskId = $task; # 回存下 //// break; //// default: //// break; //// } //// //// ctx()->task = $userTask; # 回存 //// UserProc::updateUserInfo(); //// return Resp::ok(array(// # 返回 //// "gold" => ctx()->baseInfo->gold, //// "cash" => ctx()->baseInfo->cash, //// "tili" => ctx()->baseInfo->tili, //// "store" => ctx()->store, //// "task" => ctx()->task //// )); // } // // /** // * [6201]更新任务状态 // */ // static function GetTaskInfo() { // self::autoRecoverStateMissions(); # 重新更新其它状态类的任务卡 // UserProc::updateUserInfo(); // return Resp::ok(array("task" => ctx()->task)); // } // //// // // /** // * 每天重置日常任务. // */ // static function ResetDailyTaskCards($start = 0) { // $lv = glc()->DailyTaskLevelLimitLock; // // if (ctx()->baseInfo->level < $lv) { // return; // } // //// var_dump("重置日常任务卡"); // $store = ctx()->store(true); // my_default_Obj($store->taskcards); // // $tag = 0; // foreach ($store->taskcards as $k => $val) { // $tp = GameConfig::item_taskcard_getItem($val->typeId)->type; // if ($tp == 2) { // $tag = 1; // break; // } // } // // // if ($start != 0 && $tag != 0) { // return; // } // // if ($start == 0 && $tag == 0) { // return; // } // // $dailyCards = new \stdClass(); // foreach (GameConfig::item_taskcard() as $id => $cardMo) { // isEditor() and $cardMo = new \sm_item_taskcard(); // if ($cardMo->type == 2) { # 1:主线;2:日程;3:圣哲;4:商店 // $dailyCards->$id = $cardMo; // } // } // $dailyCards = (array) $dailyCards; // ksort($dailyCards); // foreach ($dailyCards as $id => $cardMo) { // foreach ($store->taskcards as $uid => $card) { // $cardVo = new Ins_TaskCard($card); // if ($cardVo->typeId == $id) { # 找到对应的实例. // unset($store->taskcards->$uid); # 删除昨日未完成日常 // } // } // } // ctx()->store = $store; // // $pri = ctx()->privateData(); # 私有数据 // $cardType = 2; # 日常任务,设置追踪 // my_default_Obj($pri->taskCardTracing); # 确保 tracing数据结构是否完整. // // $commonTaskList = explode(',', glc()->dailyTask_Common); // if (count($commonTaskList) < 4) { // // 再遍历一遍, 添加今日日常任务. // rsort($commonTaskList); // $cid = 0; // foreach ($commonTaskList as $id) { // $cid = StoreProc::PutTaskCardInStore($id); # 添加任务卡到背包 // } // // $pri->taskCardTracing->$cardType = $cid; # 更新tracing数据 // } else { // $tempCid = 0; // $count = count($commonTaskList); // $temp = array(); // while (true) { // $num = rand(0, $count - 1); // if (in_array($num, $temp)) { // continue; // } // $id = $commonTaskList[$num]; // $cid = StoreProc::PutTaskCardInStore($id); # 添加任务卡到背包 // if ($tempCid == 0) { // $tempCid = $cid; // } // // $temp[] = $num; // if (count($temp) >= 4) { // break; // } // } // $pri->taskCardTracing->$cardType = $tempCid; # 更新tracing数据 // } // // //重置每日任务里的交付任务 // //$handTaskId = glc()->dailyTask_HandOver; // //StoreProc::PutTaskCardInStore($handTaskId); // // UserProc::updateUserInfo(); # 回存数据.(不管从哪里调用的, 更新肯定没错.) // } // // static function InitdailyTask_HandOver() { // $taskcards = ctx()->store->taskcards; // $index = 0; // $handTaskId = glc()->dailyTask_HandOver; // $tag = true; // foreach ($taskcards as $key => $val) { // if (GameConfig::item_taskcard_getItem($val->typeId)->type == 2 && $val->state == 4) { // $index += 1; // } // // if ($val->typeId == $handTaskId) { // $tag = false; // } // } // // if ($index >= 4 && $tag) { // StoreProc::PutTaskCardInStore($handTaskId); // } // } // // /** // * 重置每日任务 // * @deprecated since version 0 已废弃,换用任务卡接口. (2021.9.26) // */ // static function ResetDailyTask() { // return; //// $userTask = new Info_UserTask(ctx()->task); //// $userTask->resetDailyTask(); //// ctx()->task = $userTask; // } // //// // // // // /** // * 检查任务条件是否达成 // * @param Ins_TaskParams $taskParam Description // * @deprecated since version 0 已废弃,换用taskcard. // */ // static function CheckTaskConditions($taskParam) { // return; ////// var_dump($taskParam); //// $bUpdate = false; //// foreach (ctx()->task->taskListPlot as $tid => $task) { //// $taskCfg = GameConfig::task_getItem($tid); //// my_Assert($taskCfg != null, ErrCode::err_const_no); # 获取任务配置数据 //// if ($taskCfg->tasktype != $taskParam->taskType) { # 任务类型必须匹配 //// continue; //// } //// isEditor() and $task = new Ins_TaskInfo(-1); //// if ($task->progress == 1) { # 已完成的不再更新处理 //// continue; //// } //// if (is_null($taskCfg->canshu1)) { //// $task->progress = 1; //// $bUpdate = true; //// continue; //// } //// //// if ($taskCfg->canshu1 == $taskParam->canshu1) { //// $task->tag1 = $taskParam->canshu1; //// if (null == $taskCfg->canshu2 || 0 == $taskCfg->canshu2) { //// $task->progress = 1; //// $task->tag2 = $taskParam->canshu2; //// $bUpdate = true; //// } else { //// if (is_numeric($taskCfg->canshu2)) { //// $task->tag2 = max($task->tag2, $taskParam->canshu2); //// if ($taskCfg->canshu2 <= $taskParam->canshu2) { //// $bUpdate = true; //// $task->progress = 1; //// } //// } else { //// $task->tag2 = $taskParam->canshu2; //// if ($taskCfg->canshu2 == $taskParam->canshu2) { //// $bUpdate = true; //// $task->progress = 1; //// } //// } //// } //// } //// } //// if ($bUpdate) { //// CornerSignEventProc::OnTask_Plot_new(); //// } // } // // /** // * 检查任务条件是否达成 // * @param Ins_TaskParams $taskParam Description // * @deprecated since version 0 已废弃,换用taskcard // */ // static function CheckDailyTaskConditions($taskParam) { // return; //// $bUpdate = false; //// $daily = ctx()->task->taskListDaily; //// foreach ($daily as $tid => &$task) { //// $taskCfg = GameConfig::task_daily_getItem($tid); //// my_Assert($taskCfg != null, ErrCode::err_const_no); # 获取任务配置数据 //// if ($taskCfg->tasktype != $taskParam->taskType) { # 任务类型必须匹配 //// continue; //// } //// $task = new Ins_TaskInfo($task); //// if ($task->progress >= 1) { # 已完成的不再更新处理 //// continue; //// } //// $task->counter++; # 计数器 //// if (is_null($taskCfg->canshu1) || $taskCfg->canshu1 == 0) { //// $task->progress = 1; //// $bUpdate = true; //// continue; //// } //// if ($taskCfg->canshu1 == $task->counter) { //// $task->progress = 1; //// $bUpdate = true; //// continue; //// } //// } //// //// if ($bUpdate) { //// CornerSignEventProc::OnTask_Daily_new(); //// } // } // //// //// // // // // // // /** // * 神庙抽奖 // */ // static function OnTempleLottery() { //// $taskParam = new Ins_TaskParams(Enum_TaskCmdType::TempleLottery); //// self::CheckTaskConditions($taskParam); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::TempleLottery, Enum_PropelType::set, 1, array()); // self::CheckTaskCardConditions($taskEventArg); // } // // /** // * 例如当指挥官等级提升的时候需要检查是否有任务达成 // */ // static function OnUserLevelUp($newLvl) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::CommanderLevelUpTo, $newLvl); // self::CheckTaskConditions($taskParam); // // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::CommanderLevelUpTo, Enum_PropelType::set, $newLvl, array($newLvl)); // self::CheckTaskCardConditions($taskEventArg); // } // // /** // * 英雄升级 // * @param type $heroMoId // * @param type $newLvl // */ // static function OnHeroLevelUp($heroMoId, $newLvl) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroLevelUpTo, $heroMoId, $newLvl); // self::CheckTaskConditions($taskParam); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroLevelUpTo, Enum_PropelType::set, $newLvl, array($heroMoId)); // self::CheckTaskCardConditions($taskEventArg); // } // // /** // * 英雄升阶 // * @param type $heroMoId // * @param type $newGrade // */ // static function OnHeroGradeUp($heroMoId, $newGrade) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroGradeUpTo, $heroMoId, $newGrade); // self::CheckTaskConditions($taskParam); // self::OnHeroImprove(); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroGradeUpTo, Enum_PropelType::add, 1, array()); // self::CheckTaskCardConditions($taskEventArg); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroGradeUpTo_status, Enum_PropelType::set, $newGrade, array()); // self::CheckTaskCardConditions($taskEventArg); // } // // /** // * 英雄碎片数量达到指定值 // * @param type $heroMoId // * @param type $num // */ // static function OnHeroSegmengNum($heroMoId, $num) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroSegmentNumberTo, $heroMoId, $num); // self::CheckTaskConditions($taskParam); // } // // /** // * 英雄解锁技能 // * @param type $heroMoId // * @param type $skillId // */ // static function OnHeroUnlocSkill($heroMoId, $skillId) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::HeroSkillUnlock, $heroMoId, $skillId); // self::CheckTaskConditions($taskParam); // } // // /** // * 英雄穿上武器 // * @param type $heroMoid // * @param type $weaponMoId // */ // static function OnHeroWearWeapon($heroMoid, $weaponMoId) { // $weapMO = GameConfig::item_base_getItem($weaponMoId); // my_Assert($weapMO, ErrCode::err_const_no); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroWearupWeapon_quality, Enum_PropelType::set, 1, array($heroMoid, $weapMO->quality)); // self::CheckTaskCardConditions($taskEventArg); // // $taskEventArg1 = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroWearingWeapon_Except, Enum_PropelType::set, 1, array($heroMoid, $weaponMoId)); // self::CheckTaskCardConditions($taskEventArg1); // } // // /** // * 英雄装备言灵 // * @param type $heroMoid // * @param type $weaponMoId // */ // static function OnHeroWearYanling($heroMoid, $yanlingMoId) { // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroWearupYanling, Enum_PropelType::set, 1, array($heroMoid, $yanlingMoId)); // self::CheckTaskCardConditions($taskEventArg); # 检查装备言灵任务 // $ylmo = GameConfig::item_base_getItem($yanlingMoId); // my_Assert(null != $ylmo, ErrCode::err_const_no); // $taskEventArg2 = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroWearUpXYanlingWithQualityN, Enum_PropelType::add, 1, array($ylmo->quality)); // self::CheckTaskCardConditions($taskEventArg2); # 检查装备x个n品质言灵任务 // $taskEventArg3 = new Ins_TaskEventArgs(Enum_TaskCmdType::HeroWearingYanling, Enum_PropelType::set, 1, array($heroMoid)); # 唤灵师装备了任意言灵 // self::CheckTaskCardConditions($taskEventArg3); // } // // /** // * 通关剧情关卡 // * @param type $gateId // * @param type $difficulty // */ // static function OnPassGateN($gateId, $difficulty) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PassGateN, $gateId, $difficulty); // self::CheckTaskConditions($taskParam); // self::OnPassGate(); //// var_dump("通关剧情检测 $gateId $difficulty"); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::PassGateN, Enum_PropelType::set, 1, array($gateId, $difficulty)); // self::CheckTaskCardConditions($taskEventArg); // } // // /** // * 通关材料副本第n层 // * @param type $gateId // * @param type $level // */ // static function OnPassMaterialCarbonN($gateId, $level) { // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::PassMaterialCarbonN, Enum_PropelType::set, 1, array($gateId, $level)); // self::CheckTaskCardConditions($taskEventArg); // } // // /** // * 通关无尽塔副本关卡 // * @param type $gateId // * @param type $difficulty 层数 // */ // static function OnPassEndlessCarboN($gateId, $difficulty) { //// $taskParam = new Ins_TaskParams(Enum_TaskCmdType::passEndlessCarbonN, $gateId, $difficulty); //// self::CheckTaskConditions($taskParam); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::passEndlessCarbonN, Enum_PropelType::set, $difficulty, array($gateId, $difficulty)); //// var_dump($taskEventArg); // self::CheckTaskCardConditions($taskEventArg); // } // // static function OnKillMonster($monsterID, $num) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::KillMonster, Enum_PropelType::add, $num, array($monsterID)); // return self::CheckTaskCardConditions($taskParam); // } // // /** // * 获得道具 // */ // static function OnGainItem($itemId, $num) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::GainItem, Enum_PropelType::stat, $num, array($itemId)); // // self::CheckTaskCardConditions($taskParam); // } // // /** // * 对话完成 // * @param type $gate_or_npc_id // * @param type $stage // * @return type // */ // static function OnPlotOver($gate_or_npc_id, $stage) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::PlotOver, Enum_PropelType::set, 1, array($gate_or_npc_id, "$stage")); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 购买n张任务卡(非特定) // * @param type $_num // * @return type // */ // static function OnBuyTaskCard($_num = 1) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::BuyTaskCard_Num, Enum_PropelType::add, $_num, array()); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 完成任务卡(不指定) 这是要造检查任务卡的任务卡[・_・?] // * @param Ins_TaskCard $taskCard // */ // static function OnFinishTaskCard($taskCard) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::FinishTaskCard_noID, Enum_PropelType::set, 1, array()); // self::CheckTaskCardConditions($taskParam); // $cardBase = GameConfig::item_base_getItem($taskCard->mo()->typeId); // $taskParam2 = new Ins_TaskEventArgs(Enum_TaskCmdType::FinishXCardWithQualityN, Enum_PropelType::add, 1, array($cardBase->quality)); // self::CheckTaskCardConditions($taskParam2); // if ($taskCard->mo()->cardType == "言灵") { // $taskParam3 = new Ins_TaskEventArgs(Enum_TaskCmdType::FinishXYanlingCardAboutQualityN, Enum_PropelType::add, 1, array($cardBase->quality)); // self::CheckTaskCardConditions($taskParam3); // } // } // // /** // * 领取系统邮件奖励 // * @param type $mailId 指定邮件id // * @return type // */ // static function OnDrawSysMail($mailId) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::DrawSysMail_ID, Enum_PropelType::set, 1, array($mailId)); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 言灵升级 // * @param type $yanlingType // * @param type $level // * @return type // */ // static function OnYanlingLevelUp($yanlingType, $level) { // # 任意言灵提升 // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::AnyYanlingLevelUp, Enum_PropelType::set, 1, array($yanlingType, $level)); // self::CheckTaskCardConditions($taskParam); // # 指定言灵提升 // $taskParam2 = new Ins_TaskEventArgs(Enum_TaskCmdType::YanlingLevelUp, Enum_PropelType::set, $level, array($yanlingType)); // self::CheckTaskCardConditions($taskParam2); // } // // /** // * 言灵升星(突破) // * @param type $newStar // */ // static function OnYanlingStarUp($newStar) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::UpgradeXYanlingToNStar, Enum_PropelType::add, 1, array($newStar)); // self::CheckTaskCardConditions($taskParam); // } // // static function OnWeaponUpgrade() { // // } // // /** // * 武器突破 // * @param type $newStar // */ // static function OnWeaponStarUp($newStar) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::UpgradeXWeaponToNStar, Enum_PropelType::add, 1, array($newStar)); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 领取任意一个学院课程下的任意一个任务(num:1,paras[])(学院界面) // */ // static function OnGetSchoolTask() { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::GetSchoolTask, Enum_PropelType::set, 1, array()); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 完成任意一个学院课程下的任意一张任务卡(num:1,paras:[])(学院界面) // */ // static function OnFinishSchoolTask() { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::FinishSchoolTask, Enum_PropelType::set, 1, array()); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 完成指课程的全部任务(num:1,paras:[courseId])(学院界面) // * @param int $courseId 课程id // */ // static function OnFinishAllSchoolTaskOfGrade($courseId) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::FinishAllSchoolTaskOfGrade, Enum_PropelType::set, 1, array($courseId)); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 特定武器升级到X等级 // * @param type $weaponId // * @param type $level // */ // static function OnWeaponLevelUp($weaponId, $level) { // $taskParam = new Ins_TaskEventArgs(Enum_TaskCmdType::WeaponLevelUp, Enum_PropelType::set, $level, array($weaponId)); // self::CheckTaskCardConditions($taskParam); // $taskParam2 = new Ins_TaskEventArgs(Enum_TaskCmdType::AnyWeaponLevelUp, Enum_PropelType::set, $level, array()); // self::CheckTaskCardConditions($taskParam2); // } // // /** // * 完成一次boss战胜利 // * @param type $gateId // */ // static function OnPassWorldBoss($gateId) { //// $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PassWorldBoss, $gateId); //// self::CheckTaskConditions($taskParam); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::PassWorldBoss, Enum_PropelType::set, 1, array($gateId)); //// var_dump($taskEventArg); // self::CheckTaskCardConditions($taskEventArg); //// // $taskEventArgDaily = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyBossChallenge, Enum_PropelType::add, 1, array($gateId)); //// var_dump($taskEventArgDaily); // self::CheckTaskCardConditions($taskEventArgDaily); // } // // /** // * 竞技场胜利场次 // * @param type $num // */ // static function OnPvPWinN($num) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PvPWinNumberTo, $num); // self::CheckTaskConditions($taskParam); // } // // /** // * 竞技场积分 // * @param type $score // */ // static function OnPvPScoreN($score) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::PvPScoreTo, $score); // self::CheckTaskConditions($taskParam); // } // // /** // * 玩家总战力值 // * @param type $num // */ // static function OnUserFightPowerN($num) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::UserPowerTo, $num); // self::CheckTaskConditions($taskParam); // } // // /** // * 玩家收集积分 // * @param type $num // */ // static function OnUserCollectScoreN($num) { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::UserCollectScoreTo, $num); // self::CheckTaskConditions($taskParam); // } // // // //// // // // // // // //// static function Upate // // /** // * 每日登陆 // */ // static function OnUserLogin() { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyLogin); // self::CheckDailyTaskConditions($taskParam); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyLogin, Enum_PropelType::set, 1, array()); // self::CheckTaskCardConditions($taskEventArg); # 检查日常任务 // } // // /** // * 每日:英雄强化(升级或升阶)n次 // */ // static function OnHeroImprove() { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyHeroImprove); // self::CheckDailyTaskConditions($taskParam); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyHeroImprove, Enum_PropelType::inc, 1, array()); // self::CheckTaskCardConditions($taskEventArg); # 检查日常任务 // } // // /** // * 每日:剧情关卡,胜利n次 // */ // static function OnPassGate() { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyGatesWin); // self::CheckDailyTaskConditions($taskParam); // $taskEventArg = new Ins_TaskEventArgs(Enum_TaskCmdType::DailyGatesWin, Enum_PropelType::inc, 1, array()); // self::CheckTaskCardConditions($taskEventArg); # 检查日常任务 // } // // /** // * 竞技场每日挑战,胜负均可 // */ // static function OnPvp() { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyPVP); // self::CheckDailyTaskConditions($taskParam); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 每日挑战,胜负均可 // */ // static function OnRankChalenge() { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyRankChalenge); // self::CheckDailyTaskConditions($taskParam); // self::CheckTaskCardConditions($taskParam); // } // // /** // * 每日购买商品 // */ // static function OnShopping() { // $taskParam = new Ins_TaskParams(Enum_TaskCmdType::DailyShopping); // self::CheckDailyTaskConditions($taskParam); // self::CheckTaskCardConditions($taskParam); // } // // // //// // // // // // // // // /** // * 自动修正任务追踪信息 // */ // static function autoRecoverTaskTracingState() { // $tasks = ctx()->store->taskcards; // $pri = ctx()->privateData(); // for ($tp = 1; $tp < 5; $tp++) { // if (StlUtil::dictHasProperty($pri->taskCardTracing, $tp)) { // $curId = $pri->taskCardTracing->$tp; // } else { // $curId = 0; // } // // //$curId = my_null_default($pri->taskCardTracing->$tp, 0); # 当前追踪中的任务卡id // // $needRefresh = false; // if ($curId > 0) { # 存在任务卡 // if (CommUtil::isPropertyExists($tasks, $curId)) { // $curTask = new Ins_TaskCard($tasks->$curId); // if ($curTask->state >= 4) { # 任务卡已经被领取奖励, 尝试刷新 // $needRefresh = true; // } // } else { # 任务卡已经被删除, 尝试刷新 // $needRefresh = true; // } // } else { # 没有追踪目标, 尝试刷新 // $needRefresh = true; // } // // if ($needRefresh) { // $ok = false; // foreach ($tasks as $tid => &$task) { // $task = new Ins_TaskCard($task); // if ($task->mo()->type == $tp) { // if ($task->state >= 4) { // continue; // } // $pri->taskCardTracing->$tp = $tid; // $ok = true; // break; // } // } // if (!$ok) { # 没有找到合适的追踪对象 // $pri->taskCardTracing->$tp = 0; # 删除所有追踪(剩余任务已经全部完成了) // } // ctx()->store->taskcards = $tasks; // ctx()->privateState = $pri; // } // } // } // // /** // * 自动修复状态型任务 // */ // static function autoRecoverStateMissions() { // $tasks = ctx()->store->taskcards; // foreach ($tasks as $tid => &$task) { // $task = new Ins_TaskCard($task); // // if ($task->state == Enum_TaskCardStateType::ing // # 进行中的或者已完成的 // || $task->state == Enum_TaskCardStateType::finish) { // foreach ($task->curSteps as &$tsp) { # 初期里面只有一个任务 // $tsp = new Ins_TaskStep($tsp); // $tsp->autoCalcStatusCur(); // } // if ($task->state == Enum_TaskCardStateType::finish) { # 检查是否任务卡的所有步骤都已完成 // if (!$task->IsFinish()) { // $task->state = Enum_TaskCardStateType::ing; # 状态回退 // } // } // } // } //// Clog::info("更新状态统计类的任务卡!"); // ctx()->store->taskcards = $tasks; // } // // /** // * 检查任务卡条件是否达成 // * @param Ins_TaskEventArgs $taskParam Description // */ // static function CheckTaskCardConditions($taskParam) { // $bUpdate = false; // $tasks = ctx()->store->taskcards; // foreach ($tasks as $tid => &$task) { // $task = new Ins_TaskCard($task); // if ($task->state != Enum_TaskCardStateType::ing) { // continue; // } // foreach ($task->curSteps as &$tsp) { # 初期里面只有一个任务 // $tsp = new Ins_TaskStep($tsp); // if ($tsp->check_new($taskParam)) { // $bUpdate = true; // $tsp->propel($taskParam); // NormalEventProc::OnTaskCardStep_Process($task->uid, $tsp->typeId); # 任务进度更新 // if ($tsp->isFinish()) { // NormalEventProc::OnTaskCardStep_Complete($task->uid, $tsp->typeId); # 广播任务步骤完成事件 //// $tsp->doFinishAct(); // } // } // } // if ($task->IsFinish()) { # 检查后添加后续任务 // $arr = array(); // foreach ($task->curSteps as &$tsp) { # 初期里面只有一个任务 // $tsp = new Ins_TaskStep($tsp); // if (strlen($tsp->mo()->next) > 0) { # 有后续任务 // $arr = array_merge($arr, explode(',', $tsp->mo()->next)); # 累加下一个任务步骤 // } // } // foreach ($arr as $stpid) { # 轮询添加后续任务 // if ($stpid > 0) { // $task->AddStep($stpid); # 将后续任务追加到任务列表中 // } // } // // if (count($arr) != 0) { // self::autoRecoverStateMissions(); // } // } // if ($task->IsFinish()) { # 检查是否任务卡的所有步骤都已完成 // $task->state = Enum_TaskCardStateType::finish; // NormalEventProc::OnTaskCard_Finish($task->uid, null); # 广播卡完成事件 // } // } // if ($bUpdate) { # 带回数据到客户端 // ctx()->store->taskcards = $tasks; // UserProc::updateUserInfo(); # 更新玩家数据 // } // // return $bUpdate; // } // // // // // //// //}