更新json和部分dictionary定义
This commit is contained in:
+18
-2
@@ -15,7 +15,7 @@ import { dicQuestion } from "./dictionary/DicQuestion";
|
||||
import { dicSe } from "./dictionary/DicSe";
|
||||
import { dicTower } from "./dictionary/DicTower";
|
||||
import { dicTowerTask } from "./dictionary/DicTowerTask";
|
||||
import { dicWar } from "./dictionary/DicWar";
|
||||
import { dicWar, dicWarPvp } from "./dictionary/DicWar";
|
||||
import { dicWarJson } from "./dictionary/DicWarJson";
|
||||
import { dicXunbao } from "./dictionary/DicXunbao";
|
||||
import { SPECIAL_ATTR } from "../consts/consts";
|
||||
@@ -36,6 +36,9 @@ import { dicSchool } from './dictionary/DicSchool';
|
||||
import { dicSchoolRate } from './dictionary/DicSchoolRate';
|
||||
import { dicHeroScroll, preHeroScroll } from './dictionary/DicHeroScroll';
|
||||
import { ABI_TYPE_TO_STAGE } from "../consts";
|
||||
import { dicPvpOpponent } from './dictionary/DicPvpOpponent';
|
||||
import { dicPvpTeamLevel } from './dictionary/DicPvpTeamLevel';
|
||||
import { dicPvpRefreshConsume } from './dictionary/DicPvpRefreshConsume';
|
||||
|
||||
export const gameData = {
|
||||
blurprtCompose: dicBlueprtCompose,
|
||||
@@ -84,7 +87,11 @@ export const gameData = {
|
||||
school: dicSchool,
|
||||
schoolRate: dicSchoolRate,
|
||||
heroScroll: dicHeroScroll,
|
||||
preHeroScroll: preHeroScroll
|
||||
preHeroScroll: preHeroScroll,
|
||||
pvpOpponent: dicPvpOpponent,
|
||||
pvpTeamLevel: dicPvpTeamLevel,
|
||||
pvpWar: dicWarPvp,
|
||||
pvpRefreshConsume: dicPvpRefreshConsume
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -251,4 +258,13 @@ export function getSuit(id: number) {
|
||||
export function getFuncsSwitch(id:number) {
|
||||
const funcInfo = gameData.funcsSwitch.get(id);
|
||||
return funcInfo;
|
||||
}
|
||||
|
||||
export function getPLvByScore(score: number) {
|
||||
let lv = 0;
|
||||
for(let {teamLv, topFiveMin, topFiveMax} of gameData.pvpTeamLevel) {
|
||||
if(score > topFiveMin) lv = teamLv;
|
||||
if(score < topFiveMax) break;
|
||||
}
|
||||
return lv;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// pvp三个对手
|
||||
import {readJsonFile} from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicPvpOpponent {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 战胜可得积分
|
||||
readonly score: number;
|
||||
// 匹配对手最高等级
|
||||
readonly maxLv: number;
|
||||
// 匹配对手最低等级
|
||||
readonly minLv: number;
|
||||
// 系数
|
||||
readonly ratio: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_OPPONENT);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicPvpOpponent = new Map<number, DicPvpOpponent>();
|
||||
|
||||
arr.forEach(o => {
|
||||
dicPvpOpponent.set(o.id, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
@@ -0,0 +1,25 @@
|
||||
// pvp三个对手
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicPvpRefreshConsume {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 次数
|
||||
readonly count: number;
|
||||
// 消耗
|
||||
readonly consume: RewardInter[]
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_TEAM_LEVEL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicPvpRefreshConsume = new Map<number, DicPvpRefreshConsume>();
|
||||
|
||||
arr.forEach(o => {
|
||||
o.consume = parseGoodStr(o.consume);
|
||||
dicPvpRefreshConsume.set(o.count, o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
@@ -0,0 +1,25 @@
|
||||
// pvp三个对手
|
||||
import { readJsonFile } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicPvpTeamLevel {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 队伍等级
|
||||
readonly teamLv: number;
|
||||
// 最高五人军功和下限
|
||||
readonly topFiveMin: number;
|
||||
// 最高五人军功和上限
|
||||
readonly topFiveMax: number;
|
||||
}
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_PVP_TEAM_LEVEL);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicPvpTeamLevel = new Array<DicPvpTeamLevel>();
|
||||
|
||||
arr.forEach(o => {
|
||||
dicPvpTeamLevel.push(o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
@@ -1,6 +1,6 @@
|
||||
// 关卡表
|
||||
import {decodeArrayListStr, readJsonFile} from '../util'
|
||||
import { WAR_RELATE_TABLES } from '../../consts';
|
||||
import { WAR_RELATE_TABLES, WAR_TYPE } from '../../consts';
|
||||
|
||||
export interface DicWar {
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface DicWar {
|
||||
}
|
||||
|
||||
export const dicWar = new Map<number, DicWar>();
|
||||
export const dicWarPvp = new Array<DicWar>();
|
||||
|
||||
for(let filename of WAR_RELATE_TABLES) {
|
||||
const str = readJsonFile(filename);
|
||||
@@ -40,10 +41,13 @@ for(let filename of WAR_RELATE_TABLES) {
|
||||
o.conditionReward = parseConditionReward(o.conditionReward);
|
||||
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
||||
dicWar.set(o.war_id, o);
|
||||
if(o.warType == WAR_TYPE.PVP) {
|
||||
dicWarPvp.push(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function parseFixReward(str: string) {
|
||||
function parseFixReward(str: string = '') {
|
||||
let result = new Array<{id: number, count: number}>();
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
@@ -56,7 +60,7 @@ function parseFixReward(str: string) {
|
||||
return result
|
||||
}
|
||||
|
||||
function parseConditionReward(str: string) {
|
||||
function parseConditionReward(str: string = '') {
|
||||
let result = new Array<{id: number, count: number, condition: number}>();
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
@@ -69,7 +73,7 @@ function parseConditionReward(str: string) {
|
||||
return result
|
||||
}
|
||||
|
||||
function parseRandomReward(str: string) {
|
||||
function parseRandomReward(str: string = '') {
|
||||
let result = new Array<{id: number, count: number, frequency: number}>();
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
|
||||
@@ -53,4 +53,5 @@ export interface SclPosInter {
|
||||
export interface SclResultInter {
|
||||
id: number;
|
||||
position: SclPosInter[]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import fs = require('fs');
|
||||
import path = require('path');
|
||||
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
||||
import { HERO_CE_RATIO, ABI_STAGE } from '../consts';
|
||||
import { PvpDefenseType } from '../db/PvpDefense';
|
||||
|
||||
const _ = require('underscore');
|
||||
|
||||
@@ -173,6 +174,10 @@ export function getRandomByLen(arr: Array<any>): any {
|
||||
return arr[Math.floor(Math.random() * len)]
|
||||
}
|
||||
|
||||
export function getRandomIndexByLen(len: number) {
|
||||
return Math.floor(Math.random() * len);
|
||||
}
|
||||
|
||||
export function getRandomWithWeight(randomList: any) {
|
||||
let len = randomList.reduce((pre, cur) => {
|
||||
return pre + cur.weight || 1;
|
||||
|
||||
Reference in New Issue
Block a user