皮肤:修复初始武将皮肤
This commit is contained in:
@@ -20,6 +20,7 @@ import { GiftCodeDetailModel } from '@db/GiftCodeDetail';
|
||||
import { CreateHeroes, deletRole } from '@pubUtils/roleUtil';
|
||||
import { RScriptRecordModel } from '@db/RScriptRecord';
|
||||
import { DicWar } from '@pubUtils/dictionary/DicWar';
|
||||
import { SkinModel } from '@db/Skin';
|
||||
|
||||
// import { resResult } from '@pubUtils/util';
|
||||
|
||||
@@ -489,6 +490,7 @@ export default class GMUsers extends Service {
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
if (!hero) continue;
|
||||
await HeroModel.deleteHero(roleId, hid);
|
||||
await SkinModel.deleteByHero(roleId, hid);
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
await calculatetopLineup(role, hid, 0, null);
|
||||
await PvpDefenseModel.deleteHero(roleId, hid);
|
||||
|
||||
@@ -43,6 +43,11 @@ export default class Skin extends BaseModel {
|
||||
const items: SkinType = await SkinModel.findOneAndUpdate({ roleId, id }, { $setOnInsert: setOnInsert }, { new: true, upsert: true }).lean(lean);
|
||||
return items;
|
||||
}
|
||||
|
||||
public static async deleteByHero(roleId: string, hid: number) {
|
||||
const rec: SkinType[] = await SkinModel.deleteMany({ roleId, hid }).lean();
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
|
||||
export const SkinModel = getModelForClass(Skin);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DEFAULT_HERO_LV, FIGURE_UNLOCK_CONDITION, LINEUP_NUM, REDIS_KEY, STATUS, TASK_TYPE } from "../consts";
|
||||
import { SkinModel } from "../db/Skin";
|
||||
import { DEFAULT_HEROES, HERO_SYSTEM_TYPE } from "../consts";
|
||||
import { HeroModel, HeroType, HeroUpdate } from "../db/Hero";
|
||||
import { HeroModel, HeroSkin, HeroType, HeroUpdate } from "../db/Hero";
|
||||
import { RoleModel, RoleType, RoleUpdate } from "../db/Role";
|
||||
import { SkinUpdate } from "../db/Skin";
|
||||
import { Figure, TopHero } from "../domain/dbGeneral";
|
||||
@@ -260,10 +260,12 @@ export class CreateHeroes extends UpdateHeroes {
|
||||
private taskPushMessage: TaskListReturn[] = [];
|
||||
private activityTaskPushMessage = [];
|
||||
private figureInfos: { heads: Figure[], frames: Figure[], spines: Figure[] }[] = [];
|
||||
private skinPushMessages: { heros: {skins: HeroSkin[], hid: number}[], skins: {id: number, hid: number }[]} = { heros: [], skins: [] };
|
||||
|
||||
private async getSkinsOfThisHero(hid: number, initSkinInfo: SkinUpdate, isInit: boolean) {
|
||||
let allSkins = isInit? []: await SkinModel.findbyRoleAndHid(this.roleId, hid);
|
||||
let skin = await SkinModel.insertSkins(this.roleId, this.roleName, [initSkinInfo]);
|
||||
this.skinPushMessages.skins.push(...skin);
|
||||
if(skin) allSkins.push(...skin);
|
||||
let skins: { id: number, skin: string, enable: boolean, skinId: number }[] = [];
|
||||
for(let skin of allSkins) {
|
||||
@@ -287,6 +289,9 @@ export class CreateHeroes extends UpdateHeroes {
|
||||
}
|
||||
// 武将使用初始加载数据插入
|
||||
this.resultHeroes = await HeroModel.insertHeroes(this.roleId, this.roleName, this.serverId, initHeroInfos);
|
||||
let heroSkins = this.resultHeroes.map(cur => { return pick(cur, ['hid', 'skins']) });
|
||||
|
||||
this.skinPushMessages.heros.push(...heroSkins);
|
||||
// 头像解锁
|
||||
let { figureInfo, frames, heads, spines } = unlockFigureWithoutSave(conditions, role);
|
||||
this.figureInfos.push(figureInfo);
|
||||
@@ -335,6 +340,7 @@ export class CreateHeroes extends UpdateHeroes {
|
||||
if (!!figureInfo && (figureInfo.heads.length > 0 || figureInfo.frames.length > 0 || figureInfo.spines.length > 0)) {
|
||||
pinus.app.get('channelService').pushMessageByUids('onHeadChange', resResult(STATUS.SUCCESS, { ...figureInfo }), uids);
|
||||
}
|
||||
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, this.skinPushMessages), uids);
|
||||
}
|
||||
|
||||
public getResultHeroes() {
|
||||
|
||||
Reference in New Issue
Block a user