主线:添加宝箱
This commit is contained in:
@@ -28,7 +28,7 @@ import { getGuildTrainInstance, getTrainBoxRewardsResult } from './guildTrainSer
|
||||
import { BossInstanceModel } from '../db/BossInstance';
|
||||
import { getBossInstanceInfo } from './guildBossService';
|
||||
import { getEvent } from './eventSercive';
|
||||
import { getBattleListOfMain } from './normalBattleService';
|
||||
import { getBattleListOfMain, getMainChapter } from './normalBattleService';
|
||||
import { GuildType } from '../db/Guild';
|
||||
import UserGuild, { UserGuildType } from '../db/UserGuild';
|
||||
import { setPreDayActiveData, getAllGuildActivityStatus } from './guildActivity/guildActivityService';
|
||||
@@ -154,7 +154,8 @@ async function getModuleData(type: string, data: { role: RoleType, session: Fron
|
||||
return await getBattleListOfMain(role);
|
||||
case 'guildActivity':
|
||||
return getAllGuildActivityStatus();
|
||||
|
||||
case 'chapter':
|
||||
return getMainChapter(role);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -193,4 +193,32 @@ export async function getBattleList(role: RoleType, type: number) {
|
||||
}
|
||||
result = result.sort((a, b) => { return a.battleId - b.battleId });
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export function getStarOfChapter(warStar: WarStar[]) {
|
||||
let map = new Map<number, number>();
|
||||
for(let { id, star } of warStar ) {
|
||||
let dicWar = gameData.war.get(id);
|
||||
if(dicWar.warType == WAR_TYPE.NORMAL && star > 0) {
|
||||
if(!map.has(dicWar.chapter)) {
|
||||
map.set(dicWar.chapter, star);
|
||||
} else {
|
||||
map.set(dicWar.chapter, map.get(dicWar.chapter) + star);
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
export function getMainChapter(role: RoleType) {
|
||||
let chapterMap = getStarOfChapter(role.warStar);
|
||||
let chapterArr: { chapter: number, star: number }[] = [];
|
||||
for(let [ chapter, star ] of chapterMap) {
|
||||
chapterArr.push({ chapter, star });
|
||||
}
|
||||
|
||||
return {
|
||||
star: chapterArr,
|
||||
receivedBox: role.receivedBox||[],
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user