gitxsm 3 месяцев назад
Родитель
Сommit
e67ac91ec7

+ 2 - 0
script/common/Lang.lua

@@ -586,6 +586,8 @@ YUNYING_BUY_ERR_CNT = [[剩余购买次数不足]]
 YUNYING_BUY_ERR_VIP = [[VIP等级不足]]
 YUNYING_BUY_ERR_VIP = [[VIP等级不足]]
 YUNYING_BUY_ERR_HAD = [[已购买]]
 YUNYING_BUY_ERR_HAD = [[已购买]]
 
 
+MONEYTREE_START = [[请先开始游戏]]
+
 MONEYTREE_IS_MAX = [[篮子已撑破, 不能再获得奖励了]]
 MONEYTREE_IS_MAX = [[篮子已撑破, 不能再获得奖励了]]
 
 
 QQAPI_ERR_TIMEOUT = [[登录状态超时,请刷新游戏后再次尝试]]
 QQAPI_ERR_TIMEOUT = [[登录状态超时,请刷新游戏后再次尝试]]

+ 1 - 0
script/common/ProtoID.lua

@@ -1779,6 +1779,7 @@ _ENV[1819]="CG_ABS_COMONACT_MONEYTREE_GET_REWARD"
 _ENV[1820]="CG_VOUCHER_INVEST_QUERY"
 _ENV[1820]="CG_VOUCHER_INVEST_QUERY"
 _ENV[1821]="GC_VOUCHER_INVEST_QUERY"
 _ENV[1821]="GC_VOUCHER_INVEST_QUERY"
 _ENV[1822]="CG_VOUCHER_INVEST_GET"
 _ENV[1822]="CG_VOUCHER_INVEST_GET"
+_ENV[1823]="CG_ABS_COMONACT_MONEYTREE_LOTTERY_STAGE"
 
 
 
 
 _ENV[1896]="CG_ZHUANPAN_SUBSCRIBE_REWARD_QUERY"
 _ENV[1896]="CG_ZHUANPAN_SUBSCRIBE_REWARD_QUERY"

+ 59 - 8
script/module/absAct/CommonActMoneyTree.lua

@@ -5,6 +5,8 @@
         basketItemArr = nil, --篮子里的道具idx列表
         basketItemArr = nil, --篮子里的道具idx列表
 
 
         lotteryTimes = nil, -- 抽奖次数
         lotteryTimes = nil, -- 抽奖次数
+
+        nowStage = 0, -- 当前阶段, 0-未开始阶段, 1-抽奖阶段
     }   
     }   
 ]=]--
 ]=]--
 
 
@@ -21,7 +23,7 @@ local AbsActExcel = require("excel.absAct")
 
 
 local LOGTYPE = "CommonActMoneyTree" -- 日志标识
 local LOGTYPE = "CommonActMoneyTree" -- 日志标识
 local COMMONACT_MONEYTREE_ID = 7506  -- 活动Id
 local COMMONACT_MONEYTREE_ID = 7506  -- 活动Id
-local BASKET_WEIGHT = 100           -- 篮子可承受的总重量
+local BASKET_WEIGHT_MAX = 100           -- 篮子可承受的总重量
 
 
 
 
 local function getData(human)
 local function getData(human)
@@ -49,6 +51,12 @@ local function resetBasketArr(human)
     actData.basketItemArr = nil
     actData.basketItemArr = nil
 end
 end
 
 
+local function updateStage(human, newStage)
+    local actData = getData(human)
+    actData.nowStage = newStage
+end
+
+
 
 
 
 
 local function isOpenAct(human, funcID)
 local function isOpenAct(human, funcID)
@@ -118,6 +126,10 @@ function isRed(human, YYInfo, funcConfig)
     end
     end
 
 
     local actData = getData(human)
     local actData = getData(human)
+    if (actData.nowStage or 0) == 1 then
+        return true
+    end
+
     if (actData.lotteryTimes or 0) > 0 then
     if (actData.lotteryTimes or 0) > 0 then
         return true
         return true
     end
     end
