mafei 1 год назад
Родитель
Сommit
ca9523e4bc

+ 1 - 1
script/module/xianzhi/Handler.lua

@@ -32,5 +32,5 @@ function CG_XIANZHI_SHOP_QUERY(human,msg)
 end
 
 function CG_XIANZHI_SHOP_BUY(human,msg)
-	XianzhiLogic.shopBuy(human,msg.id)
+	XianzhiLogic.shopBuy(human,msg.id,msg.count)
 end

+ 2 - 1
script/module/xianzhi/Proto.lua

@@ -73,7 +73,8 @@ GC_XIANZHI_SHOP_QUERY={
 }
 
 CG_XIANZHI_SHOP_BUY={
-	{"id",             1,             "int"}
+	{"id",             1,             "int"},
+	{"count",             1,             "int"}
 }
 
 GC_XIANZHI_SHOP_BUY = {

+ 5 - 4
script/module/xianzhi/XianzhiLogic.lua

@@ -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)