✨ feat(稷下学宫): ff931afe4到7421822f6
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 角色卡奖励卡池方案
|
||||
*/
|
||||
|
||||
import { FILENAME } from "../consts";
|
||||
import { readFileAndParse } from "./util";
|
||||
|
||||
export interface DicRougeCharaCardPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number; // 方案编号
|
||||
readonly cardId: number; // 角色卡id
|
||||
readonly weight: number; // 权重
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeCharaCardPlan = new Map<number, DicRougeCharaCardPlan[]>();
|
||||
|
||||
export function loadRougeCharaCardPlan() {
|
||||
dicRougeCharaCardPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_CHARA_CARD_PLAN);
|
||||
|
||||
|
||||
arr.forEach(o => {
|
||||
if (!dicRougeCharaCardPlan.has(o.planId)) {
|
||||
dicRougeCharaCardPlan.set(o.planId, []);
|
||||
}
|
||||
dicRougeCharaCardPlan.get(o.planId).push(o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 圣物卡奖励卡池方案
|
||||
*/
|
||||
|
||||
import { FILENAME } from "../consts";
|
||||
import { readFileAndParse } from "./util";
|
||||
|
||||
|
||||
export interface DicRougeHolyCardPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number; // 方案编号
|
||||
readonly cardId: number; // 角色卡id
|
||||
readonly weight: number; // 权重
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeHolyCardPlan = new Map<number, DicRougeHolyCardPlan[]>();
|
||||
|
||||
export function loadRougeHolyCardPlan() {
|
||||
dicRougeHolyCardPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_HOLY_CARD_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
if (!dicRougeHolyCardPlan.has(o.planId)) {
|
||||
dicRougeHolyCardPlan.set(o.planId, []);
|
||||
}
|
||||
dicRougeHolyCardPlan.get(o.planId).push(o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
+114
-1
@@ -141,6 +141,37 @@ import { dicAuthorsBookMaxProgress, dicAuthorsBookSubs, dicAuthorsBookSubStar, l
|
||||
import { dicAuthorsBookPoint, loadAuthorsBookPoint } from "./dictionary/DicAuthorsBookPoint";
|
||||
import { dicAuthorsBook, loadAuthorsBook } from './dictionary/DicAuthorsBook';
|
||||
import { dicBossRankActivePoint, loadBossRankActivePoint } from "./dictionary/DicBossRankActivePoint";
|
||||
// import { dicRougeType, loadRougeType } from "./dictionary/DicRougeType";
|
||||
import { dicRougeChara, dicRougeCharaByInitial, loadRougeChara } from "./dictionary/DicRougeChara";
|
||||
import { dicRougePassiveCardPlan, loadRougePassiveCardPlan } from "./dictionary/DicRougePassiveCardPlan";
|
||||
import { dicRougePassiveCard, dicRougePassiveCardByGroup, loadRougePassiveCard } from "./dictionary/DicRougePassiveCard";
|
||||
import { dicRougeSkillCard, loadRougeSkillCard } from "./dictionary/DicRougeSkillCard";
|
||||
import { dicRougeHolyCard, loadRougeHolyCard } from "./dictionary/DicRougeHolyCard";
|
||||
import { dicRougeLayerRewardPlan, loadRougeLayerRewardPlan } from "./dictionary/DicRougeLayerReward";
|
||||
import { dicRougeNode, loadRougeNode } from "./dictionary/DicRougeNode";
|
||||
import { dicRougeShopPlan, loadRougeShopPlan } from "./dictionary/DicRougeShopPlan";
|
||||
import { dicRougeTypeGrade, dicRougeTypeGradeById, loadRougeTypeGrade } from "./dictionary/DicRougeTypeGrade";
|
||||
import { dicRougeLayerPlan, dicRougeLayerPlanByPlanId, loadRougeLayerPlan } from "./dictionary/DicRougeLayerPlan";
|
||||
import { dicRougeLayerNodeNumPlan, loadRougeLayerNodeNumPlan } from "./dictionary/DicRougeLayerNodeNumPlan";
|
||||
import { dicRougeLayerNodePlan, loadRougeLayerNodePlan } from "./dictionary/DicRougeLayerNodePlan";
|
||||
import { dicRougeAuthorType, loadRougeAuthorType } from "./dictionary/DicRougeAuthorType";
|
||||
import { dicRougeChallenge, loadRougeChallenge } from "./dictionary/DicRougeChallenge";
|
||||
import { dicRougeChallengePlan, loadRougeChallengePlan } from "./dictionary/DicRougeChallengePlan";
|
||||
import { dicRougeQuestionMarkPlan, loadRougeQuestionMarkPlan } from "./dictionary/DicRougeQuestionMarkPlan";
|
||||
import { dicRougeRandomEventPlan, loadRougeRandomEventPlan } from "./dictionary/DicRougeRandomEventPlan";
|
||||
import { dicRougeCharaCardPlan, loadRougeCharaCardPlan } from "./DicRougeCharaCardPlan";
|
||||
import { dicRougeHolyCardPlan, loadRougeHolyCardPlan } from "./DicRougeHolyCardPlan";
|
||||
import { dicRougeEventOption, loadRougeEventOption } from "./dictionary/DicRougeEventOption";
|
||||
|
||||
import { dicRougeTech, loadRougeTech, dicRougeTechIdByRow } from "./dictionary/DicRougeTech";
|
||||
import { dicRougeTechCircle, dicRougeTechCircleByTechId, loadRougeTechCircle } from "./dictionary/DicRougeTechCircle";
|
||||
import { dicRougeTechLevel, loadRougeTechLevel } from "./dictionary/DicRougeTechLevel";
|
||||
import { dicRougeOptionGroup, loadRougeOptionGroup } from "./dictionary/DicRougeOptionGroup";
|
||||
import { dicRougePassiveCollect, loadRougePassiveCollect } from "./dictionary/DicRougePassiveCollect";
|
||||
import { dicRougeScoreNum, dicRougeScoreReward, loadRougeScoreReward } from "./dictionary/DicRougeScoreReward";
|
||||
import { dicRougeEffect, loadRougeEffect } from "./dictionary/DicRougeEffect";
|
||||
import { dicRougeEffectType, loadRougeEffectType } from "./dictionary/DicRougeEffectType";
|
||||
import { dicSpiritPlan, loadSpiritPlan } from "./dictionary/DicSpiritPlan";
|
||||
|
||||
export const gameData = {
|
||||
daily: dicDaily,
|
||||
@@ -361,6 +392,46 @@ export const gameData = {
|
||||
authorBookPoint: dicAuthorsBookPoint,
|
||||
authorBookMaxProgress: dicAuthorsBookMaxProgress,
|
||||
bossRankActivePoint: dicBossRankActivePoint,
|
||||
|
||||
// rougeType: dicRougeType, //暂时用不到
|
||||
rougeAuthorType: dicRougeAuthorType,
|
||||
rougeTypeGrade: dicRougeTypeGrade,
|
||||
rougeTypeGradeById: dicRougeTypeGradeById,
|
||||
rougeLayerPlan: dicRougeLayerPlan,
|
||||
spiritPlan: dicSpiritPlan,
|
||||
rougeLayerPlanByPlanId: dicRougeLayerPlanByPlanId,
|
||||
rougeLayerNodeNumPlan: dicRougeLayerNodeNumPlan,
|
||||
rougeLayerNodePlan: dicRougeLayerNodePlan,
|
||||
rougeNode: dicRougeNode,
|
||||
rougeLayerRewardPlan: dicRougeLayerRewardPlan,
|
||||
rougeShopPlan: dicRougeShopPlan,
|
||||
rougeChara: dicRougeChara,
|
||||
rougeCharaByInitial: dicRougeCharaByInitial,
|
||||
rougePassiveCard: dicRougePassiveCard,
|
||||
rougePassiveCardByGroup: dicRougePassiveCardByGroup,
|
||||
rougeSkillCard: dicRougeSkillCard,
|
||||
rougeHolyCard: dicRougeHolyCard,
|
||||
rougeCharaCardPlan: dicRougeCharaCardPlan,
|
||||
rougePassiveCardPlan: dicRougePassiveCardPlan,
|
||||
rougeHolyCardPlan: dicRougeHolyCardPlan,
|
||||
|
||||
rougeChallenge: dicRougeChallenge,
|
||||
rougeChallengePlan: dicRougeChallengePlan,
|
||||
rougeQuestionMarkPlan: dicRougeQuestionMarkPlan,
|
||||
rougeRandomEventPlan: dicRougeRandomEventPlan,
|
||||
rougeEventOption: dicRougeEventOption,
|
||||
rougeOptionGroup: dicRougeOptionGroup,
|
||||
rougePassiceCollect: dicRougePassiveCollect,
|
||||
rougeScoreReward: dicRougeScoreReward,
|
||||
rougeScoreNum: dicRougeScoreNum,
|
||||
rougeEffect: dicRougeEffect,
|
||||
rougeEffectType: dicRougeEffectType,
|
||||
|
||||
rougeTech: dicRougeTech,
|
||||
rougeTechCircle: dicRougeTechCircle,
|
||||
rougeCircleByTech: dicRougeTechCircleByTechId,
|
||||
rougeTechByRow: dicRougeTechIdByRow,
|
||||
rougeTechLevel: dicRougeTechLevel,
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -1298,6 +1369,16 @@ export function getDicServerName(env: string, serverId: number) {
|
||||
return dic.get(serverId);
|
||||
}
|
||||
|
||||
export function getRougeEffectTypeKind(effectTypes: number[]) {
|
||||
let kinds: number[] = [];
|
||||
for (let effectType of effectTypes) {
|
||||
let dicEffectType = gameData.rougeEffectType.get(effectType);
|
||||
if (!dicEffectType) continue;
|
||||
if (!kinds.includes(dicEffectType.kind)) kinds.push(dicEffectType.kind);
|
||||
}
|
||||
return kinds;
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
function initDatas() {
|
||||
parseDicParam();
|
||||
@@ -1675,9 +1756,41 @@ function loadDatas(type?: string) {
|
||||
loadAuthorsBookPoint();
|
||||
if (type == undefined || type == 'loadAuthorsBook')
|
||||
loadAuthorsBook();
|
||||
|
||||
if (type == undefined || type == 'loadBossRankActivePoint')
|
||||
loadBossRankActivePoint();
|
||||
|
||||
// if (type == undefined || type == 'loadRougeType') loadRougeType();//暂时用不到
|
||||
if (type == undefined || type == 'loadRougeAuthorType') loadRougeAuthorType();
|
||||
if (type == undefined || type == 'loadRougeTypeGrade') loadRougeTypeGrade();
|
||||
if (type == undefined || type == 'loadRougeLayerPlan') loadRougeLayerPlan();
|
||||
if (type == undefined || type == 'loadSpiritPlan') loadSpiritPlan();
|
||||
if (type == undefined || type == 'loadRougeLayerNodeNumPlan') loadRougeLayerNodeNumPlan();
|
||||
if (type == undefined || type == 'loadRougeLayerNodePlan') loadRougeLayerNodePlan();
|
||||
if (type == undefined || type == 'loadRougeNode') loadRougeNode();
|
||||
if (type == undefined || type == 'loadRougeLayerRewardPlan') loadRougeLayerRewardPlan();
|
||||
if (type == undefined || type == 'loadRougeShopPlan') loadRougeShopPlan();
|
||||
if (type == undefined || type == 'loadRougeChara') loadRougeChara();
|
||||
if (type == undefined || type == 'loadRougePassiveCard') loadRougePassiveCard();
|
||||
if (type == undefined || type == 'loadRougeSkillCard') loadRougeSkillCard();
|
||||
if (type == undefined || type == 'loadRougeHolyCard') loadRougeHolyCard();
|
||||
if (type == undefined || type == 'loadRougeCharaCardPlan') loadRougeCharaCardPlan();
|
||||
if (type == undefined || type == 'loadRougePassiveCardPlan') loadRougePassiveCardPlan();
|
||||
if (type == undefined || type == 'loadRougeHolyCardPlan') loadRougeHolyCardPlan();
|
||||
if (type == undefined || type === 'loadRougeChallenge') loadRougeChallenge();
|
||||
if (type == undefined || type == 'loadRougeChallengePlan') loadRougeChallengePlan();
|
||||
if (type == undefined || type == 'loadRougeQuestionMarkPlan') loadRougeQuestionMarkPlan();
|
||||
if (type == undefined || type == 'loadRougeRandomEventPlan') loadRougeRandomEventPlan();
|
||||
if (type == undefined || type == 'loadRougeEventOption') loadRougeEventOption();
|
||||
if (type == undefined || type == 'loadRougeOptionGroup') loadRougeOptionGroup();
|
||||
if (type == undefined || type == 'loadRougePassiveCollect') loadRougePassiveCollect();
|
||||
if (type == undefined || type == 'loadRougeScoreReward') loadRougeScoreReward();
|
||||
if (type == undefined || type == 'loadRougeEffect') loadRougeEffect();
|
||||
if (type == undefined || type == 'loadRougeEffectType') loadRougeEffectType();
|
||||
|
||||
if (type == undefined || type == 'loadRougeTech') loadRougeTech();
|
||||
if (type == undefined || type == 'loadRougeTechCircle') loadRougeTechCircle();
|
||||
if (type == undefined || type == 'loadRougeTechLevel') loadRougeTechLevel();
|
||||
|
||||
console.log('loadDatas type: ', type || 'all');
|
||||
}
|
||||
|
||||
|
||||
@@ -365,9 +365,14 @@ export const ACTIVITY = {
|
||||
ACTIVITY_CATCH_FISH_PROBABILITY: '1&45|2&40|3&15', // 新出现的鱼是什么类型的概率 type&概率(type=1:小黑鱼 type=2:大黑鱼 type=3:锦鲤)
|
||||
ACTIVITY_WATERCHANNEL_SCORE: '1&30|10&20|15&15|30&10', // 水渠小游戏的得分规则(min(含)&socre)区间下限至下一档之间的得分
|
||||
ACTIVITY_FLAPPY_BIRD_COUNTDOWN: 60, // 飞鸟小游戏倒计时(s)
|
||||
ACTIVITY_FLAPPY_BIRD_SCORE: 1, // 飞过每根柱子的得分
|
||||
ACTIVITY_FLAPPY_BIRD_SCORE: 2, // 飞过每根柱子的得分
|
||||
ACTIVITY_LAYER_CAKE_COUNTDOWN: 60, // 叠糕小游戏倒计时(s)
|
||||
ACTIVITY_LAYER_CAKE_SCORE: 1, // 每叠一层糕点的得分
|
||||
ACTIVITY_LAYER_CAKE_SCORE: 2, // 每叠一层糕点的得分
|
||||
ACTIVITY_RABBIT_FINDING_TIME: 20, // 大家来找茬每轮总次数
|
||||
ACTIVITY_RABBIT_PUSH_BOX_TIME: 60, // 推箱子小游戏倒计时
|
||||
ACTIVITY_RABBIT_PUSH_BOX_SCORE: 2, // 到达指定位置获得积分
|
||||
ACTIVITY_BEATING_TOWER: 15, // 敲塔小游戏总层数
|
||||
ACTIVITY_BEATING_SCORE: 2, // 敲塔小游戏成功敲掉一层所加分数
|
||||
};
|
||||
export const BATTLE_PREPARING = {
|
||||
CHANGE_ORDER_OPEN: 109, // 出兵界面行动顺序按钮开启关卡
|
||||
@@ -454,3 +459,18 @@ export const PLATFORM_CONFIG = {
|
||||
export const COMMUNICATION = {
|
||||
COMMUNICATION_FOLLOW: '31002&100|22001&2', // 关注公众号奖励
|
||||
};
|
||||
export const ROUGELIKE = {
|
||||
INIT_RANDOM_CHARA_COUNT: 3, // 初始需要随机的角色卡数量
|
||||
AUTHOR_ADD_RANDOM: 10, // 选择流派后该流派百家特性卡增加的权重X
|
||||
PASSIVE_LABLE_NUM: 3, // 获得X张同passiveLable的特性卡时,该label的特性卡权重增加
|
||||
PASSIVE_LABLE_ADD_RANDOM: 5, // 获得N张同passiveLable的特性卡时,该label的特性卡权重增加X
|
||||
HOLY_LABLE_NUM: 3, // 获得X张同hollyLable的特性卡时,该label的圣物权重增加
|
||||
HOLY_LABLE_ADD_RANDOM: 5, // 获得N张同hollyLable的特性卡时,该label的圣物权重增加X
|
||||
RECOVERY_RATIO: 50, // 休整点恢复系数,填整数,百分比
|
||||
TAKEOUT_REWARD_CNT: 3, // 每周可领取的额外奖励次数
|
||||
SPIRIT_RANDOM_NUM: 5, // 额外带出奖励的英灵随机数量
|
||||
SELECT_PASSIVECARD_WEIGHT: 30, // 选择的特性卡后该特性卡权重减少比例(%)
|
||||
RANDOM_PASSIVECARD_WEIGHT: 10, // 随机出的特性卡后该特性卡权重减少比例(%)
|
||||
SELECT_HOLLYCARD_WEIGHT: 30, // 选择的圣物卡后该特性卡权重减少比例(%)
|
||||
RANDOM_HOLLYCARD_WEIGHT: 10, // 随机出的圣物卡后该特性卡权重减少比例(%)
|
||||
};
|
||||
|
||||
@@ -41,10 +41,12 @@ export interface DicHero {
|
||||
readonly urType: number;
|
||||
// 武将id
|
||||
readonly actorId: number;
|
||||
|
||||
readonly hp: number;
|
||||
}
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicHeroKeys: KeysEnum<DicHero> = {heroId: true, name: true, quality: true, camp: true, jobClass: true, jobid: true, skill: true, pieceId: true, initialStar: true, initialColorStar: true, pieceCount: true, baseAbilityArr: true, baseAbilityUpArr: true, initialSkin: true, recruit: true, face_id: true, talentId: true, urType: true, actorId: true };
|
||||
const DicHeroKeys: KeysEnum<DicHero> = {heroId: true, name: true, quality: true, camp: true, jobClass: true, jobid: true, skill: true, pieceId: true, initialStar: true, initialColorStar: true, pieceCount: true, baseAbilityArr: true, baseAbilityUpArr: true, initialSkin: true, recruit: true, face_id: true, talentId: true, urType: true, actorId: true, hp: true };
|
||||
export const dicHero = new Map<number, DicHero>();
|
||||
export function loadHero() {
|
||||
dicHero.clear();
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 流派类型配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeAuthorType {
|
||||
readonly id: number;
|
||||
readonly authorType: number; // 流派类型
|
||||
// readonly holyCard: number; // 圣物奖励
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeAuthorType = new Map<number, DicRougeAuthorType>();
|
||||
export function loadRougeAuthorType() {
|
||||
dicRougeAuthorType.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_AUTHOR_TYPE);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRougeAuthorType.set(o.authorType, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 挑战类型配置表
|
||||
*/
|
||||
|
||||
import { parseNumberList, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeChallenge {
|
||||
readonly id: number;
|
||||
readonly challengeId: number; // 挑战
|
||||
readonly type: number; // 挑战的类型,具体是啥需要一个文档
|
||||
readonly effectId: number[]; // 挑战达成的参数
|
||||
readonly condition: number; // 客户端显示的 x/n,里面的n
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeChallenge = new Map<number, DicRougeChallenge>();
|
||||
export function loadRougeChallenge() {
|
||||
dicRougeChallenge.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_CHALLANGE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.effectId = parseNumberList(o.effectId);
|
||||
dicRougeChallenge.set(o.challengeId, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 挑战关随机配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeChallengePlan {
|
||||
readonly id: number;
|
||||
readonly planId: number;
|
||||
readonly challengeId: number; // 挑战关卡的id dicRougeChallenge的id
|
||||
readonly weight: number; // 权重
|
||||
}
|
||||
|
||||
export const dicRougeChallengePlan = new Map<number, DicRougeChallengePlan[]>();
|
||||
export function loadRougeChallengePlan() {
|
||||
dicRougeChallengePlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_CHALLANGE_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
if (!dicRougeChallengePlan.has(o.planId)) {
|
||||
dicRougeChallengePlan.set(o.planId, []);
|
||||
}
|
||||
dicRougeChallengePlan.get(o.planId).push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 角色卡配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeChara {
|
||||
readonly id: number;
|
||||
readonly heroId: number; // 角色id
|
||||
readonly charaType: number; // 1-普通卡 2-高级卡
|
||||
readonly initial: number; // 是否能被初始随机到
|
||||
readonly initCardCnt: number; // 初始获得多少特性卡装在身上
|
||||
readonly recruitConsume: number; // 试炼币购买
|
||||
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeChara = new Map<number, DicRougeChara>();
|
||||
export const dicRougeCharaByInitial = new Map<number, DicRougeChara[]>();
|
||||
|
||||
export function loadRougeChara() {
|
||||
dicRougeChara.clear();
|
||||
dicRougeCharaByInitial.clear();
|
||||
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_CHARA);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRougeChara.set(o.id, o);
|
||||
|
||||
if (!dicRougeCharaByInitial.has(o.initial)) {
|
||||
dicRougeCharaByInitial.set(o.initial, []);
|
||||
}
|
||||
dicRougeCharaByInitial.get(o.initial).push(o);
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 圣物效果配置表
|
||||
*/
|
||||
|
||||
import { decodeArrayListStr, readFileAndParse } from '../util'
|
||||
import { ABI_TYPE, FILENAME, ROUGE_EFFECT_TYPE } from '../../consts'
|
||||
|
||||
export interface DicRougeEffect {
|
||||
readonly id: number;
|
||||
readonly effectId: number;
|
||||
readonly effectType: number; // 效果的类型,具体什么type写个文档
|
||||
readonly effectParam: number[]; // 效果的具体参数,不同的type对这个param的解释不同需要分别定义,用&连接
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeEffect = new Map<number, DicRougeEffect>();
|
||||
export function loadRougeEffect() {
|
||||
dicRougeEffect.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_EFFECT);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.effectParam = parseEffectParam(o.effectType, o.effectParam);
|
||||
// console.log('effectParam', o.effectParam)
|
||||
// if (!dicRougeEffect.has(o.effectType)) {
|
||||
// dicRougeEffect.set(o.effectType, []);
|
||||
// }
|
||||
// dicRougeEffect.get(o.effectType).push(o);
|
||||
dicRougeEffect.set(o.effectId, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseEffectParam(effectType: number, str: string) {
|
||||
let arr = decodeArrayListStr(str);
|
||||
switch(effectType) {
|
||||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||||
case ROUGE_EFFECT_TYPE.HOLY_CHARA_MAIN_ATTR_UP:
|
||||
{
|
||||
arr = arr.filter(cur => cur[0] == ABI_TYPE.ABI_HP.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return arr.length > 0? arr[0].map(cur => parseFloat(cur)): [];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 圣物效果配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicRougeEffectType {
|
||||
readonly id: number;
|
||||
readonly effectType: number; // 效果的类型,具体什么type写个文档
|
||||
readonly kind: number;
|
||||
}
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicRougeEffectTypeKeys: KeysEnum<DicRougeEffectType> = {
|
||||
id: true,
|
||||
effectType: true,
|
||||
kind: true,
|
||||
}
|
||||
|
||||
export const dicRougeEffectType = new Map<number, DicRougeEffectType>();
|
||||
export function loadRougeEffectType() {
|
||||
dicRougeEffectType.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_EFFECT_TYPE);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRougeEffectType.set(o.effectType, _.pick(o, Object.keys(DicRougeEffectTypeKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 随机事件配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeEventOption {
|
||||
readonly id: number;
|
||||
readonly randomEventId: number; // 事件id
|
||||
readonly optionGroup: number; // 一组选项的组id
|
||||
readonly title: string //标题
|
||||
readonly index: number; // 选项在他这组里的索引
|
||||
readonly text: string; // 选项
|
||||
readonly afterGroup: number; // 选了这个选项之后的选项组
|
||||
readonly holyCardPlan: number; // 奖励的圣物
|
||||
}
|
||||
export const dicRougeEventOption = new Map<number, DicRougeEventOption>();
|
||||
export function loadRougeEventOption() {
|
||||
dicRougeEventOption.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_EVENT_OPTION);
|
||||
|
||||
arr.forEach(o => {
|
||||
|
||||
dicRougeEventOption.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 圣物
|
||||
*/
|
||||
|
||||
import { parseGoodStr, parseNumberList, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicRougeHolyCard {
|
||||
readonly id: number;
|
||||
readonly name: string;
|
||||
readonly imageName: string;
|
||||
readonly quality: number; // 品质
|
||||
readonly authorType: number; // 所属百家流派
|
||||
readonly skillId: number; // ?待解释,可能是战场技能
|
||||
readonly content: string;
|
||||
readonly useCount: number;
|
||||
readonly label: number; // 当获得同标签的百家特性卡达到X个,同标签的圣物获得概率增加
|
||||
readonly purchasePrice: number; // 试炼币购买
|
||||
readonly collectReward: RewardInter[];
|
||||
readonly effectId: number[];
|
||||
readonly getLimit: number; //获取上限
|
||||
}
|
||||
|
||||
export const dicRougeHolyCard = new Map<number, DicRougeHolyCard>();
|
||||
export function loadRougeHolyCard() {
|
||||
dicRougeHolyCard.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_HOLY_CARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.collectReward = parseGoodStr(o.collectReward);
|
||||
o.effectId = parseNumberList(o.effectId);
|
||||
|
||||
dicRougeHolyCard.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 每层可以随机的点的数量的池子
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeLayerNodeNumPlan {
|
||||
readonly id: number;
|
||||
readonly nodeNumPlanId: number; // 随机方案,dicRougeLayer的nodeNumPlan引用
|
||||
readonly nodeNum: number; // 节点数量
|
||||
readonly weight: number; // 他的权重
|
||||
}
|
||||
export const dicRougeLayerNodeNumPlan = new Map<number, DicRougeLayerNodeNumPlan[]>();
|
||||
|
||||
export function loadRougeLayerNodeNumPlan() {
|
||||
dicRougeLayerNodeNumPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_LAYER_NODE_NUM_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
|
||||
if (!dicRougeLayerNodeNumPlan.get(o.nodeNumPlanId)) dicRougeLayerNodeNumPlan.set(o.nodeNumPlanId, []);
|
||||
dicRougeLayerNodeNumPlan.get(o.nodeNumPlanId).push(o);
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 试炼难度配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeLayerNodePlan {
|
||||
readonly id: number;
|
||||
readonly nodePlanId: number; // 随机方案,dicRougeLayer的nodePlan引用
|
||||
readonly nodeId: number; // 节点的类型,引用的是 dicRougeNode 表的nodeId
|
||||
readonly weight: number;
|
||||
}
|
||||
// export const dicRougeLayerNodePlan = new Map<string, DicRougeLayerNodePlan>();
|
||||
export const dicRougeLayerNodePlan = new Map<number, DicRougeLayerNodePlan[]>();
|
||||
|
||||
export function loadRougeLayerNodePlan() {
|
||||
|
||||
dicRougeLayerNodePlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_LAYER_NODE_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
|
||||
if (!dicRougeLayerNodePlan.get(o.nodePlanId)) dicRougeLayerNodePlan.set(o.nodePlanId, []);
|
||||
dicRougeLayerNodePlan.get(o.nodePlanId).push(o);
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 试炼难度配置表
|
||||
*/
|
||||
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicRougeLayerPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number; // 试炼类型
|
||||
readonly layerIndex: number; // 层
|
||||
readonly nodeNumPlan: number; // 每层可以随机的点的数量
|
||||
readonly nodePlan: number; // 每层可以随机到的节点
|
||||
readonly rewardPlan: number; // 每层可以赠送的奖励
|
||||
readonly shopPlan: number; // 该层可以随机到的商店方案
|
||||
readonly takeoutReward: RewardInter[]; //额外奖励
|
||||
readonly spiritPlan: number; //英灵随机奖励
|
||||
}
|
||||
export const dicRougeLayerPlan = new Map<string, DicRougeLayerPlan>();
|
||||
export const dicRougeLayerPlanByPlanId = new Map<number, DicRougeLayerPlan[]>();
|
||||
|
||||
export function loadRougeLayerPlan() {
|
||||
dicRougeLayerPlan.clear();
|
||||
dicRougeLayerPlanByPlanId.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_LAYER_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
|
||||
o.takeoutReward = parseGoodStr(o.takeoutReward);
|
||||
dicRougeLayerPlan.set(o.planId + '_' + o.layerIndex, o);
|
||||
|
||||
if (!dicRougeLayerPlanByPlanId.get(o.planId)) dicRougeLayerPlanByPlanId.set(o.planId, []);
|
||||
dicRougeLayerPlanByPlanId.get(o.planId).push(o);
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 每层可随机到的奖励
|
||||
*/
|
||||
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeLayerRewardPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number;
|
||||
readonly nodeType: number; // 精英关、普通关、boss关、挑战、随机事件、休整点
|
||||
readonly charaPlan: number; // 角色卡
|
||||
readonly charaRandomNum: number; // 玩家可以随机出多少奖励
|
||||
readonly charaChooseNum: number; // 玩家可以从随机出的里选择多少奖励
|
||||
readonly charaPassivePlan: number; // 高级卡自带的特性卡
|
||||
readonly passiveCardPlan: number; // 特性卡
|
||||
readonly passiveCardRandomNum: number; // 玩家可以随机出多少奖励
|
||||
readonly passiveCardChooseNum: number; // 玩家可以从随机出的里选择多少奖励
|
||||
readonly holyCardPlan: number; // 圣物
|
||||
readonly holyCardRandomNum: number; // 玩家可以随机出多少奖励
|
||||
readonly holyCardChooseNum: number; // 玩家可以从随机出的里选择多少奖励
|
||||
readonly coin: number; // 试炼币
|
||||
readonly score: number; // 学分
|
||||
readonly tech: number; // 科技点
|
||||
// readonly goods: RewardInter[]; // 灵石 物品表id&count
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeLayerRewardPlan = new Map<string, DicRougeLayerRewardPlan>();
|
||||
export function loadRougeLayerRewardPlan() {
|
||||
dicRougeLayerRewardPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_LAYER_REWARD_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.goods = parseGoodStr(o.goods);
|
||||
dicRougeLayerRewardPlan.set(o.planId + '_' + o.nodeType, o);
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 关卡配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeNode {
|
||||
readonly id: number;
|
||||
readonly nodeId: number; // 关卡id
|
||||
readonly nodeType: number; // 试炼类型 普通关、精英关、boss关、挑战点、问号点、休整点、商店
|
||||
readonly param: number; // 普通关、精英关、boss关的对应关卡id
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeNode = new Map<number, DicRougeNode>();
|
||||
export function loadRougeNode() {
|
||||
dicRougeNode.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_NODE);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRougeNode.set(o.nodeId, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 随机事件图鉴
|
||||
*/
|
||||
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicRougeOptionGroup {
|
||||
readonly id: number;
|
||||
readonly optionGroup: number; // 一组选项的组id
|
||||
readonly collectReward: RewardInter[]; // 图鉴收集奖励(同Group只领取一次奖励)
|
||||
}
|
||||
export const dicRougeOptionGroup = new Map<number, DicRougeOptionGroup>();
|
||||
export function loadRougeOptionGroup() {
|
||||
dicRougeOptionGroup.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_OPTION_GROUP);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.collectReward = parseGoodStr(o.collectReward);
|
||||
dicRougeOptionGroup.set(o.optionGroup, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 特性卡
|
||||
*/
|
||||
|
||||
import { parseNumberList, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougePassiveCard {
|
||||
readonly id: number;
|
||||
readonly group: number; // 同样的group之间才可以特训
|
||||
readonly lv: number; // 特训等级,可以初始获得不同等级
|
||||
readonly name: string;
|
||||
readonly quality: number; // 品质
|
||||
readonly authorType: number; // 所属百家流派,在该流派试炼中出现概率提升
|
||||
readonly seid: string; // 纯战场、服务器不读
|
||||
readonly content: string;
|
||||
readonly passiveLabel: number[]; // 关联其他特性卡,获得这个特性卡之后他relationId的概率提升
|
||||
readonly holyLabel: number[]; // 关联圣物,获得这个特性卡之后圣物概率提升
|
||||
readonly strengthConsume: number; // 强化消耗
|
||||
readonly price: number; // 试炼币购买
|
||||
readonly getLimit: number; //获取上限
|
||||
}
|
||||
|
||||
export const dicRougePassiveCard = new Map<number, DicRougePassiveCard>();
|
||||
export const dicRougePassiveCardByGroup = new Map<number, DicRougePassiveCard[]>();
|
||||
export function loadRougePassiveCard() {
|
||||
dicRougePassiveCard.clear();
|
||||
dicRougePassiveCardByGroup.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_PASSIVE_CARD);
|
||||
|
||||
|
||||
arr.forEach(o => {
|
||||
o.passiveLabel = parseNumberList(o.passiveLabel);
|
||||
o.holyLabel = parseNumberList(o.holyLabel);
|
||||
|
||||
dicRougePassiveCard.set(o.id, o);
|
||||
if (!dicRougePassiveCardByGroup.has(o.group)) {
|
||||
dicRougePassiveCardByGroup.set(o.group, []);
|
||||
}
|
||||
dicRougePassiveCardByGroup.get(o.group).push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 特性卡奖励卡池方案
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougePassiveCardPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number; // 方案编号
|
||||
readonly cardId: number; // 角色卡id
|
||||
readonly weight: number; // 权重
|
||||
}
|
||||
|
||||
|
||||
export const dicRougePassiveCardPlan = new Map<number, DicRougePassiveCardPlan[]>();
|
||||
|
||||
export function loadRougePassiveCardPlan() {
|
||||
dicRougePassiveCardPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_PASSIVE_CARD_PLAN);
|
||||
|
||||
|
||||
arr.forEach(o => {
|
||||
if (!dicRougePassiveCardPlan.has(o.planId)) {
|
||||
dicRougePassiveCardPlan.set(o.planId, []);
|
||||
}
|
||||
dicRougePassiveCardPlan.get(o.planId).push(o);
|
||||
});
|
||||
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 特性卡
|
||||
*/
|
||||
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicRougePassiveCollect {
|
||||
readonly id: number;
|
||||
readonly num: number; // 收集数量
|
||||
readonly collectReward: RewardInter[]; // 奖励
|
||||
}
|
||||
|
||||
export const dicRougePassiveCollect = new Map<number, DicRougePassiveCollect>();
|
||||
export function loadRougePassiveCollect() {
|
||||
dicRougePassiveCollect.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_PASSIVE_COLLECT);
|
||||
|
||||
|
||||
arr.forEach(o => {
|
||||
o.collectReward = parseGoodStr(o.reward);
|
||||
dicRougePassiveCollect.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 问好点随机配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
|
||||
export interface DicRougeQuestionMarkPlan {
|
||||
readonly id: number;
|
||||
readonly questionMarkPlanId: number; // 问号点随机方案编号
|
||||
readonly questionMarkIndex: number; // 方案内node编号
|
||||
readonly nodeType: number; // 关卡类型 普通关、精英关、boss关、挑战点问号点、休整点、商店
|
||||
readonly param: number; // 普通关、精英关对应的warId
|
||||
readonly weight: number; //随机权重
|
||||
}
|
||||
|
||||
export const dicRougeQuestionMarkPlan = new Map<number, DicRougeQuestionMarkPlan[]>();
|
||||
|
||||
export function loadRougeQuestionMarkPlan() {
|
||||
dicRougeQuestionMarkPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_QUESTION_MARK_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
|
||||
if (!dicRougeQuestionMarkPlan.get(o.questionMarkPlanId)) dicRougeQuestionMarkPlan.set(o.questionMarkPlanId, []);
|
||||
dicRougeQuestionMarkPlan.get(o.questionMarkPlanId).push(o);
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 随机关卡配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeRandomEventPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number;
|
||||
readonly randomEventId: number; // 随机关卡的id dicRougeEventOption中的randomEventId
|
||||
readonly weight: number; // 权重
|
||||
}
|
||||
|
||||
export const dicRougeRandomEventPlan = new Map<number, DicRougeRandomEventPlan[]>();
|
||||
export function loadRougeRandomEventPlan() {
|
||||
dicRougeRandomEventPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_RANDOM_EVENT_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
if (!dicRougeRandomEventPlan.has(o.planId)) {
|
||||
dicRougeRandomEventPlan.set(o.planId, []);
|
||||
}
|
||||
dicRougeRandomEventPlan.get(o.planId).push(o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 随机事件图鉴
|
||||
*/
|
||||
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicRougeScoreReward {
|
||||
readonly index: number;
|
||||
readonly score: number; // 积分
|
||||
readonly reward: RewardInter[]; // 图鉴收集奖励(同Group只领取一次奖励)
|
||||
}
|
||||
export const dicRougeScoreReward = new Map<number, DicRougeScoreReward>();
|
||||
export const dicRougeScoreNum = { num: 0 }
|
||||
export function loadRougeScoreReward() {
|
||||
dicRougeScoreReward.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_SCORE_REWARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicRougeScoreReward.set(o.index, o);
|
||||
dicRougeScoreNum.num++;
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 试炼类型配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeShopPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number;
|
||||
readonly passivecardPlanId: number; // 特性卡
|
||||
readonly passiveCardRandomNum: number; // 玩家可以在商店随机出多少奖励
|
||||
readonly holyCardPlanId: number; // 圣物
|
||||
readonly holyCardRandomNum: number; // 玩家可以商店随机出多少奖励
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeShopPlan = new Map<number, DicRougeShopPlan>();
|
||||
export function loadRougeShopPlan() {
|
||||
dicRougeShopPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_SHOP_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
dicRougeShopPlan.set(o.planId, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 技能卡
|
||||
*/
|
||||
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicRougeSkillCard {
|
||||
readonly id: number;
|
||||
readonly name: string;
|
||||
readonly quality: number; // 品质
|
||||
readonly skillType: number; // 技能类型
|
||||
readonly authorType: number; // 所属百家流派,在该流派试炼中出现概率提升
|
||||
readonly skillId: number; // 战场技能
|
||||
readonly collectReward: RewardInter[];
|
||||
}
|
||||
|
||||
export const dicRougeSkillCard = new Map<number, DicRougeSkillCard>();
|
||||
export function loadRougeSkillCard() {
|
||||
dicRougeSkillCard.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_SKILL_CARD);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.collectReward = parseGoodStr(o.collectReward);
|
||||
dicRougeSkillCard.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 科技树配置
|
||||
*/
|
||||
|
||||
import { parseGoodStr, parseNumberList, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicRougeTech {
|
||||
readonly id: number;
|
||||
readonly techId: number; // 科技点
|
||||
readonly rowId: number; // 列
|
||||
readonly index: number; // 第几个
|
||||
readonly preTechId: number[]; // 前置节点
|
||||
readonly cost: RewardInter[]; // 消耗的科技点
|
||||
}
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
const DicRougeTechKeys: KeysEnum<DicRougeTech> = {
|
||||
id: true,
|
||||
techId: true,
|
||||
rowId: true,
|
||||
index: true,
|
||||
preTechId: true,
|
||||
cost: true,
|
||||
}
|
||||
|
||||
export const dicRougeTech = new Map<number, DicRougeTech>();
|
||||
export const dicRougeTechIdByRow = new Map<number, number[]>();
|
||||
|
||||
export function loadRougeTech() {
|
||||
dicRougeTech.clear();
|
||||
dicRougeTechIdByRow.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_TECH);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.preTechId = parseNumberList(o.preTechId);
|
||||
o.cost = parseGoodStr(o.cost);
|
||||
dicRougeTech.set(o.techId, _.pick(o, Object.keys(DicRougeTechKeys)));
|
||||
|
||||
if(!dicRougeTechIdByRow.has(o.rowId)) dicRougeTechIdByRow.set(o.rowId, []);
|
||||
dicRougeTechIdByRow.get(o.rowId)?.push(o.techId);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 科技树法阵配置
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicRougeTechCircle {
|
||||
readonly id: number;
|
||||
readonly techId: number; // 科技树
|
||||
readonly circleId: number; // 对应法阵id
|
||||
}
|
||||
|
||||
export const dicRougeTechCircle = new Map<number, number>();
|
||||
export const dicRougeTechCircleByTechId = new Map<number, number[]>();
|
||||
|
||||
export function loadRougeTechCircle() {
|
||||
dicRougeTechCircle.clear();
|
||||
dicRougeTechCircleByTechId.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_TECH_CIRCLE);
|
||||
|
||||
arr.forEach(o => {
|
||||
if(!dicRougeTechCircle.has(o.circleId)) dicRougeTechCircle.set(o.circleId, o.techId);
|
||||
if(!dicRougeTechCircleByTechId.has(o.techId)) dicRougeTechCircleByTechId.set(o.techId, []);
|
||||
if(!dicRougeTechCircleByTechId.get(o.techId).includes(o.circleId)) dicRougeTechCircleByTechId.get(o.techId).push(o.circleId);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 科技树法阵配置
|
||||
*/
|
||||
|
||||
import { parseNumberList, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicRougeTechLevel {
|
||||
readonly techId: number; // 对应等级
|
||||
readonly level: number; // 等级
|
||||
readonly ce: number; // 战力
|
||||
readonly techEffectIds: number[]; // 加成
|
||||
}
|
||||
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: boolean };
|
||||
const DicRougeTechCircleKeys: KeysEnum<DicRougeTechLevel> = {
|
||||
techId: true,
|
||||
level: true,
|
||||
ce: true,
|
||||
techEffectIds: true,
|
||||
}
|
||||
|
||||
export const dicRougeTechLevel = new Map<number, DicRougeTechLevel[]>();
|
||||
|
||||
export function loadRougeTechLevel() {
|
||||
dicRougeTechLevel.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_TECH_LEVEL);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.techEffectIds = parseNumberList(o.techEffectId);
|
||||
if(!dicRougeTechLevel.has(o.techId)) dicRougeTechLevel.set(o.techId, []);
|
||||
dicRougeTechLevel.get(o.techId)?.push(_.pick(o, Object.keys(DicRougeTechCircleKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 试炼类型配置表
|
||||
*/
|
||||
|
||||
export interface DicRougeType {
|
||||
readonly id: number;
|
||||
readonly type: number; // 试炼类型
|
||||
readonly grade: number; // 共有多少难度
|
||||
}
|
||||
|
||||
|
||||
export const dicRougeType = new Map<number, DicRougeType>();
|
||||
export function loadRougeType() {
|
||||
dicRougeType.clear();
|
||||
|
||||
// let arr = readFileAndParse(FILENAME.DIC_ROUGE_TYPE);
|
||||
|
||||
// arr.forEach(o => {
|
||||
// dicRougeType.set(o.type, o);
|
||||
// });
|
||||
// arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 试炼难度配置表
|
||||
*/
|
||||
|
||||
import { parseGoodStr, readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
|
||||
export interface DicRougeTypeGrade {
|
||||
readonly id: number;
|
||||
readonly type: number; // 试炼类型
|
||||
readonly gradeIndex: number; // 难度
|
||||
readonly lvLimit: number; // 等级限制
|
||||
readonly limitId: number; //解锁需要的前置id
|
||||
readonly buyRewardPlan: number; // 该试炼给的英灵奖励方案(dic_spiritPlan的id)
|
||||
readonly layerCount: number; // 共有多少层
|
||||
readonly layerPlan: number; // 每一层的配置,dicRougeLayerPlan的planId
|
||||
readonly challengePlan: number; // 这个试炼会随机出的挑战关卡的池子
|
||||
readonly randomEventPlan: number; // 该试炼随机事件的随机池方案
|
||||
readonly firstReward: RewardInter[]; // 首通奖励
|
||||
readonly heroValue: number;
|
||||
}
|
||||
export const dicRougeTypeGrade = new Map<string, DicRougeTypeGrade>();
|
||||
export const dicRougeTypeGradeById = new Map<number, DicRougeTypeGrade>();
|
||||
|
||||
export function loadRougeTypeGrade() {
|
||||
dicRougeTypeGrade.clear();
|
||||
dicRougeTypeGradeById.clear();
|
||||
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_ROUGE_TYPE_GRADE);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.firstReward = parseGoodStr(o.firstReward);
|
||||
|
||||
dicRougeTypeGrade.set(o.type + '_' + o.gradeIndex, o);
|
||||
|
||||
dicRougeTypeGradeById.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 英灵随机奖励配置表
|
||||
*/
|
||||
|
||||
import { readFileAndParse } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicSpiritPlan {
|
||||
readonly id: number;
|
||||
readonly planId: number;
|
||||
readonly spiritId: number;
|
||||
readonly weight: number;
|
||||
}
|
||||
export const dicSpiritPlan = new Map<number, DicSpiritPlan[]>();
|
||||
|
||||
export function loadSpiritPlan() {
|
||||
dicSpiritPlan.clear();
|
||||
|
||||
let arr = readFileAndParse(FILENAME.DIC_SPIRIT_PLAN);
|
||||
|
||||
arr.forEach(o => {
|
||||
|
||||
if (!dicSpiritPlan.has(o.planId)) dicSpiritPlan.set(o.planId, []);
|
||||
dicSpiritPlan.get(o.planId).push(o);
|
||||
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
// 一些通用的interface定义
|
||||
|
||||
import { RougelikeCardPara } from "../db/RougelikeCard";
|
||||
import { RougelikeCharaPara } from "../db/RougelikeChara";
|
||||
import { RougelikeCollectionType } from "../db/RougelikeCollection";
|
||||
import { UserGuildType } from "../db/UserGuild";
|
||||
|
||||
export interface RewardInter {
|
||||
@@ -39,6 +42,16 @@ export interface pvpEndParamInter {
|
||||
underDamage: number;
|
||||
}
|
||||
|
||||
export interface RougeDamageInter {
|
||||
charaCode: string;
|
||||
hp: number;
|
||||
ap: number;
|
||||
shield: number;
|
||||
damage: number;
|
||||
heal: number;
|
||||
unserDamage: number;
|
||||
}
|
||||
|
||||
export interface Uid {
|
||||
uid: string;
|
||||
sid: string;
|
||||
@@ -69,4 +82,119 @@ export interface guildInter {
|
||||
export interface recycleSoulFastPara {
|
||||
hid: number;
|
||||
count: number;
|
||||
}
|
||||
}
|
||||
|
||||
export class CommonCard {
|
||||
cardCode: string; // 卡code
|
||||
cardId: number; // 卡ID
|
||||
type: number; // 卡类型
|
||||
charaId: number; // 装备在哪个角色上,没有装备为0
|
||||
lv: number; // 卡的等级
|
||||
useCount: number;
|
||||
|
||||
constructor(card: RougelikeCardPara) {
|
||||
this.cardCode = card?.cardCode || '';
|
||||
this.cardId = card?.cardId || 0;
|
||||
this.type = card?.type || 0;
|
||||
this.charaId = card?.charaId || 0;
|
||||
this.lv = card?.lv || 0;
|
||||
this.useCount = card?.useCount || 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export class CommonChara {
|
||||
charaCode: string; // 角色卡唯一id
|
||||
seqId: number; // 排序
|
||||
charaId: number; // 角色卡id
|
||||
cards: { // 卡槽,没有那个index表示没有解锁
|
||||
index: number;
|
||||
cardCode: string;
|
||||
cardId: number; // 当为0的时候表示没有装入卡片
|
||||
}[];
|
||||
hp: number; // 当前hp
|
||||
maxHp: number; // 最大hp
|
||||
ap: number; // 当前怒气
|
||||
shield: number;
|
||||
roundSkill: number; // 玩家选择的回合技能卡
|
||||
apSkill: number; // 玩家选择的怒气技能卡
|
||||
|
||||
constructor(chara: RougelikeCharaPara) {
|
||||
this.charaCode = chara?.charaCode || '';
|
||||
this.seqId = chara?.seqId || 0;
|
||||
this.charaId = chara?.charaId || 0;
|
||||
this.cards = chara?.cards || [];
|
||||
this.hp = chara?.hp || 0;
|
||||
this.maxHp = chara?.maxHp || 0;
|
||||
this.ap = chara?.ap || 0;
|
||||
this.shield = chara?.shield || 0;
|
||||
this.roundSkill = chara?.roundSkill || 0;
|
||||
this.apSkill = chara?.apSkill || 0;
|
||||
}
|
||||
};
|
||||
|
||||
export class CollectionReturnParam {
|
||||
type: number = 0; // 类型
|
||||
id: number = 0; // 图鉴id
|
||||
num: number = 0; // 图鉴达成数量
|
||||
received: number[] = []; // 是否领取
|
||||
|
||||
constructor(collect: RougelikeCollectionType) {
|
||||
this.type = collect?.type || 0;
|
||||
this.id = collect?.id || 0;
|
||||
this.num = collect?.num || 0;
|
||||
this.received = collect?.received || [];
|
||||
}
|
||||
}
|
||||
|
||||
export interface layerNode {
|
||||
detailCode: string;
|
||||
index: number; // 索引
|
||||
nodeId: number; // 关卡id
|
||||
preNodeIndexs: number[]; // 连线的关卡,填上一层节点的索引
|
||||
type: number; // 类型
|
||||
isChoose: number; // 玩家选择,0-未选择,1-选择
|
||||
}
|
||||
export interface CommonNode {
|
||||
layer: number; // 层
|
||||
layerNodes: layerNode[];
|
||||
};
|
||||
|
||||
|
||||
export interface WeightRecord {
|
||||
originalWight?: number;
|
||||
passiveRedWight?: number;
|
||||
holyRedWight?: number;
|
||||
authorAddWeight?: number;
|
||||
passiveLableNum?: number;
|
||||
passiveLableNumAddWeight?: number;
|
||||
holyLableNum?: number;
|
||||
holyLableNumAddWeight?: number;
|
||||
finalWeight?: number;
|
||||
}
|
||||
export interface RewardOption {
|
||||
optionIndex: number; // 第几个选项
|
||||
rewardId: number; // 角色卡的id或特性卡的id或圣物的id
|
||||
optionStatus: number; // 0-没有选择这个奖励 1-选择了这个奖励
|
||||
passiveCardIds?: number[]; //高级学员自带特性卡
|
||||
weightRecord?: WeightRecord //用于测试权重记录
|
||||
}
|
||||
|
||||
export interface CommonReward {
|
||||
rewards?: {
|
||||
groupIndex: number; // 奖励的索引值
|
||||
rewardType: number; // 奖励的类型 1-角色卡 2-特性卡 3-圣物
|
||||
options?: RewardOption[]; // 奖励的选项,试炼币大概就不用了
|
||||
groupStatus: number; // 组选择 0-未选择 1-已选择
|
||||
chooseNum?: number; // 这一组总共能选的数量3选2
|
||||
}[];
|
||||
takeoutReward?: RewardInter[]; // 可以外带的奖励 id&count
|
||||
score?: number; // 增加的积分
|
||||
techScore?: number; // 增加的科技分
|
||||
}
|
||||
|
||||
|
||||
export interface SlotCard {
|
||||
index: number; //卡槽标记
|
||||
cardCode: string; //安装的特性卡唯一code
|
||||
}
|
||||
+130
-76
@@ -80,11 +80,11 @@ export function genCode(len) {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 len 长度的随机字符串
|
||||
* @param len 长度
|
||||
* @param radix 基数
|
||||
*/
|
||||
/**
|
||||
* 生成 len 长度的随机字符串
|
||||
* @param len 长度
|
||||
* @param radix 基数
|
||||
*/
|
||||
export function generateStr(len: number, radix = 36) {
|
||||
return `${csprng(len, radix)}`;
|
||||
}
|
||||
@@ -140,8 +140,8 @@ export function decodeIdCntArrayStr(str: string, multi: number) {
|
||||
* @param proTime 之后的时间
|
||||
*/
|
||||
export function deltaDays(preTime: Date, proTime: Date, useNaturalZero = false): number {
|
||||
let beginZeroPoint = getZeroPointOfTimeD(preTime, SHOP_REFRESH_TYPE.DAILY, useNaturalZero? 0: REFRESH_TIME);
|
||||
let endZeroPoint = getZeroPointOfTimeD(proTime, SHOP_REFRESH_TYPE.DAILY, useNaturalZero? 0: REFRESH_TIME);
|
||||
let beginZeroPoint = getZeroPointOfTimeD(preTime, SHOP_REFRESH_TYPE.DAILY, useNaturalZero ? 0 : REFRESH_TIME);
|
||||
let endZeroPoint = getZeroPointOfTimeD(proTime, SHOP_REFRESH_TYPE.DAILY, useNaturalZero ? 0 : REFRESH_TIME);
|
||||
return moment(endZeroPoint).diff(moment(beginZeroPoint), "days");
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ export function getRandSingleIndex(len: number) {
|
||||
*/
|
||||
export function getRandEelmWithWeight<T extends { weight: number }>(randomList: T[]): { dic: T, index: number } {
|
||||
let len = randomList.reduce((pre, cur) => {
|
||||
return pre + (cur.weight||0);
|
||||
return pre + (cur.weight || 0);
|
||||
}, 0);
|
||||
let index = Math.floor(Math.random() * len);
|
||||
let result = { dic: null, index: -1 };
|
||||
@@ -243,6 +243,45 @@ export function getRandEelmWithWeight<T extends { weight: number }>(randomList:
|
||||
return result
|
||||
}
|
||||
|
||||
export function getRandEelmWithWeightAndNum<T extends { weight: number }>(randomList: T[], num: number): { dic: T, index: number }[] {
|
||||
let result: { dic: T, index: number }[] = [];
|
||||
let remainingList = randomList.slice(); // Make a copy of randomList to work with
|
||||
|
||||
for (let n = 0; n < Math.min(num, randomList.length); n++) {
|
||||
if (remainingList.length === 0) {
|
||||
// If there are no more elements to choose from, exit the loop
|
||||
break;
|
||||
}
|
||||
|
||||
let len = remainingList.reduce((pre, cur) => {
|
||||
return pre + (cur.weight || 0);
|
||||
}, 0);
|
||||
|
||||
let index = Math.floor(Math.random() * len);
|
||||
let found = false;
|
||||
|
||||
for (let i = 0; i < remainingList.length; i++) {
|
||||
let { weight = 0 } = remainingList[i];
|
||||
if (index < weight) {
|
||||
result.push({ dic: remainingList[i], index: randomList.indexOf(remainingList[i]) });
|
||||
remainingList.splice(i, 1); // Remove the selected element from the list
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
index -= weight;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
// In case the index exceeds the weights, add a default value
|
||||
result.push({ dic: null, index: -1 });
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 不改变原数组长度,将内部元素打乱
|
||||
* @param source
|
||||
@@ -271,10 +310,12 @@ export function getRandValue(base: number, ratio: number, decimal = 2): number {
|
||||
*/
|
||||
export function getRandValueByMinMax(min: number, max: number, decimal = 2): number {
|
||||
let pow = Math.pow(10, decimal);
|
||||
return Math.floor((min + (max - min) * Math.random()) * pow)/pow;
|
||||
return Math.floor((min + (max - min) * Math.random()) * pow) / pow;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function resResult<T>(status: { code: number, simStr: string }, data: T = <T>{}, customMsg = ''): { code: number, msg: string, data: T } {
|
||||
const { code, simStr } = status;
|
||||
if (code !== STATUS.SUCCESS.code) {
|
||||
@@ -349,7 +390,7 @@ export const cal = {
|
||||
|
||||
export function getDecimalCnt(num: number) {
|
||||
let str = num.toString();
|
||||
return str.split('.')[1]? str.split('.')[1].length: 0;
|
||||
return str.split('.')[1] ? str.split('.')[1].length : 0;
|
||||
}
|
||||
|
||||
//计算公式
|
||||
@@ -371,9 +412,9 @@ export function getDecimalCnt(num: number) {
|
||||
// }
|
||||
// }
|
||||
|
||||
export function ratioReward(reward: {id: number, count: number}[], ratio: number): {id: number, count: number}[] {
|
||||
export function ratioReward(reward: { id: number, count: number }[], ratio: number): { id: number, count: number }[] {
|
||||
return reward.map(cur => {
|
||||
return {id: cur.id, count: cur.count * ratio}
|
||||
return { id: cur.id, count: cur.count * ratio }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -426,7 +467,7 @@ export function readFileAndParseJson(path: string) {
|
||||
try {
|
||||
let readResult = readFile(path);
|
||||
return JSON.parse(readResult);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
throw new Error(`connectors.json 格式错误:${(<Error>e).message}`);
|
||||
}
|
||||
}
|
||||
@@ -462,9 +503,9 @@ export function readServerNameFileList() {
|
||||
|
||||
export function readWordTxt(fileName: string) {
|
||||
try {
|
||||
let file = fs.readFileSync(path.resolve(__dirname, `../resource/${fileName}.txt`)).toString('utf8').replace(/^\uFEFF/, '');
|
||||
let file = fs.readFileSync(path.resolve(__dirname, `../resource/${fileName}.txt`)).toString('utf8').replace(/^\uFEFF/, '');
|
||||
return file;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return null
|
||||
}
|
||||
@@ -472,18 +513,18 @@ export function readWordTxt(fileName: string) {
|
||||
|
||||
export function writeWordTxt(fileName: string, words: string) {
|
||||
try {
|
||||
let file = fs.writeFileSync(path.resolve(__dirname, `../resource/${fileName}.txt`), words);
|
||||
let file = fs.writeFileSync(path.resolve(__dirname, `../resource/${fileName}.txt`), words);
|
||||
return file;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function readTsFile(fileName: string) {
|
||||
try {
|
||||
let file = fs.readFileSync(path.resolve(__dirname, `../pubUtils/${fileName}.js`)).toString('utf8').replace(/^\uFEFF/, '');
|
||||
let file = fs.readFileSync(path.resolve(__dirname, `../pubUtils/${fileName}.js`)).toString('utf8').replace(/^\uFEFF/, '');
|
||||
return file;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -492,7 +533,7 @@ export function readFileAndParse(fileName: string) {
|
||||
try {
|
||||
let readResult = readJsonFile(fileName);
|
||||
return JSON.parse(readResult);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
throw new Error(`${fileName}格式错误:${(<Error>e).message}`);
|
||||
}
|
||||
}
|
||||
@@ -500,11 +541,11 @@ export function readFileAndParse(fileName: string) {
|
||||
export function readWarJsonFileAndParse() {
|
||||
let warJsons = readWarJsonFileList();
|
||||
let result = [];
|
||||
for(let { name, str } of warJsons) {
|
||||
for (let { name, str } of warJsons) {
|
||||
try {
|
||||
let json = JSON.parse(str);
|
||||
result.push(json);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
throw new Error(`${name}格式错误:${(<Error>e).message}`);
|
||||
}
|
||||
}
|
||||
@@ -622,7 +663,7 @@ export function checkRoleIsRobot(roleId: string) {
|
||||
|
||||
// 将一般的roleId转为带_r的
|
||||
export function makeRobotId(roleId: string, sysType?: ROBOT_SYS_TYPE) {
|
||||
if(sysType) {
|
||||
if (sysType) {
|
||||
return `${sysType}|${roleId}_r`;
|
||||
} else {
|
||||
return `${roleId}_r`;
|
||||
@@ -631,7 +672,7 @@ export function makeRobotId(roleId: string, sysType?: ROBOT_SYS_TYPE) {
|
||||
// 获取来源系统
|
||||
export function getRobotSysType(roleId: string) {
|
||||
let type = roleId.split('|')[0];
|
||||
if(isNaN(parseInt(type))) {
|
||||
if (isNaN(parseInt(type))) {
|
||||
return 0
|
||||
} else {
|
||||
return parseInt(type);
|
||||
@@ -658,13 +699,13 @@ export function splitString(dataString: string, key: string) {
|
||||
|
||||
|
||||
export function isTimestamp(time: number, len = 10) {
|
||||
if(!isNumber(time)) return false;
|
||||
if(time.toString().length != len) return false;
|
||||
if (!isNumber(time)) return false;
|
||||
if (time.toString().length != len) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getReasonByWarType(warType: number) {
|
||||
switch(warType) {
|
||||
switch (warType) {
|
||||
case WAR_TYPE.NORMAL:
|
||||
return ITEM_CHANGE_REASON.NORMAL_BATTLE_END;
|
||||
case WAR_TYPE.VESTIGE:
|
||||
@@ -708,55 +749,55 @@ export function getReasonByWarType(warType: number) {
|
||||
return ITEM_CHANGE_REASON.BOSS_BATTLE_END;
|
||||
case WAR_TYPE.LADDER:
|
||||
return ITEM_CHANGE_REASON.LADDER_BATTLE_REWARD;
|
||||
default:
|
||||
default:
|
||||
return ITEM_CHANGE_REASON.NORMAL_BATTLE_END;
|
||||
}
|
||||
}
|
||||
|
||||
export function getWarTypeName(warType: number) {
|
||||
switch(warType) {
|
||||
case WAR_TYPE.NORMAL: return '主线';
|
||||
case WAR_TYPE.VESTIGE: return '支线';
|
||||
case WAR_TYPE.EVENT: return '事件';
|
||||
case WAR_TYPE.DAILY: return '每日';
|
||||
case WAR_TYPE.EXPEDITION: return '远征';
|
||||
case WAR_TYPE.MYSTERY: return '秘境';
|
||||
case WAR_TYPE.COM_BATTLE: return '寻宝';
|
||||
case WAR_TYPE.TOWER: return '镇念塔';
|
||||
case WAR_TYPE.PVP: return '竞技';
|
||||
case WAR_TYPE.GUILD_ACTIVITY: return '军团活动';
|
||||
case WAR_TYPE.GUILD_TRAIN: return '训练场';
|
||||
case WAR_TYPE.MAIN_ELITE: return '主线精英';
|
||||
case WAR_TYPE.BRANCH_ELITE: return '梦魇支线';
|
||||
case WAR_TYPE.BRANCH: return '支线';
|
||||
case WAR_TYPE.ACT_TREASURE_HUNT: return '运营活动-神州探秘';
|
||||
case WAR_TYPE.ACT_SELF_SHOP: return '运营活动-糜家商队';
|
||||
case WAR_TYPE.ACT_DAILY_GK: return '运营活动-节日活动';
|
||||
case WAR_TYPE.ACT_NEW_HERO_GK: return '新武将活动关卡';
|
||||
case WAR_TYPE.TRY: return '试用关卡';
|
||||
case WAR_TYPE.BOSS: return '演武台';
|
||||
switch (warType) {
|
||||
case WAR_TYPE.NORMAL: return '主线';
|
||||
case WAR_TYPE.VESTIGE: return '支线';
|
||||
case WAR_TYPE.EVENT: return '事件';
|
||||
case WAR_TYPE.DAILY: return '每日';
|
||||
case WAR_TYPE.EXPEDITION: return '远征';
|
||||
case WAR_TYPE.MYSTERY: return '秘境';
|
||||
case WAR_TYPE.COM_BATTLE: return '寻宝';
|
||||
case WAR_TYPE.TOWER: return '镇念塔';
|
||||
case WAR_TYPE.PVP: return '竞技';
|
||||
case WAR_TYPE.GUILD_ACTIVITY: return '军团活动';
|
||||
case WAR_TYPE.GUILD_TRAIN: return '训练场';
|
||||
case WAR_TYPE.MAIN_ELITE: return '主线精英';
|
||||
case WAR_TYPE.BRANCH_ELITE: return '梦魇支线';
|
||||
case WAR_TYPE.BRANCH: return '支线';
|
||||
case WAR_TYPE.ACT_TREASURE_HUNT: return '运营活动-神州探秘';
|
||||
case WAR_TYPE.ACT_SELF_SHOP: return '运营活动-糜家商队';
|
||||
case WAR_TYPE.ACT_DAILY_GK: return '运营活动-节日活动';
|
||||
case WAR_TYPE.ACT_NEW_HERO_GK: return '新武将活动关卡';
|
||||
case WAR_TYPE.TRY: return '试用关卡';
|
||||
case WAR_TYPE.BOSS: return '演武台';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一群人分总数固定的东西
|
||||
* @param total 总数
|
||||
* @param max 每个人能拿到的最大数量
|
||||
* @param memberCnt 人数
|
||||
*/
|
||||
export function getRandResultByMember(total: number, max: number, memberCnt: number) {
|
||||
let arr: number[] = [];
|
||||
for(let i = 1; i <= memberCnt; i++) {
|
||||
let randMax = total > max? max: total;
|
||||
let randMin = total - (memberCnt - i) * max;
|
||||
if(randMin < 0) randMin = 0;
|
||||
if(randMin > max) randMin = max;
|
||||
let rand = getRandValueByMinMax(randMin, randMax + 1, 0);
|
||||
arr.push(rand);
|
||||
total -= rand;
|
||||
}
|
||||
return { arr, remain: total }
|
||||
}
|
||||
/**
|
||||
* 一群人分总数固定的东西
|
||||
* @param total 总数
|
||||
* @param max 每个人能拿到的最大数量
|
||||
* @param memberCnt 人数
|
||||
*/
|
||||
export function getRandResultByMember(total: number, max: number, memberCnt: number) {
|
||||
let arr: number[] = [];
|
||||
for (let i = 1; i <= memberCnt; i++) {
|
||||
let randMax = total > max ? max : total;
|
||||
let randMin = total - (memberCnt - i) * max;
|
||||
if (randMin < 0) randMin = 0;
|
||||
if (randMin > max) randMin = max;
|
||||
let rand = getRandValueByMinMax(randMin, randMax + 1, 0);
|
||||
arr.push(rand);
|
||||
total -= rand;
|
||||
}
|
||||
return { arr, remain: total }
|
||||
}
|
||||
|
||||
//数据格式转换'id&数量|id&数量|' ->> Array<RewardInter> 老资源格式
|
||||
export function stringToRewardInter(rewardStr: string): Array<RewardInter> {
|
||||
@@ -773,16 +814,16 @@ export function stringToRewardInter(rewardStr: string): Array<RewardInter> {
|
||||
}
|
||||
|
||||
export function addToMap<T>(map: Map<T, number>, id: T, value: number) {
|
||||
if(!map.has(id)) {
|
||||
if (!map.has(id)) {
|
||||
map.set(id, value);
|
||||
} else {
|
||||
map.set(id, map.get(id) + value);
|
||||
}
|
||||
}
|
||||
|
||||
export function arrToMap<T>(arr: T[], getKey: (obj: T) => number|string): Map<number, T> {
|
||||
export function arrToMap<T>(arr: T[], getKey: (obj: T) => number | string): Map<number, T> {
|
||||
let map = new Map();
|
||||
for(let obj of arr) {
|
||||
for (let obj of arr) {
|
||||
let key = getKey(obj);
|
||||
map.set(key, obj);
|
||||
}
|
||||
@@ -841,12 +882,12 @@ export function getGachaRemainFloor(gachaId: number, userFloor: Floor[]) {
|
||||
let dicGacha = gameData.gacha.get(gachaId);
|
||||
if(dicGacha.gachaType != GACHA_TYPE.NORMAL && dicGacha.gachaType != GACHA_TYPE.ACTIVITY && dicGacha.gachaType != GACHA_TYPE.TAUTOR) return 0;
|
||||
|
||||
for(let floorId of dicGacha.floor) {
|
||||
for (let floorId of dicGacha.floor) {
|
||||
let dicGachaFloor = gameData.gachaFloor.get(floorId);
|
||||
if(dicGachaFloor && dicGachaFloor.floorType == GACHA_FLOOR_TYPE.MAIN_FLOOR) {
|
||||
if (dicGachaFloor && dicGachaFloor.floorType == GACHA_FLOOR_TYPE.MAIN_FLOOR) {
|
||||
let myFloor = userFloor.find(cur => cur.id == floorId);
|
||||
|
||||
return dicGachaFloor.param - (myFloor?.count||0);
|
||||
return dicGachaFloor.param - (myFloor?.count || 0);
|
||||
}
|
||||
}
|
||||
return 0
|
||||
@@ -859,7 +900,7 @@ export function isDevelopEnv(env: string) {
|
||||
|
||||
export function getArrayOfNumber(len: number) {
|
||||
let arr: number[] = [];
|
||||
for(let i = 1; i <= len; i++) arr.push(i);
|
||||
for (let i = 1; i <= len; i++) arr.push(i);
|
||||
return arr;
|
||||
}
|
||||
|
||||
@@ -890,4 +931,17 @@ export function swapFields(originObj: object, targetObj: object, fieldsToSwap: s
|
||||
originObj[field] = targetObj[field];
|
||||
targetObj[field] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
export function compareNumberArray(arrA: number[], arrB: number[]) {
|
||||
if(arrA.length != arrB.length) return false;
|
||||
let sortArrA: number[] = [], sortArrB: number[] = [];
|
||||
for(let a of arrA) sortArrA.push(a);
|
||||
for(let b of arrB) sortArrB.push(b);
|
||||
sortArrA.sort();
|
||||
sortArrB.sort();
|
||||
for(let i = 0; i < sortArrA.length; i++) {
|
||||
if(sortArrA[i] != sortArrB[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user