增加帐号初始化时获取物品的处理
This commit is contained in:
parent
f2e271799c
commit
17f663776a
@ -10,10 +10,12 @@ import { ItemFuncCfg } from '../cfg/parsers/ItemFuncCfg'
|
||||
import ItemCtrl from "../logic/ItemCtrl";
|
||||
import { EffectCardCfg } from '../cfg/parsers/EffectCardCfg'
|
||||
import { IncomeCfg } from '../cfg/parsers/IncomeCfg'
|
||||
import { BaseCfg } from '../cfg/parsers/BaseCfg'
|
||||
|
||||
|
||||
export function initData() {
|
||||
const rP = DataParser.regCommonParser.bind(DataParser);
|
||||
rP(BaseConst.COMPOUND, BaseCfg)
|
||||
rP(BaseConst.HERO, HeroCfg);
|
||||
rP(BaseConst.UNIT, UnitCfg);
|
||||
rP(BaseConst.EFFECTCARD, EffectCardCfg);
|
||||
|
@ -56,6 +56,8 @@ export class BaseConst {
|
||||
public static readonly PLAYER2_INIT_NUM = 99028
|
||||
public static readonly PLAYER3_INIT_NUM = 99029
|
||||
public static readonly PLAYER4_INIT_NUM = 99030
|
||||
// 帐号初始化后赠送的物品
|
||||
public static readonly PLAYER_INIT_ITEMS = 99037
|
||||
|
||||
|
||||
|
||||
|
@ -5,6 +5,10 @@ import { updateRank } from '../service/rank'
|
||||
import { Card } from '../models/subdoc/Card'
|
||||
import { Hero } from '../models/subdoc/Hero'
|
||||
import { addHeroDefaultCardGroup } from './CardGroupDao'
|
||||
import { Base } from '@typegoose/typegoose/lib/defaultClasses'
|
||||
import { ItemInfo } from '../logic/ItemDef'
|
||||
import ItemCtrl from '../logic/ItemCtrl'
|
||||
import { BagItem } from '../models/BagItem'
|
||||
|
||||
export async function fetchAccount({ accountid, nickname, avatar, robot = false }
|
||||
: { accountid: string, nickname?: string, avatar?: string, robot?: boolean }) {
|
||||
@ -26,6 +30,15 @@ export async function fetchAccount({ accountid, nickname, avatar, robot = false
|
||||
if (avatar) {
|
||||
account.avatar = avatar
|
||||
}
|
||||
if (!robot) {
|
||||
let baseCfg = global.$cfg.get(BaseConst.COMPOUND)
|
||||
let initItem = baseCfg.get(BaseConst.PLAYER_INIT_ITEMS)
|
||||
if (initItem) {
|
||||
const initItemStr = `${initItem.value}:1`
|
||||
const itemInfos: ItemInfo[] = ItemCtrl.getItemsByInfo(initItemStr)
|
||||
await BagItem.addItems(account._id, itemInfos)
|
||||
}
|
||||
}
|
||||
let cardMap = account.cardMap
|
||||
for (let [, cfg] of global.$cfg.get(BaseConst.EFFECTCARD)) {
|
||||
if (cfg.org_gift == 1 && cfg.type_id == 1 && !cardMap.has(cfg.id + '')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user