Przeglądaj źródła

在线好礼领取奖励方式改为一键领取

gitxsm 5 miesięcy temu
rodzic
commit
93668cb126
1 zmienionych plików z 25 dodań i 10 usunięć
  1. 25 10
      script/module/onlineReward/OnlineRewardLogic.lua

+ 25 - 10
script/module/onlineReward/OnlineRewardLogic.lua

@@ -129,18 +129,33 @@ end
 
 -- 获取奖励
 function getReward(human, id)
-	local status = getStatus(human, id)
-	if status ~= STATUS_CANGET then
-		return
+	-- local status = getStatus(human, id)
+	-- if status ~= STATUS_CANGET then
+	-- 	return
+	-- end
+
+	-- local config = OnlineRewardExcel.onlineReward[id]    
+    -- human.db.onlineReward.getId[id] = 1
+	-- -- 增加物品
+	-- BagLogic.cleanMomentItemList()
+	-- BagLogic.updateMomentItem(1, config.itemID, config.itemCnt)
+	-- BagLogic.addMomentItemList(human, "online_reward")
+	-- sendOnlineReward(human)
+
+	-- 改为一键领取
+	local itemList = {}
+	for k, v in ipairs(OnlineRewardExcel.onlineReward) do
+		local status = getStatus(human, k)
+		if status == STATUS_CANGET then
+			human.db.onlineReward.getId[k] = 1
+			itemList[v.itemID] = (itemList[v.itemID] or 0) + v.itemCnt
+		end
 	end
 
-	local config = OnlineRewardExcel.onlineReward[id]    
-    human.db.onlineReward.getId[id] = 1
-	-- 增加物品
-	BagLogic.cleanMomentItemList()
-	BagLogic.updateMomentItem(1, config.itemID, config.itemCnt)
-	BagLogic.addMomentItemList(human, "online_reward")
-	sendOnlineReward(human)
+	if next(itemList) then
+		BagLogic.addItemList(human, itemList, "online_reward")
+		sendOnlineReward(human)
+	end
 end
 
 function isDot(human)