陆莹:粮草先行&寻宝路由
This commit is contained in:
@@ -23,23 +23,31 @@ export function battle(session: Session, msg: any, app: Application, cb: (err: E
|
|||||||
}
|
}
|
||||||
|
|
||||||
let rid = session.get('roleId');
|
let rid = session.get('roleId');
|
||||||
|
let needDispatch = false;
|
||||||
|
|
||||||
if (msg.args && msg.args.length > 0) {
|
if (msg.args && msg.args.length > 0) {
|
||||||
for (let arg of msg.args) {
|
for (let arg of msg.args) {
|
||||||
if (!arg.route) continue;
|
if (!arg.route) continue;
|
||||||
if (['battle.comBattleHandler.createTeam', 'battle.comBattleHandler.searchTeam'].indexOf(arg.route) !== -1) {
|
if (['battle.comBattleHandler.createTeam', 'battle.comBattleHandler.searchTeam'].indexOf(arg.route) !== -1) {
|
||||||
|
needDispatch = true;
|
||||||
rid = Math.random().toString(36).slice(-8);
|
rid = Math.random().toString(36).slice(-8);
|
||||||
session.set('teamCode', rid);
|
session.set('teamCode', rid);
|
||||||
} else if (arg.route.indexOf('battle.comBattleHandler') !== -1) {
|
} else if (arg.route.indexOf('battle.comBattleHandler') !== -1) {
|
||||||
if (arg.body.teamCode) {
|
if (arg.body.teamCode) {
|
||||||
|
needDispatch = true;
|
||||||
rid = arg.body.teamCode;
|
rid = arg.body.teamCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = session.get('battleServer')||dispatch(rid, battleServers, 'battle').id;
|
if(needDispatch) {
|
||||||
cb(null, id);
|
let id = dispatch(rid, battleServers, 'battle').id;
|
||||||
|
cb(null, id);
|
||||||
|
} else {
|
||||||
|
let id = session.get('battleServer')||dispatch(rid, battleServers, 'battle').id;
|
||||||
|
cb(null, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -52,6 +60,7 @@ export function guild(session: Session, msg: any, app: Application, cb: (err: Er
|
|||||||
}
|
}
|
||||||
|
|
||||||
let rid = session.get('roleId');
|
let rid = session.get('roleId');
|
||||||
|
let needDispatch = false;
|
||||||
|
|
||||||
if (msg.args && msg.args.length > 0) {
|
if (msg.args && msg.args.length > 0) {
|
||||||
for (let arg of msg.args) {
|
for (let arg of msg.args) {
|
||||||
@@ -66,6 +75,7 @@ export function guild(session: Session, msg: any, app: Application, cb: (err: Er
|
|||||||
'guild.gateActivityHandler.debugStartActivity',
|
'guild.gateActivityHandler.debugStartActivity',
|
||||||
'guild.gateActivityHandler.debugEndActivity'
|
'guild.gateActivityHandler.debugEndActivity'
|
||||||
].indexOf(arg.route) !== -1) {
|
].indexOf(arg.route) !== -1) {
|
||||||
|
needDispatch = true;
|
||||||
rid = session.get('guildCode');
|
rid = session.get('guildCode');
|
||||||
} else if (['guild.cityActivityHandler.getCityStatus',
|
} else if (['guild.cityActivityHandler.getCityStatus',
|
||||||
'guild.cityActivityHandler.declareCity',
|
'guild.cityActivityHandler.declareCity',
|
||||||
@@ -75,6 +85,7 @@ export function guild(session: Session, msg: any, app: Application, cb: (err: Er
|
|||||||
].indexOf(arg.route) !== -1) {
|
].indexOf(arg.route) !== -1) {
|
||||||
|
|
||||||
if (arg.body.cityId) {
|
if (arg.body.cityId) {
|
||||||
|
needDispatch = true;
|
||||||
rid = arg.body.cityId.toString();
|
rid = arg.body.cityId.toString();
|
||||||
}
|
}
|
||||||
} else if (['guild.raceActivityHandler.getRaceActivity',
|
} else if (['guild.raceActivityHandler.getRaceActivity',
|
||||||
@@ -83,14 +94,20 @@ export function guild(session: Session, msg: any, app: Application, cb: (err: Er
|
|||||||
'guild.raceActivityHandler.useItem',
|
'guild.raceActivityHandler.useItem',
|
||||||
'guild.raceActivityHandler.battleEnd',
|
'guild.raceActivityHandler.battleEnd',
|
||||||
].indexOf(arg.route) !== -1) {
|
].indexOf(arg.route) !== -1) {
|
||||||
|
needDispatch = true;
|
||||||
rid = session.get('serverId').toString();
|
rid = session.get('serverId').toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = session.get('guildServer')||dispatch(rid, guildServers, 'guild').id;
|
if(needDispatch) {
|
||||||
cb(null, id);
|
let id = dispatch(rid, guildServers, 'guild').id;
|
||||||
|
cb(null, id);
|
||||||
|
} else {
|
||||||
|
let id = session.get('guildServer')||dispatch(rid, guildServers, 'guild').id;
|
||||||
|
cb(null, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function activity(session: Session, msg: any, app: Application, cb: (err: Error, serverId?: string) => void) {
|
export function activity(session: Session, msg: any, app: Application, cb: (err: Error, serverId?: string) => void) {
|
||||||
|
|||||||
Reference in New Issue
Block a user