形象:修改字典表
This commit is contained in:
@@ -22,7 +22,8 @@ import { roleLevelup } from '../../../services/normalBattleService';
|
|||||||
import { addUserToChannel } from '../../../services/roleService';
|
import { addUserToChannel } from '../../../services/roleService';
|
||||||
import { ChannelUser } from '../../../domain/ChannelUser';
|
import { ChannelUser } from '../../../domain/ChannelUser';
|
||||||
import { pushComBtlTeamMsg, pushNormalEquipMsg, pushTeamInviteMsg } from '../../../services/chatService';
|
import { pushComBtlTeamMsg, pushNormalEquipMsg, pushTeamInviteMsg } from '../../../services/chatService';
|
||||||
import { FIGURE } from '../../../pubUtils/dicParam';
|
import { EXTERIOR } from '../../../pubUtils/dicParam';
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
return new ComBattleHandler(app);
|
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 (!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 (teamIsFullToStart(teamStatus)) 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 = 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);
|
let { quality } = getGoodById(teamStatus.blueprtId);
|
||||||
if (lv < COM_BTL_CONST.ENABLE_LV) {
|
if (lv < COM_BTL_CONST.ENABLE_LV) {
|
||||||
|
|||||||
@@ -110,7 +110,10 @@ export class EntryHandler {
|
|||||||
let apJson = await getAp(Date.now(), role.roleId);
|
let apJson = await getAp(Date.now(), role.roleId);
|
||||||
role['apJson'] = apJson;
|
role['apJson'] = apJson;
|
||||||
role['mails'] = mails;
|
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);
|
const recentPrivateChats = await recentPrivateChatInfos(role.roleId, role.roleName);
|
||||||
if (recentPrivateChats) {
|
if (recentPrivateChats) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { resResult, decodeIdCntArrayStr, parseGoodStr } from '../../../pubUtils/
|
|||||||
import {Application, BackendSession, pinus} from 'pinus';
|
import {Application, BackendSession, pinus} from 'pinus';
|
||||||
import { handleCost } from '../../../services/rewardService';
|
import { handleCost } from '../../../services/rewardService';
|
||||||
import { getTitle, getTeraph, gameData, getScollByStar, getFriendLvByExp } from '../../../pubUtils/data';
|
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 { getAtrrNameById } from '../../../consts/constModules/abilityConst'
|
||||||
import { findIndex } from 'underscore';
|
import { findIndex } from 'underscore';
|
||||||
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
|
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
|
||||||
@@ -73,7 +73,7 @@ export class RoleHandler {
|
|||||||
|
|
||||||
async getRoleInfo(msg: {targetRoleId: string}, session: BackendSession) {
|
async getRoleInfo(msg: {targetRoleId: string}, session: BackendSession) {
|
||||||
let { targetRoleId } = msg;
|
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 });
|
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 { getRandRobot, transBossHpArr } from "./battleService";
|
||||||
import { difference, omit } from 'underscore';
|
import { difference, omit } from 'underscore';
|
||||||
import { Channel, ChannelService } from 'pinus';
|
import { Channel, ChannelService } from 'pinus';
|
||||||
import { TREASURE, FIGURE } from '../pubUtils/dicParam';
|
import { TREASURE, EXTERIOR } from '../pubUtils/dicParam';
|
||||||
import { decreaseItems } from './rewardService';
|
import { decreaseItems } from './rewardService';
|
||||||
import { getFriendLvAdd } from './friendService';
|
import { getFriendLvAdd } from './friendService';
|
||||||
import { getRoleIds } from '../pubUtils/friendUtil';
|
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 robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
||||||
// const imgHid = robot[Math.floor(Math.random() * robot.length)];
|
// const imgHid = robot[Math.floor(Math.random() * robot.length)];
|
||||||
const { robotRoleId, robotRoleName } = robotInfos[idx];
|
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);
|
robotStArr.push(robotStatus);
|
||||||
robotIdArr.push(robotRoleId);
|
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) {
|
export async function getValidTeammateRoleSt(roleId: string, roleIds: string[], ceLimit: number, quality: number) {
|
||||||
let roleInfo = await RoleModel.findByRoleId(roleId, null, true);
|
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);
|
const valid = await teammateValid(roleInfo, roleId, roleIds, ceLimit);
|
||||||
if (!valid) return null;
|
if (!valid) return null;
|
||||||
@@ -574,7 +574,7 @@ export async function hasEnoughBlueprt(roleId: string, blueprtId: number) {
|
|||||||
* @param {boolean} isFrd
|
* @param {boolean} isFrd
|
||||||
*/
|
*/
|
||||||
export function addRoleToTeam(comTeam: MemComBtlTeam, roleInfo: RoleType, isCap: boolean, isFrd: boolean) {
|
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;
|
let { topLineupCe = 1000 } = roleInfo;
|
||||||
const roleSt = new RoleStatus(roleId, roleName, isCap, isFrd, head, frame, spine, topLineupCe, lv);
|
const roleSt = new RoleStatus(roleId, roleName, isCap, isFrd, head, frame, spine, topLineupCe, lv);
|
||||||
addRoleStToTeam(comTeam, roleSt);
|
addRoleStToTeam(comTeam, roleSt);
|
||||||
|
|||||||
@@ -108,8 +108,9 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
|||||||
let equips: Array<EquipInter> = [];
|
let equips: Array<EquipInter> = [];
|
||||||
let bags: Array<BagInter> = [];
|
let bags: Array<BagInter> = [];
|
||||||
let skins: Array<number> = [];
|
let skins: Array<number> = [];
|
||||||
|
let figures: Array<number> = [];
|
||||||
let uids = [{uid: roleId, sid}];
|
let uids = [{uid: roleId, sid}];
|
||||||
sortItems(goods, bags, skins, currencysMap, equips, showItems);
|
sortItems(goods, bags, skins, figures, currencysMap, equips, showItems);
|
||||||
let equipInfos = [];
|
let equipInfos = [];
|
||||||
for (let equip of equips) {
|
for (let equip of equips) {
|
||||||
let equipInfo = await addEquips(roleId, roleName, equip);
|
let equipInfo = await addEquips(roleId, roleName, equip);
|
||||||
@@ -162,7 +163,7 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
|||||||
return showItems;
|
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) {
|
for (let good of goods) {
|
||||||
let goodInfo = gameData.goods.get(good.id);
|
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;
|
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);
|
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天以后
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -131,9 +131,9 @@ const itid_array = [
|
|||||||
{ id: 47, name: '典籍宝石', table: 'item', type: CONSUME_TYPE.JEWEL },
|
{ id: 47, name: '典籍宝石', table: 'item', type: CONSUME_TYPE.JEWEL },
|
||||||
{ id: 48, name: '灵玄石', table: 'item', type: CONSUME_TYPE.JEWEL },
|
{ id: 48, name: '灵玄石', table: 'item', type: CONSUME_TYPE.JEWEL },
|
||||||
{ id: 49, name: '玩家好感道具', table: 'item', type: CONSUME_TYPE.FRIEND_FAVOUR },
|
{ id: 49, name: '玩家好感道具', table: 'item', type: CONSUME_TYPE.FRIEND_FAVOUR },
|
||||||
{ id: 50, name: '形象', table: 'hero', type: CONSUME_TYPE.FRIEND_FAVOUR },
|
{ id: 50, name: '形象', table: 'role', type: CONSUME_TYPE.HEAD },
|
||||||
{ id: 51, name: '相框', table: 'hero', type: CONSUME_TYPE.FRIEND_FAVOUR },
|
{ id: 51, name: '相框', table: 'role', type: CONSUME_TYPE.FRAME },
|
||||||
{ id: 52, name: '玩家形象', table: 'hero', type: CONSUME_TYPE.FRIEND_FAVOUR }
|
{ id: 52, name: '玩家形象', table: 'role', type: CONSUME_TYPE.SPINE }
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ITID = new Map<number, {id: number, name: string, table: string, type?: number, isCurrency?: boolean, equipJewel?: number}>();
|
export const ITID = new Map<number, {id: number, name: string, table: string, type?: number, isCurrency?: boolean, equipJewel?: number}>();
|
||||||
@@ -248,4 +248,5 @@ export function getDropItems() {
|
|||||||
export enum FIGURE_UNLOCK_CONDITION {
|
export enum FIGURE_UNLOCK_CONDITION {
|
||||||
GET_HERO = 1, // 获取武将
|
GET_HERO = 1, // 获取武将
|
||||||
HERO_FAVOR = 2, // 武将好感度达到
|
HERO_FAVOR = 2, // 武将好感度达到
|
||||||
|
GET_SKIN = 3, // 获得时装
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import BaseModel from './BaseModel';
|
import BaseModel from './BaseModel';
|
||||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||||
import { FIGURE } from '../pubUtils/dicParam';
|
import { EXTERIOR } from '../pubUtils/dicParam';
|
||||||
|
|
||||||
export class RoleStatus {
|
export class RoleStatus {
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
@@ -27,13 +27,13 @@ export class RoleStatus {
|
|||||||
@prop({ required: false, default: false })
|
@prop({ required: false, default: false })
|
||||||
isFrd: boolean;
|
isFrd: boolean;
|
||||||
// 头像
|
// 头像
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_HEAD })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_FACE })
|
||||||
head: number;
|
head: number;
|
||||||
// 相框
|
// 相框
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_FRAME })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_FACECASE })
|
||||||
frame: number;
|
frame: number;
|
||||||
// 形象
|
// 形象
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_SPINE })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_APPEARANCE })
|
||||||
spine: number;
|
spine: number;
|
||||||
// 前五战力
|
// 前五战力
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import BaseModel from './BaseModel';
|
|||||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||||
|
|
||||||
import { PvpEnemies, PvpOtherHeroes } from '../domain/dbGeneral';
|
import { PvpEnemies, PvpOtherHeroes } from '../domain/dbGeneral';
|
||||||
import { FIGURE } from '../pubUtils/dicParam';
|
import { EXTERIOR } from '../pubUtils/dicParam';
|
||||||
|
|
||||||
export class HeroScores {
|
export class HeroScores {
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
@@ -21,11 +21,11 @@ export default class PvpHistoryOpp extends BaseModel {
|
|||||||
oppRoleId: string; // 对手角色 id
|
oppRoleId: string; // 对手角色 id
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
roleName: string; // 角色名称
|
roleName: string; // 角色名称
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_HEAD })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_FACE })
|
||||||
head: number; // 对手头像
|
head: number; // 对手头像
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_FRAME })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_FACECASE })
|
||||||
frame: number; // 对手相框
|
frame: number; // 对手相框
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_SPINE })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_APPEARANCE })
|
||||||
spine: number; // 对手形象
|
spine: number; // 对手形象
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
score: number; // 对手军功
|
score: number; // 对手军功
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
|
|||||||
import { getBeforeDayDate } from '../pubUtils/timeUtil';
|
import { getBeforeDayDate } from '../pubUtils/timeUtil';
|
||||||
import { genCode } from '../pubUtils/util';
|
import { genCode } from '../pubUtils/util';
|
||||||
import { PvpHeroInfo } from '../domain/dbGeneral';
|
import { PvpHeroInfo } from '../domain/dbGeneral';
|
||||||
import { FIGURE } from '../pubUtils/dicParam';
|
import { EXTERIOR } from '../pubUtils/dicParam';
|
||||||
|
|
||||||
export class HeroesRecord {
|
export class HeroesRecord {
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
@@ -42,11 +42,11 @@ export class PlayerInfo {
|
|||||||
roleName: string; // 角色 名
|
roleName: string; // 角色 名
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
lv: number; // 等级
|
lv: number; // 等级
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_HEAD })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_FACE })
|
||||||
head: number; // 头像
|
head: number; // 头像
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_FRAME })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_FACECASE })
|
||||||
frame: number; // 相框
|
frame: number; // 相框
|
||||||
@prop({ required: true, default: FIGURE.DEFAULT_SPINE })
|
@prop({ required: true, default: EXTERIOR.EXTERIOR_APPEARANCE })
|
||||||
spine: number; // 形象
|
spine: number; // 形象
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
title: number; // 爵位
|
title: number; // 爵位
|
||||||
|
|||||||
+26
-7
@@ -6,7 +6,7 @@ import { shouldRefresh, reduceCe } from '../pubUtils/util';
|
|||||||
import { initRoleAtrr } from '../pubUtils/playerCe';
|
import { initRoleAtrr } from '../pubUtils/playerCe';
|
||||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||||
import { Figure } from '../domain/dbGeneral';
|
import { Figure } from '../domain/dbGeneral';
|
||||||
import { FIGURE } from '../pubUtils/dicParam';
|
import { EXTERIOR } from '../pubUtils/dicParam';
|
||||||
import Hero from './Hero';
|
import Hero from './Hero';
|
||||||
|
|
||||||
// role表属性格式
|
// role表属性格式
|
||||||
@@ -124,26 +124,26 @@ export default class Role extends BaseModel {
|
|||||||
@prop({ required: true, type: Number })
|
@prop({ required: true, type: Number })
|
||||||
showLineup: number[]; // 展示阵容
|
showLineup: number[]; // 展示阵容
|
||||||
|
|
||||||
@prop({ required: true, type: Figure, default: [], _id: false })
|
@prop({ required: true, type: Figure, default: getDefualtFigure('head'), _id: false })
|
||||||
heads: Figure[]; // 拥有头像列表
|
heads: Figure[]; // 拥有头像列表
|
||||||
@prop({ required: true, type: Figure, default: [], _id: false })
|
@prop({ required: true, type: Figure, default: getDefualtFigure('frame'), _id: false })
|
||||||
frames: Figure[]; // 拥有相框列表
|
frames: Figure[]; // 拥有相框列表
|
||||||
@prop({ required: true, type: Figure, default: [], _id: false })
|
@prop({ required: true, type: Figure, default: getDefualtFigure('spine'), _id: false })
|
||||||
spines: Figure[]; // 拥有的形象
|
spines: Figure[]; // 拥有的形象
|
||||||
|
|
||||||
public get head () { // 虚拟字段head 当前头像
|
public get head () { // 虚拟字段head 当前头像
|
||||||
let curHead = this.heads?.find(cur => cur.enable && cur.time > nowSeconds());
|
let curHead = this.heads?.find(cur => cur.enable && cur.time > nowSeconds());
|
||||||
return curHead?curHead.id: FIGURE.DEFAULT_HEAD;
|
return curHead?curHead.id: EXTERIOR.EXTERIOR_FACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get frame () { // 虚拟字段frame 当前相框
|
public get frame () { // 虚拟字段frame 当前相框
|
||||||
let curFrame = this.frames?.find(cur => cur.enable && cur.time > nowSeconds());
|
let curFrame = this.frames?.find(cur => cur.enable && cur.time > nowSeconds());
|
||||||
return curFrame?curFrame.id: FIGURE.DEFAULT_FRAME;
|
return curFrame?curFrame.id: EXTERIOR.EXTERIOR_FACECASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get spine () { // 虚拟字段spine 当前形象
|
public get spine () { // 虚拟字段spine 当前形象
|
||||||
let curSpine = this.spines?.find(cur => cur.enable && cur.time > nowSeconds());
|
let curSpine = this.spines?.find(cur => cur.enable && cur.time > nowSeconds());
|
||||||
return curSpine?curSpine.id: FIGURE.DEFAULT_SPINE;
|
return curSpine?curSpine.id: EXTERIOR.EXTERIOR_APPEARANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
@@ -551,6 +551,10 @@ export default class Role extends BaseModel {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async addFigure(roleId: string, id: number, figure: Figure) {
|
||||||
|
const result = await RoleModel.findOneAndUpdate({roleId}, { $pull: { heads: { id: id }, $push: { heads: figure } }}, {new: true}).lean();
|
||||||
|
return result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RoleModel = getModelForClass(Role);
|
export const RoleModel = getModelForClass(Role);
|
||||||
@@ -567,3 +571,18 @@ function getInitialTeraph() {
|
|||||||
}
|
}
|
||||||
return teraphs;
|
return teraphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDefualtFigure(type: string) {
|
||||||
|
let figures = new Array<Figure>();
|
||||||
|
if(type == 'head') {
|
||||||
|
let figure = new Figure(EXTERIOR.EXTERIOR_FACE, true, null, true);
|
||||||
|
figures.push(figure);
|
||||||
|
} else if (type == 'frame') {
|
||||||
|
let figure = new Figure(EXTERIOR.EXTERIOR_FACECASE, true, null, true);
|
||||||
|
figures.push(figure);
|
||||||
|
} else if (type == 'spine') {
|
||||||
|
let figure = new Figure(EXTERIOR.EXTERIOR_APPEARANCE, true, null, true);
|
||||||
|
figures.push(figure);
|
||||||
|
}
|
||||||
|
return figures;
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ import { GuildType } from "../../db/Guild";
|
|||||||
import { RoleType } from "../../db/Role";
|
import { RoleType } from "../../db/Role";
|
||||||
import { WAR_TYPE } from "../../consts/consts";
|
import { WAR_TYPE } from "../../consts/consts";
|
||||||
import { gameData } from "../../pubUtils/data";
|
import { gameData } from "../../pubUtils/data";
|
||||||
import { FIGURE } from "../../pubUtils/dicParam";
|
import { EXTERIOR } from "../../pubUtils/dicParam";
|
||||||
|
|
||||||
export class PlayerDetailHero {
|
export class PlayerDetailHero {
|
||||||
actorId: number;
|
actorId: number;
|
||||||
@@ -50,9 +50,9 @@ export class PlayerDetail {
|
|||||||
roleName: string;
|
roleName: string;
|
||||||
lv: number;
|
lv: number;
|
||||||
title?: number = 1;
|
title?: number = 1;
|
||||||
head?: number = FIGURE.DEFAULT_HEAD;
|
head?: number = EXTERIOR.EXTERIOR_FACE;
|
||||||
frame?: number = FIGURE.DEFAULT_FRAME;
|
frame?: number = EXTERIOR.EXTERIOR_FACECASE;
|
||||||
spine?: number = FIGURE.DEFAULT_SPINE;
|
spine?: number = EXTERIOR.EXTERIOR_APPEARANCE;
|
||||||
|
|
||||||
score?: number = 0;
|
score?: number = 0;
|
||||||
pLv?: number = 1;
|
pLv?: number = 1;
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import { prop, mongoose, Ref } from '@typegoose/typegoose';
|
|||||||
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||||
import { Attribute } from './roleField/attribute';
|
import { Attribute } from './roleField/attribute';
|
||||||
import Hero, { HeroType } from '../db/Hero';
|
import Hero, { HeroType } from '../db/Hero';
|
||||||
import { gameData } from '../pubUtils/data';
|
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||||
import { nowSeconds, getBeforeDaySeconds } from '../pubUtils/timeUtil';
|
|
||||||
|
|
||||||
// 从玩家数据中覆盖warjson的部分字段
|
// 从玩家数据中覆盖warjson的部分字段
|
||||||
export class PvpHeroInfo {
|
export class PvpHeroInfo {
|
||||||
@@ -210,7 +209,7 @@ export class Figure {
|
|||||||
enable: boolean = false; // 是否启用
|
enable: boolean = false; // 是否启用
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
time?: number; // 到期时间
|
time?: number; // 到期时间
|
||||||
@prop({ required: true, default: [] })
|
@prop({ required: true, default: [], type: Number })
|
||||||
unlockedType: number[] = []; // 当前已经解锁了的type
|
unlockedType: number[] = []; // 当前已经解锁了的type
|
||||||
@prop({ required: true, default: false })
|
@prop({ required: true, default: false })
|
||||||
unlocked: boolean = false; // 是否已解锁
|
unlocked: boolean = false; // 是否已解锁
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ export class ServerParamWithRole extends ServerParam {
|
|||||||
lv: number; // 等级
|
lv: number; // 等级
|
||||||
updatedAt: Date;
|
updatedAt: Date;
|
||||||
|
|
||||||
|
headHid: number = 19; // TODO,等客户端完成后删除这个字段
|
||||||
|
sHid: number = 19;
|
||||||
|
|
||||||
constructor(role: RoleType, server: ServerInfo) {
|
constructor(role: RoleType, server: ServerInfo) {
|
||||||
super(server);
|
super(server);
|
||||||
this.groupId = server.groupId;
|
this.groupId = server.groupId;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FIGURE } from "../pubUtils/dicParam";
|
import { EXTERIOR } from "../pubUtils/dicParam";
|
||||||
|
|
||||||
// 排行榜返回玩家值
|
// 排行榜返回玩家值
|
||||||
export class RankParam {
|
export class RankParam {
|
||||||
@@ -6,9 +6,9 @@ export class RankParam {
|
|||||||
lv: number;
|
lv: number;
|
||||||
vLv: number;
|
vLv: number;
|
||||||
guildName: string = "";
|
guildName: string = "";
|
||||||
head: number = FIGURE.DEFAULT_HEAD;
|
head: number = EXTERIOR.EXTERIOR_FACE;
|
||||||
frame: number = FIGURE.DEFAULT_FRAME;
|
frame: number = EXTERIOR.EXTERIOR_FACECASE;
|
||||||
spine: number = FIGURE.DEFAULT_SPINE;
|
spine: number = EXTERIOR.EXTERIOR_APPEARANCE;
|
||||||
title: number;
|
title: number;
|
||||||
|
|
||||||
headHid: number = 19; // TODO 等客户端接完将这些删除
|
headHid: number = 19; // TODO 等客户端接完将这些删除
|
||||||
|
|||||||
@@ -60,15 +60,18 @@ export const FRIEND = {
|
|||||||
FRIEND_CLOSEPOINT_ADD: 5, // 每赠送/领取一次增加的亲密度
|
FRIEND_CLOSEPOINT_ADD: 5, // 每赠送/领取一次增加的亲密度
|
||||||
FRIEND_FRIENDPOINT_ADD: 1, // 每领取一次爱心会增加的情谊值
|
FRIEND_FRIENDPOINT_ADD: 1, // 每领取一次爱心会增加的情谊值
|
||||||
FRIEND_RECONMMEND_LEVEL: 5, // 系统推荐玩家等级要求浮动
|
FRIEND_RECONMMEND_LEVEL: 5, // 系统推荐玩家等级要求浮动
|
||||||
FRIEND_RECONMMEND_ACTIVETIME: 1000, // 系统推荐玩家活跃时间要求(小时)
|
FRIEND_RECONMMEND_ACTIVETIME: 24, // 系统推荐玩家活跃时间要求(小时)
|
||||||
FRIEND_BLACKLIST_MAX: 100, // 黑名单人数上限
|
FRIEND_BLACKLIST_MAX: 100, // 黑名单人数上限
|
||||||
FRIEND_MANAGE_APPLICATION: 50, // 好友显示收到的申请条数上限
|
FRIEND_MANAGE_APPLICATION: 50, // 好友显示收到的申请条数上限
|
||||||
FRIEND_RECEIVE_SINGLE: 1, // 向单个好友每日最多赠送多少爱心
|
FRIEND_RECEIVE_SINGLE: 1, // 向单个好友每日最多赠送多少爱心
|
||||||
FRIEND_RECONMMEND_NUM: 8, // 同一批推荐好友数量
|
FRIEND_RECONMMEND_NUM: 8, // 同一批推荐好友数量
|
||||||
FRIEND_RECONMMEND_SERVICE: 4, // 同一批推荐本服的好友数量
|
FRIEND_RECONMMEND_SERVICE: 4, // 同一批推荐本服的好友数量
|
||||||
};
|
};
|
||||||
export const FIGURE = {
|
export const LOGIN = {
|
||||||
DEFAULT_HEAD: 11201, // 默认头像
|
LOGIN_PUBLIC_LABLE: '1&zi_remen|2&zi_zuixin|3&zi_zhiding', // 公告中对应的标签图片
|
||||||
DEFAULT_FRAME: 11301, // 默认相框
|
};
|
||||||
DEFAULT_SPINE: 11401, // 默认形象
|
export const EXTERIOR = {
|
||||||
};
|
EXTERIOR_FACE: 11219, // 默认头像id
|
||||||
|
EXTERIOR_FACECASE: 11301, // 默认头像框id
|
||||||
|
EXTERIOR_APPEARANCE: 11419, // 默认形象id
|
||||||
|
};
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ import { ItemModel } from '../db/Item';
|
|||||||
import { EquipModel, RandSe, Holes } from './../db/Equip';
|
import { EquipModel, RandSe, Holes } from './../db/Equip';
|
||||||
import { BagInter, EquipInter } from './interface';
|
import { BagInter, EquipInter } from './interface';
|
||||||
import { gameData } from './data';
|
import { gameData } from './data';
|
||||||
import { RANDOM_SE_COUNT, FIX_ATTRIBUTES_RAN, ITID, CURRENCY_BY_TYPE, CURRENCY_TYPE } from '../consts';
|
import { RANDOM_SE_COUNT, FIX_ATTRIBUTES_RAN, ITID, CURRENCY_BY_TYPE, CURRENCY_TYPE, ROLE_SELECT, FIGURE_UNLOCK_CONDITION, CONSUME_TYPE } from '../consts';
|
||||||
import { getRandValueByMinMax, getRandEelm } from './util';
|
import { getRandValueByMinMax, getRandEelm } from './util';
|
||||||
|
|
||||||
import { findWhere } from 'underscore';
|
import { findWhere } from 'underscore';
|
||||||
|
import { RoleModel, RoleType } from '../db/Role';
|
||||||
|
import { Figure } from '../domain/dbGeneral';
|
||||||
|
import { getBeforeDaySeconds } from './timeUtil';
|
||||||
|
|
||||||
export async function addSkins(roleId: string, id: number) {
|
export async function addSkins(roleId: string, id: number) {
|
||||||
let skinInfo = gameData.fashion.get(id);
|
let skinInfo = gameData.fashion.get(id);
|
||||||
@@ -74,4 +77,83 @@ export function getGoldObject(count: number) {
|
|||||||
*/
|
*/
|
||||||
export function getFriendPointObject(count: number) {
|
export function getFriendPointObject(count: number) {
|
||||||
return { id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.FRIEND_POINT), count};
|
return { id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.FRIEND_POINT), count};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解锁头像/相框
|
||||||
|
* @param type 解锁类型(获得武将/好感达到)
|
||||||
|
* @param num 参数(武将id/好感等级)
|
||||||
|
*/
|
||||||
|
export async function unlockFigure(roleId: string, conditions: {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;
|
||||||
|
for(let {type, num} of conditions) {
|
||||||
|
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天以后
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接获得形象/相框
|
||||||
|
export async function addFigure(roleId: string, id: number) {
|
||||||
|
let figure = new Figure(id, true, null, false);
|
||||||
|
let role = await RoleModel.addFigure(roleId, id, figure);
|
||||||
|
return role;
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
|||||||
import { COUNTER, HERO_SYSTEM_TYPE, DEFAULT_LV, DEFAULT_ITEMS, ITID, DEFAULT_GOLD, DEFAULT_HERO_LV, DEFAULT_EQUIPS, DEFAULT_COIN, ADULT_AGE, GUEST_MAX_TIME } from '@consts';
|
|
||||||
|
import { COUNTER, HERO_SYSTEM_TYPE, DEFAULT_LV, DEFAULT_ITEMS, ITID, DEFAULT_GOLD, DEFAULT_HERO_LV, DEFAULT_EQUIPS, DEFAULT_COIN, ADULT_AGE, GUEST_MAX_TIME, GUEST_DAY, FIGURE_UNLOCK_CONDITION } from '@consts';
|
||||||
import { DEFAULT_HEROES } from '@consts';
|
import { DEFAULT_HEROES } from '@consts';
|
||||||
import { HeroModel } from '@db/Hero';
|
import { HeroModel } from '@db/Hero';
|
||||||
import { RoleModel } from '@db/Role';
|
import { RoleModel } from '@db/Role';
|
||||||
@@ -308,6 +309,8 @@ export default class Auth extends Service {
|
|||||||
const role = await RoleModel.createRole(uid, serverId, { roleId, code, roleName, seqId, lv: DEFAULT_LV, exp: (getExpByLv(DEFAULT_LV - 1) || { sum: 0 }).sum || 0 });
|
const role = await RoleModel.createRole(uid, serverId, { roleId, code, roleName, seqId, lv: DEFAULT_LV, exp: (getExpByLv(DEFAULT_LV - 1) || { sum: 0 }).sum || 0 });
|
||||||
if (role) {
|
if (role) {
|
||||||
let skinIds = new Array<number>();
|
let skinIds = new Array<number>();
|
||||||
|
let conditions = new Array<{type: number, num: number}>()
|
||||||
|
|
||||||
for (let hid of DEFAULT_HEROES) {
|
for (let hid of DEFAULT_HEROES) {
|
||||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||||
if (hero) {
|
if (hero) {
|
||||||
@@ -325,9 +328,15 @@ export default class Auth extends Service {
|
|||||||
skins: [{ id: initialSkin, enable: true }], lv: DEFAULT_HERO_LV, exp: getHeroExpByLv(DEFAULT_HERO_LV - 1) || 0
|
skins: [{ id: initialSkin, enable: true }], lv: DEFAULT_HERO_LV, exp: getHeroExpByLv(DEFAULT_HERO_LV - 1) || 0
|
||||||
});
|
});
|
||||||
skinIds.push(initialSkin);
|
skinIds.push(initialSkin);
|
||||||
|
conditions.push({type: FIGURE_UNLOCK_CONDITION.GET_HERO, num: hid});
|
||||||
|
conditions.push({type: FIGURE_UNLOCK_CONDITION.GET_SKIN, num: initialSkin});
|
||||||
|
|
||||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, roleId, hero, {});
|
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, roleId, hero, {});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 解锁形象
|
||||||
|
await ctx.service.utils.unlockFigure(roleId, conditions, role);
|
||||||
|
|
||||||
await reCalAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, roleId, {}, skinIds)
|
await reCalAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, roleId, {}, skinIds)
|
||||||
|
|
||||||
for (let { id, count } of DEFAULT_ITEMS) {
|
for (let { id, count } of DEFAULT_ITEMS) {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Service } from 'egg';
|
import { Service } from 'egg';
|
||||||
import { resResult as pubResult } from '../pubUtils/util';
|
import { resResult as pubResult } from '../pubUtils/util';
|
||||||
import { addSkins, addBags, addEquips } from 'app/pubUtils/itemUtils';
|
import { addSkins, addBags, addEquips, unlockFigure } from 'app/pubUtils/itemUtils';
|
||||||
import { BagInter, EquipInter } from 'app/pubUtils/interface';
|
import { BagInter, EquipInter } from 'app/pubUtils/interface';
|
||||||
|
import { RoleType } from '@db/Role';
|
||||||
const csprng = require('csprng');
|
const csprng = require('csprng');
|
||||||
/**
|
/**
|
||||||
* Utils Service
|
* Utils Service
|
||||||
@@ -53,4 +54,8 @@ export default class Utils extends Service {
|
|||||||
public addEquips(roleId: string, roleName: string, weapon: EquipInter) {
|
public addEquips(roleId: string, roleName: string, weapon: EquipInter) {
|
||||||
return addEquips(roleId, roleName, weapon);
|
return addEquips(roleId, roleName, weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public unlockFigure(roleId: string, conditions: {type: number, num: number}[], role?: RoleType) {
|
||||||
|
return unlockFigure(roleId, conditions, role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user