增加寻宝返回字段; 增加形象字段
This commit is contained in:
@@ -52,7 +52,7 @@ export class ComBattleHandler {
|
|||||||
if (!goodData || goodData.itid !== IT_TYPE.BLUEPRT) return resResult(STATUS.COM_BATTLE_BLUEPRT_INVALID);
|
if (!goodData || goodData.itid !== IT_TYPE.BLUEPRT) return resResult(STATUS.COM_BATTLE_BLUEPRT_INVALID);
|
||||||
|
|
||||||
// 检查藏宝图是否足够
|
// 检查藏宝图是否足够
|
||||||
let { consumeGoods, lv, headHid, topFiveCe } = await RoleModel.findByRoleId(roleId);
|
let { consumeGoods, lv, headHid, topFiveCe, sHid } = await RoleModel.findByRoleId(roleId);
|
||||||
if (lv < COM_TEAM_ENABLE_LV) return resResult(STATUS.COM_BATTLE_LV_NOT_ENOUGH);
|
if (lv < COM_TEAM_ENABLE_LV) return resResult(STATUS.COM_BATTLE_LV_NOT_ENOUGH);
|
||||||
let blueprt = consumeGoods.find(good => good.id === blueprtId && good.count >= 1);
|
let blueprt = consumeGoods.find(good => good.id === blueprtId && good.count >= 1);
|
||||||
if (!blueprt) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_FOUND);
|
if (!blueprt) return resResult(STATUS.COM_BATTLE_BLUEPRT_NOT_FOUND);
|
||||||
@@ -76,12 +76,14 @@ export class ComBattleHandler {
|
|||||||
let roleStatus = new RoleStatus();
|
let roleStatus = new RoleStatus();
|
||||||
roleStatus.heroes = heroes;
|
roleStatus.heroes = heroes;
|
||||||
roleStatus.isCap = true;
|
roleStatus.isCap = true;
|
||||||
roleStatus.headHid = headHid;
|
roleStatus.headHid = headHid || 19;
|
||||||
roleStatus.topFiveCe = topFiveCe;
|
roleStatus.topFiveCe = topFiveCe;
|
||||||
roleStatus.roleId = roleId;
|
roleStatus.roleId = roleId;
|
||||||
roleStatus.isReady = true;
|
roleStatus.isReady = true;
|
||||||
roleStatus.totalDmg = 0;
|
roleStatus.totalDmg = 0;
|
||||||
roleStatus.roleName = roleName;
|
roleStatus.roleName = roleName;
|
||||||
|
roleStatus.lv = lv;
|
||||||
|
roleStatus.sHid = sHid || 19;
|
||||||
comTeam.roleStatus = [roleStatus];
|
comTeam.roleStatus = [roleStatus];
|
||||||
|
|
||||||
this.teamMap.set(teamCode, comTeam);
|
this.teamMap.set(teamCode, comTeam);
|
||||||
@@ -108,7 +110,7 @@ export class ComBattleHandler {
|
|||||||
let teamStatus = this.teamMap.get(teamCode);
|
let teamStatus = this.teamMap.get(teamCode);
|
||||||
if (!teamStatus || teamStatus.status !== 0 || teamStatus.roleIds.length === 3) return resResult(STATUS.COM_BATTLE_MEMBER_LIMIT);
|
if (!teamStatus || teamStatus.status !== 0 || teamStatus.roleIds.length === 3) return resResult(STATUS.COM_BATTLE_MEMBER_LIMIT);
|
||||||
if (teamStatus.roleIds.indexOf(roleId) !== -1) return resResult(STATUS.COM_BATTLE_DUP_ENTER);
|
if (teamStatus.roleIds.indexOf(roleId) !== -1) return resResult(STATUS.COM_BATTLE_DUP_ENTER);
|
||||||
let { lv, headHid, topFiveCe } = await Role.findByRoleId(roleId);
|
let { lv, headHid, topFiveCe, sHid } = await Role.findByRoleId(roleId);
|
||||||
let { quality } = getGoodById(teamStatus.blueprtId);
|
let { quality } = getGoodById(teamStatus.blueprtId);
|
||||||
let { assistanceLevel, assistanceTime } = getComBtlSetByQuality(quality);
|
let { assistanceLevel, assistanceTime } = getComBtlSetByQuality(quality);
|
||||||
if (lv < COM_TEAM_ENABLE_LV) {
|
if (lv < COM_TEAM_ENABLE_LV) {
|
||||||
@@ -125,13 +127,15 @@ export class ComBattleHandler {
|
|||||||
let roleStatus = new RoleStatus();
|
let roleStatus = new RoleStatus();
|
||||||
roleStatus.heroes = [];
|
roleStatus.heroes = [];
|
||||||
roleStatus.isCap = false;
|
roleStatus.isCap = false;
|
||||||
roleStatus.headHid = headHid || 1;
|
roleStatus.headHid = headHid || 19; // 默认给赵云
|
||||||
roleStatus.topFiveCe = topFiveCe || 0;
|
roleStatus.topFiveCe = topFiveCe || 0;
|
||||||
roleStatus.roleId = roleId;
|
roleStatus.roleId = roleId;
|
||||||
roleStatus.roleName = roleName;
|
roleStatus.roleName = roleName;
|
||||||
roleStatus.isFrd = isFrd;
|
roleStatus.isFrd = isFrd;
|
||||||
roleStatus.isReady = false;
|
roleStatus.isReady = false;
|
||||||
roleStatus.totalDmg = 0;
|
roleStatus.totalDmg = 0;
|
||||||
|
roleStatus.lv = lv;
|
||||||
|
roleStatus.sHid = sHid || 19;
|
||||||
const team = await ComBattleTeamModel.addRole(teamCode, roleStatus);
|
const team = await ComBattleTeamModel.addRole(teamCode, roleStatus);
|
||||||
if (!team) {
|
if (!team) {
|
||||||
return resResult(STATUS.COM_BATTLE_CREATE_ERR);
|
return resResult(STATUS.COM_BATTLE_CREATE_ERR);
|
||||||
@@ -143,7 +147,7 @@ export class ComBattleHandler {
|
|||||||
if (users.indexOf(roleId) === -1) {
|
if (users.indexOf(roleId) === -1) {
|
||||||
channel.add(roleId, sid);
|
channel.add(roleId, sid);
|
||||||
}
|
}
|
||||||
channel.pushMessage('onTeamJoin', {teamCode, roleInfo: {roleId, headHid: roleStatus.headHid, topFiveCe: roleStatus.topFiveCe}});
|
channel.pushMessage('onTeamJoin', {teamCode, roleInfo: roleStatus});
|
||||||
teamStatus.roleIds.push(roleId);
|
teamStatus.roleIds.push(roleId);
|
||||||
teamStatus.roleStatus.push(roleStatus);
|
teamStatus.roleStatus.push(roleStatus);
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,20 @@ export class RoleStatus {
|
|||||||
@prop({ required: false, default: false })
|
@prop({ required: false, default: false })
|
||||||
isFrd: boolean;
|
isFrd: boolean;
|
||||||
// 头像
|
// 头像
|
||||||
@prop({ required: true, default: 1 })
|
@prop({ required: true, default: 19 })
|
||||||
headHid: number;
|
headHid: number;
|
||||||
|
// 形象
|
||||||
|
@prop({ required: true, default: 19 })
|
||||||
|
sHid: number;
|
||||||
// 前五战力
|
// 前五战力
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
topFiveCe: number;
|
topFiveCe: number;
|
||||||
// 是否准备
|
// 是否准备
|
||||||
@prop({ required: true, default: false })
|
@prop({ required: true, default: false })
|
||||||
isReady: boolean;
|
isReady: boolean;
|
||||||
|
// 主公等级
|
||||||
|
@prop({ required: true, default: 1 })
|
||||||
|
lv: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@index({ teamCode: 1 })
|
@index({ teamCode: 1 })
|
||||||
|
|||||||
+4
-2
@@ -46,8 +46,10 @@ export default class Role extends BaseModel {
|
|||||||
blocked: boolean; // 是否屏蔽
|
blocked: boolean; // 是否屏蔽
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
code: string; // 邀请码
|
code: string; // 邀请码
|
||||||
@prop({ required: true, default: 1 })
|
@prop({ required: true, default: 19 })
|
||||||
headHid: number; // 头像所用武将 Id
|
headHid: number; // 头像所用武将 Id,默认赵云
|
||||||
|
@prop({ required: true, default: 19 })
|
||||||
|
sHid: number; // 形象所用武将 Id,默认赵云
|
||||||
|
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
exp: number; // 经验值
|
exp: number; // 经验值
|
||||||
|
|||||||
Reference in New Issue
Block a user