feat(诸子列传): 添加功能

This commit is contained in:
luying
2023-07-12 17:38:19 +08:00
parent b1af8ad204
commit 1eb6f76cce
25 changed files with 5475 additions and 71 deletions

View File

@@ -0,0 +1,179 @@
import { Application, BackendSession, HandlerService, } from "pinus";
import { STATUS, HERO_SYSTEM_TYPE, ITEM_CHANGE_REASON, TASK_TYPE } from "../../../consts";
import { ArtifactModel, ArtifactModelType, ArtifactModelUpdate } from "../../../db/Artifact";
import { HeroModel } from "../../../db/Hero";
import { ArtifactParam } from "../../../domain/roleField/hero";
import { gameData, getArtifactByGidAndType, getArtifactStageZero, getArtifactWithQuality, getDicArtifactLvByPlanId, getDicAuthorBookSub, getNextArtifact } from "../../../pubUtils/data";
import { ARTIFACT, BAG } from "../../../pubUtils/dicParam";
import { ItemInter, RewardInter } from "../../../pubUtils/interface";
import { resResult, parseGoodStr, arrToMap, genCode } from "../../../pubUtils/util";
import { checkArtifactCanCompose, getRebuildConsume, hasArtifactStrength } from "../../../services/equipService";
import { calculateCeWithHero, calculateCeWithRole } from "../../../services/playerCeService";
import { CheckMeterial } from "../../../services/role/checkMaterial";
import { addItems, handleCost } from "../../../services/role/rewardService";
import { combineItems } from "../../../services/role/util";
import { checkTask } from "../../../services/task/taskService";
import { AuthorBookModel } from "../../../db/AuthorBook";
import { checkAuthorBookLimit, replaceAuthorBooks } from "../../../services/roleService";
export default function (app: Application) {
new HandlerService(app, {});
return new AuthorsBookHandler(app);
}
export class AuthorsBookHandler {
constructor(private app: Application) {
}
public async starUp(msg: { bookId: number, subId: number, star: number, useItem: boolean }, session: BackendSession) {
const roleId: string = session.get('roleId');
const sid: string = session.get('sid');
const roleName: string = session.get('roleName');
const serverId: number = session.get('serverId');
const { bookId, subId, star, useItem } = msg;
let allAuthorBooks = await AuthorBookModel.findByRoleId(roleId);
let authorBookData = allAuthorBooks.find(authorBook => authorBook.bookId == bookId);
let starInData = authorBookData?.authors?.find(cur => cur.subId == subId)?.star??0;
if(star != starInData) return resResult(STATUS.ACCESS_BUSY);
let dicAuthorsBookSub = getDicAuthorBookSub(bookId, subId, star + 1);
if(!dicAuthorsBookSub) return resResult(STATUS.AUTHOR_BOOK_SUB_MAX);
// 是否解锁(进度解锁)
if(!checkAuthorBookLimit(allAuthorBooks, bookId)) return resResult(STATUS.AUTHOR_BOOK_LOCK);
// 英灵是否够
let check = new CheckMeterial(roleId);
let isEnough = await check.decreaseItemsContinue(dicAuthorsBookSub.spirits);
console.log('@@@@@@@@@@ isEnough', isEnough, dicAuthorsBookSub.spirits)
let useItemCnt = 0;
if(useItem) { // 使用英灵石代替
if(!isEnough) {
let notEnoughItems = check.getNotEnoughItems();
console.log('@@@@@@@@ getNotEnoughItems', notEnoughItems)
let replaceItems: RewardInter[] = [];
for(let [ id, count ] of notEnoughItems) {
let dicSpirit = gameData.spirit.get(id);
if(!dicSpirit) return resResult(STATUS.DIC_DATA_NOT_FOUND); // 应该是表填错,正常情况不可能出现
for(let item of dicSpirit.composeItem) {
replaceItems.push({ id: item.id, count: item.count * count });
useItemCnt += item.count * count;
}
}
isEnough = await check.decreaseItemsContinue(replaceItems);
}
}
if(!isEnough) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
let consumes = check.getConsume();
let costResult = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.AUTHOR_BOOK_STAR_UP);
if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
// 升星
authorBookData = await AuthorBookModel.upStar(roleId, bookId, subId, star, dicAuthorsBookSub.value, gameData.authorBookSubs.get(bookId)||[]);
if(!authorBookData) {
// 防并发问题
await addItems(roleId, roleName, sid, consumes, ITEM_CHANGE_REASON.AUTHOR_BOOK_STAR_RETURN);
return resResult(STATUS.ACCESS_BUSY);
}
// 计算战力更新
await calculateCeWithRole(HERO_SYSTEM_TYPE.AUTHOR_BOOK_STAR, roleId, serverId, sid, {}, { authorBooks: replaceAuthorBooks(allAuthorBooks, authorBookData), bookId, subId });
let curAuthorBook = authorBookData.authors?.find(cur => cur.subId == subId);
let maxProgress = gameData.authorBookMaxProgress.get(bookId)??0;
return resResult(STATUS.SUCCESS, {
bookId,
subId,
star: curAuthorBook?.star??0,
progress: authorBookData.progress,
maxProgress,
useItemCnt
});
}
// 重置条目
public async resetAuthor(msg: { bookId: number, subId: number, star: number }, session: BackendSession) {
const roleId: string = session.get('roleId');
const sid: string = session.get('sid');
const roleName: string = session.get('roleName');
const serverId: number = session.get('serverId');
const { bookId, subId, star } = msg;
let allAuthorBooks = await AuthorBookModel.findByRoleId(roleId);
let authorBookData = allAuthorBooks.find(authorBook => authorBook.bookId == bookId);
if(!authorBookData) return resResult(STATUS.ACCESS_BUSY)
let starInData = authorBookData?.authors?.find(cur => cur.subId == subId)?.star??0;
if(star != starInData) return resResult(STATUS.ACCESS_BUSY);
let progress = 0, spirits: RewardInter[] = [];
for(let i = 1; i <= star; i++) {
let dicAuthorsBookSub = getDicAuthorBookSub(bookId, subId, i);
if(!dicAuthorsBookSub) return resResult(STATUS.DIC_DATA_NOT_FOUND);
progress += dicAuthorsBookSub.value;
spirits.push(...dicAuthorsBookSub.spirits);
}
// 重置诸子列传
authorBookData = await AuthorBookModel.resetSub(roleId, bookId, subId, star, -progress);
if(!authorBookData) return resResult(STATUS.ACCESS_BUSY);
let goods = await addItems(roleId, roleName, sid, combineItems(spirits), ITEM_CHANGE_REASON.AUTHOR_BOOK_SUB_RESET);
// 计算战力更新
await calculateCeWithRole(HERO_SYSTEM_TYPE.AUTHOR_BOOK_SUB_RESET, roleId, serverId, sid, {}, { authorBooks: replaceAuthorBooks(allAuthorBooks, authorBookData), bookId, subId });
let curAuthorBook = authorBookData.authors?.find(cur => cur.subId == subId);
let maxProgress = gameData.authorBookMaxProgress.get(bookId)??0;
return resResult(STATUS.SUCCESS, {
bookId,
subId,
star: curAuthorBook?.star??0,
progress: authorBookData.progress,
maxProgress,
goods
});
}
// 买英灵
public async buySpirit(msg: { id: number, count: number }, session: BackendSession) {
let roleId: string = session.get('roleId');
let sid: string = session.get('sid');
let roleName: string = session.get('roleName');
const { id, count } = msg;
let dicSpirit = gameData.spirit.get(id);
if(!dicSpirit) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let consumes = dicSpirit.composeItem.map(cur => ({ id: cur.id, count: cur.count * count }));
let costResult = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.BUY_SPIRIT);
if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
let reward = [{ id, count }];
let goods = await addItems(roleId, roleName, sid, reward, ITEM_CHANGE_REASON.BUY_SPIRIT);
return resResult(STATUS.SUCCESS, { goods });
}
public async decomposeSpirit(msg: { id: number, count: number }, session: BackendSession) {
let roleId: string = session.get('roleId');
let sid: string = session.get('sid');
let roleName: string = session.get('roleName');
const { id, count } = msg;
let dicSpirit = gameData.spirit.get(id);
if(!dicSpirit) return resResult(STATUS.DIC_DATA_NOT_FOUND);
let consumes = [{ id, count }];
let costResult = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.DECOMPOSE_SPIRIT);
if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
let reward = dicSpirit.decomposeItem;
let goods = await addItems(roleId, roleName, sid, reward, ITEM_CHANGE_REASON.DECOMPOSE_SPIRIT);
return resResult(STATUS.SUCCESS, { goods });
}
}