@@ -169,11 +181,12 @@ end
 function CommonActMoneyTree_Query(human)
 function CommonActMoneyTree_Query(human)
     local msgRet = Msg.gc.GC_ABS_COMONACT_MONEYTREE_QUERY
     local msgRet = Msg.gc.GC_ABS_COMONACT_MONEYTREE_QUERY
     msgRet.rewardBasket[0] = 0
     msgRet.rewardBasket[0] = 0
-    msgRet.weighMax = BASKET_WEIGHT
+    msgRet.weighMax = BASKET_WEIGHT_MAX
     msgRet.weighNow = 0
     msgRet.weighNow = 0
     msgRet.lotteryTimes = 0
     msgRet.lotteryTimes = 0
     msgRet.isStart = 1
     msgRet.isStart = 1
     msgRet.isEnd = 0
     msgRet.isEnd = 0
+    msgRet.nowStage = 0
 
 
     local actData = getData(human)
     local actData = getData(human)
 
 
@@ -185,6 +198,10 @@ function CommonActMoneyTree_Query(human)
         msgRet.weighNow = calcBasketWeight(actData.basketItemArr)
         msgRet.weighNow = calcBasketWeight(actData.basketItemArr)
     end
     end
 
 
+    if actData.nowStage then
+        msgRet.nowStage = actData.nowStage
+    end
+
     local itemNum = actData.basketItemArr and #actData.basketItemArr or 0
     local itemNum = actData.basketItemArr and #actData.basketItemArr or 0
     if itemNum == 0 then
     if itemNum == 0 then
         msgRet.isEnd = 1
         msgRet.isEnd = 1
@@ -219,8 +236,8 @@ function CommonActMoneyTree_Query(human)
     end
     end
 end
 end
 
 
--- 抽奖
-function CommonActMoneyTree_Lottery(human)
+-- 进入抽奖阶段
+function CommonActMoneyTree_EnterLotteryStage(human)
     if not isOpenAct(human, COMMONACT_MONEYTREE_ID) then
     if not isOpenAct(human, COMMONACT_MONEYTREE_ID) then
         return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
         return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
     end
     end
@@ -230,25 +247,48 @@ function CommonActMoneyTree_Lottery(human)
         return Broadcast.sendErr(human, Lang.JINBI_EXCHANGE_ERR_CNT)
         return Broadcast.sendErr(human, Lang.JINBI_EXCHANGE_ERR_CNT)
     end
     end
 
 
+    -- 扣除次数
+    updateLotteryTimes(human, -1)
+
+    -- 更新阶段
+    updateStage(human, 1)
+
+    -- 推送最新数据给客户端
+    CommonActMoneyTree_Query(human)
+end
+
+-- 抽一次奖
+function CommonActMoneyTree_Lottery(human)
+    if not isOpenAct(human, COMMONACT_MONEYTREE_ID) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
+
+    local actData = getData(human)
+    if (actData.nowStage or 0) ~= 1 then
+        return Broadcast.sendErr(human, Lang.MONEYTREE_START)
+    end
+
     if actData.basketItemArr then
     if actData.basketItemArr then
         local weightNow = calcBasketWeight(actData.basketItemArr)
         local weightNow = calcBasketWeight(actData.basketItemArr)
-        if weightNow > BASKET_WEIGHT then
+        if weightNow > BASKET_WEIGHT_MAX then
             return Broadcast.sendErr(human, Lang.MONEYTREE_IS_MAX)
             return Broadcast.sendErr(human, Lang.MONEYTREE_IS_MAX)
         end
         end
     end
     end
 
 
     -- 扣除次数
     -- 扣除次数
-    updateLotteryTimes(human, -1)
+    -- updateLotteryTimes(human, -1)
 
 
     local finalIdx = lottery()
     local finalIdx = lottery()
     if finalIdx == 0 then
     if finalIdx == 0 then
         return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
         return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
     end
     end
 
 
-    -- 检查当前篮子中道具重量是否超过限定重量, 如果超过则当前篮子中每个道具都有50%几率失去
+    -- 把道具加入篮子
     insertBasketItemArr(human, finalIdx)
     insertBasketItemArr(human, finalIdx)
