Преглед на файлове

梼杌玩法公会奖励领取改为一键领取

gitxsm преди 10 месеца
родител
ревизия
44cd637f6b
променени са 2 файла, в които са добавени 49 реда и са изтрити 11 реда
  1. 34 8
      script/module/mozhu/MoZhuLogic.lua
  2. 15 3
      script/module/mozhu/MoZhuMiddleLogic.lua

+ 34 - 8
script/module/mozhu/MoZhuLogic.lua

@@ -441,13 +441,21 @@ function unionHurtGet(human, id)
     end
 
     if not human.db.mozhu then return end 
-    local oldId = human.db.mozhu.unionGet or 0
-    if id ~= oldId + 1 then return end
+    -- local oldId = human.db.mozhu.unionGet or 0
+    -- if id ~= oldId + 1 then return end
 
+    -- local msgInner = {} -- InnerMsg.lw.LW_MOZHU_UNION_GET
+    -- msgInner.uuid = human.db._id
+    -- msgInner.unionUuid = human.db.unionUuid
+    -- msgInner.id = id 
+    -- --InnerMsg.sendMsg(0, msgInner)
+    -- MozhuMiddleLogic.LW_MOZHU_UNION_GET(0,msgInner)
+
+    -- 新修改:一键领取所有可领取奖励
     local msgInner = {} -- InnerMsg.lw.LW_MOZHU_UNION_GET
     msgInner.uuid = human.db._id
     msgInner.unionUuid = human.db.unionUuid
-    msgInner.id = id 
+    -- msgInner.id = id 
     --InnerMsg.sendMsg(0, msgInner)
     MozhuMiddleLogic.LW_MOZHU_UNION_GET(0,msgInner)
 end
@@ -459,15 +467,33 @@ function unionGetWL(human, msg)
         return
     end
 
-    local config = MoZhuExcel.hurt[msg.id]
-    if not config then return end
+    -- local config = MoZhuExcel.hurt[msg.id]
+    -- if not config then return end
+
+    -- BagLogic.addItemList(human, config.reward,  "ciYuanMozhu")
+
+    -- human.db.mozhu.unionGet = msg.id
+
+    local len = 0
+    local itemVec = {}
+
+    for _, idx in ipairs(msg.rewardIdxList) do
+        local config = MoZhuExcel.hurt[idx]
+        if config then
+            for _, item in ipairs(config.reward) do
+                len = len + 1
+                itemVec[len] = item
 
-    BagLogic.addItemList(human, config.reward,  "ciYuanMozhu")
+                human.db.mozhu.unionGet = idx
+            end
+        end
+    end
 
-    human.db.mozhu.unionGet = msg.id
+    BagLogic.addItemList(human, itemVec,  "ciYuanMozhu")
 
     local msgRet = Msg.gc.GC_MOZHU_REWARD_GET
-    msgRet.id = msg.id
+    -- msgRet.id = msg.id
+    msgRet.id = human.db.mozhu.unionGet
     Msg.send(msgRet, human.fd)
 end
 

+ 15 - 3
script/module/mozhu/MoZhuMiddleLogic.lua

@@ -276,17 +276,29 @@ function LW_MOZHU_UNION_GET(fd, msg)
     local union = mozhuDB.union[msg.unionUuid]
     local rank = MoZhuDB.getUnionRank(msg.unionUuid)
     local ret = 0
+    local rewardIdxList
     if rank > 0 and union then
-        local config = MoZhuExcel.hurt[msg.id]
-        if config.unionHurt <= union.hurt then
-            ret = 1
+        -- local config = MoZhuExcel.hurt[msg.id]
+        -- if config.unionHurt <= union.hurt then
+        --     ret = 1
+        -- end
+
+        for k,v in ipairs(MoZhuExcel.hurt) do
+            if v.unionHurt <= union.hurt then
+                ret = ret + 1
+                rewardIdxList = rewardIdxList or {}
+                rewardIdxList[ret] = k
+            end
         end
+
     end
 
     local msgInner = {} --InnerMsg.wl.WL_MOZHU_UNION_GET
     msgInner.uuid = msg.uuid
     msgInner.ret  = ret
     msgInner.id   = msg.id
+    msgInner.rewardIdxList = rewardIdxList
+
     --InnerMsg.sendMsg(fd, msgInner)
     WL_MOZHU_UNION_GET(fd,msgInner)
 end