ソースを参照

修改弹窗礼包

gitxsm 4 ヶ月 前
コミット
4ce85cde75

+ 2 - 1
script/module/chengjiu/ChengjiuLogic.lua

@@ -299,6 +299,8 @@ function getReward(human,taskID)
 
 
     local giftType
+    GiftLogic = GiftLogic or require("topup.GiftLogic")
+
     if taskID == 404 then
         giftType = GiftLogic.GIFT_TALISMAN_OPEN
     elseif taskID == 405 then
@@ -309,7 +311,6 @@ function getReward(human,taskID)
     end
 
     if giftType then
-        GiftLogic = GiftLogic or require("topup.GiftLogic")
         GiftLogic.trigger(human, giftType, nil, GiftLogic.GIFT_SEC_TYPE2)
     end
 

+ 1 - 1
script/module/elf/ElfLogic.lua

@@ -583,7 +583,7 @@ function Elf_UpGradeStar(human, elfId)
     TriggerLogic.PublishEvent(TriggerDefine.EVENT_TYPE_JINGLING_STAR, human.db._id, 1)
 
     GiftLogic = GiftLogic or require("topup.GiftLogic")
-    GiftLogic.trigger(human, GiftLogic.GIFT_ELF_UPGRADE_STAR, {currentVal = nextStar}, GiftLogic.GIFT_SEC_TYPE1)
+    GiftLogic.trigger(human, GiftLogic.GIFT_ELF_UPGRADE_STAR, {currentVal = nAllStar}, GiftLogic.GIFT_SEC_TYPE1)
 end
 
 -- 布阵界面, 请求精灵数据

+ 2 - 1
script/module/talisman/TalismanLogic.lua

@@ -345,8 +345,9 @@ function UpGrade(human, id)
     -- 总星数
     TriggerLogic.PublishEvent(TriggerDefine.MIBAO_ALLSTAR, human.db._id, 1)
 
+    local allStar = talismanLogic_GetAllStar(human)
     GiftLogic = GiftLogic or require("topup.GiftLogic")
-    GiftLogic.trigger(human, GiftLogic.GIFT_TALISMAN_UPGRADE_STAR, {currentVal = nLevel}, GiftLogic.GIFT_SEC_TYPE1)
+    GiftLogic.trigger(human, GiftLogic.GIFT_TALISMAN_UPGRADE_STAR, {currentVal = allStar}, GiftLogic.GIFT_SEC_TYPE1)
 
     --刷新红点
     nLevel = nLevel + 1

+ 8 - 16
script/module/topup/GiftLogic.lua

@@ -121,19 +121,15 @@ local function sendHumanGift(human)
     })
 end
 
--- 每日只触发一次的礼包类型检查
-local function dailyEventCheck(human, eventType)
-    if not dailyEventList[eventType] then
-        return true
-    end
-
+-- 每日只触发一次的礼包
+local function dailyEventCheck(human, giftId)
     if not human.db.gift or not human.db.gift.dailyEventRecord then
         return true
     end
 
     local dailyEventRecord = human.db.gift.dailyEventRecord
-    if dailyEventRecord[eventType] then
-        local lastGenGiftTime = dailyEventRecord[eventType]
+    if dailyEventRecord[giftId] then
+        local lastGenGiftTime = dailyEventRecord[giftId]
         if Util.isSameDay(lastGenGiftTime) then
             return false
         end
@@ -142,9 +138,9 @@ local function dailyEventCheck(human, eventType)
     return true
 end
 
-local function updateDailyEventRecord(human, eventType)
+local function updateDailyEventRecord(human, giftId)
     human.db.gift.dailyEventRecord = human.db.gift.dailyEventRecord or {}
-    human.db.gift.dailyEventRecord[eventType] = os.time()
+    human.db.gift.dailyEventRecord[giftId] = os.time()
 end
 
 
@@ -254,11 +250,11 @@ local handler2 = {
     [GIFT_SEC_TYPE1] = function (human, param, eventType)
         for id,cfg in pairs(GiftExcel) do
             -- 触发新礼包
-            if cfg.trigger == eventType and cfg.param[1] == param.currentVal then
+            if cfg.trigger == eventType and cfg.param[1] == param.currentVal and (not dailyEventList[eventType] or dailyEventCheck(human, id)) then
                 genGift(human,id)
 
                 if dailyEventList[eventType] then
-                    updateDailyEventRecord(human, eventType)
+                    updateDailyEventRecord(human, id)
                 end
             end
         end
@@ -284,10 +280,6 @@ function onLogin(human)
 end
 
 function trigger(human,type,param, extraType)
-    if not dailyEventCheck(human, type) then
-        return
-    end
-
     local f
     if not extraType then
         f = handler[type]

+ 2 - 1
script/module/winnerRelic/WinnerRelicLogic.lua

@@ -299,8 +299,9 @@ function ActiveandUpgrade(human,relicId)
     -- 总星数
     TriggerLogic.PublishEvent(TriggerDefine.YIWU_ALLSTAR, human.db._id, 1)
 
+    local allStars = WinnerRelic_GetAllStar(human)
     GiftLogic = GiftLogic or require("topup.GiftLogic")
-    GiftLogic.trigger(human, GiftLogic.GIFT_WINNERRELIC_UPGRADE_STAR, {currentVal = nextStar}, GiftLogic.GIFT_SEC_TYPE1)
+    GiftLogic.trigger(human, GiftLogic.GIFT_WINNERRELIC_UPGRADE_STAR, {currentVal = allStars}, GiftLogic.GIFT_SEC_TYPE1)
 
     --更新英雄身上穿的遗物的星级