活动:添加新任务统计
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ITID, CONSUME_TYPE, getCurNameById, ITEM_TABLE, HERO_SYSTEM_TYPE, CURRENCY_BY_TYPE, FIGURE_UNLOCK_CONDITION, REDIS_KEY } from './../consts';
|
||||
import { ITID, CONSUME_TYPE, getCurNameById, ITEM_TABLE, HERO_SYSTEM_TYPE, CURRENCY_BY_TYPE, FIGURE_UNLOCK_CONDITION, REDIS_KEY, TASK_TYPE } from './../consts';
|
||||
import { EquipModel } from './../db/Equip';
|
||||
import { resResult } from '../pubUtils/util';
|
||||
import { RoleModel, RoleType } from '../db/Role';
|
||||
@@ -14,7 +14,7 @@ import { uniq, indexOf, findIndex } from 'underscore';
|
||||
import { HeroModel, HeroType } from '../db/Hero';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
import { Rank } from './rankService';
|
||||
import { pushTaskUpdate } from './taskService';
|
||||
import { checkActivityTask, pushTaskUpdate } from './taskService';
|
||||
import { CreateHeroParam } from '../domain/roleField/hero';
|
||||
|
||||
export async function handleCost(roleId: string, sid: string, goods: Array<ItemInter>) {
|
||||
@@ -64,7 +64,7 @@ export async function handleCost(roleId: string, sid: string, goods: Array<ItemI
|
||||
|
||||
function sortConsumes(goods: Array<ItemInter>, bags: Array<ItemInter>, currencysMap: any, equips: Array<number>) {
|
||||
for (let good of goods) {
|
||||
if(good.count == 0) continue;
|
||||
if (good.count == 0) continue;
|
||||
let goodInfo = gameData.goods.get(good.id);
|
||||
let { type, table } = ITID.get(goodInfo.itid);
|
||||
|
||||
@@ -120,6 +120,12 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
|
||||
pushTaskUpdate(roleId, sid, null, taskPushMessage);
|
||||
|
||||
//统计装备
|
||||
if (equipInfos.length > 0) {
|
||||
let { serverId } = await RoleModel.findByRoleId(roleId);
|
||||
await checkActivityTask(serverId, sid, [], roleId, TASK_TYPE.EQUIP_QUALITY_COUNT, equipInfos.length, { equips: equipInfos })
|
||||
}
|
||||
|
||||
//货币推送
|
||||
if (!!Object.keys(currencysMap).length) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
@@ -310,7 +316,7 @@ export async function createHeroes(roleId: string, roleName: string, sid: string
|
||||
|
||||
let newHeroInfo: CreateHeroParam[] = [], pieces: ItemInter[] = [];
|
||||
for (let h of heroInfo) {
|
||||
let heroCount = h.count||1;
|
||||
let heroCount = h.count || 1;
|
||||
if (userHeroesMap.has(h.hid)) {
|
||||
let { pieceId, count } = transPiece(h.hid);
|
||||
pieces.push({ id: pieceId, count: count * heroCount });
|
||||
|
||||
Reference in New Issue
Block a user