羁绊:修改武将羁绊格式
This commit is contained in:
@@ -19,7 +19,7 @@ export enum ROLE_SELECT {
|
||||
|
||||
export enum HERO_SELECT {
|
||||
ENTRY = '-_id -attr -__v',
|
||||
HERO_DETAIL = 'roleId roleName hid hName ce lv star colorStar quality job skins attr ePlace skinId connections favourLv',
|
||||
HERO_DETAIL = 'roleId roleName hid hName ce lv star colorStar quality job skins attr ePlace skinId connections',
|
||||
// 排行榜中lineup字段
|
||||
RANK_LINEUP = 'seqId roleId hid star colorStar lv quality job ce updatedAt skinId'
|
||||
}
|
||||
|
||||
+2
-4
@@ -16,6 +16,8 @@ export class Connect {
|
||||
shipId: number;
|
||||
@prop({ required: true })
|
||||
level: number;
|
||||
@prop({ required: true })
|
||||
exp: number;
|
||||
}
|
||||
|
||||
export class Talent {
|
||||
@@ -151,10 +153,6 @@ export default class Hero extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
skinId: number; // 当前皮肤id,fashions表的heroId字段
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
favour: number; // 好感度
|
||||
@prop({ required: true, default: 1 })
|
||||
favourLv: number; // 好感等级
|
||||
@prop({ required: true, type: Connect, default: [], _id: false })
|
||||
connections: Connect[]; // 羁绊
|
||||
@prop({ required: true, type: HeroSkin, default: [], _id: false })
|
||||
|
||||
@@ -192,7 +192,6 @@ export class HeroDetailParam {
|
||||
}
|
||||
talent: Talent[] = [];
|
||||
connections: Connect[] = [];
|
||||
favourLv: number = 0;
|
||||
role: {
|
||||
title: number;
|
||||
scroll: number;
|
||||
@@ -219,7 +218,6 @@ export class HeroDetailParam {
|
||||
}
|
||||
}
|
||||
this.connections = hero.connections;
|
||||
this.favourLv = hero.favourLv;
|
||||
}
|
||||
|
||||
setAttributes(attributes: {hp: number, atk: number, def: number, mdef: number}) {
|
||||
|
||||
@@ -56,8 +56,6 @@ export class HeroParam {
|
||||
jobStage: number; // 职阶
|
||||
skinId: number; // 当前皮肤id,fashions表的heroId字段
|
||||
|
||||
favour: number; // 好感度
|
||||
favourLv: number; // 好感等级
|
||||
connections: Connect[]; // 羁绊
|
||||
skins: HeroSKinParam[] = []; // 皮肤
|
||||
ePlace: EPlace[]; // 武将装备引用数组
|
||||
@@ -86,8 +84,6 @@ export class HeroParam {
|
||||
this.totalTalentPoint = gameData.talentPointOfJob.get(hero.job)||0;
|
||||
this.jobStage = hero.jobStage;
|
||||
this.skinId = hero.skinId;
|
||||
this.favour = hero.favour;
|
||||
this.favourLv = hero.favourLv;
|
||||
this.connections = hero.connections;
|
||||
for(let skin of hero.skins) {
|
||||
this.skins.push(new HeroSKinParam(skin));
|
||||
|
||||
+16
-16
@@ -15,8 +15,7 @@ import { dicWar, dicWarPvp, dicDailyWarByType, loadWar, dicHeroIdByWar } from ".
|
||||
import { dicWarJson, loadWarJson } from "./dictionary/DicWarJson";
|
||||
import { AUCTION_TIME } from "../consts";
|
||||
import { dicFashions, dicFashionsByHeroId, loadFashions } from "./dictionary/DicFashions";
|
||||
import { friendShips, friendShipHidAandIds, loadFriendShip } from "./dictionary/DicFriendShip";
|
||||
import { maxFriendShipLv, dicFriendShipLevelMap, loadFriendShipLevel } from "./dictionary/DicFriendShipLevel";
|
||||
import { friendShips, friendShipsByLv, loadFriendShip } from "./dictionary/DicFriendShip";
|
||||
import { dicHeroQualityUp, loadHeroQualityUp } from "./dictionary/DicHeroQualityUp";
|
||||
import { dicHeroStar, loadHeroStar } from "./dictionary/DicHeroStar";
|
||||
import { dicHeroWake, loadHeroWake } from "./dictionary/DicHeroWake";
|
||||
@@ -139,9 +138,7 @@ export const gameData = {
|
||||
fashion: dicFashions,
|
||||
fashionBySkinId: dicFashionsByHeroId,
|
||||
friendShips: friendShips,
|
||||
friendShipHidAandIds: friendShipHidAandIds,
|
||||
maxFriendShipLv: maxFriendShipLv,
|
||||
friendShipLevelMap: dicFriendShipLevelMap,
|
||||
friendShipsByLv: friendShipsByLv,
|
||||
randomEffectPool: dicRandomEffectPool,
|
||||
randomEffectPoolByGroupAndLv: dicRandomEffectPoolByGroupAndLv,
|
||||
title: dicTitle,
|
||||
@@ -321,19 +318,23 @@ export function getHeroExpByLv(lv: number) {
|
||||
return gameData.charexp.get(lv);
|
||||
}
|
||||
|
||||
export function hasCurConnect(actorId: number, shipId: number) {
|
||||
return gameData.friendShips.has(`${actorId}_${shipId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据武将当前好感获得好感等级
|
||||
* @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;
|
||||
export function getConnectLvByExp(actorId: number, shipId: number, newExp: number) {
|
||||
let exps = gameData.friendShips.get(`${actorId}_${shipId}`)||[];
|
||||
exps.sort((a, b) => a.level - b.level);
|
||||
let newLv = 0, maxLv = 0;
|
||||
for(let { level, shipValue } of exps) {
|
||||
if(newExp >= shipValue) newLv = level;
|
||||
if(maxLv < level) maxLv = level
|
||||
}
|
||||
|
||||
return curLv;
|
||||
return { newLv, maxLv }
|
||||
}
|
||||
|
||||
export function getBossHpByWarId(warId: number) {
|
||||
@@ -408,8 +409,8 @@ export function getJobByGradeAndClass(jobClass: number, grade: number) {
|
||||
return gameData.jobClassAndgrades.get(jobClass + '_' + grade);
|
||||
}
|
||||
|
||||
export function getFriendShipById(shipId: number, level: number) {
|
||||
return gameData.friendShips.get(shipId + '_' + level);
|
||||
export function getFriendShipByIdAndLv(actorId: number, shipId: number, level: number) {
|
||||
return gameData.friendShipsByLv.get(`${actorId}_${shipId}_${level}`);
|
||||
}
|
||||
|
||||
export function getGoodById(gid: number) {
|
||||
@@ -1057,7 +1058,6 @@ function loadDatas() {
|
||||
loadWarJson();
|
||||
loadFashions();
|
||||
loadFriendShip();
|
||||
loadFriendShipLevel();
|
||||
loadHeroQualityUp();
|
||||
loadHeroStar();
|
||||
loadHeroWake();
|
||||
|
||||
@@ -17,24 +17,30 @@ export interface DicFriendShip {
|
||||
readonly hids: Array<number>;
|
||||
// 属性加成
|
||||
readonly attributes: Array<{id: number, number: number}>
|
||||
// 消耗铜币
|
||||
readonly costCoin: number;
|
||||
// 升到这一级所需的羁绊值
|
||||
readonly shipValue: number;
|
||||
}
|
||||
|
||||
export const friendShips = new Map<string, DicFriendShip>();
|
||||
export const friendShipHidAandIds = new Map<number, {actorId: number, level:number}>();
|
||||
export const friendShips = new Map<string, { level: number, shipValue: number }[]>();
|
||||
export const friendShipsByLv = new Map<string, DicFriendShip>();
|
||||
export function loadFriendShip() {
|
||||
friendShips.clear();
|
||||
friendShipHidAandIds.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_FRIEND_SHIP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.attributes = parseAttribute(o.attribute);
|
||||
o.hids = parseNumberList(o.memberId);
|
||||
friendShips.set(o.shipId + '_' + o.level, o);
|
||||
let fiendShipHidAandId = friendShipHidAandIds.get(o.shipId);
|
||||
if (!fiendShipHidAandId || fiendShipHidAandId.level < o.level)
|
||||
friendShipHidAandIds.set(o.shipId, {actorId: o.actorId, level: o.level});
|
||||
let key1 = `${o.actorId}_${o.shipId}`;
|
||||
let shipSumValue = 0;
|
||||
if(!friendShips.has(key1)) {
|
||||
friendShips.set(key1, []);
|
||||
shipSumValue = 0;
|
||||
}
|
||||
shipSumValue += o.shipValue;
|
||||
friendShips.get(key1).push({ level: o.level, shipValue: shipSumValue });
|
||||
|
||||
let key2 = `${o.actorId}_${o.shipId}_${o.level}`;
|
||||
friendShipsByLv.set(key2, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// 武将羁绊好感等级表
|
||||
import { readFileAndParse } from '../util';
|
||||
import { FILENAME } from '../../consts';
|
||||
|
||||
export interface DicFriendShipLevel {
|
||||
// 等级
|
||||
readonly level: number;
|
||||
// 下一级经验
|
||||
readonly exp: number;
|
||||
// 加成百分比
|
||||
readonly add: number;
|
||||
// 到这一级的总经验
|
||||
readonly expSum: number;
|
||||
}
|
||||
|
||||
export const maxFriendShipLv = { max: 0 };
|
||||
export const dicFriendShipLevelMap = new Map<number, DicFriendShipLevel>();
|
||||
export function loadFriendShipLevel() {
|
||||
maxFriendShipLv.max = 0;
|
||||
dicFriendShipLevelMap.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_FRIEND_SHIP_LEVEL);
|
||||
let expSum = 0;
|
||||
arr.forEach(o => {
|
||||
expSum += o.exp;
|
||||
o.expSum = expSum;
|
||||
dicFriendShipLevelMap.set(o.level, o);
|
||||
if(o.level > maxFriendShipLv.max) maxFriendShipLv.max = o.level;
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&84",
|
||||
"costCoin": 10000,
|
||||
"shipValue": 10,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -22,6 +23,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&168",
|
||||
"costCoin": 20000,
|
||||
"shipValue": 20,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -36,6 +38,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&252",
|
||||
"costCoin": 30000,
|
||||
"shipValue": 30,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -50,6 +53,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&336",
|
||||
"costCoin": 40000,
|
||||
"shipValue": 40,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -64,6 +68,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&420",
|
||||
"costCoin": 50000,
|
||||
"shipValue": 50,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -78,6 +83,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&504",
|
||||
"costCoin": 60000,
|
||||
"shipValue": 60,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -92,6 +98,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&588",
|
||||
"costCoin": 70000,
|
||||
"shipValue": 70,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -106,6 +113,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&672",
|
||||
"costCoin": 80000,
|
||||
"shipValue": 80,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -120,6 +128,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&756",
|
||||
"costCoin": 90000,
|
||||
"shipValue": 90,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -134,6 +143,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&840",
|
||||
"costCoin": 100000,
|
||||
"shipValue": 100,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -148,6 +158,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&924",
|
||||
"costCoin": 110000,
|
||||
"shipValue": 110,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
@@ -162,6 +173,7 @@
|
||||
"memberId": "1&5&14",
|
||||
"attribute": "2&1008",
|
||||
"costCoin": 120000,
|
||||
"shipValue": 120,
|
||||
"__EMPTY": 0,
|
||||
"__EMPTY_1": 0,
|
||||
"__EMPTY_2": 0,
|
||||
|
||||
Reference in New Issue
Block a user