添加寻宝数据库和简单的组队接口

This commit is contained in:
liangtongchuan
2020-11-18 23:58:35 +08:00
parent 9e9b6bb2d8
commit 35ab52b8c5
6 changed files with 241 additions and 13 deletions

View File

@@ -22,7 +22,23 @@ export function battle(session: Session, msg: any, app: Application, cb: (err: E
return;
}
let res = dispatch(session.get('roleId'), battleServers);
let rid = session.get('roleId');
if (msg.args && msg.args.length > 0) {
for (let arg of msg.args) {
if (!arg.route) continue;
if (arg.route === 'battle.comBattleHandler.createTeam') {
rid = Math.random().toString(36).slice(-8);
session.set('teamCode', rid);
} else if (arg.route.indexOf('battle.comBattleHandler') !== -1) {
if (arg.body.teamCode) {
rid = arg.body.teamCode;
}
}
}
}
let res = dispatch(rid, battleServers);
cb(null, res.id);
}