排行榜: 获取排行榜

This commit is contained in:
luying
2021-04-12 09:47:15 +08:00
parent 34e02dea89
commit 5dca7b304d
32 changed files with 1077 additions and 290 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
import { dicHero } from "./dictionary/DicHero";
import { dicHero, dicMyHeroes } from "./dictionary/DicHero";
import { dicGoods, blueprt, dicJewel, figureCondition } from "./dictionary/DicGoods";
import { dicBlueprtCompose } from "./dictionary/DicBlueprtCompose";
import { dicBlueprtPossibility } from "./dictionary/DicBlueprtPossibility";
@@ -166,7 +166,8 @@ export const gameData = {
raceEventItems: decodeRaceEventItems(),
shop: dicShop,
shopItem: dicShopItem,
shopList: dicShopList
shopList: dicShopList,
dicMyHeroes: dicMyHeroes
};
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
+4
View File
@@ -34,8 +34,12 @@ let arr = JSON.parse(str);
type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicHeroKeys: KeysEnum<DicHero> = {heroId: true, name: true, quality: true, camp: true, jobid: true, skill: true, pieceId: true, initialStars: true, pieceCount: true, baseAbilityArr: true, baseAbilityUpArr: true, initialSkin: true};
export const dicMyHeroes = new Array<number>();
export const dicHero = new Map<number, DicHero>();
arr.forEach(o => {
if(o.heroId > 0 && o.heroId <= 300) {
dicMyHeroes.push(o.heroId);
}
o.baseAbilityArr = parseBaseAbilityArr(o);
o.baseAbilityUpArr = parseBaseAbilityUpArr(o);
+4 -3
View File
@@ -1,17 +1,18 @@
import { HeroModel } from '../db/Hero';
import { HeroModel, HeroUpdate, HeroType } from '../db/Hero';
import { ItemModel } from '../db/Item';
import { EquipModel, RandSe, Holes } from './../db/Equip';
import { BagInter, EquipInter } from './interface';
import { gameData } from './data';
import { RANDOM_SE_COUNT, FIX_ATTRIBUTES_RAN, ITID, CURRENCY_BY_TYPE, CURRENCY_TYPE, ROLE_SELECT, FIGURE_UNLOCK_CONDITION, CONSUME_TYPE } from '../consts';
import { RANDOM_SE_COUNT, FIX_ATTRIBUTES_RAN, ITID, CURRENCY_BY_TYPE, CURRENCY_TYPE, ROLE_SELECT, FIGURE_UNLOCK_CONDITION, CONSUME_TYPE, HERO_SYSTEM_TYPE } from '../consts';
import { getRandValueByMinMax, getRandEelm } from './util';
import { findWhere } from 'underscore';
import { RoleModel, RoleType } from '../db/Role';
import { Figure } from '../domain/dbGeneral';
import { getBeforeDaySeconds } from './timeUtil';
import { calPlayerCeAndSave } from './playerCe';
export async function addSkins(roleId: string, id: number) {
let skinInfo = gameData.fashion.get(id);
@@ -213,4 +214,4 @@ function unlockSingleFigure(dbFigures: Figure[], id: number, unlockDirect = fals
}
return figure
}
}
+5 -3
View File
@@ -24,7 +24,7 @@ import { DicJob } from './dictionary/DicJob';
export async function calPlayerCeAndSave(type: number, roleId: string, originHero: HeroType, update: HeroUpdate, args?: Array<number>) {
let role = await RoleModel.findByRoleId(roleId);
let { attr: roleAttrs = [] } = role;
let { attr: roleAttrs = [], serverId } = role;
let heroAttrs = calPlayerCe(originHero, update, type, args); // 根据操作计算attr的增加
@@ -52,7 +52,7 @@ export async function calPlayerCeAndSave(type: number, roleId: string, originHer
ce: reduceCe(heroCe),
incHeroCe: reduceCe(incCe),
});
return { pushHeros, role, topLineupCe, hero, guild }
return { pushHeros, role, topLineupCe, hero, guild, serverId }
}
//全局属性加成
@@ -89,8 +89,10 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
update.topLineupCe = topLineupCe;
role = await RoleModel.updateRoleInfo(roleId, update);
let guild = await GuildModel.updateCe(roleId, allIncCe); // 公会更新战力
return { role, pushHeros, ce: role.ce, topLineupCe: role.topLineupCe, guild }
return { role, pushHeros, ce: role.ce, topLineupCe: role.topLineupCe, guild, serverId: role.serverId }
}
// 计算武将全局战力