任务:添加每日主公经验
This commit is contained in:
@@ -11,6 +11,9 @@ import { getMainTask, refDailyTaskBox, removeHistoryTask, getCurTask, checkTask
|
||||
import { TASK } from "../../../pubUtils/dicParam";
|
||||
import { newHeroGiftPoint } from "../../../services/activity/newHeroGiftsService";
|
||||
import { ActivityTaskPointModel } from "../../../db/ActivityTaskPoint";
|
||||
import { ItemInter } from "../../../pubUtils/interface";
|
||||
import { RoleModel } from "../../../db/Role";
|
||||
import { roleLevelup } from "../../../services/normalBattleService";
|
||||
|
||||
export default function (app: Application) {
|
||||
return new ShopHandler(app);
|
||||
@@ -47,7 +50,7 @@ export class ShopHandler {
|
||||
rec = await UserTaskRecModel.receiveTask(roleId, type, taskType, group, id);
|
||||
|
||||
// 每日、成就增加积分
|
||||
let point = 0, weeklyPoint = 0;
|
||||
let point = 0, weeklyPoint = 0, expItem: ItemInter;
|
||||
if (type == TASK_FUN_TYPE.DAILY) { // 增加积分
|
||||
let userTask = await UserTaskModel.findByRole(roleId);
|
||||
let dic = <DicDailyTask>dicTask;
|
||||
@@ -59,6 +62,8 @@ export class ShopHandler {
|
||||
}
|
||||
point = userTask.dailyTaskPoint;
|
||||
weeklyPoint = userTask.dailyTaskPointWeekly;
|
||||
let { lv } = await RoleModel.findByRoleId(roleId, 'lv');
|
||||
expItem = { id: dic.exp.id, count: dic.exp.count * gameData.taskExp.get(lv)};
|
||||
} else if (type == TASK_FUN_TYPE.ACHIEVEMENT) {
|
||||
let dic = <DicAchievement>dicTask;
|
||||
let userTask = await UserTaskModel.incInfo(roleId, { achievementPoint: dic.point });
|
||||
@@ -74,6 +79,10 @@ export class ShopHandler {
|
||||
}
|
||||
|
||||
let goods = await addItems(roleId, roleName, sid, taskReward);
|
||||
if(expItem) {
|
||||
await roleLevelup(roleId, expItem.count, session);
|
||||
goods.push(expItem);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
type, id, count: rec.count, received: rec.received.includes(id),
|
||||
|
||||
Reference in New Issue
Block a user