diff --git a/game-server/app/services/shopService.ts b/game-server/app/services/shopService.ts index 511ad4b68..cbd2f9efd 100644 --- a/game-server/app/services/shopService.ts +++ b/game-server/app/services/shopService.ts @@ -12,6 +12,7 @@ import { DicShop } from "../pubUtils/dictionary/DicShop"; import { BackendSession } from "pinus"; import { ActivityModelType } from "../db/Activity"; import { addItems } from "./role/rewardService"; +import { LadderMatchModel } from "../db/LadderMatch"; export async function getAllShopList(roleId: string, serverId: number) { let userShopRecs = await UserShopModel.findByRoleId(roleId); @@ -157,7 +158,12 @@ export async function checkShopItemCanBuy(activityId: number, shopItemId: number return STATUS.LV_LIMIT; } } - + if(dicShopItem.ranklimit) { + let ladder = await LadderMatchModel.findByRoleId(roleId); + if(ladder.historyRank < dicShopItem.ranklimit) { + return STATUS.LADDER_LV_LIMIT; + } + } if(dicShopItem.purchaseLimit != -1) { if(vipStartTime > 0 && dicShopItem.vipPurchaseLimit != -1) { if(buyCount + count > dicShopItem.purchaseLimit + dicShopItem.vipPurchaseLimit) { diff --git a/shared/consts/statusCode.ts b/shared/consts/statusCode.ts index a382f0b96..698bfadde 100644 --- a/shared/consts/statusCode.ts +++ b/shared/consts/statusCode.ts @@ -417,6 +417,7 @@ export const STATUS = { HERO_NOT_MAX: { code: 30904, simStr: '该武将未升满星' }, LV_LIMIT: { code: 30905, simStr: '玩家等级不足' }, CAN_NOT_PURCHASE: { code: 30906, simStr: '该商品不可使用该购买方式' }, + LADDER_LV_LIMIT: { code: 30907, simStr: '名将擂台等级不足' }, // 任务相关 31001-31100 TASK_NOT_REACH_CONDITION: { code: 31001, simStr: '任务不满足条件' }, diff --git a/shared/domain/roleField/shop.ts b/shared/domain/roleField/shop.ts index 5d381fe3e..f11eac069 100644 --- a/shared/domain/roleField/shop.ts +++ b/shared/domain/roleField/shop.ts @@ -19,6 +19,7 @@ interface ShopItemInDb { num: number; guildLvLimit: number; lvLimit: number; + ranklimit: number; purchaseLimit: number; vipPurchaseLimit: number; refreshType: number; @@ -75,6 +76,7 @@ export class ShopDicData { num: number; guildLvLimit: number; lvLimit: number; + ranklimit: number; purchaseLimit: number; vipPurchaseLimit: number; refreshType: SHOP_REFRESH_TYPE; @@ -94,6 +96,7 @@ export class ShopDicData { this.num = obj.num; this.guildLvLimit = obj.guildLvLimit; this.lvLimit = obj.lvLimit; + this.ranklimit = obj.ranklimit; this.purchaseLimit = obj.purchaseLimit; this.vipPurchaseLimit = obj.vipPurchaseLimit; this.refreshType = obj.refreshType; diff --git a/shared/pubUtils/dictionary/DicShop.ts b/shared/pubUtils/dictionary/DicShop.ts index 273a8dce9..a900884d6 100644 --- a/shared/pubUtils/dictionary/DicShop.ts +++ b/shared/pubUtils/dictionary/DicShop.ts @@ -20,6 +20,8 @@ export interface DicShop { readonly guildLvLimit: number; // 玩家等级需求 readonly lvLimit: number; + // 名将擂台需求 + readonly ranklimit: number; // 购买次数限制 readonly purchaseLimit: number; // vip购买次数限制