-- 每日好礼(小7渠道专属) -- db.roleDailyGiftGot = true 表示今日已领取,跨天由 updateDaily 重置 local Lang = require("common.Lang") local Msg = require("core.Msg") local Broadcast = require("broadcast.Broadcast") local Grid = require("bag.Grid") local BagLogic = require("bag.BagLogic") local CommonDefine = require("common.CommonDefine") local RoleSystemLogic = require("roleSystem.RoleSystemLogic") local RoleSystemDefine = require("roleSystem.RoleSystemDefine") local LOGTYPE = "roleDailyGift" local REWARD_ITEM_ID = 31 local REWARD_ITEM_CNT = 648 local function getChannelId(human) return human.db.phpChanelID or human.phpChanelID end local function isXiaoQiChannel(human) local channelID = getChannelId(human) return channelID == CommonDefine.CHANNEL_TAG_XIAOQI or channelID == tostring(CommonDefine.CHANNEL_TAG_XIAOQI) end function ModuleisOpen(human) return isXiaoQiChannel(human) end local function isClaimedToday(human) return human.db.roleDailyGiftGot == true end local function getPrizeState(human) if isClaimedToday(human) then return CommonDefine.COMMON_PRIZE_STATE_GET end return CommonDefine.COMMON_PRIZE_STATE_CANGET end function isDot(human) if not ModuleisOpen(human) then return false end return getPrizeState(human) == CommonDefine.COMMON_PRIZE_STATE_CANGET end function updateDaily(human) if not ModuleisOpen(human) then return end human.db.roleDailyGiftGot = nil RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_113) if human.fd then Query(human) end end function Query(human) if not ModuleisOpen(human) then return end local msgRet = Msg.gc.GC_ROLE_DAILY_GIFT_QUERY msgRet.status = getPrizeState(human) Grid.makeItem(msgRet.item, REWARD_ITEM_ID, REWARD_ITEM_CNT) Msg.send(msgRet, human.fd) end function Get(human) if not ModuleisOpen(human) then return Broadcast.sendErr(human, Lang.COMMON_SYSTEM_READY) end if isClaimedToday(human) then return Broadcast.sendErr(human, Lang.LIMITACT_CANT_GET_MINGTIAN) end local itemArr = {{REWARD_ITEM_ID, REWARD_ITEM_CNT}} BagLogic.addItemList(human, itemArr, LOGTYPE) human.db.roleDailyGiftGot = true RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_113) Query(human) end