diff --git a/doc/Bag.py b/doc/Bag.py index 2b4c24bf..1d334e6c 100644 --- a/doc/Bag.py +++ b/doc/Bag.py @@ -53,4 +53,18 @@ class Bag(object): ['property_chg', _common.PropertyChg(), '属性变更'], ] }, + { + 'name': 'buyItem', + 'desc': '购买道具(目前只一次购买改名卡)', + 'group': 'Bag', + 'url': 'webapp/index.php?c=Bag&a=buyItem', + 'params': [ + _common.ReqHead(), + ['item_id', '', '道具id'], + ], + 'response': [ + _common.RspHead(), + ['property_chg', _common.PropertyChg(), '属性变更'], + ] + }, ] diff --git a/doc/Battle.py b/doc/Battle.py index 0d61cdd1..892fd43f 100644 --- a/doc/Battle.py +++ b/doc/Battle.py @@ -29,6 +29,7 @@ class Battle(object): 'params': [ _common.ReqHead(), ['battle_uniid', '', 'battle_uuid'], + ['match_mode', 0, '0: 匹配赛模式 1: 排位赛 3: pve'], ['is_valid_battle', 0, 'is_valid_battle'], ['payload', '', 'payload'], ['map_id', 0, '地图id'], diff --git a/doc/Team.py b/doc/Team.py index 7ac73a77..7d2c849b 100644 --- a/doc/Team.py +++ b/doc/Team.py @@ -15,6 +15,8 @@ class Team(object): _common.ReqHead(), ['node_id', 0, '节点id'], ['map_id', 0, '地图id'], + ['match_mode', 0, '0: 匹配赛模式 1: 排位赛 3: pve'], + ['pve_instance_id', 0, 'pve副本id'], ], 'response': [ _common.RspHead(), @@ -62,6 +64,73 @@ class Team(object): _common.RspHead(), ] }, + { + 'name': 'kickout', + 'desc': '踢人', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=kickout', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ['target_id', '', '目标account_id'], + ], + 'response': [ + _common.RspHead(), + ] + }, + { + 'name': 'closeSlot', + 'desc': '关闭槽位', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=closeSlot', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ] + }, + { + 'name': 'openSlot', + 'desc': '开启槽位', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=openSlot', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ] + }, + { + 'name': 'handover', + 'desc': '转移队长职位', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=handover', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ['target_id', '', '目标account_id'], + ], + 'response': [ + _common.RspHead(), + ] + }, + { + 'name': 'cancel', + 'desc': '取消游戏开始', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=cancel', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ] + }, { 'name': 'startGame', 'desc': '开始游戏', diff --git a/doc/_common.py b/doc/_common.py index ee732c56..f4899256 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -515,6 +515,7 @@ class TeamMember(object): ['game_times', 0, '游戏次数'], ['win_times', 0, '胜利次数'], ['kills', 0, '击杀数'], + ['is_leader', 0, '是否队长'], ['createtime', 0, '账号创建时间'], ] @@ -523,6 +524,10 @@ class TeamInfo(object): def __init__(self): self.fields = [ ['team_uuid', '', '队伍唯一id'], + ['payload', '', '透传给CMJoin'], + ['match_mode', 0, '0: 匹配赛模式 1: 排位赛 3: pve'], + ['pve_instance_id', 0, 'pve副本id'], + ['slot_num', 0, '槽位数 >=1 && <= 4'], ['state', 0, '0:未开始 1:准备就绪(这时客户端进入长链接走组队逻辑)'], ['!member_list', [TeamMember()], '队伍成员列表(包含自己)'], ] @@ -759,6 +764,8 @@ class HisBattle(object): def __init__(self): self.fields = [ ['battle_uuid', '', '本次比赛唯一id'], + ['victory', 0, '是否胜利'], + ['room_mode', 0, '0:吃鸡模式 1:歼灭模式 2:生存模式'], ['match_mode', 0, '比赛模式 1:匹配赛 2:排位赛 3: pve'], ['team_mode', 0, '组队模式 1:单人 2::多人'], ['result', '', '比赛结果 当pve模式时: 1:通关 2:通关失败 其他模式:排名'], diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index afcd576a..7e8cb632 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -138,6 +138,7 @@ class BagController extends BaseAuthedController { )); $this->propertyChgService->addBagChg(); } + $this->propertyChgService->addUserChg(); $this->_rspData(array( 'property_chg' => $this->propertyChgService->toDto(), )); @@ -236,6 +237,32 @@ class BagController extends BaseAuthedController { )); } + public function buyItem() + { + $itemId = getReqVal('item_id', 0); + $itemMeta = mt\Item::get($itemId); + if (!$itemMeta) { + $this->_rspErr(1, "item_id error"); + return; + } + if (!( + $itemMeta['type'] == mt\Item::FUNC_TYPE && + $itemMeta['sub_type'] == mt\Item::FUNC_RENAME_CARD_SUBTYPE)) { + $this->_rspErr(1, "only supported rename card"); + return; + } + $items = array( + 'item_id' => itemId, + 'item_num' => 1 + ); + $this->_addItems($items, $this->awardService, $this->propertyService); + $this->propertyChgService->addBagChg(); + $this->_rspData(array( + 'award' => $this->awardService->toDto(), + 'property_chg' => $this->propertyChgService->toDto(), + )); + } + private function useTiliDrug($itemDb, $itemMeta, $itemNum, $param1, $param2, $param3) { $errCode = 0; diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index b5e28aeb..f0b22e80 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -1,26 +1,48 @@ _getZid(); $teamUuid = $nodeId . '_' . $zid . '_' . md5($this->_getAccountId() . $this->_getNowTime()); + /*if (!in_array(array + ( + self::MATCH_MODE_NORMAL, + self::MATCH_MODE_RANK, + self::MATCH_MODE_PVE, + ), + $matchMode)) { + $this->_rspErr(1, 'match mode error'); + return; + }*/ + $userDb = $this->_getOrmUserInfo(); $userDto = User::info($userDb); $userDto['createtime'] = $userDb['createtime']; $teamDb = array( 'team_uuid' => $teamUuid, 'state' => 0, + 'payload' => '', + 'match_mode' => $matchMode, + 'pve_instance_id' => $pveInstanceId, + 'slot_num' => 4, 'member_list' => array($userDto)); $r = $this->_getRedis($teamUuid); @@ -97,6 +119,71 @@ class TeamController extends BaseAuthedController { $this->_rspOk(); } + public function kickout() + { + $teamUuid = getReqVal('team_uuid', ''); + $r = $this->_getRedis($teamUuid); + $teamDb = $this->readTeamDb($r, $teamUuid); + if (empty($teamDb)) { + $this->_rspOk(); + return; + } + $this->saveTeamDb($r, $teamUuid, $teamDb); + $this->_rspOk(); + } + + public function closeSlot() + { + $teamUuid = getReqVal('team_uuid', ''); + $r = $this->_getRedis($teamUuid); + $teamDb = $this->readTeamDb($r, $teamUuid); + if (empty($teamDb)) { + $this->_rspOk(); + return; + } + $this->saveTeamDb($r, $teamUuid, $teamDb); + $this->_rspOk(); + } + + public function openSlot() + { + $teamUuid = getReqVal('team_uuid', ''); + $r = $this->_getRedis($teamUuid); + $teamDb = $this->readTeamDb($r, $teamUuid); + if (empty($teamDb)) { + $this->_rspOk(); + return; + } + $this->saveTeamDb($r, $teamUuid, $teamDb); + $this->_rspOk(); + } + + public function handover() + { + $teamUuid = getReqVal('team_uuid', ''); + $r = $this->_getRedis($teamUuid); + $teamDb = $this->readTeamDb($r, $teamUuid); + if (empty($teamDb)) { + $this->_rspOk(); + return; + } + $this->saveTeamDb($r, $teamUuid, $teamDb); + $this->_rspOk(); + } + + public function cancel() + { + $teamUuid = getReqVal('team_uuid', ''); + $r = $this->_getRedis($teamUuid); + $teamDb = $this->readTeamDb($r, $teamUuid); + if (empty($teamDb)) { + $this->_rspOk(); + return; + } + $this->saveTeamDb($r, $teamUuid, $teamDb); + $this->_rspOk(); + } + public function startGame() { $teamUuid = getReqVal('team_uuid', ''); diff --git a/webapp/mt/PveGemini.php b/webapp/mt/PveGemini.php new file mode 100644 index 00000000..a51b2aa6 --- /dev/null +++ b/webapp/mt/PveGemini.php @@ -0,0 +1,26 @@ + $this->userChg ? User::info(myself()->_getOrmUserInfo()) : array(), + $data = array( 'container_chg' => $this->chgList ); + if ($this->userChg) { + $data['user_info'] = User::info(myself()->_getOrmUserInfo()); + } + return $data; } private function internalAddChg($name)