Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
97519934c5
14
doc/Bag.py
14
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(), '属性变更'],
|
||||
]
|
||||
},
|
||||
]
|
||||
|
@ -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'],
|
||||
|
69
doc/Team.py
69
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': '开始游戏',
|
||||
|
@ -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:通关失败 其他模式:排名'],
|
||||
|
@ -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;
|
||||
|
@ -1,26 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once('models/User.php');
|
||||
require_once('mt/PveGemini.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\User;
|
||||
|
||||
class TeamController extends BaseAuthedController {
|
||||
|
||||
const MATCH_MODE_NORMAL = 0;
|
||||
const MATCH_MODE_RANK = 1;
|
||||
const MATCH_MODE_PVE = 2;
|
||||
|
||||
public function createTeam()
|
||||
{
|
||||
$nodeId = getReqVal('node_id', 1);
|
||||
$matchMode = getReqVal('match_mode', 0);
|
||||
$pveInstanceId = getReqVal('pve_instance_id', 0);
|
||||
$zid = myself()->_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', '');
|
||||
|
26
webapp/mt/PveGemini.php
Normal file
26
webapp/mt/PveGemini.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace mt;
|
||||
|
||||
use phpcommon;
|
||||
|
||||
class PveGemini {
|
||||
|
||||
const FIRST_INSTANCE_ID = 10001;
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
|
||||
}
|
||||
|
||||
protected static function getMetaList()
|
||||
{
|
||||
if (!self::$metaList) {
|
||||
self::$metaList = getMetaTable('pveGemini@pveGemini.php');
|
||||
}
|
||||
return self::$metaList;
|
||||
}
|
||||
|
||||
protected static $metaList;
|
||||
|
||||
}
|
@ -48,10 +48,13 @@ class PropertyChgService extends BaseService {
|
||||
|
||||
public function toDto()
|
||||
{
|
||||
return array(
|
||||
'user_info' => $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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user