|
|
@@ -430,7 +430,7 @@ function shopQuery(human)
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
end
|
|
|
|
|
|
-function shopBuy(human,id)
|
|
|
+function shopBuy(human,id,count)
|
|
|
-- 判断道具是否足够
|
|
|
local goodsCfg = XianzhiExcel.xianzhiShop[id]
|
|
|
--
|
|
|
@@ -438,12 +438,13 @@ function shopBuy(human,id)
|
|
|
return Broadcast.sendErr(human, Util.format(Lang.XIANZHI_GOODS_NOT_FOUND,id))
|
|
|
end
|
|
|
local cnt = BagLogic.getItemCnt(human,xianzhiOutPutId)
|
|
|
- if cnt < goodsCfg.price then
|
|
|
+ local needCnt = goodsCfg.price * count
|
|
|
+ if cnt < needCnt then
|
|
|
return Broadcast.sendErr(human, Util.format(Lang.XIANZHI_NO_ITEM,ItemDefine.getValue(xianzhiOutPutId,"name")))
|
|
|
end
|
|
|
-- 先扣款 再发道具
|
|
|
- BagLogic.delItem(human,xianzhiOutPutId,goodsCfg.price,"xianzhi_buy")
|
|
|
- BagLogic.addItem(human,goodsCfg.goods[1],goodsCfg.goods[2],"xianzhi_buy")
|
|
|
+ BagLogic.delItem(human,xianzhiOutPutId,needCnt,"xianzhi_buy")
|
|
|
+ BagLogic.addItem(human,goodsCfg.goods[1],goodsCfg.goods[2] * count,"xianzhi_buy")
|
|
|
-- 同步客户端最新先知精华数量
|
|
|
local msgRet = Msg.gc.GC_XIANZHI_SHOP_BUY
|
|
|
msgRet.xianzhiCoin = BagLogic.getItemCnt(human,xianzhiOutPutId)
|