From a712045e38066f783c9962dbc7d7b930f5fc3f6c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 14 Sep 2022 15:01:54 +0800 Subject: [PATCH 1/7] 1 --- doc/_common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/_common.py b/doc/_common.py index 79dc4e5c..f9250ca9 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -750,6 +750,7 @@ class HisBattle(object): def __init__(self): self.fields = [ ['battle_uuid', '', '本次比赛唯一id'], + ['room_mode', 0, '0:吃鸡模式 1:歼灭模式 2:生存模式'], ['match_mode', 0, '比赛模式 1:匹配赛 2:排位赛 3: pve'], ['team_mode', 0, '组队模式 1:单人 2::多人'], ['result', '', '比赛结果 当pve模式时: 1:通关 2:通关失败 其他模式:排名'], From cdbcc8d42f8e3fe298337af0e991054838b91186 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 14 Sep 2022 15:22:17 +0800 Subject: [PATCH 2/7] 1 --- doc/_common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/_common.py b/doc/_common.py index f9250ca9..2f10207f 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -750,6 +750,7 @@ 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::多人'], From 109392cb23bd93b459db85478260acaf58faf7fb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 14 Sep 2022 16:01:24 +0800 Subject: [PATCH 3/7] 1 --- doc/Team.py | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/_common.py | 5 ++++ 2 files changed, 74 insertions(+) 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 2f10207f..e80b162c 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -506,6 +506,7 @@ class TeamMember(object): ['game_times', 0, '游戏次数'], ['win_times', 0, '胜利次数'], ['kills', 0, '击杀数'], + ['is_leader', 0, '是否队长'], ['createtime', 0, '账号创建时间'], ] @@ -514,6 +515,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()], '队伍成员列表(包含自己)'], ] From 3655dd6ce9a7ee9b63cf2bb22ebd9b6c5ee68de5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 14 Sep 2022 16:03:54 +0800 Subject: [PATCH 4/7] 1 --- webapp/controller/TeamController.class.php | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index b5e28aeb..83bc5fa0 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -97,6 +97,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', ''); From 607625da33106627b76c3b189c742d5168b8100b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 14 Sep 2022 17:21:45 +0800 Subject: [PATCH 5/7] 1 --- webapp/controller/TeamController.class.php | 22 ++++++++++++++++++ webapp/mt/PveGemini.php | 26 ++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 webapp/mt/PveGemini.php diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index 83bc5fa0..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); 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 @@ + Date: Thu, 15 Sep 2022 14:37:09 +0800 Subject: [PATCH 6/7] 1 --- doc/Bag.py | 14 ++++++++++++ doc/Battle.py | 1 + webapp/controller/BagController.class.php | 27 +++++++++++++++++++++++ webapp/services/PropertyChgService.php | 2 +- 4 files changed, 43 insertions(+), 1 deletion(-) 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/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/services/PropertyChgService.php b/webapp/services/PropertyChgService.php index e345270e..1df6173b 100644 --- a/webapp/services/PropertyChgService.php +++ b/webapp/services/PropertyChgService.php @@ -49,7 +49,7 @@ class PropertyChgService extends BaseService { public function toDto() { return array( - 'user_info' => $this->userChg ? User::info(myself()->_getOrmUserInfo()) : array(), + 'user_info' => $this->userChg ? User::info(myself()->_getOrmUserInfo()) : null, 'container_chg' => $this->chgList ); } From dfc01f69880b2c979d4fe355917388c5b0aaedea Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 15 Sep 2022 14:41:47 +0800 Subject: [PATCH 7/7] 1 --- webapp/services/PropertyChgService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webapp/services/PropertyChgService.php b/webapp/services/PropertyChgService.php index 1df6173b..4fbf44a8 100644 --- a/webapp/services/PropertyChgService.php +++ b/webapp/services/PropertyChgService.php @@ -48,10 +48,13 @@ class PropertyChgService extends BaseService { public function toDto() { - return array( - 'user_info' => $this->userChg ? User::info(myself()->_getOrmUserInfo()) : null, + $data = array( 'container_chg' => $this->chgList ); + if ($this->userChg) { + $data['user_info'] = User::info(myself()->_getOrmUserInfo()); + } + return $data; } private function internalAddChg($name)