addItem goodType修改
This commit is contained in:
@@ -13,7 +13,7 @@ import { Application, BackendSession } from 'pinus';
|
||||
import { resResult, getRandomByLen, calculateNum, getRandValue, ratioReward } from '../../../pubUtils/util';
|
||||
import { RoleStatus } from '../../../db/ComBattleTeam';
|
||||
import { ItemModel } from '../../../db/Item';
|
||||
import { handleFixedReward, handleReward } from '../../../services/rewardService';
|
||||
import { handleFixedReward, addItems } from '../../../services/rewardService';
|
||||
import { checkRoleInQueue, getTeamSearchByQuality, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
||||
import { transBossHpArr } from '../../../services/battleService';
|
||||
import { getRandBlueprtId, getRandComBtlRobots, checkComBattleResult, clearComBtlTimer, getRealReward, getAssistTimesByQuality, getFrd } from '../../../services/comBattleService';
|
||||
@@ -692,7 +692,8 @@ export class ComBattleHandler {
|
||||
*/
|
||||
async comBattleEnd(msg: {teamCode: string}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
let { teamCode } = msg;
|
||||
let team = await ComBattleTeamModel.getTeamByCode(teamCode);
|
||||
if (!team || team.status !== COM_TEAM_STATUS.WIN) return resResult(STATUS.COM_BATTLE_REWARD_ERR);
|
||||
@@ -718,10 +719,10 @@ export class ComBattleHandler {
|
||||
}
|
||||
|
||||
await ComBattleTeamModel.updateRewardSt(teamCode, roleId, true);
|
||||
const goods = await handleFixedReward(roleId, roleName, roleSt.fixReward, 1);
|
||||
const goods = await handleFixedReward(roleId, roleName, sid, roleSt.fixReward, 1);
|
||||
let actordata = await roleLevelup(roleId, warInfo.kingExp, this.app, session);// 主公升级经验
|
||||
|
||||
return resResult(STATUS.SUCCESS, { ...goods, ...actordata, teamInfo: {status, teamCode, roleStatus, bossHpArr} });
|
||||
return resResult(STATUS.SUCCESS, { goods, ...actordata, teamInfo: {status, teamCode, roleStatus, bossHpArr} });
|
||||
}
|
||||
|
||||
async getComBtlStatus(msg: {teamCode: string}, session: BackendSession) {
|
||||
@@ -780,6 +781,8 @@ export class ComBattleHandler {
|
||||
async composeBlueprt(msg: {original: Array<{id: number, count: number}>}, session: BackendSession) {
|
||||
const roleId = session.get('roleId');
|
||||
const roleName = session.get('roleName');
|
||||
const sid = session.get('sid');
|
||||
|
||||
const { original } = msg;
|
||||
|
||||
// 原材料检查
|
||||
@@ -817,9 +820,9 @@ export class ComBattleHandler {
|
||||
const targetList = getBluePrtByQuality(dicCompose.targetQuality);
|
||||
const target = getRandomByLen(targetList);
|
||||
const reward = [{gid: target, count: 1}];
|
||||
const goods = await handleReward(roleId, roleName, reward);
|
||||
const goods = await addItems(roleId, roleName, sid, reward);
|
||||
|
||||
|
||||
return resResult(STATUS.SUCCESS, { ...goods, costGold: 0 });
|
||||
return resResult(STATUS.SUCCESS, { goods, costGold: 0 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ export class EventBattleHandler {
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let eventStatus = session.get('eventStatus');
|
||||
let sid = session.get('sid');
|
||||
|
||||
let event = await EventRecordModel.getEventRecordByCode(roleId, eventCode);
|
||||
if(!event) {
|
||||
@@ -109,7 +110,7 @@ export class EventBattleHandler {
|
||||
let result = await EventRecordModel.setStatusByCode(roleId, eventCode, isSuccess?EVENT_RECORD_STATUS.SUCCESS_RECEIVED:EVENT_RECORD_STATUS.FAIL_RECEIVED);
|
||||
// 保存奖励
|
||||
let rewardStr = isSuccess?curEvent.winReward:curEvent.loseReward;
|
||||
let goods = await handleFixedReward(roleId, roleName, rewardStr, 1);
|
||||
let goods = await handleFixedReward(roleId, roleName, sid, rewardStr, 1);
|
||||
if(eventStatus == EVENT_STATUS.STARTING) { // 如果是第一次开启的挑战,保存成开启状态
|
||||
await RoleModel.setEventStatus(roleId, EVENT_STATUS.OPEN);
|
||||
// 第一场时间挑战完,开始正常刷新事件,所以刷新时间也重置起来
|
||||
@@ -123,7 +124,7 @@ export class EventBattleHandler {
|
||||
eventCode: result.eventCode,
|
||||
eventId: result.eventId,
|
||||
status: result.status,
|
||||
...goods
|
||||
goods
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -210,6 +210,7 @@ export class ExpeditionBattleHandler {
|
||||
const { expeditionCode, battleCode, battleId, expeditionId, isSuccess, heroes, star, enemies } = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
|
||||
let warInfo = getWarById(battleId);
|
||||
if(!warInfo) {
|
||||
@@ -259,7 +260,7 @@ export class ExpeditionBattleHandler {
|
||||
let { expeditionPoint = 0 } = role;
|
||||
|
||||
// 关卡奖励
|
||||
let warReward = new WarReward(roleId, roleName, battleId, isSuccess);
|
||||
let warReward = new WarReward(roleId, roleName, sid, battleId, isSuccess);
|
||||
let reward = await warReward.saveReward(1);
|
||||
|
||||
let actordata = await roleLevelup(roleId, isSuccess?warInfo.kingExp:0, this.app, session);// 主公升级经验
|
||||
@@ -272,7 +273,7 @@ export class ExpeditionBattleHandler {
|
||||
expeditionCode, expeditionId,
|
||||
battleCode, battleId,
|
||||
battleStatus: expeditionWarRecord.battleStatus,
|
||||
...reward,
|
||||
goods: reward,
|
||||
apJson,
|
||||
expeditionPoint,
|
||||
...actordata
|
||||
@@ -288,6 +289,7 @@ export class ExpeditionBattleHandler {
|
||||
const { point } = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let {expeditionPoint} = role;
|
||||
@@ -325,12 +327,12 @@ export class ExpeditionBattleHandler {
|
||||
}
|
||||
let pointRewards = await getPointRewardStatus(roleId);
|
||||
|
||||
let goods = await handleFixedReward(roleId, roleName, curDicExpeditionPoint.reward, 1);
|
||||
let goods = await handleFixedReward(roleId, roleName, sid, curDicExpeditionPoint.reward, 1);
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
costPoint: hasReceivedAll?maxPoint: 0,
|
||||
pointRewards,
|
||||
...goods
|
||||
goods
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ export class NormalBattleHandler {
|
||||
|
||||
let channelService = this.app.get('channelService');
|
||||
|
||||
let warReward = new WarReward(roleId, roleName, battleId, isSuccess);
|
||||
let warReward = new WarReward(roleId, roleName, sid, battleId, isSuccess);
|
||||
|
||||
let dailyNum = {};
|
||||
let towerStatus = null;
|
||||
@@ -254,7 +254,7 @@ export class NormalBattleHandler {
|
||||
// towerStatus: false-本层未通过, true-本层已通过
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
battleCode, battleId, status,
|
||||
...reward,
|
||||
goods: reward,
|
||||
apJson,
|
||||
towerStatus, dailyNum, dungeonNum,
|
||||
...actordata
|
||||
@@ -266,6 +266,7 @@ export class NormalBattleHandler {
|
||||
const { battleId, count } = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
let warInfo = getWarById(battleId);
|
||||
if(!warInfo) {
|
||||
return resResult(STATUS.BATTLE_MISS_INFO);
|
||||
@@ -305,7 +306,7 @@ export class NormalBattleHandler {
|
||||
}
|
||||
|
||||
// 发奖励
|
||||
let warReward = new WarReward(roleId, roleName, battleId, true);
|
||||
let warReward = new WarReward(roleId, roleName, sid, battleId, true);
|
||||
let result = await warReward.saveReward(count);
|
||||
|
||||
let actordata = await roleLevelup(roleId, warInfo.kingExp * count, this.app, session)// 主公升级经验
|
||||
@@ -322,7 +323,7 @@ export class NormalBattleHandler {
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
battleId, count,
|
||||
...result,
|
||||
goods: result,
|
||||
apJson,
|
||||
dailyNum, dungeonNum,
|
||||
...actordata
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Application, BackendSession } from 'pinus';
|
||||
import { getTaskById, getTowerDataByLv } from '../../../pubUtils/gamedata';
|
||||
import { decodeArrayStr, resResult, shouldRefresh, calculateNum, getRefTime, genCode } from '../../../pubUtils/util';
|
||||
import { calcuHangUpReward, checkTaskConditions, checkHangUpSpdUpCnt, createCurTasks, treatTask, getRemainTime, getTasksReward, getTaskStatus, getDoingOrWaitingTasks } from '../../../services/battleService';
|
||||
import { handleFixedReward, handleReward } from '../../../services/rewardService';
|
||||
import { handleFixedReward, addItems } from '../../../services/rewardService';
|
||||
import { checkBattleHeroes } from '../../../services/normalBattleService';
|
||||
import { getRank, setRank, initRank, existsRank } from '../../../services/redisService';
|
||||
|
||||
@@ -97,21 +97,23 @@ export class TowerBattleHandler {
|
||||
async recHangUpRewards(msg: {}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
const result = await calcuHangUpReward(roleId);
|
||||
if(result.status == -1) {
|
||||
return result.resResult
|
||||
}
|
||||
let { timeReward, endLv, endTime, deltaTime, needReceiveGoods } = result.data;
|
||||
|
||||
const goods = await handleReward(roleId, roleName, timeReward);
|
||||
const goods = await addItems(roleId, roleName, sid, timeReward);
|
||||
await HangUpRecordModel.updateRec(roleId, roleName, endLv, endTime, needReceiveGoods);
|
||||
|
||||
return resResult(STATUS.SUCCESS, { endTime, hangUpPassTime: Math.floor((deltaTime%HANG_UP_CONSTS.UNIT_TIME)/1000), ...goods });
|
||||
return resResult(STATUS.SUCCESS, { endTime, hangUpPassTime: Math.floor((deltaTime%HANG_UP_CONSTS.UNIT_TIME)/1000), goods });
|
||||
}
|
||||
|
||||
async hangUpSpeedUp(msg: {speedUpCnt: number}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
if (msg.speedUpCnt <= 0) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
@@ -137,12 +139,12 @@ export class TowerBattleHandler {
|
||||
return resResult(STATUS.TOWER_HANG_UP_FAILED);
|
||||
}
|
||||
const spdUpRec = await HangUpSpdUpRecModel.updateRec(roleId, roleName, msg.speedUpCnt, endLv, needReceiveGoods);
|
||||
const goods = await handleReward(roleId, roleName, timeReward);
|
||||
const goods = await addItems(roleId, roleName, sid, timeReward);
|
||||
hangUpSpdUpCnt -= msg.speedUpCnt;
|
||||
let num = HANG_UP_CONSTS.MAX_SPD_UP_CNT - hangUpSpdUpCnt + 1;
|
||||
let nextCostGold = calculateNum(GOLD_COST_RATIO.TOWER_HANG_SPDUP, {num}, 50);
|
||||
|
||||
return resResult(STATUS.SUCCESS, { ...goods, hangUpSpdUpCnt, nextCostGold, hangUpPassTime: Math.floor(deltaTime/1000), rewardLv: endLv, costGold });
|
||||
return resResult(STATUS.SUCCESS, { goods, hangUpSpdUpCnt, nextCostGold, hangUpPassTime: Math.floor(deltaTime/1000), rewardLv: endLv, costGold });
|
||||
}
|
||||
|
||||
getHangUpCost(originCnt: number, count: number) {
|
||||
@@ -267,6 +269,7 @@ export class TowerBattleHandler {
|
||||
async settleTask(msg: {batchCode: string, taskCode: string}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
|
||||
let allFlag = !msg.taskCode;
|
||||
|
||||
@@ -285,12 +288,12 @@ export class TowerBattleHandler {
|
||||
let {completeTime, reward, termsForAdd, additionalReward} = getTaskById(task.taskId);
|
||||
if (task.sendTime && task.sendTime.getTime() + completeTime * 1000 < curTime.getTime()) {
|
||||
compTasks.push(task.taskCode);
|
||||
const rewardGoods = await handleFixedReward(roleId, roleName, reward, 1);
|
||||
goods = goods.concat(rewardGoods.goods);
|
||||
const rewardGoods = await handleFixedReward(roleId, roleName, sid, reward, 1);
|
||||
goods = goods.concat(rewardGoods);
|
||||
if(termsForAdd) {
|
||||
const result = await checkTaskConditions(roleId, task.heroes, termsForAdd);
|
||||
const bonusGoods = await handleFixedReward(roleId, roleName, result?additionalReward:'', 1);
|
||||
goods = goods.concat(bonusGoods.goods);
|
||||
const bonusGoods = await handleFixedReward(roleId, roleName, sid, result?additionalReward:'', 1);
|
||||
goods = goods.concat(bonusGoods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,17 @@ export class EquipHandler {
|
||||
constructor(private app: Application) {
|
||||
}
|
||||
|
||||
|
||||
// 合成装备
|
||||
public async addItem(msg: { id: number, count: number}, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
let roleName: string = session.get('roleName');
|
||||
let sid: string = session.get('sid');
|
||||
let {id, count} = msg;
|
||||
let goods = await addItems(roleId, roleName, sid, [{id, count}]);
|
||||
return resResult(STATUS.SUCCESS, { goods });
|
||||
}
|
||||
|
||||
// 合成装备
|
||||
public async composeEquip(msg: { gid: number, originalEquip: number[]}, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
@@ -192,7 +203,7 @@ export class EquipHandler {
|
||||
return resResult(STATUS.SUCCESS, { isSuccess, curHero});
|
||||
}
|
||||
|
||||
// 装备洗炼锁定,消耗TODO
|
||||
// 装备洗炼锁定
|
||||
public async lockRandSe(msg: { eid: number, id: number, lock: boolean }, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
// let roleName: string = session.get('roleName');
|
||||
@@ -207,10 +218,10 @@ export class EquipHandler {
|
||||
return resResult(STATUS.EQUIP_HAVE_NO_RANDSE);
|
||||
}
|
||||
|
||||
// TODO 锁
|
||||
// let lock = 0;
|
||||
// let result = await handleCost(roleId, sid, [{id: lock, count: 1}]);
|
||||
// if(!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
if(lock) { // 仅在上锁时消耗
|
||||
let result = await handleCost(roleId, sid, []);
|
||||
if(!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
let result = await EquipModel.lock(roleId, eid, id, lock);
|
||||
if(!result) {
|
||||
@@ -241,7 +252,7 @@ export class EquipHandler {
|
||||
let {randomEffect} = dicGoods;
|
||||
let pool = randomEffect.map(cur => gameData.randomEffectPool.get(cur));
|
||||
let chosen = randSe.map(cur => cur.seid); // 上一轮和这一轮随机出来的
|
||||
let hasReset = false;
|
||||
let hasReset = false, lockNum = 0;
|
||||
for(let i = 0; i < randSe.length; i++) {
|
||||
if(!randSe[i].locked) {
|
||||
let newPool = pool.filter(cur => !chosen.includes(cur.id));
|
||||
@@ -252,6 +263,8 @@ export class EquipHandler {
|
||||
randSe[i].seid = random.id;
|
||||
randSe[i].rand = rand;
|
||||
hasReset = true;
|
||||
} else {
|
||||
lockNum ++;
|
||||
}
|
||||
}
|
||||
if(!hasReset) {
|
||||
@@ -259,7 +272,11 @@ export class EquipHandler {
|
||||
}
|
||||
|
||||
// TODO 消耗
|
||||
let cost = [];
|
||||
let cost = new Array<ItemInter>();
|
||||
if(lockNum == 0) {
|
||||
|
||||
}
|
||||
|
||||
let result = await handleCost(roleId, sid, cost);
|
||||
if(!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { TowerRecordModel } from './../db/TowerRecord';
|
||||
import { RoleModel } from './../db/Role';
|
||||
import { getHeroInfoById, getJobInfoById, getTowerDataByLv, getTaskById, getGamedata, getRandExpedition, getWarById, getWarJsons } from "../pubUtils/gamedata"
|
||||
import { decodeArrayStr, shouldRefresh, resResult, decodeStr, cal, getRandomWithWeight, getRefTime, decodeStrSingle, genCode } from '../pubUtils/util';
|
||||
import { handleFixedReward } from './rewardService';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { HangUpSpdUpRecModel } from '../db/HangUpSpdUpRec';
|
||||
import { TowerTaskRecModel } from '../db/TowerTaskRec';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GOOD_TYPE, ITID, CURRENCY, CURRENCY_TYPE, CONSUME_TYPE, getCurNameById } from './../consts';
|
||||
import { ITID, CONSUME_TYPE, getCurNameById, ITEM_TABLE } from './../consts';
|
||||
import { EquipModel } from './../db/Equip';
|
||||
import { decodeStr, resResult } from '../pubUtils/util';
|
||||
import { resResult, parseReward } from '../pubUtils/util';
|
||||
import { getGoodById } from '../pubUtils/gamedata';
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { setAp } from './actionPointService';
|
||||
@@ -12,120 +12,15 @@ import { EquipInter, ItemInter, BagInter } from '../pubUtils/interface';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
const _ = require('underscore');
|
||||
|
||||
export async function handleFixedReward(roleId: string, roleName: string, rewardStr: string, multi: number) {
|
||||
let reward = decodeStr('fixReward', rewardStr);
|
||||
export async function handleFixedReward(roleId: string, roleName: string, sid: string, rewardStr: string, multi: number) {
|
||||
let reward = parseReward(rewardStr);
|
||||
let rewards = [];
|
||||
for(let obj of reward)
|
||||
rewards.push({ ...obj, count: Math.ceil(obj.count * multi)});
|
||||
const result = await handleReward(roleId, roleName, reward);
|
||||
const result = await addItems(roleId, roleName, sid, reward);
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function handleReward(roleId: string, roleName: string, rewards: Array<{type?: number, gid: number, count: number, times?: number}>) {
|
||||
|
||||
let returnGoods = new Array(), getGold = 0, getCoin = 0, getAp = 0;
|
||||
for(let goods of rewards) {
|
||||
let goodInfo = getGoodById(goods.gid);
|
||||
let result = new Array<any>()
|
||||
if(goodInfo.goodType == GOOD_TYPE.EQUIP) { // 装备
|
||||
result = await rewardWeapons(roleId, roleName, goodInfo, {id: goods.gid, cnt: goods.count });
|
||||
} else if(goodInfo.goodType == GOOD_TYPE.CONSUMES|| goodInfo.goodType == GOOD_TYPE.SCRIPT) { // 消耗品
|
||||
let {type, isCurrency} = ITID.get(goodInfo.itid);
|
||||
if(isCurrency) { // 货币
|
||||
result = await rewardCurrency(roleId, goodInfo, {id: goods.gid, cnt: goods.count });
|
||||
} else {
|
||||
result = await rewardItems(roleId, roleName, goodInfo, type, {id: goods.gid, cnt: goods.count });
|
||||
}
|
||||
}
|
||||
|
||||
for(let obj of result) {
|
||||
returnGoods.push({dropType: goods.type, times: goods.times, ...obj});
|
||||
if(obj.isCurrency) {
|
||||
if(obj.currencyType == CURRENCY_TYPE.GOLD) {
|
||||
getGold += obj.count;
|
||||
} else if (obj.currencyType == CURRENCY_TYPE.COIN) {
|
||||
getCoin += obj.count;
|
||||
} else if (obj.currencyType == CURRENCY_TYPE.ACTION_POINT) {
|
||||
getAp += obj.count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
goods: returnGoods,
|
||||
getGold,
|
||||
getCoin,
|
||||
getAp
|
||||
};
|
||||
}
|
||||
|
||||
async function rewardWeapons (roleId: string, roleName: string, dicGood: any, weapon: {id:number,cnt:number }) {
|
||||
|
||||
let weaponsData = [];
|
||||
let cnt = weapon.cnt;
|
||||
// while (cnt > 0) {
|
||||
// const seqId = await CounterModel.getNewCounter(COUNTER.EID);
|
||||
// const equipInfo = {
|
||||
// roleId,
|
||||
// roleName,
|
||||
// id: weapon.id,
|
||||
// name: dicGood.name,
|
||||
// seqId,
|
||||
// quality: dicGood.lv,
|
||||
// type: dicGood.goodType
|
||||
// }
|
||||
// const equip = await EquipModel.createEquip(equipInfo);
|
||||
// cnt -= 1;
|
||||
// weaponsData.push(equip);
|
||||
// }
|
||||
return weaponsData;
|
||||
}
|
||||
|
||||
// 消耗品
|
||||
async function rewardItems (roleId: string, roleName: string, dicGood: any, type: number, data: {id:number,cnt:number }) {
|
||||
|
||||
let goods = new Array();
|
||||
let {id, cnt} = data;
|
||||
|
||||
let result = await ItemModel.increaseItem(roleId, id, cnt, {roleId, roleName, itemName: dicGood.name, id, type, hid: dicGood.hid||0});
|
||||
|
||||
if(result) {
|
||||
goods.push({
|
||||
id: id,
|
||||
name: dicGood.name,
|
||||
count: cnt,
|
||||
type: dicGood.goodType,
|
||||
isCurrency: false
|
||||
});
|
||||
}
|
||||
return goods;
|
||||
}
|
||||
|
||||
// 消耗品
|
||||
async function rewardCurrency (roleId: string, dicGood: any, data: {id:number,cnt:number }) {
|
||||
|
||||
let goods = new Array();
|
||||
let {id, cnt} = data;
|
||||
let dicCurrency = CURRENCY.get(id);
|
||||
if(dicCurrency.type == CURRENCY_TYPE.GOLD) { // 处理元宝
|
||||
await RoleModel.addGoldFree(roleId, cnt);
|
||||
} else if(dicCurrency.type == CURRENCY_TYPE.COIN) { // 处理铜币
|
||||
await RoleModel.addCoin(roleId, cnt);
|
||||
} else if(dicCurrency.type == CURRENCY_TYPE.ACTION_POINT) { // 处理体力
|
||||
await setAp(Date.now(), roleId, cnt);
|
||||
}
|
||||
|
||||
goods.push({
|
||||
id: id,
|
||||
name: dicGood.name,
|
||||
count: cnt,
|
||||
type: dicGood.goodType,
|
||||
isCurrency: true,
|
||||
currencyType: dicCurrency.type
|
||||
});
|
||||
return goods;
|
||||
}
|
||||
|
||||
export async function handleCost(roleId: string, sid: string, goods: Array<ItemInter>) {
|
||||
let currencysMap: any = {};
|
||||
let equips: Array<number> = [];
|
||||
@@ -173,15 +68,25 @@ 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.type == GOOD_TYPE.EQUIP) { // 装备
|
||||
let goodInfo = getGoodById(good.id);
|
||||
let {type, table } = ITID.get(goodInfo.itid);
|
||||
|
||||
if(table == ITEM_TABLE.EQUIP) {
|
||||
if (!!good.seqId) {
|
||||
equips.push(good.seqId);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
let goodInfo = getGoodById(good.id);
|
||||
let {type} = ITID.get(goodInfo.itid);
|
||||
} else if (table == ITEM_TABLE.ITEM) {
|
||||
let index = _.indexOf(bags, {id: good.id});
|
||||
if (index > 0) {
|
||||
bags[index].count = bags[index].count + good.count;
|
||||
} else {
|
||||
bags.push(good);
|
||||
}
|
||||
} else if (table == ITEM_TABLE.HERO) {
|
||||
return false
|
||||
} else if (table == ITEM_TABLE.ROLE) {
|
||||
let curname = getCurNameById(goodInfo.good_id);
|
||||
if (!!curname) {
|
||||
if (curname != 'ap') {
|
||||
@@ -189,15 +94,6 @@ function sortConsumes(goods: Array<ItemInter>, bags: Array<ItemInter>, currencys
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (type != CONSUME_TYPE.SKIN){
|
||||
let index = _.indexOf(bags, {id: good.id});
|
||||
if (index > 0) {
|
||||
bags[index].count = bags[index].count + good.count;
|
||||
} else {
|
||||
bags.push(good);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,14 +160,31 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array<number>, currencysMap: any, equips: Array<EquipInter>, showItems: Array<ItemInter>) {
|
||||
for (let good of goods) {
|
||||
let goodInfo = gameData.goods.get(good.id);
|
||||
console.log('*****', good.id, goodInfo.goodType)
|
||||
if (goodInfo.goodType == GOOD_TYPE.EQUIP) { // 装备
|
||||
console.log()
|
||||
console.error('无道具', good.id);
|
||||
|
||||
let {type, table, isCurrency} = ITID.get(goodInfo.itid);
|
||||
if(table == ITEM_TABLE.EQUIP) {
|
||||
for (let i = 0; i < good.count; i++) {
|
||||
equips.push({id: good.id, ...goodInfo});
|
||||
}
|
||||
} else {
|
||||
let {type, isCurrency} = ITID.get(goodInfo.itid);
|
||||
} else if (table == ITEM_TABLE.ITEM) {
|
||||
|
||||
let index = _.indexOf(bags, {id: good.id});
|
||||
if (index > 0) {
|
||||
bags[index].count = bags[index].count + good.count;
|
||||
} else {
|
||||
bags.push({id: good.id, count: good.count, itemName: goodInfo.name, hid: goodInfo.hid||0, type});
|
||||
}
|
||||
|
||||
} else if (table == ITEM_TABLE.HERO) {
|
||||
if (type == CONSUME_TYPE.SKIN) {
|
||||
let index = _.indexOf(skins, good.id);
|
||||
if (index == -1) {
|
||||
skins.push(good.id);
|
||||
}
|
||||
}
|
||||
} else if (table == ITEM_TABLE.ROLE) {
|
||||
|
||||
if (!!isCurrency) {
|
||||
let curname = getCurNameById(goodInfo.good_id);
|
||||
if (!!curname) {
|
||||
@@ -283,18 +196,6 @@ function sortItems (goods: Array<ItemInter>, bags: Array<BagInter>, skins: Array
|
||||
}
|
||||
currencysMap[curname] = (currencysMap[curname]||0 )+ good.count;
|
||||
}
|
||||
} else if (type == CONSUME_TYPE.SKIN) {
|
||||
let index = _.indexOf(skins, good.id);
|
||||
if (index == -1) {
|
||||
skins.push(good.id);
|
||||
}
|
||||
} else {
|
||||
let index = _.indexOf(bags, {id: good.id});
|
||||
if (index > 0) {
|
||||
bags[index].count = bags[index].count + good.count;
|
||||
} else {
|
||||
bags.push({id: good.id, count: good.count, itemName: goodInfo.name, hid: goodInfo.hid||0, type});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,14 @@ import { BattleDropModel } from '../db/BattleDrop';
|
||||
import { getWarById, getBluePrtByQuality, getGamedata } from '../pubUtils/gamedata';
|
||||
import { decodeStr, getRefTime, getRandomWithWeight, getRandomByLen } from '../pubUtils/util';
|
||||
import { BATTLE_REWARD_TYPE, BLUEPRT_CONST } from '../consts';
|
||||
import { handleReward } from './rewardService';
|
||||
import { addItems } from './rewardService';
|
||||
import { BattleBlueprtDropModel } from '../db/BattleBlueprtDrop'
|
||||
import { RoleModel } from '../db/Role';
|
||||
|
||||
export class WarReward {
|
||||
private roleId: string;
|
||||
private roleName: string;
|
||||
private sid: string;
|
||||
private battleId: number;
|
||||
private condition: Map<number, boolean>;
|
||||
private warInfo: any;
|
||||
@@ -24,9 +25,10 @@ export class WarReward {
|
||||
private randomReward: string;
|
||||
private costAp: number;
|
||||
|
||||
constructor(roleId: string, roleName: string, battleId: number, isSuccess: boolean) {
|
||||
constructor(roleId: string, roleName: string, sid: string, battleId: number, isSuccess: boolean) {
|
||||
this.roleId = roleId;
|
||||
this.roleName = roleName;
|
||||
this.sid = sid;
|
||||
this.battleId = battleId;
|
||||
this.condition = new Map();
|
||||
this.warInfo = getWarById(battleId);
|
||||
@@ -196,8 +198,9 @@ export class WarReward {
|
||||
if(this.costAp > 0) await this.handlerBlueprtReward(num);
|
||||
}
|
||||
|
||||
let returnGoods = await handleReward(this.roleId, this.roleName, this.rewards);
|
||||
return returnGoods;
|
||||
let rewards = this.rewards.sort((a, b) => a.times - b.times)
|
||||
await addItems(this.roleId, this.roleName, this.sid, rewards);
|
||||
return rewards;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,11 +4,14 @@ export const IT_TYPE = {
|
||||
}
|
||||
|
||||
|
||||
// 大类型,区分存到哪张表里
|
||||
// 背包页签
|
||||
export const GOOD_TYPE = {
|
||||
ITEM: 1,
|
||||
EQUIP: 2,
|
||||
CONSUMES: 1,
|
||||
SCRIPT: 3
|
||||
PIECE: 3,
|
||||
BLUEPRT: 4,
|
||||
JEWEL: 5,
|
||||
PICTURE: 6
|
||||
};
|
||||
|
||||
// 存到消耗品表内显示的类型
|
||||
@@ -35,56 +38,63 @@ export enum EQUIP_TYPE {
|
||||
END = 6
|
||||
}
|
||||
|
||||
export const ITEM_TABLE = {
|
||||
EQUIP: 'equip',
|
||||
ITEM: 'item',
|
||||
ROLE: 'role',
|
||||
HERO: 'hero'
|
||||
}
|
||||
|
||||
const itid_array = [
|
||||
{ id: 1, name: '短兵(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 2, name: '枪矛(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 3, name: '重兵(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 4, name: '弓弩(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 5, name: '奇门(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 6, name: '羽扇(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 7, name: '法器(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 8, name: '杖(神兵)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 9, name: '头盔(冠冕)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.CAP },
|
||||
{ id: 10, name: '头巾(冠冕)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.CAP },
|
||||
{ id: 11, name: '重铠(宝甲)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 12, name: '皮甲(宝甲)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 13, name: '布衣(宝甲)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 14, name: '兵书(典籍)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.BOOK },
|
||||
{ id: 15, name: '杂记(典籍)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.BOOK },
|
||||
{ id: 16, name: '经典(典籍)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.BOOK },
|
||||
{ id: 17, name: '马(行具)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.SHOES },
|
||||
{ id: 18, name: '鞋(行具)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.SHOES },
|
||||
{ id: 19, name: '车(行具)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.SHOES },
|
||||
{ id: 20, name: '佩饰(礼器)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.ACCESSORY },
|
||||
{ id: 21, name: '钟鼎(礼器)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.ACCESSORY },
|
||||
{ id: 22, name: '印章(礼器)', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.ACCESSORY },
|
||||
{ id: 1, name: '短兵(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 2, name: '枪矛(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 3, name: '重兵(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 4, name: '弓弩(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 5, name: '奇门(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 6, name: '羽扇(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 7, name: '法器(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 8, name: '杖(神兵)', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 9, name: '头盔(冠冕)', table: 'equip', type: EQUIP_TYPE.CAP },
|
||||
{ id: 10, name: '头巾(冠冕)', table: 'equip', type: EQUIP_TYPE.CAP },
|
||||
{ id: 11, name: '重铠(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 12, name: '皮甲(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 13, name: '布衣(宝甲)', table: 'equip', type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 14, name: '兵书(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK },
|
||||
{ id: 15, name: '杂记(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK },
|
||||
{ id: 16, name: '经典(典籍)', table: 'equip', type: EQUIP_TYPE.BOOK },
|
||||
{ id: 17, name: '马(行具)', table: 'equip', type: EQUIP_TYPE.SHOES },
|
||||
{ id: 18, name: '鞋(行具)', table: 'equip', type: EQUIP_TYPE.SHOES },
|
||||
{ id: 19, name: '车(行具)', table: 'equip', type: EQUIP_TYPE.SHOES },
|
||||
{ id: 20, name: '佩饰(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY },
|
||||
{ id: 21, name: '钟鼎(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY },
|
||||
{ id: 22, name: '印章(礼器)', table: 'equip', type: EQUIP_TYPE.ACCESSORY },
|
||||
|
||||
{ id: 23, name: '消耗品', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.CONSUME },
|
||||
{ id: 23, name: '消耗品', table: 'item', type: CONSUME_TYPE.CONSUME },
|
||||
|
||||
{ id: 37, name: '消耗类物品(图纸类)', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.CONSUME },
|
||||
{ id: 35, name: '消耗类物品(经验书)', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.EXP },
|
||||
{ id: 36, name: '消耗类物品(好感道具)', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.FAVOUR },
|
||||
{ id: 38, name: '消耗类物品(材料类)', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.CONSUME },
|
||||
{ id: 24, name: '使用类物品(宝箱类)', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.CONSUME },
|
||||
{ id: 25, name: '武将碎片', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.SOUL },
|
||||
{ id: 37, name: '消耗类物品(图纸类)', table: 'item', type: CONSUME_TYPE.CONSUME },
|
||||
{ id: 35, name: '消耗类物品(经验书)', table: 'item', type: CONSUME_TYPE.EXP },
|
||||
{ id: 36, name: '消耗类物品(好感道具)', table: 'item', type: CONSUME_TYPE.FAVOUR },
|
||||
{ id: 38, name: '消耗类物品(材料类)', table: 'item', type: CONSUME_TYPE.CONSUME },
|
||||
{ id: 24, name: '使用类物品(宝箱类)', table: 'item', type: CONSUME_TYPE.CONSUME },
|
||||
{ id: 25, name: '武将碎片', table: 'item', type: CONSUME_TYPE.SOUL },
|
||||
|
||||
{ id: 26, name: '剧情物品', goodType: GOOD_TYPE.SCRIPT },
|
||||
{ id: 26, name: '剧情物品', table: 'item', type: CONSUME_TYPE.CONSUME },
|
||||
|
||||
{ id: 27, name: '货币', goodType: GOOD_TYPE.CONSUMES, isCurrency: true },
|
||||
{ id: 28, name: '藏宝图', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.BLUEPRT },
|
||||
{ id: 27, name: '货币', table: 'role', isCurrency: true },
|
||||
{ id: 28, name: '藏宝图', table: 'item', type: CONSUME_TYPE.BLUEPRT },
|
||||
|
||||
{ id: 29, name: '礼器', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.ACCESSORY },
|
||||
{ id: 30, name: '宝甲', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 31, name: '名驹', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.SHOES },
|
||||
{ id: 32, name: '典籍', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.BOOK },
|
||||
{ id: 33, name: '神兵', goodType: GOOD_TYPE.EQUIP, type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 34, name: '代币', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.POINT },
|
||||
{ id: 39, name: '时装', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.SKIN },
|
||||
{ id: 40, name: '装备碎片', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.PIECE },
|
||||
{ id: 41, name: '宝石', goodType: GOOD_TYPE.CONSUMES, type: CONSUME_TYPE.JEWEL }
|
||||
{ id: 29, name: '礼器', table: 'equip', type: EQUIP_TYPE.ACCESSORY },
|
||||
{ id: 30, name: '宝甲', table: 'equip', type: EQUIP_TYPE.CLOTHES },
|
||||
{ id: 31, name: '名驹', table: 'equip', type: EQUIP_TYPE.SHOES },
|
||||
{ id: 32, name: '典籍', table: 'equip', type: EQUIP_TYPE.BOOK },
|
||||
{ id: 33, name: '神兵', table: 'equip', type: EQUIP_TYPE.WEAPON },
|
||||
{ id: 34, name: '代币', table: 'item', type: CONSUME_TYPE.POINT },
|
||||
{ id: 39, name: '时装', table: 'hero', type: CONSUME_TYPE.SKIN },
|
||||
{ id: 40, name: '装备碎片', table: 'item', type: CONSUME_TYPE.PIECE },
|
||||
{ id: 41, name: '宝石', table: 'item', type: CONSUME_TYPE.JEWEL }
|
||||
];
|
||||
|
||||
export const ITID = new Map<number, {id: number, name: string, goodType: number, type?: number, isCurrency?: boolean}>();
|
||||
export const ITID = new Map<number, {id: number, name: string, table: string, type?: number, isCurrency?: boolean}>();
|
||||
for(let obj of itid_array) {
|
||||
ITID.set(obj.id, obj);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
export const EQUIP = {
|
||||
EQUIP_ONE_HOLE: '1&1', // 装备孔1号位消耗
|
||||
EQUIP_TWO_HOLE: '1&2', // 装备孔2号位消耗
|
||||
EQUIP_THREE_HOLE: '1&4', // 装备孔3号位消耗
|
||||
XILIAN_ZERO_LOCK: '1&1', // 洗炼0个锁
|
||||
XILIAN_ONE_LOCK: '1&2', // 洗炼1个锁
|
||||
XILIAN_TWO_LOCK: '1&3', // 洗炼2个锁
|
||||
XILIAN_THREE_LOCK: '1&4', // 洗炼3个锁
|
||||
EQUIP_ONE_HOLE: '17038&1', // 装备孔1号位消耗
|
||||
EQUIP_TWO_HOLE: '17038&2', // 装备孔2号位消耗
|
||||
EQUIP_THREE_HOLE: '17038&4', // 装备孔3号位消耗
|
||||
EQUIP_ONE_REFORGED: '17040&1', // 装备位洗练词条第一次消耗
|
||||
EQUIP_TWO_REFORGED: '17040&2', // 装备位洗练词条第二次消耗
|
||||
EQUIP_THREE_REFORGED: '17040&4', // 装备位洗练词条第三次消耗
|
||||
EQUIP_FOUR_REFORGED: '17040&8', // 装备位洗练词条第四次消耗
|
||||
EQUIP_ONE_LOCKED: '17041&1', // 装备位洗练词条不锁住钥匙消耗
|
||||
EQUIP_TWO_LOCKED: '17041&2', // 装备位洗练词条锁住一条钥匙消耗
|
||||
EQUIP_THREE_LOCKED: '17041&4', // 装备位洗练词条锁住二条钥匙消耗
|
||||
EQUIP_FOUR_LOCKED: '17041&8', // 装备位洗练词条锁住三条钥匙消耗
|
||||
};
|
||||
|
||||
@@ -35,8 +35,9 @@ export interface EquipInter {
|
||||
randomEffect: Array<number>;
|
||||
itid: number;
|
||||
hid?: number;
|
||||
times?: number;
|
||||
};
|
||||
|
||||
|
||||
export interface BagInter {id: number, itemName: string, count: number, type: number, hid:number};
|
||||
export interface BagInter {id: number, itemName: string, count: number, type: number, hid:number, times?: number};
|
||||
export interface ItemInter {id?: number, count?: number, seqId?: number, type?: number};
|
||||
|
||||
@@ -42,21 +42,21 @@ const moment = require('moment');
|
||||
let result: any;
|
||||
switch (type) {
|
||||
case 'fixReward': {
|
||||
let [gid, count] = arr;
|
||||
if(isNaN(gid) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { gid: parseInt(gid), count: parseInt(count)};
|
||||
let [id, count] = arr;
|
||||
if(isNaN(id) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { id: parseInt(id), count: parseInt(count)};
|
||||
break;
|
||||
}
|
||||
case 'conditionReward': {
|
||||
let [gid, count, condition] = arr;
|
||||
if(isNaN(gid) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { gid: parseInt(gid), count: parseInt(count), condition: parseInt(condition) };
|
||||
let [id, count, condition] = arr;
|
||||
if(isNaN(id) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { id: parseInt(id), count: parseInt(count), condition: parseInt(condition) };
|
||||
break;
|
||||
}
|
||||
case 'randomReward': {
|
||||
let [gid, count, frequency] = arr;
|
||||
if(isNaN(gid) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { gid: parseInt(gid), count: parseInt(count), frequency: parseInt(frequency) };
|
||||
let [id, count, frequency] = arr;
|
||||
if(isNaN(id) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { id: parseInt(id), count: parseInt(count), frequency: parseInt(frequency) };
|
||||
break;
|
||||
}
|
||||
case 'suitLevel': {
|
||||
@@ -91,9 +91,9 @@ const moment = require('moment');
|
||||
break;
|
||||
}
|
||||
case 'decimalReward': {
|
||||
let [gid, count] = arr;
|
||||
if(isNaN(gid) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { gid: parseInt(gid), count: parseFloat(count) };
|
||||
let [id, count] = arr;
|
||||
if(isNaN(id) || isNaN(count)) throw new Error('data table format wrong');
|
||||
result = { id: parseInt(id), count: parseFloat(count) };
|
||||
break;
|
||||
}
|
||||
case 'towerTaskCondition': {
|
||||
|
||||
Reference in New Issue
Block a user