(寻宝): 将寻宝的服单拎出来
This commit is contained in:
@@ -23,17 +23,30 @@ export async function battle(session: Session, msg: any, app: Application, cb: (
|
||||
return;
|
||||
}
|
||||
|
||||
let rid = session.get('roleId');
|
||||
let id = session.get('battleServer')||(await dispatch(redisClient(), rid, battleServers, 'battle')).id;
|
||||
cb(null, id);
|
||||
}
|
||||
|
||||
export async function comBattle(session: Session, msg: any, app: Application, cb: (err: Error, serverId?: string) => void) {
|
||||
let battleServers = app.getServersByType('comBattle');
|
||||
|
||||
if (!battleServers || battleServers.length === 0) {
|
||||
cb(new Error('can not find comBattle servers.'));
|
||||
return;
|
||||
}
|
||||
|
||||
let rid = session.get('roleId');
|
||||
let needDispatch = false;
|
||||
|
||||
if (msg.args && msg.args.length > 0) {
|
||||
for (let arg of msg.args) {
|
||||
if (!arg.route) continue;
|
||||
if (['battle.comBattleHandler.createTeam', 'battle.comBattleHandler.searchTeam'].indexOf(arg.route) !== -1) {
|
||||
if (['comBattle.comBattleHandler.createTeam', 'comBattle.comBattleHandler.searchTeam'].indexOf(arg.route) !== -1) {
|
||||
needDispatch = true;
|
||||
rid = Math.random().toString(36).slice(-8);
|
||||
session.set('teamCode', rid);
|
||||
} else if (arg.route.indexOf('battle.comBattleHandler') !== -1) {
|
||||
} else if (arg.route.indexOf('comBattle.comBattleHandler') !== -1) {
|
||||
if (arg.body.teamCode) {
|
||||
needDispatch = true;
|
||||
rid = arg.body.teamCode;
|
||||
@@ -43,15 +56,14 @@ export async function battle(session: Session, msg: any, app: Application, cb: (
|
||||
}
|
||||
|
||||
if(needDispatch) {
|
||||
let id = (await dispatch(redisClient(), rid, battleServers, 'battle')).id;
|
||||
let id = (await dispatch(redisClient(), rid, battleServers, 'comBattle')).id;
|
||||
cb(null, id);
|
||||
} else {
|
||||
let id = session.get('battleServer')||(await dispatch(redisClient(), rid, battleServers, 'battle')).id;
|
||||
let id = session.get('comBattleServer')||(await dispatch(redisClient(), rid, battleServers, 'comBattle')).id;
|
||||
cb(null, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function guild(session: Session, msg: any, app: Application, cb: (err: Error, serverId?: string) => void) {
|
||||
let guildServers = app.getServersByType('guild');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user