OntimerOBJ = {} function OntimerOBJ:hasPickupDrop(actor) local mapid = getbaseinfo(actor, ConstCfg.gbase.mapid) local x = getbaseinfo(actor, ConstCfg.gbase.x) local y = getbaseinfo(actor, ConstCfg.gbase.y) if not mapid or mapid == "" or not x or not y then return false end local items = getobjectinmap(mapid, x, y, 10, 8) return items and next(items) ~= nil end function OntimerOBJ:refreshPickupSprite(actor) local timerId = VarCfg.Timer["ʰȡ¾«ÁéѲ¼ì"] if getflagstatus(actor, VarCfg.Falg_shiqujinlin) ~= 1 then pickupitems(actor, -1) releasesprite(actor) setofftimer(actor, timerId) return end local hasDrop = self:hasPickupDrop(actor) local hasSprite = checkspritelevel(actor, "à»à»»¢") if hasDrop then if not hasSprite then createsprite(actor, "à»à»»¢") pickupitems(actor, 3, 10, 1000) end else if hasSprite then pickupitems(actor, -1) releasesprite(actor) end end end function OntimerOBJ:startPickupSpriteTimer(actor) local timerId = VarCfg.Timer["ʰȡ¾«ÁéѲ¼ì"] if getflagstatus(actor, VarCfg.Falg_shiqujinlin) ~= 1 then self:stopPickupSpriteTimer(actor) return end if not hastimer(actor, timerId) then setontimer(actor, timerId, 3, 0) end self:refreshPickupSprite(actor) end function OntimerOBJ:stopPickupSpriteTimer(actor) local timerId = VarCfg.Timer["ʰȡ¾«ÁéѲ¼ì"] if hastimer(actor, timerId) then setofftimer(actor, timerId) end pickupitems(actor, -1) releasesprite(actor) end OntimerOBJ.ontimer = { [20] = function(actor) -- LOGDump(ShabaKeOBJ.SBK._state()) local _state = ShabaKeOBJ.SBK._state() if not _state then setofftimer(actor, VarCfg.Timer["¹¥É³¶¨Ê±Æ÷"]) return end local _guild = getbaseinfo(actor, ConstCfg.gbase.guild) if _guild == "" then setofftimer(actor, VarCfg.Timer["¹¥É³¶¨Ê±Æ÷"]) return end local _relevel = getbaseinfo(actor, ConstCfg.gbase.renew_level) if _relevel < ShabaKeOBJ.cfg.minRelevel then return end local _sbkrange = getbaseinfo(actor, ConstCfg.gbase.sbkrange) if not _sbkrange then return end local _min = Player.getTLint(actor, VarCfg.Player.TL.int["¹¥³ÇÇøÓò¼ÆÃë"]) or 0 Player.setTLint(actor, VarCfg.Player.TL.int["¹¥³ÇÇøÓò¼ÆÃë"], _min + 1) -- LOGDump("¹¥³ÇÇøÓò¼ÆÃë: " .. _min) end, [21] = function(actor) OntimerOBJ:refreshPickupSprite(actor) end, [22] = function(actor) if AutoXunHangOBJ and AutoXunHangOBJ.onTimer then AutoXunHangOBJ:onTimer(actor) end end, [23] = function(actor) if NPCGotoMapOBJ and NPCGotoMapOBJ.onLimitedTimer then NPCGotoMapOBJ:onLimitedTimer(actor) end end } for i, v in pairs(VarCfg.Timer or {}) do _G["ontimer" .. v] = function(actor) if OntimerOBJ.ontimer[v] then OntimerOBJ.ontimer[v](actor) end end end GameEvent.add(EventCfg.onExitGame, function(actor) OntimerOBJ:stopPickupSpriteTimer(actor) end, OntimerOBJ) return OntimerOBJ