View File

@@ -2012,6 +2012,23 @@ export function checkRouteParam(route: string, msg: any) {
if(!isBoolean(msg.hasComment)) return false;
break;
}
case "role.authorsBookHandler.starUp":
{
if(!checkNaturalNumbers(msg.bookId, msg.subId, msg.star)) return false;
if(!isBoolean(msg.useItem)) return false;
break;
}
case "role.authorsBookHandler.resetAuthor":
{
if(!checkNaturalNumbers(msg.bookId, msg.subId, msg.star)) return false;
break;
}
case "role.authorsBookHandler.buySpirit":
case "role.authorsBookHandler.decomposeSpirit":
{
if(!checkNaturalNumbers(msg.id, msg.count)) return false;
break;
}
case 'activity.dragonBoatHandler.gameStart':
case 'activity.dragonBoatHandler.gameEnd':
{

View File

@@ -52,6 +52,8 @@ import { ArtifactModel } from '../db/Artifact';
import { ActivityItemModel } from '../db/ActivityItem';
import { LinkModel } from '../db/Link';
import { getHiddenData } from './memoryCache/hiddenData';
import { AuthorBookModel } from '../db/AuthorBook';
import { gameData } from '../pubUtils/data';
/**
* init: 初始的时候是否推送 true-推 false-不推
@@ -128,7 +130,6 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
let artifacts = await ArtifactModel.findbyRole(role.roleId, ARTIFACT_SELECT.ENTRY);
let activityItems = await ActivityItemModel.findbyRole(role.roleId, ACTIVITYITEM_SELECT.ENTRY);
let link = await LinkModel.findByType(SNS_LINK_TYPE.CUSTOMER);
role['heros'] = heros.map(hero => new HeroParam(hero));
role['jewels'] = jewels;
role['consumeGoods'] = items;
@@ -138,6 +139,7 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
role['ipLocation'] = role.fixedIpLocation||role.ipLocation||'未知';
role['artifacts'] = artifacts;
role['activityItems'] = activityItems;
role['authorBook'] = await getAuthorBook(role.roleId);
if (!role.showLineup) role.showLineup = role.topLineup.map(cur => cur.hid);
role.heads = role.heads.filter(cur => cur.status);
@@ -433,3 +435,12 @@ export async function leaveServer(session: FrontendOrBackendSession) {
incServerNum(sid, -1);
incConnectorNum(sid, -1);
}
async function getAuthorBook(roleId: string) {
let authorBooks = await AuthorBookModel.findByRoleId(roleId);
return authorBooks.map(authorBook => {
let maxProgress = gameData.authorBookMaxProgress.get(authorBook.bookId);
let { bookId, authors, progress } = authorBook;
return { bookId, authors, progress, maxProgress: maxProgress??0 }
})
}

View File

@@ -21,6 +21,7 @@ import { SkinType } from '../db/Skin';
import { LadderMatchModel } from '../db/LadderMatch';
import { ArtifactModelType } from '../db/Artifact';
import { GVGVestigeRankModel } from '../db/GVGVestigeRank';
import { AuthorBookType } from '../db/AuthorBook';
interface Param {
isInitRole?: boolean,
@@ -49,6 +50,9 @@ interface Param {
artifact?: ArtifactModelType,
artifacts?: ArtifactModelType[],
job?: number,
authorBooks?: AuthorBookType[],
bookId?: number,
subId?: number,
}
export async function calculateCeWithHero(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, hid: number, heroUpdate: HeroUpdate, param: Param = {}) {
@@ -427,6 +431,14 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
break;
}
case HERO_SYSTEM_TYPE.AUTHOR_BOOK_STAR: // 40. 诸子百家升星
{
let { authorBooks = [], bookId, subId } = param;
calCe.setAuthorBooks(authorBooks);
ceChangeTxt.push(`诸子列传 ${bookId}${subId} 重置星级`);
break;
}
}
let { heroCe, roleInc } = calCe.getCeInc(); // 计算战力,获得有变化的武将战力
let changeHids: number[] = [];

View File

@@ -1,12 +1,13 @@
import { ABI_STAGE, ABI_STAGE_TO_TYPE, ABI_TYPE, ABI_TYPE_MAIN, LINEUP_NUM, SEID_TYPE, TALENT_RELATION_TYPE } from "../../consts";
import { ArtifactModelType } from "../../db/Artifact";
import { AuthorBookType } from "../../db/AuthorBook";
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Stone, Talent } from "../../db/Hero";
import { JewelType } from "../../db/Jewel";
import { RoleUpdate, Teraph } from "../../db/Role";
import { AttrCell, Attribute, EquipAttr, HeroAttr, RoleCeType, SchoolAttr, ScrollAttr } from "../../db/RoleCe";
import { TopHero } from "../../domain/dbGeneral";
import { AttributeCal } from "../../domain/roleField/attribute";
import { gameData, getDicArtifactLvByPlanId, getEquipQualityIdByEquipIdAndPoint, getEquipStarAttrByStage, getEquipStrenthenAttr, getEquipSuitByHero, getFriendShipByIdAndLv, getHeroStarByQuality, getHeroWakeByQuality, getJewelConditionByLvAndSeId, getJobByGradeAndClass, getSchoolRateByStar, getScollByStar, getTeraph } from "../../pubUtils/data";
import { gameData, getDicArtifactLvByPlanId, getDicAuthorBookSub, getEquipQualityIdByEquipIdAndPoint, getEquipStarAttrByStage, getEquipStrenthenAttr, getEquipSuitByHero, getFriendShipByIdAndLv, getHeroStarByQuality, getHeroWakeByQuality, getJewelConditionByLvAndSeId, getJobByGradeAndClass, getSchoolRateByStar, getScollByStar, getTeraph } from "../../pubUtils/data";
import { DicRandomEffectPool } from "../../pubUtils/dictionary/DicRandomEffectPool";
import { DicSe } from "../../pubUtils/dictionary/DicSe";
import { addToMap, deepCopy } from "../../pubUtils/util";
@@ -47,20 +48,20 @@ export class CalCe {
for(let attrId = ABI_TYPE.ABI_HP; attrId < ABI_TYPE.ABI_MAX; attrId++) {
if(!this.data.heroAttrs.has(`${hid}_${attrId}`) && !this.data.globalAttrs.has(attrId)) continue;
let { mainBase = 0, mainBaseUp = 0, subBase = 0, job = 0, starUp = 0, connect = 0, talent = 0, equipQuality = 0, equipStrength = 0, equipStar = 0, equipSuit = 0, jewel = 0, stone = 0, artifactLv = 0, artifactQuality = 0, artifactSeid = 0, jewelBase = 0 } = this.data.heroAttrs.get(`${hid}_${attrId}`)||{};
let { school = 0, teraph = 0, title = 0, scroll = 0, skin = 0 } = this.data.getGlobalAttrById(attrId)||{};
let { school = 0, teraph = 0, title = 0, scroll = 0, skin = 0, authorBook = 0 } = this.data.getGlobalAttrById(attrId)||{};
let val = 0, ceVal = 0, str = '', ceStr = '';
if(ABI_TYPE_MAIN.indexOf(attrId) != -1) {
// {[ hp1 + lv * hp2 ] * ( 1 + hp5 ) + [( hp6 + hp7 ) * ( 1 + hp8 )]} * ( 1 + hp9 ) + hp10 + hp11 + hp14
val = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 + artifactSeid/100) + stone + teraph + title + scroll + artifactLv + artifactQuality + jewelBase;
ceVal = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 + artifactSeid/100) + stone + teraph + title + scroll + artifactLv + artifactQuality + jewelBase;
str += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100+${artifactSeid}/100)+${stone}+${teraph}+${title}+${scroll}+${artifactLv}+${artifactQuality}+${jewelBase}`;
ceStr += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100+${artifactSeid}/100)+${stone}+${teraph}+${title}+${scroll}+${artifactLv}+${artifactQuality}+${jewelBase}`;
val = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 + artifactSeid/100) + stone + teraph + title + scroll + artifactLv + artifactQuality + jewelBase + authorBook;
ceVal = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 + artifactSeid/100) + stone + teraph + title + scroll + artifactLv + artifactQuality + jewelBase + authorBook;
str += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100+${artifactSeid}/100)+${stone}+${teraph}+${title}+${scroll}+${artifactLv}+${artifactQuality}+${jewelBase}+${authorBook}`;
ceStr += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100+${artifactSeid}/100)+${stone}+${teraph}+${title}+${scroll}+${artifactLv}+${artifactQuality}+${jewelBase}+${authorBook}`;
} else {
// attr1 + attr2 + attr4 + attr5 + attr6 + attr7 + attr9
val = subBase + job + teraph + school + title + jewel + equipStar;
ceVal = job + teraph + school + title + jewel + equipStar;
str += `${subBase}+${job}+${teraph}+${school}+${title}+${jewel}+${equipStar}`;
ceStr += `${job}+${teraph}+${school}+${title}+${jewel}+${equipStar}`;
// attr1 + attr2 + attr4 + attr5 + attr6 + attr7 + attr9 + attr10
val = subBase + job + teraph + school + title + jewel + equipStar + authorBook;
ceVal = job + teraph + school + title + jewel + equipStar + authorBook;
str += `${subBase}+${job}+${teraph}+${school}+${title}+${jewel}+${equipStar}+${authorBook}`;
ceStr += `${job}+${teraph}+${school}+${title}+${jewel}+${equipStar}+${authorBook}`;
}
if(!attrs.has(hid)) attrs.set(hid, []);
attrs.get(hid).push({ id: attrId, val, ceVal, str, ceStr });
@@ -566,6 +567,34 @@ export class CalCe {
}
}
// 诸子列传属性
public setAuthorBooks(authorBooks: AuthorBookType[]) {
this.data.clearRoleAttr('authorBook');
let attrResult = new Map<number, number>();
for(let { bookId, progress, authors } of authorBooks) {
// 升星的属性
for(let { subId, star } of authors) {
let dicAuthorBook = getDicAuthorBookSub(bookId, subId, star);
if(dicAuthorBook) {
for(let {id, val} of dicAuthorBook.attr) addToMap(attrResult, id, val);
}
}
let dicPoints = gameData.authorBookPoint.get(bookId)||[];
for(let { value, attr } of dicPoints) {
if(progress > value) {
for(let { id, val } of attr) addToMap(attrResult, id, val);
}
}
}
for(let [attrId, value] of attrResult) {
let globalAttr = this.data.getGlobalAttrById(attrId);
globalAttr.authorBook = value;
}
}
// 宝物品质
public setArtifactQuality(hid: number, artifactId: number) {
this.data.clearHeroAttrByHid(hid, 'artifactQuality');
@@ -969,6 +998,7 @@ abstract class GlobalAllAttr {
title: number = 0;
scroll: number = 0;
skin: number = 0;
authorBook: number = 0;
constructor(attrId: number) {
this.attrId = attrId;
@@ -1003,6 +1033,8 @@ class GlobalMainAttr extends GlobalAllAttr {
this.scroll = value; break;
case GLOBAL_MAIN_ATTR_INDEX.SKIN:
this.skin = value; break;
case GLOBAL_MAIN_ATTR_INDEX.AUTH_BOOK:
this.authorBook = value; break;
}
}
}
@@ -1027,6 +1059,9 @@ class GlobalMainAttr extends GlobalAllAttr {
case GLOBAL_MAIN_ATTR_INDEX.SKIN:
values.push(this.skin);
break;
case GLOBAL_MAIN_ATTR_INDEX.AUTH_BOOK:
values.push(this.authorBook);
break;
}
}
return values;
@@ -1042,12 +1077,14 @@ class GlobalSubAttr extends GlobalAllAttr {
switch(i) {
case GLOBAL_SUB_ATTR_INDEX.SCHOOL:
this.school = value; break;
case GLOBAL_MAIN_ATTR_INDEX.TERAPH:
case GLOBAL_SUB_ATTR_INDEX.TERAPH:
this.teraph = value; break;
case GLOBAL_MAIN_ATTR_INDEX.TITLE:
case GLOBAL_SUB_ATTR_INDEX.TITLE:
this.title = value; break;
case GLOBAL_MAIN_ATTR_INDEX.SKIN:
case GLOBAL_SUB_ATTR_INDEX.SKIN:
this.skin = value; break;
case GLOBAL_SUB_ATTR_INDEX.AUTH_BOOK:
this.authorBook = value; break;
}
}
}
@@ -1055,20 +1092,23 @@ class GlobalSubAttr extends GlobalAllAttr {
public getValues() {
let values: number[] = [];
for(let i = GLOBAL_MAIN_ATTR_INDEX.START; i < GLOBAL_MAIN_ATTR_INDEX.END; i++) {
for(let i = GLOBAL_SUB_ATTR_INDEX.START; i < GLOBAL_SUB_ATTR_INDEX.END; i++) {
switch(i) {
case GLOBAL_MAIN_ATTR_INDEX.SCHOOL:
case GLOBAL_SUB_ATTR_INDEX.SCHOOL:
values.push(this.school);
break;
case GLOBAL_MAIN_ATTR_INDEX.TERAPH:
case GLOBAL_SUB_ATTR_INDEX.TERAPH:
values.push(this.teraph);
break;
case GLOBAL_MAIN_ATTR_INDEX.TITLE:
case GLOBAL_SUB_ATTR_INDEX.TITLE:
values.push(this.title);
break;
case GLOBAL_MAIN_ATTR_INDEX.SKIN:
case GLOBAL_SUB_ATTR_INDEX.SKIN:
values.push(this.skin);
break;
case GLOBAL_SUB_ATTR_INDEX.AUTH_BOOK:
values.push(this.authorBook);
break;
}
}
return values;
@@ -1382,6 +1422,7 @@ enum GLOBAL_MAIN_ATTR_INDEX {
TITLE = 2, // hp11, 爵位加成(dic_zyz_title的hp)
SCROLL = 3, // hp11名将谱加成(dic_zyz_heroScroll的hp)
SKIN = 4, // hp12, 皮肤加成(dic_zyz_fashion的actorAttr)
AUTH_BOOK = 5, // hp16诸子列传
END
}
@@ -1391,6 +1432,7 @@ enum GLOBAL_SUB_ATTR_INDEX {
TERAPH = 1, // attr4, 神像加成(dic_zyz_teraph中的assistAttrValue)
TITLE = 2, // attr6, 爵位dic_zyz_title中的pdi、mdi
SKIN = 3, // attr8, 皮肤
AUTH_BOOK = 4, // attr10诸子列传
END
}

View File

@@ -36,7 +36,7 @@ export class CheckMeterial {
this.notEnoughItems.set(id, this.notEnoughItems.get(id) + count);
}
private getNotEnoughItems() {
public getNotEnoughItems() {
let map = new Map<number, number>();
for(let [ id, count ] of this.notEnoughItems) {
map.set(id, count);
@@ -74,6 +74,27 @@ export class CheckMeterial {
return true;
}
// 当消耗不足的时候,不提前返回,也不去算元宝和铜币
public async decreaseItemsContinue(goods: {id: number, count: number}[]) {
this.tempConsumes.splice(0, this.tempConsumes.length);
this.notEnoughItems.clear();
let { items } = sortItems(goods, HANDLE_REWARD_TYPE.COST);
let itemIsEnough = true;
for(let { id, count} of items) {
let notEnoughCount = await this.decreaseItem(id, count);
if(notEnoughCount > 0) {
let isEnough = await this.checkReplaceItem(id, notEnoughCount);
if(isEnough) {
this.tempConsumes.push({ id, count: count - notEnoughCount });
} else {
itemIsEnough = false;
}
}
}
this.consumes.push(...this.tempConsumes);
return itemIsEnough;
}
public setCanReplace(canReplace: boolean) {
this.canReplace = canReplace;
}

View File

@@ -1,6 +1,6 @@
import { Channel, pinus } from 'pinus';
import { getRandValueByMinMax, getRandEelm, decodeIdCntArrayStr, compareVersion } from '../pubUtils/util';
import { DEFAULT_HEROES, LINEUP_NUM, ROLE_SELECT, TALENT_RELATION_TYPE, TERAPH_RANDOM, SYSTEM_OPEN_ID, GuideUnloadNum, CHECK_HERO_CONSUME, ABI_STAGE } from "../consts";
import { DEFAULT_HEROES, LINEUP_NUM, ROLE_SELECT, TALENT_RELATION_TYPE, TERAPH_RANDOM, SYSTEM_OPEN_ID, GuideUnloadNum, CHECK_HERO_CONSUME, ABI_STAGE, AUTHOR_BOOK_LIMIT_TYPE } from "../consts";
import { DicTeraph } from '../pubUtils/dictionary/DicTeraph';
import { Teraph, RoleModel, RoleType, RoleUpdate } from '../db/Role';
import { SCHOOL } from '../pubUtils/dicParam';
@@ -18,6 +18,7 @@ import { getServerCreateTime } from './redisService';
import { checkWhiteList } from '../pubUtils/sysUtil';
import { nowSeconds } from '../pubUtils/timeUtil';
import { ServerlistModel } from '../db/Serverlist';
import { AuthorBookModel, AuthorBookType } from '../db/AuthorBook';
const query = new IP2Region({ disableIpv6: true });
@@ -357,3 +358,36 @@ function decreaseConsume(origin: Reward[], pieceId: number, decrease: number) {
}
return { consumes, newConsumes };
}
/**
* 诸子列表是否解锁
* @param roleId
* @param bookId
* @returns true: 可以解锁 false不可解锁
*/
export function checkAuthorBookLimit(authorBooks: AuthorBookType[], bookId: number) {
let dicAuthorsBook = gameData.authorBook.get(bookId);
if(!dicAuthorsBook) return false;
for(let { type, bookId, value } of dicAuthorsBook.limit) {
if(type == AUTHOR_BOOK_LIMIT_TYPE.ALL) {
let allProgress = authorBooks.reduce((pre, cur) => pre + cur.progress, 0);
if(allProgress < value) return false;
} else if(type == AUTHOR_BOOK_LIMIT_TYPE.ASSIGN) {
let curBook = authorBooks.find(cur => cur.bookId == bookId);
let progress = curBook?.progress??0;
if(progress < value) return false;
}
}
return true;
}
export function replaceAuthorBooks(authorBooks: AuthorBookType[], authorBook: AuthorBookType) {
let index = authorBooks.findIndex(cur => cur.bookId == authorBook.bookId);
if(index == -1) {
authorBooks.push(authorBook);
} else {
authorBooks[index] = authorBook;
}
return authorBooks;
}

View File

@@ -63,6 +63,47 @@ export enum ABI_TYPE {
ABI_BLOOD_REBOUND = 27,
/** 反击伤害 */
ABI_STRIKE_BACK = 28,
/** 加怒气值 */
ABI_GAIN_AP = 29,
/** 怒气提升效率 / 1000*/
ABI_RAGE_ADD_PERCENT = 30,
/** 格挡减伤提升效率 / 1000*/
ABI_BLOCK_ADD_PERCENT = 31,
/** 护盾 */
ABI_SHIELD = 32,
/** 竞技增伤 */
ABI_PVP_ADD = 33,
/** 竞技减伤 */
ABI_PVP_MINUS = 34,
/** 对魏增伤 */
ABI_WEI_ADD = 35,
/** 对魏减伤 */
ABI_WEI_MINUS = 36,
/** 对蜀增伤 */
ABI_SHU_ADD = 37,
/** 对蜀减伤 */
ABI_SHU_MINUS = 38,
/** 对吴增伤 */
ABI_WU_ADD = 39,
/** 对吴减伤 */
ABI_WU_MINUS = 40,
/** 对群增伤 */
ABI_OTHER_ADD = 41,
/** 对群减伤 */
ABI_OTHER_MINUS = 42,
ABI_MAX,
}
@@ -95,8 +136,35 @@ export const ABI_TYPE_SUB = [
ABI_TYPE.ABI_ACCEPT_TREATMENT_DECREASE,
ABI_TYPE.ABI_BLOOD_REBOUND,
ABI_TYPE.ABI_STRIKE_BACK,
ABI_TYPE.ABI_GAIN_AP,
ABI_TYPE.ABI_RAGE_ADD_PERCENT,
ABI_TYPE.ABI_BLOCK_ADD_PERCENT,
ABI_TYPE.ABI_SHIELD,
ABI_TYPE.ABI_PVP_ADD,
ABI_TYPE.ABI_PVP_MINUS,
ABI_TYPE.ABI_WEI_ADD,
ABI_TYPE.ABI_WEI_MINUS,
ABI_TYPE.ABI_SHU_ADD,
ABI_TYPE.ABI_SHU_MINUS,
ABI_TYPE.ABI_WU_ADD,
ABI_TYPE.ABI_WU_MINUS,
ABI_TYPE.ABI_OTHER_ADD,
ABI_TYPE.ABI_OTHER_MINUS
];
export const ABI_TYPE_PVP = [
ABI_TYPE.ABI_PVP_ADD,
ABI_TYPE.ABI_PVP_MINUS,
ABI_TYPE.ABI_WEI_ADD,
ABI_TYPE.ABI_WEI_MINUS,
ABI_TYPE.ABI_SHU_ADD,
ABI_TYPE.ABI_SHU_MINUS,
ABI_TYPE.ABI_WU_ADD,
ABI_TYPE.ABI_WU_MINUS,
ABI_TYPE.ABI_OTHER_ADD,
ABI_TYPE.ABI_OTHER_MINUS
]
export enum SEID_TYPE {
/**属性固定值加成(数值) */
FIX = 1,

View File

@@ -40,6 +40,8 @@ export enum HERO_SYSTEM_TYPE {
ARTIFACT_QUALITY = 37, // 宝物品质
ARTIFACT_TRANSFER = 38, // 宝物转换
ARTIFACT_REBUILD = 39, // 宝物重铸
AUTHOR_BOOK_STAR = 40, // 诸子列传升星
AUTHOR_BOOK_SUB_RESET = 41, // 诸子列传重置
};
// 武将上限
@@ -67,3 +69,9 @@ export const HERO_INITIAL_QUALITY = {
}
export const CHECK_HERO_CONSUME = true;
// 诸子列传解锁条件
export enum AUTHOR_BOOK_LIMIT_TYPE {
ALL = 1, // 所有的进度解锁
ASSIGN = 2, // 指定的进度解锁
}

View File

@@ -39,6 +39,7 @@ export const CONSUME_TYPE = {
DRAWING: 17, // 图纸
VOUCHER: 18, // 代金券
ARTIFACT_GENERAL: 19, // 宝物通用
SPIRIT_STONE: 20, // 灵石
};
export enum ROLE_TERAPH {
@@ -155,6 +156,7 @@ const itid_array = [
{ id: 64, name: '宝物', table: 'artifact' },
{ id: 65, name: '宝物通用材料', table: 'item', type: CONSUME_TYPE.ARTIFACT_GENERAL },
{ id: 66, name: '活动限时材料', table: 'activityItem' },
{ id: 67, name: '灵石', table: 'item', type: CONSUME_TYPE.SPIRIT_STONE },
];
export const ITID = new Map<number, { id: number, name: string, table: string, type?: number, isCurrency?: boolean, equipJewel?: number }>();

View File

@@ -57,7 +57,7 @@ export enum FRIEND_SHIP_SELECT {
GET_FRIEND_VALUE = 'friendValue friendLv'
}
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'jewels', 'artifacts', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip', 'createTime', 'ipLocation', 'activityItems', 'customerLink', 'isClosePush', 'hasComment'];
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'jewels', 'artifacts', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip', 'createTime', 'ipLocation', 'activityItems', 'customerLink', 'isClosePush', 'hasComment', 'authorBook'];
export enum SURVEY_SELECT {
FIND = '-__v -_id -surveyName -roleIndex -reward -mailContent -receivedRole -createdAt -updatedAt'

View File

@@ -646,6 +646,10 @@ export const FILENAME = {
DIC_GK_GVGBATTLE: 'dic_zyz_gk_GVGBattle',
DIC_GVG_VESTIGE_PLAYER_RANK: 'dic_zyz_GVGVestigePlayerRank',
DIC_PUSH_MESSAGE: 'dic_zyz_pushMessage',
DIC_AUTHORS_BOOK: 'dic_zyz_authorsBook',
DIC_AUTHORS_BOOK_POINT: 'dic_zyz_authorsBookPoint',
DIC_AUTHORS_BOOK_SUB: 'dic_zyz_authorsBookSub',
DIC_AUTHORS_GOODID: 'dic_zyz_authorsGoodId',
}
export const WAR_RELATE_TABLES = [
@@ -1194,6 +1198,11 @@ export enum ITEM_CHANGE_REASON {
ACT_DRAGON_BOAT_BUY_COST = 187, // 购买龙舟挑战奖励
ACT_ENTERTAIN = 188, // 宴请百家奖励
ACT_ENTERTAIN_BUY_COST = 189, // 宴请百家奖励花费
AUTHOR_BOOK_STAR_UP = 190, // 诸子列传升星
AUTHOR_BOOK_STAR_RETURN = 191, // 诸子列传升星并发返回
AUTHOR_BOOK_SUB_RESET = 192, // 重置列传
DECOMPOSE_SPIRIT = 193, // 分解英灵
BUY_SPIRIT = 194, // 分解英灵
}
export enum TA_EVENT {

View File

@@ -533,6 +533,10 @@ export const STATUS = {
ROLE_SCHOOL_POSITION_UNLOCK_NOT_NEED: { code: 30605, simStr: '该位置已解锁' },
ROLE_SCROLL_REACH_MAX: { code: 30606, simStr: '已经升到可以升的最高等级' },
// 诸子列传 30700-30701
AUTHOR_BOOK_LOCK: { code: 30700, simStr: '诸子列传本篇解锁中' },
AUTHOR_BOOK_SUB_MAX: { code: 30701, simStr: '诸子列传条目已达到最大星级' },
// 好友30700-30799
FRIEND_MY_CNT_MAX: { code: 30700, simStr: '好友数量已达上限' },
FRIEND_THEY_CNT_MAX: { code: 30701, simStr: '玩家好友已满' },

59
shared/db/AuthorBook.ts Normal file
View File

@@ -0,0 +1,59 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
/**
* 诸子百家
**/
class Author {
@prop({ required: true, default: 0 })
subId: number; // 条目id
@prop({ required: true, default: 0 })
star: number; // 星级
}
@index({ roleId: 1, bookId: 1 })
export default class AuthorBook extends BaseModel {
@prop({ required: true, default: '' })
roleId: string; // 举报人的 roleId
@prop({ required: true, default: '' })
bookId: number; // 列传id
@prop({ required: true, default: '' })
progress: number; // 进度
@prop({ required: true, default: [], type: Author, _id: false })
authors: Author[];
public static async findByRoleId(roleId: string) {
let result: AuthorBookType[] = await AuthorBookModel.find({ roleId }).select('-_id -roleId').lean();
return result;
}
public static async findByBookId(roleId: string, bookId: number) {
let result: AuthorBookType = await AuthorBookModel.findOne({ roleId, bookId }).select('-_id').lean();
return result;
}
// 升星
public static async upStar(roleId: string, bookId: number, subId: number, star: number, addProgress: number, initAuthors: number[]) {
await AuthorBookModel.findOneAndUpdate({ roleId, bookId }, { $setOnInsert: { progress: 0, authors: initAuthors.map(subId => ({ subId, star: 0 })) } }, { upsert: true });
let result: AuthorBookType = await AuthorBookModel.findOneAndUpdate({ roleId, bookId, 'authors.subId': subId, 'authors.star': star }, { $inc: { progress: addProgress, 'authors.$.star': 1 } }, { new: true }).lean();
return result;
}
// 重置目录
public static async resetSub(roleId: string, bookId: number, subId: number, oldStar: number, incProgress: number) {
let result: AuthorBookType = await AuthorBookModel.findOneAndUpdate({ roleId, bookId, 'authors.subId': subId, 'authors.star': oldStar }, { $set: {'authors.$.star': 0}, $inc: { progress: incProgress } }, { new: true }).lean();
return result;
}
}
export const AuthorBookModel = getModelForClass(AuthorBook);
export interface AuthorBookType extends Pick<DocumentType<AuthorBook>, keyof AuthorBook> { }
export type AuthorBookParam = Partial<AuthorBookType>;

View File

@@ -136,6 +136,10 @@ import { DicGVGVestigePlayerRank, dicGVGVestigePlayerRank, loadGVGVestigePlayerR
import { dicGVGAreaPoint, loadGVGAreaPoint, dicGVGPointsByAreaId } from "./dictionary/DicGVGAreaPoint";
import { DicGVGBattleRankReward, dicGVGBattleRankReward, loadGVGBattleRankReward } from './dictionary/DicGVGBattleRankReward';
import { dicPushMessage, loadPushMessage } from './dictionary/DicPushMessage';
import { dicAuthorsBookGoodId, loadAuthorsBookGoodId } from "./dictionary/DicAuthorsBookGoodId";
import { dicAuthorsBookMaxProgress, dicAuthorsBookSubs, dicAuthorsBookSubStar, loadAuthorsBookSub } from "./dictionary/DicAuthorsBookSub";
import { dicAuthorsBookPoint, loadAuthorsBookPoint } from "./dictionary/DicAuthorsBookPoint";
import { dicAuthorsBook, loadAuthorsBook } from './dictionary/DicAuthorsBook';
export const gameData = {
daily: dicDaily,
@@ -346,7 +350,13 @@ export const gameData = {
gvgReviveGold: new Map<number|'max', number>(),
dicPushMessage: dicPushMessage,
guildQuitCd: new Array<{day: number, minute: number}>(),
trainIdByIndex: dicTrainIdByIndex
trainIdByIndex: dicTrainIdByIndex,
spirit: dicAuthorsBookGoodId,
authorBook: dicAuthorsBook,
authorBookSubStar: dicAuthorsBookSubStar,
authorBookSubs: dicAuthorsBookSubs,
authorBookPoint: dicAuthorsBookPoint,
authorBookMaxProgress: dicAuthorsBookMaxProgress
};
// 在此提供一些原先在gamedata中提供的方法以便更方便获取gameData数据
@@ -786,6 +796,10 @@ export function getRaceEventItems() {
return items;
}
export function getDicAuthorBookSub(bookId: number, subId: number, star: number) {
return gameData.authorBookSubStar.get(`${bookId}_${subId}_${star}`);
}
// export function getRaceEventItems(members: WoodenHorseMember[], items: { id: number, total: number, max: number }[]) {
// let result = new Array<RewardInter>();
// for (let { id, min, max } of items) {
@@ -1645,6 +1659,14 @@ function loadDatas(type?: string) {
loadGVGBattleRankReward();
if(type == undefined || type == 'loadPushMessage')
loadPushMessage();
if(type == undefined || type == 'loadAuthorsBookGoodId')
loadAuthorsBookGoodId();
if(type == undefined || type == 'loadAuthorsBookSub')
loadAuthorsBookSub();
if(type == undefined || type == 'loadAuthorsBookPoint')
loadAuthorsBookPoint();
if(type == undefined || type == 'loadAuthorsBook')
loadAuthorsBook();
console.log('loadDatas type: ', type||'all');
}

View File

@@ -0,0 +1,46 @@
// 列传内的条目
import {decodeArrayListStr, readFileAndParse} from '../util'
import { FILENAME } from '../../consts'
const _ = require('lodash');
export interface DicAuthorsBook {
// 列传id
readonly id: number;
// 限制条件
readonly limit: { type: number, bookId?: number, value: number }[];
}
type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicAuthorsBookKeys: KeysEnum<DicAuthorsBook> = {
id: true,
limit: true,
}
export const dicAuthorsBook = new Map<number, DicAuthorsBook>();
export function loadAuthorsBook() {
dicAuthorsBook.clear();
let arr = readFileAndParse(FILENAME.DIC_AUTHORS_BOOK);
arr.forEach(o => {
o.limit = parseLimit(o.limit);
dicAuthorsBook.set(o.id, _.pick(o, Object.keys(DicAuthorsBookKeys)));
});
arr = undefined;
}
function parseLimit(str: string) {
let result: { type: number, bookId?: number, value: number }[] = [];
if (!str) return result;
let decodeArr = decodeArrayListStr(str);
for (let [ str1, str2, str3 ] of decodeArr) {
if (isNaN(parseInt(str1)) || isNaN(parseInt(str2)) || (str3 && isNaN(parseInt(str3)))) {
throw new Error('data table format wrong');
}
if(str3) {
result.push({ type: parseInt(str1), bookId: parseInt(str2), value: parseInt(str3) });
} else {
result.push({ type: parseInt(str1), value: parseInt(str2) });
}
}
return result
}

View File

@@ -0,0 +1,28 @@
// 英灵对应的物品表
import { parseGoodStr, readFileAndParse } from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
export interface DicAuthorsBookGoodId {
// id
readonly id: number;
// 对应物品表id
readonly goodId: number;
// 分解可得
readonly decomposeItem: RewardInter[];
// 英灵替换
readonly composeItem: RewardInter[];
}
export const dicAuthorsBookGoodId = new Map<number, DicAuthorsBookGoodId>();
export function loadAuthorsBookGoodId() {
dicAuthorsBookGoodId.clear();
let arr = readFileAndParse(FILENAME.DIC_AUTHORS_GOODID);
arr.forEach(o => {
o.decomposeItem = parseGoodStr(o.decomposeItem);
o.composeItem = parseGoodStr(o.composeItem)
dicAuthorsBookGoodId.set(o.goodId, o);
});
arr = undefined;
}

View File

@@ -0,0 +1,38 @@
// 列传的进度节点
import {decodeArrayListStr, readFileAndParse} from '../util'
import { FILENAME } from '../../consts'
export interface DicAuthorsBookPoint {
// 列传
readonly bookId: number;
// 进度节点
readonly value: number;
// 到这个节点可得的属性
readonly attr: { id: number, val: number }[]
}
export const dicAuthorsBookPoint = new Map<number, DicAuthorsBookPoint[]>();
export function loadAuthorsBookPoint() {
dicAuthorsBookPoint.clear();
let arr = readFileAndParse(FILENAME.DIC_AUTHORS_BOOK_POINT);
arr.forEach(o => {
o.attr = parseAttribute(o.attr);
if(!dicAuthorsBookPoint.has(o.id)) dicAuthorsBookPoint.set(o.id, []);
dicAuthorsBookPoint.get(o.id)?.push(o);
});
arr = undefined;
}
function parseAttribute(str: string) {
let result = new Array<{ id: number, val: number }>();
if (!str) return result;
let decodeArr = decodeArrayListStr(str);
for (let [id, val] of decodeArr) {
if (isNaN(parseInt(id)) || isNaN(parseInt(val))) {
throw new Error('data table format wrong');
}
result.push({ id: parseInt(id), val: parseInt(val) });
}
return result
}

View File

@@ -0,0 +1,71 @@
// 列传内的条目
import {decodeArrayListStr, parseNumberList, readFileAndParse} from '../util'
import { FILENAME } from '../../consts'
import { RewardInter } from '../interface';
const _ = require('lodash');
export interface DicAuthorsBookSub {
// 列传id
readonly bookId: number;
// 条目id
readonly subId: number;
// 星级
readonly star: number;
// 星级
readonly maxStar: number;
// 所需的英灵
readonly spirits: RewardInter[];
// 每升一颗星可以获得的进度
readonly value: number;
// 到这个节点可得的属性
readonly attr: { id: number, val: number }[]
}
type KeysEnum<T> = { [P in keyof Required<T>]: true };
const DicAuthorsBookSubKeys: KeysEnum<DicAuthorsBookSub> = {
bookId: true,
subId: true,
star: true,
maxStar: true,
spirits: true,
value: true,
attr: true,
}
export const dicAuthorsBookSubStar = new Map<string, DicAuthorsBookSub>();
export const dicAuthorsBookSubs = new Map<number, number[]>();
export const dicAuthorsBookMaxProgress = new Map<number, number>(); // bookId => maxProgress
export function loadAuthorsBookSub() {
dicAuthorsBookSubStar.clear();
dicAuthorsBookSubs.clear();
dicAuthorsBookMaxProgress.clear();
let arr = readFileAndParse(FILENAME.DIC_AUTHORS_BOOK_SUB);
arr.forEach(o => {
o.attr = parseAttribute(o.attr);
o.spirits = parseSpirit(o.goodsId);
dicAuthorsBookSubStar.set(`${o.bookId}_${o.subId}_${o.star}`, _.pick(o, Object.keys(DicAuthorsBookSubKeys)));
if(!dicAuthorsBookSubs.has(o.bookId)) dicAuthorsBookSubs.set(o.bookId, []);
if(dicAuthorsBookSubs.get(o.bookId).indexOf(o.subId) == -1) dicAuthorsBookSubs.get(o.bookId).push(o.subId);
if(!dicAuthorsBookMaxProgress.has(o.bookId)) dicAuthorsBookMaxProgress.set(o.bookId, 0);
dicAuthorsBookMaxProgress.set(o.bookId, dicAuthorsBookMaxProgress.get(o.bookId) + o.value);
});
arr = undefined;
}
function parseAttribute(str: string) {
let result = new Array<{ id: number, val: number }>();
if (!str) return result;
let decodeArr = decodeArrayListStr(str);
for (let [id, val] of decodeArr) {
if (isNaN(parseInt(id)) || isNaN(parseInt(val))) {
throw new Error('data table format wrong');
}
result.push({ id: parseInt(id), val: parseInt(val) });
}
return result
}
function parseSpirit(str: string): RewardInter[] {
let arr = parseNumberList(str);
return arr.map(id => ({ id, count: 1 }));
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
[
{
"id": 1,
"name": "列传1",
"image": 1,
"limit": "&",
"pointArr": "1&2&3&4&5&6&7&8"
},
{
"id": 2,
"name": "列传2",
"image": 2,
"limit": "&",
"pointArr": "9&10&11&12&13&14&15&16"
},
{
"id": 3,
"name": "列传3",
"image": 3,
"limit": "1&500",
"pointArr": "17&18&19&20&21&22&23&24"
},
{
"id": 4,
"name": "列传4",
"image": 4,
"limit": "2&3&800",
"pointArr": "25&26&27&28&29&30&31&32"
},
{
"id": 5,
"name": "列传5",
"image": 5,
"limit": "2&4&500",
"pointArr": "33&34&35&36&37&38&39&40"
}
]

View File

@@ -0,0 +1,322 @@
[
{
"id": 1,
"name": "寂灭破斩1",
"image": "zu1_1",
"bookId": 1,
"value": 100,
"attr": "2&101|3&101"
},
{
"id": 2,
"name": "寂灭破斩2",
"image": "zu1_2",
"bookId": 1,
"value": 200,
"attr": "2&102|3&102"
},
{
"id": 3,
"name": "反戈一击1",
"image": "zu1_3",
"bookId": 1,
"value": 300,
"attr": "2&103"
},
{
"id": 4,
"name": "反戈一击2",
"image": "zu1_4",
"bookId": 1,
"value": 400,
"attr": "2&104"
},
{
"id": 5,
"name": "反戈一击3",
"image": "zu1_5",
"bookId": 1,
"value": 500,
"attr": "2&105"
},
{
"id": 6,
"name": "固若金汤1",
"image": "zu1_6",
"bookId": 1,
"value": 600,
"attr": "2&106"
},
{
"id": 7,
"name": "固若金汤2",
"image": "zu1_7",
"bookId": 1,
"value": 700,
"attr": "2&107"
},
{
"id": 8,
"name": "喋血复仇",
"image": "zu1_8",
"bookId": 1,
"value": 1000,
"attr": "2&108"
},
{
"id": 9,
"name": "破釜沉舟",
"image": "zu2_1",
"bookId": 2,
"value": 100,
"attr": "3&101"
},
{
"id": 10,
"name": "风影突袭1",
"image": "zu2_2",
"bookId": 2,
"value": 200,
"attr": "3&102"
},
{
"id": 11,
"name": "风影突袭2",
"image": "zu2_3",
"bookId": 2,
"value": 300,
"attr": "3&103"
},
{
"id": 12,
"name": "奇兵突进1",
"image": "zu2_4",
"bookId": 2,
"value": 400,
"attr": "3&104"
},
{
"id": 13,
"name": "奇兵突进2",
"image": "zu2_5",
"bookId": 2,
"value": 500,
"attr": "3&105"
},
{
"id": 14,
"name": "贪狼之势1",
"image": "zu2_6",
"bookId": 2,
"value": 600,
"attr": "3&106"
},
{
"id": 15,
"name": "贪狼之势2",
"image": "zu2_7",
"bookId": 2,
"value": 700,
"attr": "3&107"
},
{
"id": 16,
"name": "贪狼之势3",
"image": "zu2_8",
"bookId": 2,
"value": 1000,
"attr": "3&108"
},
{
"id": 17,
"name": "冲锋陷阵1",
"image": "zu3_1",
"bookId": 3,
"value": 100,
"attr": "1&1001"
},
{
"id": 18,
"name": "冲锋陷阵2",
"image": "zu3_2",
"bookId": 3,
"value": 200,
"attr": "1&1002"
},
{
"id": 19,
"name": "召虎之姿",
"image": "zu3_3",
"bookId": 3,
"value": 300,
"attr": "1&1003"
},
{
"id": 20,
"name": "威震逍遥",
"image": "zu3_4",
"bookId": 3,
"value": 400,
"attr": "1&1004"
},
{
"id": 21,
"name": "镇魂箭雨1",
"image": "zu3_5",
"bookId": 3,
"value": 500,
"attr": "1&1005"
},
{
"id": 22,
"name": "镇魂箭雨2",
"image": "zu3_6",
"bookId": 3,
"value": 600,
"attr": "1&1006"
},
{
"id": 23,
"name": "追命散射1",
"image": "zu3_7",
"bookId": 3,
"value": 700,
"attr": "1&1007"
},
{
"id": 24,
"name": "追命散射2",
"image": "zu3_8",
"bookId": 3,
"value": 1000,
"attr": "1&1008"
},
{
"id": 25,
"name": "飞骑弓射1",
"image": "zu4_1",
"bookId": 4,
"value": 100,
"attr": "2&11"
},
{
"id": 26,
"name": "飞骑弓射2",
"image": "zu4_2",
"bookId": 4,
"value": 200,
"attr": "2&12"
},
{
"id": 27,
"name": "飞骑弓射3",
"image": "zu4_3",
"bookId": 4,
"value": 300,
"attr": "2&13"
},
{
"id": 28,
"name": "强弓劲弩1",
"image": "zu4_4",
"bookId": 4,
"value": 400,
"attr": "2&14"
},
{
"id": 29,
"name": "强弓劲弩2",
"image": "zu4_5",
"bookId": 4,
"value": 500,
"attr": "2&15"
},
{
"id": 30,
"name": "反曲长弓",
"image": "zu4_6",
"bookId": 4,
"value": 600,
"attr": "2&16"
},
{
"id": 31,
"name": "千里夺魂",
"image": "zu4_7",
"bookId": 4,
"value": 700,
"attr": "2&17"
},
{
"id": 32,
"name": "十胜天机1",
"image": "zu4_8",
"bookId": 4,
"value": 1000,
"attr": "2&18"
},
{
"id": 33,
"name": "十胜天机2",
"image": "zu5_1",
"bookId": 5,
"value": 100,
"attr": "1&1001|2&500"
},
{
"id": 34,
"name": "飞骑弓射3",
"image": "zu5_2",
"bookId": 5,
"value": 200,
"attr": "1&1002|2&500"
},
{
"id": 35,
"name": "十面埋伏1",
"image": "zu5_3",
"bookId": 5,
"value": 300,
"attr": "1&1001|2&501"
},
{
"id": 36,
"name": "十面埋伏2",
"image": "zu5_4",
"bookId": 5,
"value": 400,
"attr": "1&1002|2&501"
},
{
"id": 37,
"name": "逆命风流1",
"image": "zu5_5",
"bookId": 5,
"value": 500,
"attr": "1&1001|2&502"
},
{
"id": 38,
"name": "逆命风流2",
"image": "zu5_6",
"bookId": 5,
"value": 600,
"attr": "1&1002|2&502"
},
{
"id": 39,
"name": "逆命风流3",
"image": "zu5_7",
"bookId": 5,
"value": 700,
"attr": "1&1001|2&503"
},
{
"id": 40,
"name": "运筹帷幄1",
"image": "zu5_8",
"bookId": 5,
"value": 1000,
"attr": "1&1002|2&503"
}
]

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,612 @@
[
{
"id": 1,
"goodId": 110001,
"name": "曹操英灵",
"quality": 3,
"imageName": "caocao",
"authorsType": 1,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 2,
"goodId": 110002,
"name": "夏侯惇英灵",
"quality": 3,
"imageName": "xiahoudun",
"authorsType": 2,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 3,
"goodId": 110003,
"name": "张辽英灵",
"quality": 3,
"imageName": "zhangliao",
"authorsType": 3,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 4,
"goodId": 110004,
"name": "夏侯渊英灵",
"quality": 3,
"imageName": "xiahouyuan",
"authorsType": 4,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 5,
"goodId": 110005,
"name": "郭嘉英灵",
"quality": 3,
"imageName": "guojia",
"authorsType": 5,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 6,
"goodId": 110006,
"name": "典韦英灵",
"quality": 3,
"imageName": "dianwei",
"authorsType": 6,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 7,
"goodId": 110007,
"name": "庞德英灵",
"quality": 2,
"imageName": "pangde",
"authorsType": 7,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 8,
"goodId": 110008,
"name": "徐晃英灵",
"quality": 2,
"imageName": "xuhuang",
"authorsType": 8,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 9,
"goodId": 110009,
"name": "曹仁英灵",
"quality": 2,
"imageName": "caoren",
"authorsType": 9,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 10,
"goodId": 110010,
"name": "李典英灵",
"quality": 2,
"imageName": "lidian",
"authorsType": 10,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 11,
"goodId": 110011,
"name": "蔡琰英灵",
"quality": 1,
"imageName": "caiyan",
"authorsType": 1,
"decomposeItem": "40020&10",
"composeItem": "40020&20"
},
{
"id": 12,
"goodId": 110012,
"name": "贾诩英灵",
"quality": 2,
"imageName": "jiaxu",
"authorsType": 2,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 13,
"goodId": 110013,
"name": "许褚英灵",
"quality": 3,
"imageName": "xuchu",
"authorsType": 3,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 14,
"goodId": 110014,
"name": "乐进英灵",
"quality": 1,
"imageName": "yuejin",
"authorsType": 4,
"decomposeItem": "40020&10",
"composeItem": "40020&20"
},
{
"id": 15,
"goodId": 110015,
"name": "张飞英灵",
"quality": 3,
"imageName": "zhangfei",
"authorsType": 5,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 16,
"goodId": 110016,
"name": "关羽英灵",
"quality": 3,
"imageName": "guanyu",
"authorsType": 6,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 17,
"goodId": 110017,
"name": "赵云英灵",
"quality": 1,
"imageName": "zhaoyun",
"authorsType": 7,
"decomposeItem": "40020&10",
"composeItem": "40020&20"
},
{
"id": 18,
"goodId": 110018,
"name": "刘备英灵",
"quality": 3,
"imageName": "liubei",
"authorsType": 8,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 19,
"goodId": 110019,
"name": "黄忠英灵",
"quality": 3,
"imageName": "huangzhong",
"authorsType": 9,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 20,
"goodId": 110020,
"name": "诸葛亮英灵",
"quality": 3,
"imageName": "zhugeliang",
"authorsType": 10,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 21,
"goodId": 110021,
"name": "魏延英灵",
"quality": 3,
"imageName": "weiyan",
"authorsType": 1,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 22,
"goodId": 110022,
"name": "陈到英灵",
"quality": 2,
"imageName": "chendao",
"authorsType": 2,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 23,
"goodId": 110023,
"name": "关银屏英灵",
"quality": 2,
"imageName": "guanyinping",
"authorsType": 3,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 24,
"goodId": 110024,
"name": "马云禄英灵",
"quality": 2,
"imageName": "mayunlu",
"authorsType": 4,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 25,
"goodId": 110025,
"name": "马良英灵",
"quality": 2,
"imageName": "maliang",
"authorsType": 5,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 26,
"goodId": 110026,
"name": "张星彩英灵",
"quality": 4,
"imageName": "tongyongjunguan",
"authorsType": 6,
"decomposeItem": "40020&100",
"composeItem": "&"
},
{
"id": 27,
"goodId": 110027,
"name": "王平英灵",
"quality": 2,
"imageName": "wangping",
"authorsType": 7,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 28,
"goodId": 110028,
"name": "孙乾英灵",
"quality": 1,
"imageName": "sunqian",
"authorsType": 8,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 29,
"goodId": 110029,
"name": "周泰英灵",
"quality": 3,
"imageName": "zhoutai",
"authorsType": 9,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 30,
"goodId": 110030,
"name": "孙策英灵",
"quality": 3,
"imageName": "sunce",
"authorsType": 10,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 31,
"goodId": 110031,
"name": "周瑜英灵",
"quality": 3,
"imageName": "zhouyu",
"authorsType": 1,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 32,
"goodId": 110032,
"name": "太史慈英灵",
"quality": 3,
"imageName": "taishici",
"authorsType": 2,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 33,
"goodId": 110033,
"name": "孙权英灵",
"quality": 2,
"imageName": "sunquan",
"authorsType": 3,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 34,
"goodId": 110034,
"name": "甘宁英灵",
"quality": 2,
"imageName": "ganning",
"authorsType": 4,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 35,
"goodId": 110035,
"name": "孙尚香英灵",
"quality": 3,
"imageName": "sunshangxiang",
"authorsType": 5,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 36,
"goodId": 110036,
"name": "小乔英灵",
"quality": 3,
"imageName": "xiaoqiao",
"authorsType": 6,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 37,
"goodId": 110037,
"name": "大乔英灵",
"quality": 3,
"imageName": "daqiao",
"authorsType": 7,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 38,
"goodId": 110038,
"name": "步练师英灵",
"quality": 3,
"imageName": "bulianshi",
"authorsType": 8,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 39,
"goodId": 110039,
"name": "吕布英灵",
"quality": 3,
"imageName": "lvbu",
"authorsType": 9,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 40,
"goodId": 110040,
"name": "张任英灵",
"quality": 3,
"imageName": "zhangren",
"authorsType": 10,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 41,
"goodId": 110041,
"name": "华佗英灵",
"quality": 3,
"imageName": "huatuo",
"authorsType": 1,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 42,
"goodId": 110042,
"name": "张角英灵",
"quality": 3,
"imageName": "zhangjiao",
"authorsType": 2,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 43,
"goodId": 110043,
"name": "高顺英灵",
"quality": 3,
"imageName": "gaoshun",
"authorsType": 3,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 44,
"goodId": 110044,
"name": "麹义英灵",
"quality": 2,
"imageName": "quyi",
"authorsType": 4,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 45,
"goodId": 110045,
"name": "李儒英灵",
"quality": 2,
"imageName": "liru",
"authorsType": 5,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 46,
"goodId": 110046,
"name": "庞舞英灵",
"quality": 2,
"imageName": "pangwu",
"authorsType": 6,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 47,
"goodId": 110047,
"name": "夏侯轻衣英灵",
"quality": 1,
"imageName": "xiahouqingyi",
"authorsType": 7,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 48,
"goodId": 110048,
"name": "文丑英灵",
"quality": 1,
"imageName": "wenchou",
"authorsType": 8,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 49,
"goodId": 110049,
"name": "颜良英灵",
"quality": 1,
"imageName": "yanliang",
"authorsType": 9,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 50,
"goodId": 110050,
"name": "貂蝉英灵",
"quality": 3,
"imageName": "diaochan",
"authorsType": 10,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 51,
"goodId": 110051,
"name": "王越英灵",
"quality": 3,
"imageName": "wangyue",
"authorsType": 1,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 52,
"goodId": 110052,
"name": "董卓英灵",
"quality": 3,
"imageName": "dongzhuo",
"authorsType": 2,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 53,
"goodId": 110053,
"name": "童渊英灵",
"quality": 3,
"imageName": "tongyuan",
"authorsType": 3,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 54,
"goodId": 110054,
"name": "赵云英灵",
"quality": 1,
"imageName": "shaonianzhaoyun",
"authorsType": 4,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 55,
"goodId": 110055,
"name": "夏侯轻衣英灵",
"quality": 1,
"imageName": "shaonianxiahouqingyi",
"authorsType": 5,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 56,
"goodId": 110056,
"name": "潘璋英灵",
"quality": 1,
"imageName": "panzhang",
"authorsType": 6,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 57,
"goodId": 110057,
"name": "凌统英灵",
"quality": 1,
"imageName": "lingtong",
"authorsType": 7,
"decomposeItem": "40020&10",
"composeItem": "40020&15"
},
{
"id": 58,
"goodId": 110058,
"name": "黄盖英灵",
"quality": 2,
"imageName": "huanggai",
"authorsType": 8,
"decomposeItem": "40020&20",
"composeItem": "40020&15"
},
{
"id": 59,
"goodId": 110059,
"name": "陈宫英灵",
"quality": 3,
"imageName": "chengong",
"authorsType": 9,
"decomposeItem": "40020&30",
"composeItem": "40020&50"
},
{
"id": 60,
"goodId": 110060,
"name": "马超英灵",
"quality": 4,
"imageName": "machao",
"authorsType": 10,
"decomposeItem": "40020&100",
"composeItem": "&"
},
{
"id": 61,
"goodId": 110061,
"name": "阿丽雅英灵",
"quality": 4,
"imageName": "aliya2",
"authorsType": 4,
"decomposeItem": "40020&100",
"composeItem": "&"
}
]

View File

@@ -0,0 +1,52 @@
[
{
"id": 1,
"name": "儒家",
"imageName": "touxiang_rujia"
},
{
"id": 2,
"name": "道家",
"imageName": "yinyangjia"
},
{
"id": 3,
"name": "墨家",
"imageName": "touxiang_mojia"
},
{
"id": 4,
"name": "法家",
"imageName": "touxiang_fajia"
},
{
"id": 5,
"name": "名家",
"imageName": "touxiang_mingjia"
},
{
"id": 6,
"name": "阴阳家",
"imageName": "touxiang_daojia"
},
{
"id": 7,
"name": "纵横家",
"imageName": "touxiang_zongheng"
},
{
"id": 8,
"name": "杂家",
"imageName": "touxiang_zajia"
},
{
"id": 9,
"name": "兵家",
"imageName": "touxiang_bingjia"
},
{
"id": 10,
"name": "医家",
"imageName": "touxiang_yijia"
}
]