|
|
@@ -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]
|