主线:添加宝箱

This commit is contained in:
luying
2022-03-10 11:48:30 +08:00
parent f69c3955e0
commit 053e603301
10 changed files with 278 additions and 6 deletions

View File

@@ -537,6 +537,7 @@ export const FILENAME = {
DIC_JEWEL: 'dic_zyz_jewel',
DIC_STONE: 'dic_zyz_stone',
DIC_JEWEL_CONDITION: 'dic_zyz_jewel_condition',
DIC_MAIN_STAR_BOX: 'dic_zyz_main_star_reward',
}
export const WAR_RELATE_TABLES = [
@@ -1006,6 +1007,7 @@ export enum ITEM_CHANGE_REASON {
ACT_TASK_PASS = 142, // 活动-战令奖励
ACT_TASK_PASS_SPD_UP = 143, // 活动-战令加速
ACT_GUILD_PAY_REWARD = 144, // 活动-军团人数奖励
RECEIVE_CHAPTER_BOX = 145, // 领取主线章节宝箱
}
export enum TA_EVENT {

View File

@@ -57,6 +57,7 @@ export const STATUS = {
// 主线 20100 - 20199
BATTLE_INFO_VALIDATE_ERR: { code: 20101, simStr: '关卡信息不同' },
BATTLE_SWEEP_CONDITION_STAR: { code: 20102, simStr: '需要3星通过关卡才可以扫荡' },
BATTLE_NO_BOX_CAN_RECEIVE: { code: 20103, simStr: '宝箱不可领取' },
// 每日 20200 - 20299
DAILY_WAR_NOT_FOUND: { code: 20201, simStr: '未找到该关卡' },
DAILY_TYPE_NOT_FOUND: { code: 20202, simStr: '未找到该类型' },

View File

@@ -326,6 +326,8 @@ export default class Role extends BaseModel {
rankReceived: number[]; // 已领取奖励
@prop({ required: true, default: [], type: Number })
guide: number[]; // 引导
@prop({ required: true, default: [], type: Number })
receivedBox: number[]; // 引导
@prop({ required: true, default: false })
gachaHasGuide: boolean; // 是否进行过引导特殊招募
@@ -774,6 +776,10 @@ export default class Role extends BaseModel {
return result;
}
public static async receivedBox(roleId: string, ids: number[]) {
let rec: RoleType = await RoleModel.findOneAndUpdate({ roleId }, { $push: { receivedBox: { $each: ids } } }, { new: true }).lean();
return rec;
}
}
export const RoleModel = getModelForClass(Role);

View File

@@ -100,6 +100,7 @@ import { dicEquipStar, dicEquipStarIdByEquipId, loadEquipStar } from './dictiona
import { dicEquipQualityExtra, loadEquipQualityExtra } from './dictionary/DicEquipQualityExtra';
import { dicEquipSuit, dicEquipSuitByJobClass, loadEquipSuit } from "./dictionary/DicEquipSuit";
import { dicJewelCondition, loadJewelCondition } from './dictionary/DicJewelCondition';
import { dicMainStarBox, dicMainStarBoxByChapter, loadMainStarBox } from './dictionary/DicMainStarBox';
export const gameData = {
daily: dicDaily,
@@ -248,6 +249,8 @@ export const gameData = {
blueprt: dicBlueprt,
blueprtByLv: dicBlueprtByLv,
heroIdByWar: dicHeroIdByWar,
mainBox: dicMainStarBox,
mainBoxByChapter: dicMainStarBoxByChapter,
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据
@@ -1025,6 +1028,7 @@ function loadDatas() {
loadJewel();
loadStone();
loadJewelCondition();
loadMainStarBox();
}
// 重载dicParam

View File

@@ -0,0 +1,34 @@
// 主线星级宝箱
import {readFileAndParse, parseGoodStr} from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
export interface DicMainStarBox {
// id
readonly id: number;
// 章节id
readonly chapter: number;
// 星数
readonly star: number;
// 奖励
readonly reward: RewardInter[];
}
export const dicMainStarBox = new Map<number, DicMainStarBox>();
export const dicMainStarBoxByChapter = new Map<number, number[]>(); // chapter => ids;
export function loadMainStarBox() {
dicMainStarBox.clear();
dicMainStarBoxByChapter.clear();
let arr = readFileAndParse(FILENAME.DIC_MAIN_STAR_BOX);
arr.forEach(o => {
o.reward = parseGoodStr(o.reward);
dicMainStarBox.set(o.id, o);
if(!dicMainStarBoxByChapter.has(o.chapter)) {
dicMainStarBoxByChapter.set(o.chapter, []);
}
dicMainStarBoxByChapter.get(o.chapter).push(o.id);
});
arr = undefined;
}

View File

@@ -17,6 +17,8 @@ export interface DicWar {
readonly warType: number;
// 关卡名
readonly gk_name: string;
// 章节id
readonly chapter: number;
// 胜利后获得的君主经验
readonly kingExp: number;
// 进入战场所需的最低等级

View File

@@ -0,0 +1,146 @@
[
{
"id": 1,
"chapter": 1,
"star": 3,
"reward": "31002&500"
},
{
"id": 2,
"chapter": 1,
"star": 12,
"reward": "31002&500"
},
{
"id": 3,
"chapter": 1,
"star": 18,
"reward": "22001&30"
},
{
"id": 4,
"chapter": 2,
"star": 6,
"reward": "31002&500"
},
{
"id": 5,
"chapter": 2,
"star": 12,
"reward": "31002&500"
},
{
"id": 6,
"chapter": 2,
"star": 18,
"reward": "22001&30"
},
{
"id": 7,
"chapter": 3,
"star": 6,
"reward": "31002&500"
},
{
"id": 8,
"chapter": 3,
"star": 12,
"reward": "31002&500"
},
{
"id": 9,
"chapter": 3,
"star": 18,
"reward": "22001&30"
},
{
"id": 10,
"chapter": 4,
"star": 6,
"reward": "31002&500"
},
{
"id": 11,
"chapter": 4,
"star": 12,
"reward": "31002&500"
},
{
"id": 12,
"chapter": 4,
"star": 18,
"reward": "22001&30"
},
{
"id": 13,
"chapter": 5,
"star": 7,
"reward": "31002&500"
},
{
"id": 14,
"chapter": 5,
"star": 14,
"reward": "31002&500"
},
{
"id": 15,
"chapter": 5,
"star": 21,
"reward": "31002&500"
},
{
"id": 16,
"chapter": 5,
"star": 28,
"reward": "22001&30"
},
{
"id": 17,
"chapter": 6,
"star": 7,
"reward": "31002&500"
},
{
"id": 18,
"chapter": 6,
"star": 14,
"reward": "31002&500"
},
{
"id": 19,
"chapter": 6,
"star": 21,
"reward": "31002&500"
},
{
"id": 20,
"chapter": 6,
"star": 28,
"reward": "22001&30"
},
{
"id": 21,
"chapter": 7,
"star": 7,
"reward": "31002&500"
},
{
"id": 22,
"chapter": 7,
"star": 14,
"reward": "31002&500"
},
{
"id": 23,
"chapter": 7,
"star": 21,
"reward": "31002&500"
},
{
"id": 24,
"chapter": 7,
"star": 28,
"reward": "22001&30"
}
]