形象:修改字典表
This commit is contained in:
@@ -22,7 +22,8 @@ import { roleLevelup } from '../../../services/normalBattleService';
|
||||
import { addUserToChannel } from '../../../services/roleService';
|
||||
import { ChannelUser } from '../../../domain/ChannelUser';
|
||||
import { pushComBtlTeamMsg, pushNormalEquipMsg, pushTeamInviteMsg } from '../../../services/chatService';
|
||||
import { FIGURE } from '../../../pubUtils/dicParam';
|
||||
import { EXTERIOR } from '../../../pubUtils/dicParam';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new ComBattleHandler(app);
|
||||
}
|
||||
@@ -173,7 +174,7 @@ export class ComBattleHandler {
|
||||
if (!teamStatus || teamStatus.status !== COM_TEAM_STATUS.DEFAULT) return resResult(STATUS.COM_BATTLE_TEAM_INVALID);
|
||||
if (teamIsFullToStart(teamStatus)) return resResult(STATUS.COM_BATTLE_MEMBER_LIMIT);
|
||||
if (teamStatus.roleIds.indexOf(roleId) !== -1) return resResult(STATUS.COM_BATTLE_DUP_ENTER);
|
||||
let { lv = 1, head = FIGURE.DEFAULT_HEAD, topLineupCe = 0, frame = FIGURE.DEFAULT_FRAME, spine = FIGURE.DEFAULT_SPINE } = await Role.findByRoleId(roleId, null, true);
|
||||
let { lv = 1, head = EXTERIOR.EXTERIOR_FACE, topLineupCe = 0, frame = EXTERIOR.EXTERIOR_FACECASE, spine = EXTERIOR.EXTERIOR_APPEARANCE } = await Role.findByRoleId(roleId, null, true);
|
||||
|
||||
let { quality } = getGoodById(teamStatus.blueprtId);
|
||||
if (lv < COM_BTL_CONST.ENABLE_LV) {
|
||||
|
||||
@@ -110,7 +110,10 @@ export class EntryHandler {
|
||||
let apJson = await getAp(Date.now(), role.roleId);
|
||||
role['apJson'] = apJson;
|
||||
role['mails'] = mails;
|
||||
if(!role['showLineup']) role['showLineup'] = role.topLineup.map(cur => cur.hid);
|
||||
if(!role.showLineup) role.showLineup = role.topLineup.map(cur => cur.hid);
|
||||
role.heads = role.heads.filter(cur => cur.status);
|
||||
role.frames = role.frames.filter(cur => cur.status);
|
||||
role.spines = role.spines.filter(cur => cur.status);
|
||||
|
||||
const recentPrivateChats = await recentPrivateChatInfos(role.roleId, role.roleName);
|
||||
if (recentPrivateChats) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { resResult, decodeIdCntArrayStr, parseGoodStr } from '../../../pubUtils/
|
||||
import {Application, BackendSession, pinus} from 'pinus';
|
||||
import { handleCost } from '../../../services/rewardService';
|
||||
import { getTitle, getTeraph, gameData, getScollByStar, getFriendLvByExp } from '../../../pubUtils/data';
|
||||
import { SCHOOL, SCROLL, FIGURE } from '../../../pubUtils/dicParam';
|
||||
import { SCHOOL, SCROLL, EXTERIOR } from '../../../pubUtils/dicParam';
|
||||
import { getAtrrNameById } from '../../../consts/constModules/abilityConst'
|
||||
import { findIndex } from 'underscore';
|
||||
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
|
||||
@@ -73,7 +73,7 @@ export class RoleHandler {
|
||||
|
||||
async getRoleInfo(msg: {targetRoleId: string}, session: BackendSession) {
|
||||
let { targetRoleId } = msg;
|
||||
let { roleId, roleName, head = FIGURE.DEFAULT_HEAD, frame = FIGURE.DEFAULT_FRAME, spine = FIGURE.DEFAULT_SPINE, ce = 0, topLineup, topLineupCe = 0 } = await RoleModel.findByRoleId(targetRoleId);
|
||||
let { roleId, roleName, head = EXTERIOR.EXTERIOR_FACE, frame = EXTERIOR.EXTERIOR_FACECASE, spine = EXTERIOR.EXTERIOR_APPEARANCE, ce = 0, topLineup, topLineupCe = 0 } = await RoleModel.findByRoleId(targetRoleId);
|
||||
return resResult(STATUS.SUCCESS, { roleId, roleName, head, frame, spine, ce, topLineup, topLineupCe });
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { getRandEelm, getRandValue, resResult, ratioReward, getRandValueByMinMax
|
||||
import { getRandRobot, transBossHpArr } from "./battleService";
|
||||
import { difference, omit } from 'underscore';
|
||||
import { Channel, ChannelService } from 'pinus';
|
||||
import { TREASURE, FIGURE } from '../pubUtils/dicParam';
|
||||
import { TREASURE, EXTERIOR } from '../pubUtils/dicParam';
|
||||
import { decreaseItems } from './rewardService';
|
||||
import { getFriendLvAdd } from './friendService';
|
||||
import { getRoleIds } from '../pubUtils/friendUtil';
|
||||
@@ -58,7 +58,7 @@ export function getRandComBtlRobots(topLineupCe: number, ceLimit: number, lv: nu
|
||||
const robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
||||
// const imgHid = robot[Math.floor(Math.random() * robot.length)];
|
||||
const { robotRoleId, robotRoleName } = robotInfos[idx];
|
||||
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, FIGURE.DEFAULT_HEAD, FIGURE.DEFAULT_FRAME, FIGURE.DEFAULT_SPINE, robotCe, robotLv, robot, true);
|
||||
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, EXTERIOR.EXTERIOR_FACE, EXTERIOR.EXTERIOR_FACECASE, EXTERIOR.EXTERIOR_APPEARANCE, robotCe, robotLv, robot, true);
|
||||
robotStArr.push(robotStatus);
|
||||
robotIdArr.push(robotRoleId);
|
||||
});
|
||||
@@ -490,7 +490,7 @@ async function teammateValid(roleInfo: Partial<RoleType>, roleId: string, roleId
|
||||
*/
|
||||
export async function getValidTeammateRoleSt(roleId: string, roleIds: string[], ceLimit: number, quality: number) {
|
||||
let roleInfo = await RoleModel.findByRoleId(roleId, null, true);
|
||||
let { roleName, head = FIGURE.DEFAULT_HEAD, frame = FIGURE.DEFAULT_FRAME, spine = FIGURE.DEFAULT_SPINE, topLineupCe, lv } = roleInfo;
|
||||
let { roleName, head = EXTERIOR.EXTERIOR_FACE, frame = EXTERIOR.EXTERIOR_FACECASE, spine = EXTERIOR.EXTERIOR_APPEARANCE, topLineupCe, lv } = roleInfo;
|
||||
|
||||
const valid = await teammateValid(roleInfo, roleId, roleIds, ceLimit);
|
||||
if (!valid) return null;
|
||||
@@ -574,7 +574,7 @@ export async function hasEnoughBlueprt(roleId: string, blueprtId: number) {
|
||||
* @param {boolean} isFrd
|
||||
*/
|
||||
export function addRoleToTeam(comTeam: MemComBtlTeam, roleInfo: RoleType, isCap: boolean, isFrd: boolean) {
|
||||
const { roleId, roleName, head = FIGURE.DEFAULT_HEAD, frame = FIGURE.DEFAULT_FRAME, spine = FIGURE.DEFAULT_SPINE, lv } = roleInfo;
|
||||
const { roleId, roleName, head = EXTERIOR.EXTERIOR_FACE, frame = EXTERIOR.EXTERIOR_FACECASE, spine = EXTERIOR.EXTERIOR_APPEARANCE, lv } = roleInfo;
|
||||
let { topLineupCe = 1000 } = roleInfo;
|
||||
const roleSt = new RoleStatus(roleId, roleName, isCap, isFrd, head, frame, spine, topLineupCe, lv);
|
||||
addRoleStToTeam(comTeam, roleSt);
|
||||
|
||||
@@ -108,8 +108,9 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
let equips: Array<EquipInter> = [];
|
||||
let bags: Array<BagInter> = [];
|
||||
let skins: Array<number> = [];
|
||||
let figures: Array<number> = [];
|
||||
let uids = [{uid: roleId, sid}];
|
||||
sortItems(goods, bags, skins, currencysMap, equips, showItems);
|
||||
sortItems(goods, bags, skins, figures, currencysMap, equips, showItems);
|
||||
let equipInfos = [];
|
||||
for (let equip of equips) {
|
||||
let equipInfo = await addEquips(roleId, roleName, equip);
|
||||
@@ -162,7 +163,7 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
return showItems;
|
||||
}
|
||||
|
||||
function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array<number>, currencysMap: any, equips: Array<EquipInter>, showItems: Array<ItemInter>) {
|
||||
function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array<number>, figures: Array<number>, currencysMap: any, equips: Array<EquipInter>, showItems: Array<ItemInter>) {
|
||||
for (let good of goods) {
|
||||
let goodInfo = gameData.goods.get(good.id);
|
||||
// 道具不存在时先跳过
|
||||
@@ -205,6 +206,13 @@ function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array
|
||||
}
|
||||
currencysMap[curname] = (currencysMap[curname]||0 )+ good.count;
|
||||
}
|
||||
} else {
|
||||
if (type == CONSUME_TYPE.SKIN) {
|
||||
let index = indexOf(figures, good.id);
|
||||
if (index == -1) {
|
||||
figures.push(good.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,73 +90,3 @@ export function addUserToChannel(channel: Channel, user: ChannelUser) {
|
||||
channel.add(uid, sid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁头像/相框
|
||||
* @param type 解锁类型(获得武将/好感达到)
|
||||
* @param num 参数(武将id/好感等级)
|
||||
*/
|
||||
export async function unlockFigure(roleId: string, type: number, num: number, role?: RoleType) {
|
||||
if(!role || !role.heads || !role.frames) {
|
||||
role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_HEADS);
|
||||
}
|
||||
let { heads, frames, spines } = role;
|
||||
let canUnLockList = gameData.figureCondition.get(type);
|
||||
if(canUnLockList) {
|
||||
for(let {id, param} of canUnLockList) {
|
||||
let flag = false; // 是否达成条件
|
||||
if(type == FIGURE_UNLOCK_CONDITION.GET_HERO) {
|
||||
if(num == param) flag = true;
|
||||
} else if (type == FIGURE_UNLOCK_CONDITION.HERO_FAVOR) {
|
||||
if(num >= param) flag = true;
|
||||
}
|
||||
if(!flag) continue;
|
||||
|
||||
let dicGood = gameData.goods.get(id);
|
||||
if(!dicGood) continue;
|
||||
let dicItid = ITID.get(dicGood.itid);
|
||||
if(!dicItid) continue;
|
||||
|
||||
if(dicItid.type == CONSUME_TYPE.HEAD) {
|
||||
unlockSingleFigure(heads, id, type);
|
||||
} else if (dicItid.type == CONSUME_TYPE.FRAME) {
|
||||
unlockSingleFigure(frames, id, type);
|
||||
} else if (dicItid.type == CONSUME_TYPE.SPINE) {
|
||||
unlockSingleFigure(spines, id, type);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
role = await RoleModel.updateRoleInfo(roleId, { heads, frames, spines });
|
||||
}
|
||||
}
|
||||
|
||||
function unlockSingleFigure(dbFigures: Figure[], id: number, type: number) {
|
||||
let figure = dbFigures.find(cur => cur.id == id);
|
||||
if(!figure) {
|
||||
figure = new Figure(id, false);
|
||||
dbFigures.push(figure);
|
||||
}
|
||||
if(figure.unlocked) return; // 已解锁过
|
||||
if(figure.unlockedType.includes(type)) return;
|
||||
|
||||
figure.unlockedType.push(type);
|
||||
let dicGoods = gameData.goods.get(id);
|
||||
|
||||
let hasUnlockedAll = true;
|
||||
for(let {type} of dicGoods.condition) {
|
||||
if(!figure.unlockedType.includes(type)) {
|
||||
hasUnlockedAll = false; break;
|
||||
}
|
||||
}
|
||||
if(hasUnlockedAll) {
|
||||
figure.unlocked = true;
|
||||
|
||||
if(dicGoods.timeLimit) {
|
||||
figure.time = getBeforeDaySeconds(-1 * dicGoods.timeLimit); // timeLimit天以后
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user