|
@@ -38,6 +38,8 @@ class ActiveProc {
|
|
|
return ActiveProc::Day7_AccumulateDrawreward();
|
|
|
case CmdCode::cmd_active_limitTsBuy: # 6108 限时贩售
|
|
|
return ActiveProc::LimitTsBuy_Drawreward();
|
|
|
+ case CmdCode::cmd_active_battlePassDrawReward: # 6109 战令奖励领取
|
|
|
+ return ActiveProc::BattlePassDrawReward();
|
|
|
default:
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
@@ -481,5 +483,72 @@ class ActiveProc {
|
|
|
'reward_Gem' => StoreProc::$reward_Gem,
|
|
|
));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 6109 战令奖励领取
|
|
|
+ */
|
|
|
+ public static function BattlePassDrawReward() {
|
|
|
+ list($type,$id) = req()->paras;
|
|
|
|
|
|
+ $mo = GameConfig::activity_battlepass_getItem($id); # 查询奖励数据
|
|
|
+ my_Assert(null != $mo, ErrCode::err_const_no); # 防御找不到配置
|
|
|
+ $subFunType = $mo->type;
|
|
|
+ $typeId = $mo->typeId;
|
|
|
+ $str = $subFunType.'-'.$type.'-'.$typeId;
|
|
|
+
|
|
|
+ switch ($subFunType) {
|
|
|
+ case Enum_SubFunType::ActivePoint_BattlePass:
|
|
|
+ $point =ctx()->privateState->battlePass_taskPoint;
|
|
|
+ my_Assert($typeId >= $point, ErrCode::active_pointNotEnough);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case Enum_SubFunType::Tili_BattleBass:
|
|
|
+ my_Assert($typeId >= ctx()->base(false)->cost_tili, ErrCode::active_costTiliNotEnough);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case Enum_SubFunType::Gate_BattleBass:
|
|
|
+ my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList,$typeId), ErrCode::gate_GateNoUnlock);
|
|
|
+ my_Assert(ctx()->gates->GateList->$typeId->pass > 0, ErrCode::evolve_GateNoPass);
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ my_Assert(!in_array($str, ctx()->privateState->battlePassRewardReceived), ErrCode::active_hasgetted);
|
|
|
+ $key = 'rewards_'.$type;
|
|
|
+ StoreProc::AddMultiItemInStore($mo->$key); # 发放奖励
|
|
|
+
|
|
|
+ ctx()->privateData(true)->battlePassRewardReceived[] = $str;
|
|
|
+
|
|
|
+ UserProc::updateUserInfo(); # 回存
|
|
|
+ return Resp::ok(array('gold' => ctx()->baseInfo->gold,
|
|
|
+ 'cash' => ctx()->baseInfo->cash,
|
|
|
+ 'store' => ctx()->store,
|
|
|
+ 'heros' => ctx()->heros,
|
|
|
+ //'privateState' => ctx()->privateState,
|
|
|
+ 'reward' => StoreProc::$reward,
|
|
|
+ 'reward_Gem' => StoreProc::$reward_Gem,
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重置战令奖励信息 一个月一清理但是不同战令 开始时间不同所以 清理时间也不同
|
|
|
+ * @param type $type
|
|
|
+ */
|
|
|
+ public static function ResetBattlePassReward($type) {
|
|
|
+ $list = ctx()->privateState->battlePassRewardReceived;
|
|
|
+ $rmArr = array();
|
|
|
+ foreach ($list as $str) {
|
|
|
+ $arr = explode('-', $str);
|
|
|
+ if($arr[0] == $type){
|
|
|
+ $rmArr[] = $str;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($rmArr as $k) {
|
|
|
+ StlUtil::arrayRemove(ctx()->privateData(true)->battlePassRewardReceived, $k);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|