fix 合成装备bug
This commit is contained in:
@@ -3,6 +3,7 @@ import { index, getModelForClass, prop, DocumentType, modelOptions } from '@type
|
||||
import { COUNTER } from '../consts';
|
||||
import { CounterModel } from './Counter';
|
||||
import { HeroModel } from './Hero';
|
||||
import { CeAttrNumber } from './generalField';
|
||||
|
||||
export class RandSe {
|
||||
@prop({ required: true })
|
||||
@@ -69,6 +70,9 @@ export default class Equip extends BaseModel {
|
||||
@prop({ required: true, type: Holes, default: [] })
|
||||
holes: Holes[];
|
||||
|
||||
@prop({required: true, default: new CeAttrNumber() })
|
||||
ceAttr: CeAttrNumber; // 影响战力的属性
|
||||
|
||||
public static async findbyRole(roleId: string, lean = true) {
|
||||
const equips: EquipType[] = await EquipModel.find({ roleId }).lean(lean);
|
||||
return equips;
|
||||
|
||||
@@ -144,6 +144,11 @@ export default class Hero extends BaseModel {
|
||||
return hero;
|
||||
}
|
||||
|
||||
public static async findByHidAndRoleWithEquip(hid: number, roleId: string, lean = true) {
|
||||
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).populate('ePlace.equip').lean(lean);
|
||||
return hero;
|
||||
}
|
||||
|
||||
public static async addEquip(roleId: string, hid: number, ePlaceId: number, equipId: string, lean = true) {
|
||||
const hero: HeroType = await HeroModel.findOneAndUpdate(
|
||||
{ roleId, hid, 'ePlace.id': ePlaceId },
|
||||
|
||||
Reference in New Issue
Block a user