+
+    -- 检查当前篮子中道具重量是否超过限定重量, 如果超过则当前篮子中每个道具都有50%几率失去
     local weightNow = calcBasketWeight(actData.basketItemArr)
     local weightNow = calcBasketWeight(actData.basketItemArr)
-    if weightNow > BASKET_WEIGHT then
+    if weightNow > BASKET_WEIGHT_MAX then
         local newBasketItemArr = randBasketItem(actData.basketItemArr)
         local newBasketItemArr = randBasketItem(actData.basketItemArr)
         updateBasketItemArr(human, newBasketItemArr)
         updateBasketItemArr(human, newBasketItemArr)
         CommonActMoneyTree_Query(human)
         CommonActMoneyTree_Query(human)
@@ -268,6 +308,10 @@ function CommonActMoneyTree_GetReward(human)
 
 
     local actData = getData(human)
     local actData = getData(human)
 
 
+    if (actData.nowStage or 0) ~= 1 then
+        return Broadcast.sendErr(human, Lang.MONEYTREE_START)
+    end
+
     if not actData.basketItemArr or not next(actData.basketItemArr) then
     if not actData.basketItemArr or not next(actData.basketItemArr) then
         return Broadcast.sendErr(human, Lang.SHARE_GROUP_GET_ERR_CNT)
         return Broadcast.sendErr(human, Lang.SHARE_GROUP_GET_ERR_CNT)
     end
     end
@@ -282,8 +326,15 @@ function CommonActMoneyTree_GetReward(human)
     -- 重置篮子中道具数据
     -- 重置篮子中道具数据
     resetBasketArr(human)
     resetBasketArr(human)
 
 
+    -- 更新阶段
+    updateStage(human, 0)
+
     -- 发放道具
     -- 发放道具
     BagLogic.addItemList(human, itemList, LOGTYPE)
     BagLogic.addItemList(human, itemList, LOGTYPE)
 
 
+    -- 推送最新数据给客户端
     CommonActMoneyTree_Query(human)
     CommonActMoneyTree_Query(human)
+
+    -- 刷新红点
+    updateRedDot(human)
 end
 end

+ 4 - 0
script/module/absAct/Handler.lua

@@ -533,4 +533,8 @@ end
 
 
 function CG_ABS_COMONACT_MONEYTREE_GET_REWARD(human, msg)
 function CG_ABS_COMONACT_MONEYTREE_GET_REWARD(human, msg)
     CommonActMoneyTree.CommonActMoneyTree_GetReward(human)
     CommonActMoneyTree.CommonActMoneyTree_GetReward(human)
+end
+
+function CG_ABS_COMONACT_MONEYTREE_LOTTERY_STAGE(human, msg)
+    CommonActMoneyTree.CommonActMoneyTree_EnterLotteryStage(human)
 end
 end

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

@@ -1679,6 +1679,7 @@ GC_ABS_COMONACT_MONEYTREE_QUERY = {
     {"lotteryTimes",        1,      "short"},        -- 可抽取次数
     {"lotteryTimes",        1,      "short"},        -- 可抽取次数
     {"isStart",             1,      "byte"},         -- 是否是第一段数据, 0-否, 1-是
     {"isStart",             1,      "byte"},         -- 是否是第一段数据, 0-否, 1-是
     {"isEnd",               1,      "byte"},         -- 是否发完数据, 0-否, 1-是
     {"isEnd",               1,      "byte"},         -- 是否发完数据, 0-否, 1-是
+    {"nowStage",            1,      "byte"},         -- 阶段, 0-开始阶段, 1-摇树阶段
 }
 }
 
 
 -- 抽奖
 -- 抽奖
@@ -1688,4 +1689,7 @@ GC_ABS_COMONACT_MONEYTREE_LOTTERY = {
 }
 }
 
 
 -- 领奖
 -- 领奖
-CG_ABS_COMONACT_MONEYTREE_GET_REWARD = {}
+CG_ABS_COMONACT_MONEYTREE_GET_REWARD = {}
+
+-- 进入摇树阶段
+CG_ABS_COMONACT_MONEYTREE_LOTTERY_STAGE = {}