好友:玩家武将详细信息
This commit is contained in:
@@ -141,7 +141,7 @@ export default class Equip extends BaseModel {
|
||||
}
|
||||
|
||||
|
||||
public static async findByField(field: string, value?: number|string, lean = true) {
|
||||
public static async findByField(field: string, value?: number|string, select?: string) {
|
||||
let searchObj = {};
|
||||
if(field != 'all') {
|
||||
if(field == 'roleName') {
|
||||
@@ -151,10 +151,15 @@ export default class Equip extends BaseModel {
|
||||
}
|
||||
}
|
||||
//.select('uid tel username')
|
||||
const user: EquipType[] = await EquipModel.find(searchObj).lean(lean);
|
||||
const user: EquipType[] = await EquipModel.find(searchObj).select(select).lean();
|
||||
return user;
|
||||
}
|
||||
|
||||
public static async findListByHidAndRole(roleId: string, hid: number, select?: string) {
|
||||
let result: EquipType[] = await EquipModel.find({ roleId, hid }).select(select).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async getEquipsByIds(roleId: string, ids: Array<number>) {
|
||||
let result = await EquipModel.find({ roleId, id: { $in: ids } });
|
||||
return result;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import { EXPEDITION_WAR_RECORD_STATUS } from '../consts';
|
||||
import { Enemies } from './generalField'
|
||||
import { Enemies } from '../domain/dbGeneral';
|
||||
|
||||
|
||||
class EnemiesCurHPAP {
|
||||
|
||||
@@ -2,7 +2,7 @@ import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, mongoose, Ref } from '@typegoose/typegoose';
|
||||
import Role, { RoleType } from './Role';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { ROLE } from '../consts';
|
||||
import { ROLE_SELECT } from '../consts';
|
||||
|
||||
/**
|
||||
* 好友系统关系表
|
||||
@@ -37,7 +37,7 @@ export default class FriendApply extends BaseModel {
|
||||
public static async getApplyList(roleId: string) {
|
||||
const list: FriendApplyType[] = await FriendApplyModel.find({ roleId }, { _id: 0 })
|
||||
// .select(select)
|
||||
.populate('friend', ROLE.SHOW_FRIEND_APPLY_LIST, 'Role')
|
||||
.populate('friend', ROLE_SELECT.SHOW_FRIEND_APPLY_LIST, 'Role')
|
||||
.lean({ getters: true });
|
||||
return list;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ export default class FriendApply extends BaseModel {
|
||||
public static async getApplyListByCode(applyCodeList: string[]) {
|
||||
const list: FriendApplyType[] = await FriendApplyModel.find({ applyCode: { $in: applyCodeList } }, { _id: 0 })
|
||||
// .select(select)
|
||||
.populate('friend', ROLE.SHOW_FRIEND_APPLY_LIST, 'Role')
|
||||
.populate('friend', ROLE_SELECT.SHOW_FRIEND_APPLY_LIST, 'Role')
|
||||
.lean({ getters: true });
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import { ItemReward } from './generalField';
|
||||
import { ItemReward } from '../domain/dbGeneral';
|
||||
|
||||
/**
|
||||
* GM用户组接口
|
||||
|
||||
@@ -2,7 +2,7 @@ import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, mongoose, Ref } from '@typegoose/typegoose';
|
||||
import Role, { RoleType } from './Role';
|
||||
import FriendShip, { FriendShipType } from './FriendShip';
|
||||
import { ROLE, POPULATE_TYPE } from '../consts';
|
||||
import { ROLE_SELECT, POPULATE_TYPE } from '../consts';
|
||||
|
||||
export class Relation {
|
||||
@prop({ required: true, default: '' })
|
||||
@@ -47,11 +47,11 @@ export default class FriendRelation extends BaseModel {
|
||||
|
||||
if (populateType == POPULATE_TYPE.FRIEND) {
|
||||
document
|
||||
.populate('friends.role', ROLE.SHOW_SIMPLE, 'Role')
|
||||
.populate('friends.role', ROLE_SELECT.SHOW_SIMPLE, 'Role')
|
||||
.populate('friends.friendShip', null, 'FriendShip');
|
||||
} else if (populateType == POPULATE_TYPE.BLACKLIST) {
|
||||
document
|
||||
.populate('blacklist.role', ROLE.SHOW_SIMPLE, 'Role')
|
||||
.populate('blacklist.role', ROLE_SELECT.SHOW_SIMPLE, 'Role')
|
||||
} else if (populateType == POPULATE_TYPE.FRIENDSHIP) {
|
||||
document.populate('friends.friendShip', null, 'FriendShip');
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { CeAttr } from './generalField';
|
||||
import { CeAttr } from '../domain/roleField/attribute';
|
||||
import { index, getModelForClass, prop, Ref, mongoose, DocumentType } from '@typegoose/typegoose';
|
||||
import Equip, { } from './Equip';
|
||||
import { CounterModel } from './Counter';
|
||||
import { COUNTER, EQUIP_TYPE } from '../consts';
|
||||
import { reduceCe } from '../pubUtils/util';
|
||||
|
||||
|
||||
/**
|
||||
@@ -97,7 +98,7 @@ export default class Hero extends BaseModel {
|
||||
exp: number; // 经验值
|
||||
@prop({ required: true, default: 1 })
|
||||
lv: number; // 武将等级
|
||||
@prop({ required: true, default: 0 })
|
||||
@prop({ required: true, default: 0, set: (val: number) => val, get: (val: number) => reduceCe(val) })
|
||||
ce: number; // 武将战力
|
||||
@prop({ required: true, default: 0 })
|
||||
historyCe: number; // 武将历史最高战力
|
||||
@@ -167,8 +168,8 @@ export default class Hero extends BaseModel {
|
||||
const hero: HeroType = await HeroModel.findOne({ seqId, roleId }).lean(lean);
|
||||
return hero;
|
||||
}
|
||||
public static async findByHidAndRole(hid: number, roleId: string, select?: string, lean = true) {
|
||||
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).select(select).lean(lean);
|
||||
public static async findByHidAndRole(hid: number, roleId: string, select?: string, getters = false) {
|
||||
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).select(select).lean({ getters });
|
||||
return hero;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
|
||||
import { PvpEnemies, PvpOtherHeroes } from './generalField';
|
||||
import { PvpEnemies, PvpOtherHeroes } from '../domain/dbGeneral';
|
||||
|
||||
export class HeroScores {
|
||||
@prop({ required: true })
|
||||
|
||||
@@ -2,7 +2,7 @@ import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
import { getBeforeDayDate } from '../pubUtils/timeUtil';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { PvpHeroInfo } from './generalField';
|
||||
import { PvpHeroInfo } from '../domain/dbGeneral';
|
||||
|
||||
export class HeroesRecord {
|
||||
@prop({ required: true, default: 0 })
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { HANG_UP_CONSTS, ROLE_TERAPH, ROLE } from './../consts';
|
||||
import { HANG_UP_CONSTS, ROLE_TERAPH, ROLE_SELECT } from './../consts';
|
||||
import BaseModel from './BaseModel';
|
||||
import { CeAttrRole } from './generalField';
|
||||
import { CeAttrRole } from '../domain/roleField/attribute';
|
||||
import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose';
|
||||
import User from './User';
|
||||
import { shouldRefresh, reduceCe } from '../pubUtils/util';
|
||||
@@ -32,7 +32,7 @@ class PayRecord {
|
||||
cnt: number; // 购买次数
|
||||
}
|
||||
|
||||
class WarStar {
|
||||
export class WarStar {
|
||||
@prop({ required: true })
|
||||
id: number; // 关卡 id
|
||||
@prop({ required: true })
|
||||
@@ -450,7 +450,7 @@ export default class Role extends BaseModel {
|
||||
// 获取好友推荐列表
|
||||
public static async getRecommedList(minLv: number, maxLv: number, time: number) {
|
||||
const result = await RoleModel.find({ loginTime: { $gt: time }, lv: { $gte: minLv, $lte: maxLv } }, { _id: 0 })
|
||||
.select(ROLE.SHOW_FRIEND_APPLY_LIST)
|
||||
.select(ROLE_SELECT.SHOW_FRIEND_APPLY_LIST)
|
||||
.sort({quitTime: -1, lv: -1, ce: -1})
|
||||
.limit(200).lean({ getters: true });
|
||||
return result;
|
||||
@@ -464,7 +464,7 @@ export default class Role extends BaseModel {
|
||||
{ roleId: value }
|
||||
]
|
||||
}, { _id: 0 })
|
||||
.select(ROLE.SHOW_FRIEND_APPLY_LIST)
|
||||
.select(ROLE_SELECT.SHOW_FRIEND_APPLY_LIST)
|
||||
.sort({quitTime: -1, lv: -1, ce: -1})
|
||||
.limit(200).lean({ getters: true });
|
||||
return result;
|
||||
|
||||
@@ -1,265 +0,0 @@
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||
import { HeroType } from './Hero';
|
||||
|
||||
export class CeAttrData {
|
||||
@prop({ required: true })
|
||||
base: number = 0;
|
||||
@prop({ required: true })
|
||||
ratioUp: number = 0;
|
||||
@prop({ required: true })
|
||||
fixUp: number = 0;
|
||||
@prop({ required: true })
|
||||
equipUp: number = 0;
|
||||
}
|
||||
|
||||
export class CeAttr {
|
||||
@prop({ required: false, _id: false })
|
||||
hp?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
atk?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
matk?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
def?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
mdef?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
agi?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
luk?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
hit?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
cri?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
flee?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
antCri?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
damageIncrease?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
damageDecrease?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
defIngnore?: CeAttrData = new CeAttrData();
|
||||
@prop({ required: false, _id: false })
|
||||
bloodSuck?: CeAttrData = new CeAttrData();
|
||||
}
|
||||
|
||||
|
||||
export class CeAttrDataRole {
|
||||
@prop({ required: true })
|
||||
ratioUp: number = 0;
|
||||
@prop({ required: true })
|
||||
fixUp: number = 0;
|
||||
}
|
||||
|
||||
export class CeAttrRole {
|
||||
@prop({ required: false, _id: false })
|
||||
hp?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
atk?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
matk?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
def?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
mdef?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
agi?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
luk?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
hit?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
cri?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
flee?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
antCri?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
damageIncrease?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
damageDecrease?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
defIngnore?: CeAttrDataRole = new CeAttrDataRole();
|
||||
@prop({ required: false, _id: false })
|
||||
bloodSuck?: CeAttrDataRole = new CeAttrDataRole();
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class CeAttrNumber {
|
||||
@prop({ required: false })
|
||||
hp?: number = 0;
|
||||
@prop({ required: false })
|
||||
atk?: number = 0;
|
||||
@prop({ required: false })
|
||||
matk?: number = 0;
|
||||
@prop({ required: false })
|
||||
def?: number = 0;
|
||||
@prop({ required: false })
|
||||
mdef?: number = 0;
|
||||
@prop({ required: false })
|
||||
agi?: number = 0;
|
||||
@prop({ required: false })
|
||||
luk?: number = 0;
|
||||
@prop({ required: false })
|
||||
hit?: number = 0;
|
||||
@prop({ required: false })
|
||||
cri?: number = 0;
|
||||
@prop({ required: false })
|
||||
flee?: number = 0;
|
||||
@prop({ required: false })
|
||||
antCri?: number = 0;
|
||||
@prop({ required: false })
|
||||
damageIncrease?: number = 0;
|
||||
@prop({ required: false })
|
||||
damageDecrease?: number = 0;
|
||||
@prop({ required: false })
|
||||
defIngnore?: number = 0;
|
||||
@prop({ required: false })
|
||||
bloodSuck?: number = 0;
|
||||
}
|
||||
|
||||
// 从玩家数据中覆盖warjson的部分字段
|
||||
export class PvpHeroInfo {
|
||||
@prop({ required: true })
|
||||
actorId?: number = 0; // 敌人id
|
||||
@prop({ required: false })
|
||||
actorName?: string = ""; // 敌人名
|
||||
@prop({ required: false })
|
||||
outIndex?: number = 0; // 程序将信息存入数组顺序
|
||||
@prop({ required: false })
|
||||
star?: number = 0; // 角色星级
|
||||
@prop({ required: false })
|
||||
lv?: number = 0; // 角色等级
|
||||
@prop({ required: false })
|
||||
skill?: string = "0"; // 技能
|
||||
@prop({ required: false })
|
||||
seid?: string = "&"; // 技能
|
||||
@prop({ required: false })
|
||||
spine?: string = "0"; // S动画
|
||||
@prop({ required: false })
|
||||
colorStar?: number = 0; // 觉醒
|
||||
@prop({ required: false })
|
||||
quality?: number = 0; // 品质
|
||||
|
||||
@prop({ required: true, _id: false })
|
||||
attribute?: CeAttrNumber; // 属性
|
||||
|
||||
setHeroInfo(hero: HeroType) {
|
||||
this.actorId = hero.hid;
|
||||
this.actorName = hero.hName;
|
||||
this.star = hero.star;
|
||||
this.lv = hero.lv;
|
||||
this.colorStar = hero.colorStar;
|
||||
this.quality = hero.quality;
|
||||
}
|
||||
|
||||
setRobotInfo(warjson: DicWarJson, lv: number, initialStar: number, quality: number) {
|
||||
this.actorId = warjson.actorId;
|
||||
this.actorName = warjson.actorName;
|
||||
this.star = initialStar;
|
||||
this.lv = lv;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
setAttribute(attribute: CeAttrNumber) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
|
||||
setOutIndex(order: number) {
|
||||
this.outIndex = order;
|
||||
}
|
||||
}
|
||||
|
||||
// 远征敌军
|
||||
export class Enemies extends PvpHeroInfo {
|
||||
@prop({ required: true })
|
||||
actorId: number; // 敌人id
|
||||
@prop({ required: false })
|
||||
actorName: string; // 敌人名
|
||||
@prop({ required: false })
|
||||
dataId: number; // 战场中唯一指向武将的代码
|
||||
@prop({ required: false })
|
||||
relation: number; // 角色属于我方还是地方
|
||||
@prop({ required: false })
|
||||
x: number; // 战场x坐标
|
||||
@prop({ required: false })
|
||||
y: number; // 战场y坐标
|
||||
@prop({ required: false })
|
||||
direction: number; // 朝向
|
||||
@prop({ required: false })
|
||||
var: number; // 变量
|
||||
@prop({ required: false })
|
||||
hide: number; // 是否隐藏
|
||||
@prop({ required: false })
|
||||
initial_ai: number; // AI类型
|
||||
|
||||
// warjson 出兵表
|
||||
// heroInfo 覆盖掉出兵表的相应参数
|
||||
constructor(warjson: DicWarJson, heroInfo: PvpHeroInfo) {
|
||||
super();
|
||||
this.actorId = heroInfo.actorId != undefined? heroInfo.actorId: warjson.actorId;
|
||||
this.actorName = heroInfo.actorName != undefined? heroInfo.actorName: warjson.actorName;
|
||||
this.dataId = warjson.dataId;
|
||||
this.relation = warjson.relation;
|
||||
this.outIndex = heroInfo.outIndex != undefined? heroInfo.outIndex: warjson.outIndex;
|
||||
this.x = warjson.x;
|
||||
this.y = warjson.y;
|
||||
this.direction = warjson.direction;
|
||||
this.var = warjson.var;
|
||||
this.lv = heroInfo.lv != undefined? heroInfo.lv: warjson.lv;
|
||||
this.hide = warjson.hide;
|
||||
this.initial_ai = warjson.initial_ai;
|
||||
this.attribute = heroInfo.attribute;
|
||||
this.skill = heroInfo.skill != undefined? heroInfo.skill: warjson.skill;
|
||||
this.seid = heroInfo.seid != undefined? heroInfo.seid: warjson.seid;
|
||||
this.star = heroInfo.star != undefined? heroInfo.star: warjson.star;
|
||||
this.spine = heroInfo.spine!= undefined? heroInfo.spine: warjson.spine;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class PvpEnemies extends Enemies {
|
||||
@prop({ required: true })
|
||||
star: number;
|
||||
@prop({ required: true })
|
||||
colorStar: number;
|
||||
@prop({ required: true })
|
||||
quality: number;
|
||||
@prop({ required: true })
|
||||
lv: number;
|
||||
@prop({ required: true })
|
||||
score: number;
|
||||
|
||||
// score: 这个武将的军功
|
||||
constructor(warjson: DicWarJson, heroInfo: PvpHeroInfo, score: number) {
|
||||
super(warjson, heroInfo);
|
||||
this.star = heroInfo.star;
|
||||
this.colorStar = heroInfo.colorStar;
|
||||
this.quality = heroInfo.quality;
|
||||
this.lv = heroInfo.lv;
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
|
||||
// 未显示在阵容中的其他武将
|
||||
export class PvpOtherHeroes extends PvpHeroInfo {
|
||||
@prop({ required: true })
|
||||
score: number;
|
||||
|
||||
// score: 这个武将的军功
|
||||
constructor(score: number) {
|
||||
super();
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
|
||||
export class ItemReward {
|
||||
@prop({ required: true })
|
||||
id: number;
|
||||
@prop({ required: true })
|
||||
count: number;
|
||||
}
|
||||
Reference in New Issue
Block a user