✨ feat(任务): 添加稷下学宫任务
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { RougelikeRecordDetailType } from '../../db/RougelikeRecordDetail';
|
||||
import { COLLECTION_TYPE, PUSH_ROUTE, ROUGE_LIKE_CARD_TYPE } from '../../consts';
|
||||
import { COLLECTION_TYPE, PUSH_ROUTE, ROUGE_LIKE_CARD_TYPE, TASK_ROUGE_CARD_TYPE, TASK_TYPE } from '../../consts';
|
||||
import { genCode } from '../../pubUtils/util';
|
||||
import { Card, RougelikeCharaModel, RougelikeCharaPara, RougelikeCharaType } from '../../db/RougelikeChara';
|
||||
import { RougelikeCardPara, RougelikeCardModel } from '../../db/RougelikeCard';
|
||||
@@ -9,10 +9,13 @@ import { sendMessageToUserWithSuc } from '../pushService';
|
||||
import { gameData } from '../../pubUtils/data';
|
||||
import { clone } from 'underscore';
|
||||
import { RougeEffect, getSlotUnlockPoint } from './rougeEffectService';
|
||||
import { BackendSession } from 'pinus';
|
||||
import { checkTask } from '../task/taskService';
|
||||
|
||||
export class HandleAddCard {
|
||||
roleId: string;
|
||||
sid: string;
|
||||
serverId: number;
|
||||
gameCode: string;
|
||||
getLayer: number = 0;
|
||||
getWay: number = 0;
|
||||
@@ -21,9 +24,10 @@ export class HandleAddCard {
|
||||
addHolyCards: RougelikeCardPara[] = []; // 需要更新的圣物
|
||||
addCoin: number = 0; // 需要增加的试炼币
|
||||
|
||||
constructor(roleId: string, sid: string, gameCode: string, recordDetail?: RougelikeRecordDetailType) {
|
||||
this.roleId = roleId;
|
||||
this.sid = sid;
|
||||
constructor(session: BackendSession, gameCode: string, recordDetail?: RougelikeRecordDetailType) {
|
||||
this.roleId = session.get('roleId');
|
||||
this.sid = session.get('sid');
|
||||
this.serverId = session.get('serverId');
|
||||
this.gameCode = gameCode;
|
||||
if (recordDetail) {
|
||||
this.getLayer = recordDetail.layer;
|
||||
@@ -107,6 +111,22 @@ export class HandleAddCard {
|
||||
}
|
||||
if (collections.length > 0) await addCollection(this.roleId, this.sid, this.gameCode, collections);
|
||||
|
||||
//任务
|
||||
if (this.addPassiveCards.length > 0) {
|
||||
let passiveCardMap = new Map<number, number>();
|
||||
for (const { cardId } of this.addPassiveCards) {
|
||||
const passiveCardData = gameData.rougePassiveCard.get(cardId);
|
||||
let count = passiveCardMap.get(passiveCardData.authorType) || 0;
|
||||
passiveCardMap.set(passiveCardData.authorType, count + 1);
|
||||
}
|
||||
for (const [authorType, count] of passiveCardMap) {
|
||||
await checkTask(this.serverId, this.roleId, this.sid, TASK_TYPE.ROUGE_AUTHOR_CARD_COLLECT, { authorType, cardType: TASK_ROUGE_CARD_TYPE.PASSIVE, cardIds:this.addPassiveCards.map(cur => cur.cardId) });
|
||||
}
|
||||
}
|
||||
if (this.addHolyCards.length > 0) {
|
||||
await checkTask(this.serverId, this.roleId, this.sid, TASK_TYPE.ROUGE_HOLY_COLLECT, {cardIds:this.addHolyCards.map(cur => cur.cardId)});
|
||||
}
|
||||
|
||||
if (this.addCharas.length > 0) {
|
||||
result.addCharas = await this.getCharasByHolyEffect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user