Merge branch 'master' of gitlab.trgame.cn:zyztech/zyz_server

This commit is contained in:
mamengke01
2021-02-24 15:15:33 +08:00
9 changed files with 9754 additions and 111 deletions

View File

@@ -129,9 +129,7 @@ const BASE_ATTR = {
'hp' : 1 ,
'atk' : 2,
'def' : 3,
'mdef' : 4,
'agi' : 5,
'luk' : 6
'mdef' : 4
}
export const ABI_TYPE_TO_STAGE = new Map<number, number | ((jobType: number) => number)>([
[ABI_STAGE.HP, ABI_TYPE.ABI_HP],

View File

@@ -21,7 +21,7 @@ import { dicXunbao } from "./dictionary/DicXunbao";
import { SPECIAL_ATTR } from "../consts/consts";
import { dicFashions } from "./dictionary/DicFashions";
import { friendShips, friendShipHidAandIds } from "./dictionary/DicFriendShip";
import { dicFriendShipLevel, dicFriendShipLevelMap } from "./dictionary/DicFriendShipLevel";
import { maxFriendShipLv, dicFriendShipLevelMap } from "./dictionary/DicFriendShipLevel";
import { dicHeroQualityUp } from "./dictionary/DicHeroQualityUp";
import { dicHeroStar } from "./dictionary/DicHeroStar";
import { dicHeroWake } from "./dictionary/DicHeroWake";
@@ -93,7 +93,7 @@ export const gameData = {
fashion: dicFashions,
friendShips: friendShips,
friendShipHidAandIds: friendShipHidAandIds,
friendShipLevel: dicFriendShipLevel,
maxFriendShipLv: maxFriendShipLv,
friendShipLevelMap: dicFriendShipLevelMap,
randomEffectPool: dicRandomEffectPool,
strengthenCost: dicStrengthenCost,
@@ -189,6 +189,20 @@ export function getHeroExpByLv(lv: number) {
return gameData.charexp.get(lv);
}
/**
* 根据武将当前好感获得好感等级
* @param exp 累积经验
*/
export function getFavourLvByExp(exp: number) {
let curLv = 0;
let entries = gameData.friendShipLevelMap.entries();
for (let [lv, { expSum: sum }] of entries) {
curLv = lv;
if(exp < sum) break;
}
return curLv;
}
export function getBossHpByWarId(warId: number) {
let bossHpSum = gameData.btlBossHpSum.get(warId) || 0;

View File

@@ -9,17 +9,19 @@ export interface DicFriendShipLevel {
readonly exp: number;
// 加成百分比
readonly add: number;
// 到这一级的总经验
readonly expSum: number;
}
const str = readJsonFile(FILENAME.DIC_FRIEND_SHIP_LEVEL);
let arr = JSON.parse(str);
export const dicFriendShipLevel = new Array<DicFriendShipLevel>();
export let maxFriendShipLv = 0;
export const dicFriendShipLevelMap = new Map<number, DicFriendShipLevel>();
let expSum = 0;
arr.forEach(o => {
dicFriendShipLevel.push(o);
expSum += o.exp;
o.expSum = expSum;
dicFriendShipLevelMap.set(o.level, o);
});
dicFriendShipLevel.sort(function(a, b) {
return a.level - b.level;
if(o.level > maxFriendShipLv) maxFriendShipLv = o.level;
});

View File

@@ -127,26 +127,26 @@ export async function calPlayerCeAndSave(roleId: string, heros: Array<HeroType>,
export async function calculateTopFive(role: RoleType, hid: number, ce: number, heroId: string) {
let topFive = role?.topFive || new Array();
topFive.sort((a, b) => { return b.ce - a.ce }); // 0-5,最大-最小
topFive.sort((a, b) => { return b.ce - a.ce }); // 0-6,最大-最小
let index = topFive.findIndex(cur => cur.hid == hid);
if(index != -1 && !heroId) {
let heroes = await HeroModel.getTopHero(role.roleId, 5);
let heroes = await HeroModel.getTopHero(role.roleId, 6);
topFive = heroes.map(cur => { return { hid: cur.hid, ce: cur.ce, hero: cur._id } });
} else {
if (index == -1) { // 不在最强列表
if (topFive.length < 5) { // 不满5
if (topFive.length < 6) { // 不满6
topFive.push({ hid, ce, hero: heroId });
} else if (topFive.length == 5) {
if (ce > topFive[topFive.length - 1].ce) { // 跻身最强5
} else if (topFive.length == 6) {
if (ce > topFive[topFive.length - 1].ce) { // 跻身最强6
topFive.pop();
topFive.push({ hid, ce, hero: heroId });
}
} else {
topFive.splice(5, topFive.length - 5);
topFive.splice(6, topFive.length - 6);
}
} else { // 原来就是最强5
} else { // 原来就是最强6
if (ce < topFive[topFive.length - 1].ce) { // 滑出最强
let heroes = await HeroModel.getTopHero(role.roleId, 5);
let heroes = await HeroModel.getTopHero(role.roleId, 6);
topFive = heroes.map(cur => { return { hid: cur.hid, ce: cur.ce, hero: cur._id } });
} else {
topFive[index].ce = ce;

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@
"suitLevel": "1&20",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -28,7 +28,7 @@
"suitLevel": "1&20",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "2&3",
"winDialogue": "&",
"loseDialogue": "&"
@@ -45,7 +45,7 @@
"suitLevel": "1&20",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -62,7 +62,7 @@
"suitLevel": "1&20",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -79,7 +79,7 @@
"suitLevel": "1&20",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -96,7 +96,7 @@
"suitLevel": "1&20",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "20&21&22&23&24",
"winDialogue": "25&",
"loseDialogue": "26&"
@@ -113,7 +113,7 @@
"suitLevel": "1&20",
"warId": 2001,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "5&6",
"winDialogue": "3&",
"loseDialogue": "7&"
@@ -130,7 +130,7 @@
"suitLevel": "1&20",
"warId": 2002,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "27&28&29&30&31",
"winDialogue": "32&33",
"loseDialogue": "34&"
@@ -147,7 +147,7 @@
"suitLevel": "1&20",
"warId": 2003,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "8&9&10&11",
"winDialogue": "12&13",
"loseDialogue": "14&15"
@@ -164,7 +164,7 @@
"suitLevel": "21&40",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -181,7 +181,7 @@
"suitLevel": "21&40",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "2&3",
"winDialogue": "&",
"loseDialogue": "&"
@@ -198,7 +198,7 @@
"suitLevel": "21&40",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -215,7 +215,7 @@
"suitLevel": "21&40",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -232,7 +232,7 @@
"suitLevel": "21&40",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -249,7 +249,7 @@
"suitLevel": "21&40",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "20&21&22&23&24",
"winDialogue": "25&",
"loseDialogue": "26&"
@@ -266,7 +266,7 @@
"suitLevel": "21&40",
"warId": 2001,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "5&6",
"winDialogue": "3&",
"loseDialogue": "7&"
@@ -283,7 +283,7 @@
"suitLevel": "21&40",
"warId": 2002,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "27&28&29&30&31",
"winDialogue": "32&33",
"loseDialogue": "34&"
@@ -300,7 +300,7 @@
"suitLevel": "21&40",
"warId": 2003,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "8&9&10&11",
"winDialogue": "12&13",
"loseDialogue": "14&15"
@@ -317,7 +317,7 @@
"suitLevel": "41&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -334,7 +334,7 @@
"suitLevel": "41&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "2&3",
"winDialogue": "&",
"loseDialogue": "&"
@@ -351,7 +351,7 @@
"suitLevel": "41&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -368,7 +368,7 @@
"suitLevel": "41&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -385,7 +385,7 @@
"suitLevel": "41&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -402,7 +402,7 @@
"suitLevel": "41&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "20&21&22&23&24",
"winDialogue": "25&",
"loseDialogue": "26&"
@@ -419,7 +419,7 @@
"suitLevel": "41&100",
"warId": 2001,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "5&6",
"winDialogue": "3&",
"loseDialogue": "7&"
@@ -436,7 +436,7 @@
"suitLevel": "41&100",
"warId": 2002,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "27&28&29&30&31",
"winDialogue": "32&33",
"loseDialogue": "34&"
@@ -453,7 +453,7 @@
"suitLevel": "41&100",
"warId": 2003,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "8&9&10&11",
"winDialogue": "12&13",
"loseDialogue": "14&15"
@@ -470,7 +470,7 @@
"suitLevel": "61&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -487,7 +487,7 @@
"suitLevel": "61&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "2&3",
"winDialogue": "&",
"loseDialogue": "&"
@@ -504,7 +504,7 @@
"suitLevel": "61&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "1&4",
"winDialogue": "&",
"loseDialogue": "&"
@@ -521,7 +521,7 @@
"suitLevel": "61&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -538,7 +538,7 @@
"suitLevel": "61&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "16&17",
"winDialogue": "18&",
"loseDialogue": "19&"
@@ -555,7 +555,7 @@
"suitLevel": "61&100",
"warId": 0,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "20&21&22&23&24",
"winDialogue": "25&",
"loseDialogue": "26&"
@@ -572,7 +572,7 @@
"suitLevel": "61&100",
"warId": 2001,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "5&6",
"winDialogue": "3&",
"loseDialogue": "7&"
@@ -589,7 +589,7 @@
"suitLevel": "61&100",
"warId": 2002,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "27&28&29&30&31",
"winDialogue": "32&33",
"loseDialogue": "34&"
@@ -606,7 +606,7 @@
"suitLevel": "61&100",
"warId": 2003,
"weight": 1,
"movePointArray": "26&27&28&29",
"movePointArray": "81&83&85&87",
"startDialogue": "8&9&10&11",
"winDialogue": "12&13",
"loseDialogue": "14&15"