好友:玩家武将详细信息
This commit is contained in:
@@ -420,7 +420,7 @@ export class PvpHandler {
|
|||||||
let rank = await getMyRank(REDIS_KEY.PVP_RANK, 0, oppoRoleId);//去redis中获取排名
|
let rank = await getMyRank(REDIS_KEY.PVP_RANK, 0, oppoRoleId);//去redis中获取排名
|
||||||
|
|
||||||
result = new PlayerDetail({...role, ...pvpDefense, heroes, rank});
|
result = new PlayerDetail({...role, ...pvpDefense, heroes, rank});
|
||||||
|
result.setWarStar(role.warStar);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, result);
|
return resResult(STATUS.SUCCESS, result);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Application, BackendSession } from "pinus";
|
import { Application, BackendSession } from "pinus";
|
||||||
import { resResult, getRandEelm, getResStr, shouldRefresh } from "../../../pubUtils/util";
|
import { resResult, getRandEelm, getResStr, shouldRefresh } from "../../../pubUtils/util";
|
||||||
import { STATUS, ROLE, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID } from "../../../consts";
|
import { STATUS, ROLE_SELECT, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID, HERO_SELECT, EQUIP_SELECT } from "../../../consts";
|
||||||
import { RoleModel, RoleType } from "../../../db/Role";
|
import { RoleModel, RoleType } from "../../../db/Role";
|
||||||
import { getBeforeDaySeconds } from "../../../pubUtils/timeUtil";
|
import { getBeforeDaySeconds } from "../../../pubUtils/timeUtil";
|
||||||
import { FriendApplyModel } from "../../../db/FriendApply";
|
import { FriendApplyModel } from "../../../db/FriendApply";
|
||||||
@@ -15,6 +15,9 @@ import { addItems, handleCost } from "../../../services/rewardService";
|
|||||||
import { getFriendPointObject } from "../../../pubUtils/itemUtils";
|
import { getFriendPointObject } from "../../../pubUtils/itemUtils";
|
||||||
import { RewardInter } from "../../../pubUtils/interface";
|
import { RewardInter } from "../../../pubUtils/interface";
|
||||||
import { FriendPresentLogModel } from '../../../db/FriendPresentLog';
|
import { FriendPresentLogModel } from '../../../db/FriendPresentLog';
|
||||||
|
import { HeroModel } from "../../../db/Hero";
|
||||||
|
import { EquipModel } from "../../../db/Equip";
|
||||||
|
import { getPlayerMainAttribute } from "../../../services/pvpService";
|
||||||
|
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
@@ -32,7 +35,7 @@ export class FriendHandler {
|
|||||||
|
|
||||||
const day = getBeforeDaySeconds(1);
|
const day = getBeforeDaySeconds(1);
|
||||||
|
|
||||||
const { lv } = await RoleModel.findByRoleId(roleId, ROLE.GET_LV);
|
const { lv } = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_LV);
|
||||||
let allList = await RoleModel.getRecommedList(lv - 5, lv + 5, day);
|
let allList = await RoleModel.getRecommedList(lv - 5, lv + 5, day);
|
||||||
|
|
||||||
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||||
@@ -47,6 +50,7 @@ export class FriendHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 修改,本服在前,其他服在后
|
||||||
let list = getRandEelm(paramAllList, 6);
|
let list = getRandEelm(paramAllList, 6);
|
||||||
if(!list.length) list = paramAllList;
|
if(!list.length) list = paramAllList;
|
||||||
|
|
||||||
@@ -78,7 +82,7 @@ export class FriendHandler {
|
|||||||
let roleId: string = session.get('roleId');
|
let roleId: string = session.get('roleId');
|
||||||
let roleIds = msg.roleIds;
|
let roleIds = msg.roleIds;
|
||||||
|
|
||||||
const role = await RoleModel.findByRoleId(roleId, ROLE.GET_ROLE_ID);
|
const role = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_ROLE_ID);
|
||||||
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||||
|
|
||||||
let str = '', resultRoleIds = new Array<string>();
|
let str = '', resultRoleIds = new Array<string>();
|
||||||
@@ -353,7 +357,7 @@ export class FriendHandler {
|
|||||||
}
|
}
|
||||||
let canSendList = sortByBeSentHeart(roleId, arr);
|
let canSendList = sortByBeSentHeart(roleId, arr);
|
||||||
|
|
||||||
let {lv} = await RoleModel.findByRoleId(roleId, ROLE.GET_LV);
|
let {lv} = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_LV);
|
||||||
let dicFriendLv = gameData.roleFriend.get(lv);
|
let dicFriendLv = gameData.roleFriend.get(lv);
|
||||||
if(!dicFriendLv) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
if(!dicFriendLv) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||||
|
|
||||||
@@ -410,7 +414,7 @@ export class FriendHandler {
|
|||||||
}
|
}
|
||||||
let canReceiveList = sortByBeSentHeart(roleId, arr);
|
let canReceiveList = sortByBeSentHeart(roleId, arr);
|
||||||
|
|
||||||
let {lv} = await RoleModel.findByRoleId(roleId, ROLE.GET_LV);
|
let {lv} = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_LV);
|
||||||
let dicFriendLv = gameData.roleFriend.get(lv);
|
let dicFriendLv = gameData.roleFriend.get(lv);
|
||||||
if(!dicFriendLv) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
if(!dicFriendLv) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||||
|
|
||||||
@@ -450,7 +454,6 @@ export class FriendHandler {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 赠送礼物
|
// 赠送礼物
|
||||||
public async sendPresent(msg: { roleId: string, items: RewardInter[] }, session: BackendSession) {
|
public async sendPresent(msg: { roleId: string, items: RewardInter[] }, session: BackendSession) {
|
||||||
let roleId: string = session.get('roleId');
|
let roleId: string = session.get('roleId');
|
||||||
@@ -489,6 +492,32 @@ export class FriendHandler {
|
|||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
roleId: hisRoleId,
|
roleId: hisRoleId,
|
||||||
...result
|
...result
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查看对象武将详细
|
||||||
|
public async getHeroDetail(msg: { roleId: string, hid: number }, session: BackendSession) {
|
||||||
|
// let roleId: string = session.get('roleId');
|
||||||
|
// let sid: string = session.get('sid');
|
||||||
|
|
||||||
|
let { roleId: hisRoleId, hid } = msg;
|
||||||
|
|
||||||
|
let role = await RoleModel.findByRoleId(hisRoleId, ROLE_SELECT.ATTR);
|
||||||
|
if(!role) return resResult(STATUS.ROLE_NOT_FOUND);
|
||||||
|
|
||||||
|
let hero = await HeroModel.findByHidAndRole(hid, hisRoleId, HERO_SELECT.HERO_DETAIL, true);
|
||||||
|
if(!hero) return resResult(STATUS.HERO_NOT_FIND);
|
||||||
|
|
||||||
|
let { roleId, roleName, hName, ce, lv, star, colorStar, quality, job, skins } = hero;
|
||||||
|
let curSkin = skins.find(cur => cur.enable);
|
||||||
|
let equips = await EquipModel.findListByHidAndRole(hisRoleId, hid, EQUIP_SELECT.HERO_DETAIL);
|
||||||
|
|
||||||
|
let attributes = getPlayerMainAttribute(hero.ceAttr, role.globalCeAttr);
|
||||||
|
|
||||||
|
return {
|
||||||
|
roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job,
|
||||||
|
skin: curSkin?curSkin.id: 0, equips, attributes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { PvpDefenseModel, Heroes, OppPlayers, Robot, PvpDefenseType, HeroScores, pvpUpdateInter } from '../db/PvpDefense';
|
import { PvpDefenseModel, Heroes, OppPlayers, Robot, PvpDefenseType, HeroScores, pvpUpdateInter } from '../db/PvpDefense';
|
||||||
import { RoleType, RoleModel } from '../db/Role';
|
import { RoleType, RoleModel } from '../db/Role';
|
||||||
import { PVP_HERO_POS, ROBOT_NAME, REDIS_KEY, PVP_CONST } from '../consts';
|
import { PVP_HERO_POS, ROBOT_NAME, REDIS_KEY, PVP_CONST, HERO_CE_RATIO } from '../consts';
|
||||||
import { setPvpDefResult } from '../services/timeTaskService';
|
import { setPvpDefResult } from '../services/timeTaskService';
|
||||||
import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
|
import { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
|
||||||
import { getRandomIndexByLen, genCode, getRandomByLen, shouldRefresh, reduceCe, getChineseName } from '../pubUtils/util';
|
import { getRandomIndexByLen, genCode, getRandomByLen, shouldRefresh, reduceCe, getChineseName } from '../pubUtils/util';
|
||||||
@@ -14,7 +14,8 @@ import { setRank, getMyRank, getFieldByRank } from './redisService';
|
|||||||
import { nowSeconds, checkTodayTime } from '../pubUtils/timeUtil';
|
import { nowSeconds, checkTodayTime } from '../pubUtils/timeUtil';
|
||||||
import { HeroesRecord } from '../db/PvpRecord';
|
import { HeroesRecord } from '../db/PvpRecord';
|
||||||
import { HeroModel, HeroType } from '../db/Hero';
|
import { HeroModel, HeroType } from '../db/Hero';
|
||||||
import { CeAttrNumber, CeAttr, CeAttrRole, PvpEnemies, PvpHeroInfo, PvpOtherHeroes } from '../db/generalField';
|
import { CeAttrNumber, CeAttr, CeAttrRole, MainAttrNumber } from '../domain/roleField/attribute';
|
||||||
|
import { PvpEnemies, PvpHeroInfo, PvpOtherHeroes } from '../domain/dbGeneral';
|
||||||
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||||
import { findWhere, findIndex } from 'underscore';
|
import { findWhere, findIndex } from 'underscore';
|
||||||
import { pinus } from 'pinus';
|
import { pinus } from 'pinus';
|
||||||
@@ -509,7 +510,7 @@ export function getPlayerAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
|||||||
for(let attrName in newAttribute) {
|
for(let attrName in newAttribute) {
|
||||||
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
||||||
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
||||||
let result = base * ( 100 + ratioUp + ratioUp2) + (fixUp + fixUp2 + equipUp) *100;
|
let result = base * ( HERO_CE_RATIO + ratioUp + ratioUp2) + (fixUp + fixUp2 + equipUp) * HERO_CE_RATIO;
|
||||||
newAttribute[attrName] += reduceCe(result);
|
newAttribute[attrName] += reduceCe(result);
|
||||||
}
|
}
|
||||||
newAttribute['speed'] = 0;
|
newAttribute['speed'] = 0;
|
||||||
@@ -518,6 +519,18 @@ export function getPlayerAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
|||||||
return newAttribute;
|
return newAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据玩家数据获取到他的主属性
|
||||||
|
* @param ceAttr
|
||||||
|
* @param globalCeAttr
|
||||||
|
*/
|
||||||
|
export function getPlayerMainAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
||||||
|
let attribute = getPlayerAttribute(ceAttr, globalCeAttr);
|
||||||
|
let mainAttributes = new MainAttrNumber(attribute);
|
||||||
|
|
||||||
|
return mainAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取我方战报记录
|
// 获取我方战报记录
|
||||||
export async function generMyRecInfo(heroScores: HeroScores[], winStreakNum: number, role: RoleType, isSuccess: boolean, pos: number, myHeroes: pvpEndParamInter[]) {
|
export async function generMyRecInfo(heroScores: HeroScores[], winStreakNum: number, role: RoleType, isSuccess: boolean, pos: number, myHeroes: pvpEndParamInter[]) {
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { ItemModel } from '@db/Item';
|
|||||||
import { gameData, getHeroExpByLv } from '@pubUtils/data';
|
import { gameData, getHeroExpByLv } from '@pubUtils/data';
|
||||||
import { calPlayerCeAndSave, calculateTopFive, calEquipSeids } from '@pubUtils/playerCe';
|
import { calPlayerCeAndSave, calculateTopFive, calEquipSeids } from '@pubUtils/playerCe';
|
||||||
import { SchoolModel } from '@db/School';
|
import { SchoolModel } from '@db/School';
|
||||||
import { CeAttrNumber } from '@db/generalField';
|
import { CeAttrNumber } from '@domain/roleField/attribute';
|
||||||
import { smsModel } from '@db/Sms';
|
import { smsModel } from '@db/Sms';
|
||||||
import { isString } from 'underscore';
|
import { isString } from 'underscore';
|
||||||
import { FriendShipModel } from '@db/FriendShip';
|
import { FriendShipModel } from '@db/FriendShip';
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
"@domain/*": ["app/domain/*"],
|
||||||
"@db/*": ["app/db/*"],
|
"@db/*": ["app/db/*"],
|
||||||
"@consts": ["app/consts"],
|
"@consts": ["app/consts"],
|
||||||
"@pubUtils/*": ["app/pubUtils/*"]
|
"@pubUtils/*": ["app/pubUtils/*"]
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
|
|
||||||
export enum ROLE {
|
export enum ROLE_SELECT {
|
||||||
// 玩家列表显示基础数据
|
// 玩家列表显示基础数据
|
||||||
SHOW_SIMPLE = 'roleId roleName ce headHid sHid lv title job quitTime vLv guildName',
|
SHOW_SIMPLE = 'roleId roleName ce headHid sHid lv title job quitTime vLv guildName',
|
||||||
SHOW_FRIEND_APPLY_LIST = 'roleId roleName ce headHid sHid lv title job quitTime vLv guildName friendCnt recFrdApplyCnt',
|
SHOW_FRIEND_APPLY_LIST = 'roleId roleName ce headHid sHid lv title job quitTime vLv guildName friendCnt recFrdApplyCnt',
|
||||||
HANDLE_APPLY = 'roleId friendCnt lv',
|
HANDLE_APPLY = 'roleId friendCnt lv',
|
||||||
|
|
||||||
|
ATTR = 'globalCeAttr',
|
||||||
GET_LV = 'lv',
|
GET_LV = 'lv',
|
||||||
GET_ROLE_ID = 'roleId'
|
GET_ROLE_ID = 'roleId'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export enum HERO_SELECT {
|
||||||
|
HERO_DETAIL = 'roleId roleName hid hName ce lv star colorStar quality job skins ceAttr'
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum EQUIP_SELECT {
|
||||||
|
HERO_DETAIL = 'id name ePlaceId quality'
|
||||||
|
}
|
||||||
|
|
||||||
export enum FRIEND {
|
export enum FRIEND {
|
||||||
SEND_PRESENT = 'friendValue friendLv'
|
SEND_PRESENT = 'friendValue friendLv'
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ export const REDIS_KEY = {
|
|||||||
// 各排行榜对应hash的key
|
// 各排行榜对应hash的key
|
||||||
export const REDIS_RANK_TO_INFO = new Map([
|
export const REDIS_RANK_TO_INFO = new Map([
|
||||||
[REDIS_KEY.TOWER_RANK, REDIS_KEY.USER_INFO],
|
[REDIS_KEY.TOWER_RANK, REDIS_KEY.USER_INFO],
|
||||||
[REDIS_KEY.PVP_RANK, REDIS_KEY.PVP_RANK],
|
[REDIS_KEY.PVP_RANK, REDIS_KEY.USER_INFO],
|
||||||
[REDIS_KEY.GUILD_ACTIVE_RANK, REDIS_KEY.GUILD_INFO]
|
[REDIS_KEY.GUILD_ACTIVE_RANK, REDIS_KEY.GUILD_INFO]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -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 = {};
|
let searchObj = {};
|
||||||
if(field != 'all') {
|
if(field != 'all') {
|
||||||
if(field == 'roleName') {
|
if(field == 'roleName') {
|
||||||
@@ -151,10 +151,15 @@ export default class Equip extends BaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//.select('uid tel username')
|
//.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;
|
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>) {
|
public static async getEquipsByIds(roleId: string, ids: Array<number>) {
|
||||||
let result = await EquipModel.find({ roleId, id: { $in: ids } });
|
let result = await EquipModel.find({ roleId, id: { $in: ids } });
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
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 { EXPEDITION_WAR_RECORD_STATUS } from '../consts';
|
import { EXPEDITION_WAR_RECORD_STATUS } from '../consts';
|
||||||
import { Enemies } from './generalField'
|
import { Enemies } from '../domain/dbGeneral';
|
||||||
|
|
||||||
|
|
||||||
class EnemiesCurHPAP {
|
class EnemiesCurHPAP {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import BaseModel from './BaseModel';
|
|||||||
import { index, getModelForClass, prop, DocumentType, mongoose, Ref } from '@typegoose/typegoose';
|
import { index, getModelForClass, prop, DocumentType, mongoose, Ref } from '@typegoose/typegoose';
|
||||||
import Role, { RoleType } from './Role';
|
import Role, { RoleType } from './Role';
|
||||||
import { genCode } from '../pubUtils/util';
|
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) {
|
public static async getApplyList(roleId: string) {
|
||||||
const list: FriendApplyType[] = await FriendApplyModel.find({ roleId }, { _id: 0 })
|
const list: FriendApplyType[] = await FriendApplyModel.find({ roleId }, { _id: 0 })
|
||||||
// .select(select)
|
// .select(select)
|
||||||
.populate('friend', ROLE.SHOW_FRIEND_APPLY_LIST, 'Role')
|
.populate('friend', ROLE_SELECT.SHOW_FRIEND_APPLY_LIST, 'Role')
|
||||||
.lean({ getters: true });
|
.lean({ getters: true });
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ export default class FriendApply extends BaseModel {
|
|||||||
public static async getApplyListByCode(applyCodeList: string[]) {
|
public static async getApplyListByCode(applyCodeList: string[]) {
|
||||||
const list: FriendApplyType[] = await FriendApplyModel.find({ applyCode: { $in: applyCodeList } }, { _id: 0 })
|
const list: FriendApplyType[] = await FriendApplyModel.find({ applyCode: { $in: applyCodeList } }, { _id: 0 })
|
||||||
// .select(select)
|
// .select(select)
|
||||||
.populate('friend', ROLE.SHOW_FRIEND_APPLY_LIST, 'Role')
|
.populate('friend', ROLE_SELECT.SHOW_FRIEND_APPLY_LIST, 'Role')
|
||||||
.lean({ getters: true });
|
.lean({ getters: true });
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 { ItemReward } from './generalField';
|
import { ItemReward } from '../domain/dbGeneral';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GM用户组接口
|
* GM用户组接口
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import BaseModel from './BaseModel';
|
|||||||
import { index, getModelForClass, prop, DocumentType, mongoose, Ref } from '@typegoose/typegoose';
|
import { index, getModelForClass, prop, DocumentType, mongoose, Ref } from '@typegoose/typegoose';
|
||||||
import Role, { RoleType } from './Role';
|
import Role, { RoleType } from './Role';
|
||||||
import FriendShip, { FriendShipType } from './FriendShip';
|
import FriendShip, { FriendShipType } from './FriendShip';
|
||||||
import { ROLE, POPULATE_TYPE } from '../consts';
|
import { ROLE_SELECT, POPULATE_TYPE } from '../consts';
|
||||||
|
|
||||||
export class Relation {
|
export class Relation {
|
||||||
@prop({ required: true, default: '' })
|
@prop({ required: true, default: '' })
|
||||||
@@ -47,11 +47,11 @@ export default class FriendRelation extends BaseModel {
|
|||||||
|
|
||||||
if (populateType == POPULATE_TYPE.FRIEND) {
|
if (populateType == POPULATE_TYPE.FRIEND) {
|
||||||
document
|
document
|
||||||
.populate('friends.role', ROLE.SHOW_SIMPLE, 'Role')
|
.populate('friends.role', ROLE_SELECT.SHOW_SIMPLE, 'Role')
|
||||||
.populate('friends.friendShip', null, 'FriendShip');
|
.populate('friends.friendShip', null, 'FriendShip');
|
||||||
} else if (populateType == POPULATE_TYPE.BLACKLIST) {
|
} else if (populateType == POPULATE_TYPE.BLACKLIST) {
|
||||||
document
|
document
|
||||||
.populate('blacklist.role', ROLE.SHOW_SIMPLE, 'Role')
|
.populate('blacklist.role', ROLE_SELECT.SHOW_SIMPLE, 'Role')
|
||||||
} else if (populateType == POPULATE_TYPE.FRIENDSHIP) {
|
} else if (populateType == POPULATE_TYPE.FRIENDSHIP) {
|
||||||
document.populate('friends.friendShip', null, 'FriendShip');
|
document.populate('friends.friendShip', null, 'FriendShip');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import BaseModel from './BaseModel';
|
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 { index, getModelForClass, prop, Ref, mongoose, DocumentType } from '@typegoose/typegoose';
|
||||||
import Equip, { } from './Equip';
|
import Equip, { } from './Equip';
|
||||||
import { CounterModel } from './Counter';
|
import { CounterModel } from './Counter';
|
||||||
import { COUNTER, EQUIP_TYPE } from '../consts';
|
import { COUNTER, EQUIP_TYPE } from '../consts';
|
||||||
|
import { reduceCe } from '../pubUtils/util';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,7 +98,7 @@ export default class Hero extends BaseModel {
|
|||||||
exp: number; // 经验值
|
exp: number; // 经验值
|
||||||
@prop({ required: true, default: 1 })
|
@prop({ required: true, default: 1 })
|
||||||
lv: number; // 武将等级
|
lv: number; // 武将等级
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0, set: (val: number) => val, get: (val: number) => reduceCe(val) })
|
||||||
ce: number; // 武将战力
|
ce: number; // 武将战力
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
historyCe: number; // 武将历史最高战力
|
historyCe: number; // 武将历史最高战力
|
||||||
@@ -167,8 +168,8 @@ export default class Hero extends BaseModel {
|
|||||||
const hero: HeroType = await HeroModel.findOne({ seqId, roleId }).lean(lean);
|
const hero: HeroType = await HeroModel.findOne({ seqId, roleId }).lean(lean);
|
||||||
return hero;
|
return hero;
|
||||||
}
|
}
|
||||||
public static async findByHidAndRole(hid: number, roleId: string, select?: string, lean = true) {
|
public static async findByHidAndRole(hid: number, roleId: string, select?: string, getters = false) {
|
||||||
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).select(select).lean(lean);
|
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).select(select).lean({ getters });
|
||||||
return hero;
|
return hero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
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 { PvpEnemies, PvpOtherHeroes } from './generalField';
|
import { PvpEnemies, PvpOtherHeroes } from '../domain/dbGeneral';
|
||||||
|
|
||||||
export class HeroScores {
|
export class HeroScores {
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
|
|||||||
@@ -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 { getBeforeDayDate } from '../pubUtils/timeUtil';
|
import { getBeforeDayDate } from '../pubUtils/timeUtil';
|
||||||
import { genCode } from '../pubUtils/util';
|
import { genCode } from '../pubUtils/util';
|
||||||
import { PvpHeroInfo } from './generalField';
|
import { PvpHeroInfo } from '../domain/dbGeneral';
|
||||||
|
|
||||||
export class HeroesRecord {
|
export class HeroesRecord {
|
||||||
@prop({ required: true, default: 0 })
|
@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 BaseModel from './BaseModel';
|
||||||
import { CeAttrRole } from './generalField';
|
import { CeAttrRole } from '../domain/roleField/attribute';
|
||||||
import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose';
|
import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose';
|
||||||
import User from './User';
|
import User from './User';
|
||||||
import { shouldRefresh, reduceCe } from '../pubUtils/util';
|
import { shouldRefresh, reduceCe } from '../pubUtils/util';
|
||||||
@@ -32,7 +32,7 @@ class PayRecord {
|
|||||||
cnt: number; // 购买次数
|
cnt: number; // 购买次数
|
||||||
}
|
}
|
||||||
|
|
||||||
class WarStar {
|
export class WarStar {
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
id: number; // 关卡 id
|
id: number; // 关卡 id
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
@@ -450,7 +450,7 @@ export default class Role extends BaseModel {
|
|||||||
// 获取好友推荐列表
|
// 获取好友推荐列表
|
||||||
public static async getRecommedList(minLv: number, maxLv: number, time: number) {
|
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 })
|
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})
|
.sort({quitTime: -1, lv: -1, ce: -1})
|
||||||
.limit(200).lean({ getters: true });
|
.limit(200).lean({ getters: true });
|
||||||
return result;
|
return result;
|
||||||
@@ -464,7 +464,7 @@ export default class Role extends BaseModel {
|
|||||||
{ roleId: value }
|
{ roleId: value }
|
||||||
]
|
]
|
||||||
}, { _id: 0 })
|
}, { _id: 0 })
|
||||||
.select(ROLE.SHOW_FRIEND_APPLY_LIST)
|
.select(ROLE_SELECT.SHOW_FRIEND_APPLY_LIST)
|
||||||
.sort({quitTime: -1, lv: -1, ce: -1})
|
.sort({quitTime: -1, lv: -1, ce: -1})
|
||||||
.limit(200).lean({ getters: true });
|
.limit(200).lean({ getters: true });
|
||||||
return result;
|
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;
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
import { PvpEnemies, PvpOtherHeroes } from "../../db/generalField";
|
import { PvpEnemies, PvpOtherHeroes } from "../../domain/dbGeneral";
|
||||||
import { reduceCe } from "../../pubUtils/util";
|
import { reduceCe } from "../../pubUtils/util";
|
||||||
import { GuildType } from "../../db/Guild";
|
import { GuildType } from "../../db/Guild";
|
||||||
import { RoleType } from "../../db/Role";
|
import { RoleType, WarStar } from "../../db/Role";
|
||||||
|
import { WAR_TYPE } from "../../consts/consts";
|
||||||
|
|
||||||
export class PlayerDetailHero {
|
export class PlayerDetailHero {
|
||||||
actorId: number;
|
actorId: number;
|
||||||
@@ -21,6 +22,24 @@ export class PlayerDetailHero {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PlayerDetailBattle {
|
||||||
|
main: number = 0;
|
||||||
|
tower: number = 0;
|
||||||
|
dungeon: number = 0;
|
||||||
|
|
||||||
|
constructor(warStar: WarStar[]) {
|
||||||
|
for(let { id, warType } of warStar) {
|
||||||
|
if(warType == WAR_TYPE.NORMAL) {
|
||||||
|
if(id > this.main) this.main = id;
|
||||||
|
} else if (warType == WAR_TYPE.TOWER) {
|
||||||
|
if(id > this.tower) this.tower = id;
|
||||||
|
} else if (warType == WAR_TYPE.MYSTERY) {
|
||||||
|
if(id > this.dungeon) this.dungeon = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class PlayerDetail {
|
export class PlayerDetail {
|
||||||
roleId: string;
|
roleId: string;
|
||||||
roleName: string;
|
roleName: string;
|
||||||
@@ -35,6 +54,9 @@ export class PlayerDetail {
|
|||||||
|
|
||||||
heroes: PlayerDetailHero[];
|
heroes: PlayerDetailHero[];
|
||||||
rank?:number = 0;
|
rank?:number = 0;
|
||||||
|
|
||||||
|
battle?: PlayerDetailBattle = new PlayerDetailBattle([]);
|
||||||
|
|
||||||
constructor(detail: PlayerDetail) {
|
constructor(detail: PlayerDetail) {
|
||||||
if(detail.roleId) this.roleId = detail.roleId;
|
if(detail.roleId) this.roleId = detail.roleId;
|
||||||
if(detail.roleName) this.roleName = detail.roleName;
|
if(detail.roleName) this.roleName = detail.roleName;
|
||||||
@@ -48,6 +70,10 @@ export class PlayerDetail {
|
|||||||
if(detail.heroes) this.heroes = detail.heroes;
|
if(detail.heroes) this.heroes = detail.heroes;
|
||||||
if(detail.rank) this.rank = detail.rank;
|
if(detail.rank) this.rank = detail.rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setWarStar?(warStar: WarStar[]) {
|
||||||
|
this.battle = new PlayerDetailBattle(warStar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 军团返回
|
// 军团返回
|
||||||
|
|||||||
146
shared/domain/dbGeneral.ts
Normal file
146
shared/domain/dbGeneral.ts
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
import { prop } from '@typegoose/typegoose';
|
||||||
|
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
|
||||||
|
import { HeroType } from '../db/Hero';
|
||||||
|
import { CeAttrNumber } from './roleField/attribute';
|
||||||
|
|
||||||
|
// 从玩家数据中覆盖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;
|
||||||
|
}
|
||||||
143
shared/domain/roleField/attribute.ts
Normal file
143
shared/domain/roleField/attribute.ts
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
import { prop } from '@typegoose/typegoose';
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// hero表全属性
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// role表属性格式
|
||||||
|
export class CeAttrDataRole {
|
||||||
|
@prop({ required: true })
|
||||||
|
ratioUp: number = 0;
|
||||||
|
@prop({ required: true })
|
||||||
|
fixUp: number = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// role表全属性
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 主属性
|
||||||
|
export class MainAttrNumber {
|
||||||
|
hp: number = 0;
|
||||||
|
atk: number = 0;
|
||||||
|
matk: number = 0;
|
||||||
|
def: number = 0;
|
||||||
|
mdef: number = 0;
|
||||||
|
agi: number = 0;
|
||||||
|
luk: number = 0;
|
||||||
|
|
||||||
|
constructor(attr: CeAttrNumber) {
|
||||||
|
if(attr.hp) this.hp = attr.hp;
|
||||||
|
if(attr.atk) this.atk = attr.atk;
|
||||||
|
if(attr.def) this.def = attr.def;
|
||||||
|
if(attr.mdef) this.mdef = attr.mdef;
|
||||||
|
if(attr.agi) this.agi = attr.agi;
|
||||||
|
if(attr.luk) this.luk = attr.luk;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import { HERO_SYSTEM_TYPE, ABI_TYPE, JEWEL_ATTR } from '../consts';
|
|||||||
import { deepCopy, getAllAttrStage, reduceCe } from './util';
|
import { deepCopy, getAllAttrStage, reduceCe } from './util';
|
||||||
import { HeroModel, HeroType } from '../db/Hero';
|
import { HeroModel, HeroType } from '../db/Hero';
|
||||||
import { RoleModel, RoleType } from '../db/Role';
|
import { RoleModel, RoleType } from '../db/Role';
|
||||||
import { CeAttrData, CeAttr, CeAttrRole, CeAttrNumber, CeAttrDataRole } from '../db/generalField';
|
import { CeAttrData, CeAttr, CeAttrRole, CeAttrNumber, CeAttrDataRole } from '../domain/roleField/attribute';
|
||||||
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_STAGE, SEID_TYPE } from '../consts';
|
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_STAGE, SEID_TYPE } from '../consts';
|
||||||
import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById, getSchoolRateByStar, getScollByStar, getFieldByStage } from './data';
|
import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById, getSchoolRateByStar, getScollByStar, getFieldByStage } from './data';
|
||||||
import { DicSe } from './dictionary/DicSe';
|
import { DicSe } from './dictionary/DicSe';
|
||||||
|
|||||||
Reference in New Issue
Block a user