好友:玩家武将详细信息
This commit is contained in:
@@ -420,7 +420,7 @@ export class PvpHandler {
|
||||
let rank = await getMyRank(REDIS_KEY.PVP_RANK, 0, oppoRoleId);//去redis中获取排名
|
||||
|
||||
result = new PlayerDetail({...role, ...pvpDefense, heroes, rank});
|
||||
|
||||
result.setWarStar(role.warStar);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, result);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Application, BackendSession } from "pinus";
|
||||
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 { getBeforeDaySeconds } from "../../../pubUtils/timeUtil";
|
||||
import { FriendApplyModel } from "../../../db/FriendApply";
|
||||
@@ -15,6 +15,9 @@ import { addItems, handleCost } from "../../../services/rewardService";
|
||||
import { getFriendPointObject } from "../../../pubUtils/itemUtils";
|
||||
import { RewardInter } from "../../../pubUtils/interface";
|
||||
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) {
|
||||
@@ -32,7 +35,7 @@ export class FriendHandler {
|
||||
|
||||
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 myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||
@@ -47,6 +50,7 @@ export class FriendHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 修改,本服在前,其他服在后
|
||||
let list = getRandEelm(paramAllList, 6);
|
||||
if(!list.length) list = paramAllList;
|
||||
|
||||
@@ -78,7 +82,7 @@ export class FriendHandler {
|
||||
let roleId: string = session.get('roleId');
|
||||
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 str = '', resultRoleIds = new Array<string>();
|
||||
@@ -353,7 +357,7 @@ export class FriendHandler {
|
||||
}
|
||||
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);
|
||||
if(!dicFriendLv) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||
|
||||
@@ -410,7 +414,7 @@ export class FriendHandler {
|
||||
}
|
||||
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);
|
||||
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) {
|
||||
let roleId: string = session.get('roleId');
|
||||
@@ -489,6 +492,32 @@ export class FriendHandler {
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
roleId: hisRoleId,
|
||||
...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 { 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 { dicPvpOpponent, DicPvpOpponent } from "../pubUtils/dictionary/DicPvpOpponent";
|
||||
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 { HeroesRecord } from '../db/PvpRecord';
|
||||
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 { findWhere, findIndex } from 'underscore';
|
||||
import { pinus } from 'pinus';
|
||||
@@ -509,7 +510,7 @@ export function getPlayerAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
||||
for(let attrName in newAttribute) {
|
||||
let { base, ratioUp, fixUp, equipUp } = ceAttr[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['speed'] = 0;
|
||||
@@ -518,6 +519,18 @@ export function getPlayerAttribute(ceAttr: CeAttr, globalCeAttr: CeAttrRole) {
|
||||
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[]) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user