数数:消耗来源

This commit is contained in:
luying
2021-12-14 13:18:23 +08:00
parent e9c471c583
commit b6501ee4a2
70 changed files with 503 additions and 305 deletions

View File

@@ -1,5 +1,5 @@
import { Application, BackendSession, HandlerService, } from "pinus";
import { STATUS, CONSUME_TYPE, DEBUG_MAGIC_WORD } from "../../../consts";
import { STATUS, CONSUME_TYPE, DEBUG_MAGIC_WORD, ITEM_CHANGE_REASON } from "../../../consts";
import { RewardInter } from "../../../pubUtils/interface";
import { resResult } from "../../../pubUtils/util";
@@ -35,7 +35,7 @@ export class ItemHandler {
if (count > 0) {
let consumeResult = await handleCost(roleId, sid, [{ id: id, count: count }]);
let consumeResult = await handleCost(roleId, sid, [{ id: id, count: count }], ITEM_CHANGE_REASON.USE_GIFT_PACKAGE);
if (!consumeResult) return resResult(STATUS.ACTIVITY_RES_NOT_ENOUGH);
let dicGoods = gameData.goods.get(id);
@@ -82,7 +82,7 @@ export class ItemHandler {
let { isOver } = await getAp(roleId, role.lv);
if (isOver) return resResult(STATUS.AP_IS_FULL);
let consumeResult = await handleCost(roleId, sid, [{ id: id, count: count }]);
let consumeResult = await handleCost(roleId, sid, [{ id: id, count: count }], ITEM_CHANGE_REASON.USE_MEAT);
if (!consumeResult) return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
let apJson = await setAp(roleId, role.lv, dicGoods.value * count, sid);
@@ -125,10 +125,10 @@ export class ItemHandler {
if (curCost) cost = cost.concat(curCost);
}
let consumeResult = await handleCost(roleId, sid, cost);
let consumeResult = await handleCost(roleId, sid, cost, ITEM_CHANGE_REASON.BUY_MEAT);
if (!consumeResult) return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
let goods = await addItems(roleId, roleName, sid, [{ id, count }]);
let goods = await addItems(roleId, roleName, sid, [{ id, count }], ITEM_CHANGE_REASON.BUY_MEAT);
let apJson = await setApBuyTimes(roleId, role.lv, sid, count);
return resResult(STATUS.SUCCESS, {
@@ -167,7 +167,7 @@ export class ItemHandler {
await GiftCodeDetailModel.increaseUsedNum(code);
await GiftCodeModel.increaseUsedNum(giftCode.id);
let goods = await addItems(roleId, roleName, sid, giftCode.goods);
let goods = await addItems(roleId, roleName, sid, giftCode.goods, ITEM_CHANGE_REASON.USE_GIFT_CODE);
return resResult(STATUS.SUCCESS, { goods });
}