Kaynağa Gözat

修复私人定制活动 功能

mafei 1 yıl önce
ebeveyn
işleme
521ba29493

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

@@ -638,7 +638,8 @@ NdCustomNet = {
 }
 
 GC_ABS_ND_CUSTOM_QUERY = {
-    {"giftList",10,NdCustomNet},
+    {"isEnd", 1 , "int"},    --  0表示还有数据,1表示数据已经发送完了
+    {"giftList",5,NdCustomNet},
 }
 
 CG_ABS_ND_CUSTOM_CHOSE_ITEM = {

+ 36 - 27
script/module/absAct/SpecialCustomLogic.lua

@@ -20,8 +20,8 @@ local Msg = require("core.Msg")
 local Grid = require("bag.Grid")
 local BagLogic = require("bag.BagLogic")
 local BuyLogic = require("topup.BuyLogic")
-local ObjHuman = require("core.ObjHuman")
-local Lang  = require("common.Lang")
+local ObjHuman = require("core.ObjHuman")
+local Lang  = require("common.Lang")
 local Broadcast = require("broadcast.Broadcast")
 
 function isOpen(human, YYInfo, funcConfig)
@@ -39,10 +39,10 @@ function isActive(human, YYInfo, funcConfig)
 end
 
 
---发送定制礼包数据
--- id 动id
+--锟斤拷锟酵讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
+-- id 锟筋动id
 function getAndSendMsg(human,id,actID)
-    -- 活动未开,返回
+    -- 锟筋动未锟斤拷锟斤拷锟斤拷锟斤拷
     local state, endTime, starTime = AbsActLogic.isStarted(human, id)
     if not state then return end
     local absConfig = AbsActExcel.absActivity[id]
@@ -52,13 +52,20 @@ function getAndSendMsg(human,id,actID)
     if not absAct then
         return
     end
-    -- 初始化custom数据
+    -- 锟斤拷始锟斤拷custom锟斤拷锟斤拷
     absAct.custom = absAct.custom or {}
-    -- 构造数据
+    -- 锟斤拷锟斤拷锟斤拷锟斤拷
     local msgRet = Msg.gc.GC_ABS_ND_CUSTOM_QUERY
     local config = AbsActExcel.custom
     local len = 0
     for k,v in pairs(config) do
+        if len >= 3 then 
+            msgRet.giftList[0] =len
+            msgRet.isEnd = 0
+            Msg.send(msgRet,human.fd)
+            len = 0
+            msgRet = Msg.gc.GC_ABS_ND_CUSTOM_QUERY
+        end
         if v.actId == absConfig.actId then
             len = len + 1
             local net = msgRet.giftList[len]
@@ -108,13 +115,13 @@ function getAndSendMsg(human,id,actID)
                 end
                 net.third[0] = warehouseLen
             end
-            -- 状态为0,表示未选择物品,发送物品库
+            -- 状态为0锟斤拷锟斤拷示未选锟斤拷锟斤拷品锟斤拷锟斤拷锟斤拷锟斤拷品锟斤拷
             if net.state == 0 then
                 net.one[0] = 0
                 net.two[0] = 0
                 net.three[0] = 0
             else
-                -- 状态不为0,表示已卖完或已选择物品,展示已选择物品
+                -- 状态锟斤拷为0锟斤拷锟斤拷示锟斤拷锟斤拷锟斤拷锟斤拷锟窖★拷锟斤拷锟狡凤拷锟秸故撅拷锟窖★拷锟斤拷锟狡�
                 Grid.makeItem(net.one[1],absAct.custom[k].selectItem[1][1],absAct.custom[k].selectItem[1][2])
                 Grid.makeItem(net.two[1],absAct.custom[k].selectItem[2][1],absAct.custom[k].selectItem[2][2])
                 net.one[0] = 1
@@ -127,15 +134,17 @@ function getAndSendMsg(human,id,actID)
             end
         end
     end
-    msgRet.giftList[0] =len
+    msgRet.giftList[0] = len
+    msgRet.isEnd = 1
     Msg.send(msgRet,human.fd)
+    
 end
 
--- 选择物
+-- 选锟斤拷锟斤拷
 function selectItem(human,id,giftId,first,second,third)
     local msgRet = Msg.gc.GC_ABS_ND_CUSTOM_SELECT
     msgRet.ret = 1
-    -- 活动未开,无法选择物
+    -- 锟筋动未锟斤拷锟斤拷锟睫凤拷选锟斤拷锟斤拷
     local state, endTime, starTime = AbsActLogic.isStarted(human, id)
     if not state then 
         msgRet.ret = 0
@@ -157,21 +166,21 @@ function selectItem(human,id,giftId,first,second,third)
         return
     end
     
-    -- 礼包已卖完无法选择物品
+    -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷薹锟窖★拷锟斤拷锟狡�
     if absAct.custom and absAct.custom[giftId] and absAct.custom[giftId].state == 2 then
         msgRet.ret = 0
         Msg.send(msgRet,human.fd)
         return
     end
 
-    -- 初始化数据
+    -- 锟斤拷始锟斤拷锟斤拷锟斤拷
     absAct.custom = absAct.custom or {}
     absAct.custom[giftId] = absAct.custom[giftId] or {}
     absAct.custom[giftId].cnt = absAct.custom[giftId].cnt or 0
     absAct.custom[giftId].state = absAct.custom[giftId].state or 0
     absAct.custom[giftId].selectItem = absAct.custom[giftId].selectItem or {}
     
-    -- 校验物品是否存在
+    -- 校锟斤拷锟斤拷品锟角凤拷锟斤拷锟�
     local config = AbsActExcel.custom[giftId]
     if config == nil 
        or config.first[first] == nil 
@@ -188,7 +197,7 @@ function selectItem(human,id,giftId,first,second,third)
         return
     end
     
-    -- 将已选择物品存入数据库
+    -- 锟斤拷锟斤拷选锟斤拷锟斤拷品锟斤拷锟斤拷锟斤拷锟捷匡拷
     absAct.custom[giftId].selectItem[1] = {}
     absAct.custom[giftId].selectItem[1][1] = config.first[first][1]
     absAct.custom[giftId].selectItem[1][2] = config.first[first][2]
@@ -196,7 +205,7 @@ function selectItem(human,id,giftId,first,second,third)
     absAct.custom[giftId].selectItem[2][1] = config.second[second][1]
     absAct.custom[giftId].selectItem[2][2] = config.second[second][2]
     
-    -- 并非所有礼包都能选择3个物
+    -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟窖★拷锟�3锟斤拷锟斤拷
     if third ~= 0 then
         absAct.custom[giftId].selectItem[3] = {}
         absAct.custom[giftId].selectItem[3][1] = config.third[third][1]
@@ -207,14 +216,14 @@ function selectItem(human,id,giftId,first,second,third)
     absAct.custom[giftId].state = 1
 end
 
--- 购买礼包
+-- 锟斤拷锟斤拷锟斤拷锟�
 
 function custom(human,funcID,conf)
     customBuy(human,conf.args[1],funcID)
 end
 
 function customBuy(human,args,id)
-    -- 活动未开,返回
+    -- 锟筋动未锟斤拷锟斤拷锟斤拷锟斤拷
     local state, endTime, starTime = AbsActLogic.isStarted(human, id)
     if not state then return end
     local absConfig = AbsActExcel.absActivity[id]
@@ -225,23 +234,23 @@ function customBuy(human,args,id)
         return
     end
 
-    -- 购买状态不为可购买,返回
+    -- 锟斤拷锟斤拷状态锟斤拷为锟缴癸拷锟津,凤拷锟斤拷
     if not absAct.custom or not absAct.custom[args] or absAct.custom[args].state ~= 1 then
         return
     end
 
-    -- 未选择物品,返回
+    -- 未选锟斤拷锟斤拷品锟斤拷锟斤拷锟斤拷
     if #absAct.custom[args].selectItem <= 0 then
         return
     end
 
-    -- 已达到限购次数,返回
+    -- 锟窖达到锟睫癸拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
     local config = AbsActExcel.custom[args]
     if absAct.custom[args].cnt >= config.limitCnt then
         return
     end
 
-    -- 钻石价格不为0时,表示钻石购买,则需判断钻石是否足
+    -- 锟斤拷石锟桔革拷为0时锟斤拷锟斤拷示锟斤拷石锟斤拷锟斤拷锟斤拷锟斤拷锟叫讹拷锟斤拷石锟角凤拷锟姐
     if config.price ~= 0 then
 	    if not ObjHuman.checkRMB(human, config.price) then
 	    	return Broadcast.sendErr(human, Lang.COMMON_NO_ZUANSHI)
@@ -249,13 +258,13 @@ function customBuy(human,args,id)
 	    ObjHuman.decZuanshi(human, -config.price, "abs_custom")
     end
 
-    -- 购买次数增加一次
+    -- 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟�
     absAct.custom[args].cnt = absAct.custom[args].cnt + 1
 
-    -- 状态设置为已卖完,此时,为防止后续报错,导致可无限购买,故先设置为无法继续购买
+    -- 状态锟斤拷锟斤拷为锟斤拷锟斤拷锟疥,锟斤拷时锟斤拷为锟斤拷止锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟铰匡拷锟斤拷锟睫癸拷锟津,癸拷锟斤拷锟斤拷锟斤拷为锟睫凤拷锟斤拷锟斤拷锟斤拷锟斤拷
     absAct.custom[args].state = 2
 
-    -- 统计物品,并发放
+    -- 统锟斤拷锟斤拷品锟斤拷锟斤拷锟斤拷锟斤拷
     local item = {}
     for i = 1, #config.fixed do
         item[#item+1] = {config.fixed[i][1],config.fixed[i][2]}
@@ -265,7 +274,7 @@ function customBuy(human,args,id)
     end
     BagLogic.addItemList(human, item, "abs_custom")   
 
-    -- 判断是否达到限购次数,未达到则将购买状态设为选择物品
+    -- 锟叫讹拷锟角凤拷锏斤拷薰锟斤拷锟斤拷锟斤拷锟轿达拷锏斤拷蚪�锟斤拷锟阶刺�拷锟轿�★拷锟斤拷锟狡�
     if absAct.custom[args].cnt < config.limitCnt then 
         absAct.custom[args].selectItem = {}
         absAct.custom[args].state = 0