mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-20 22:53:26 +02:00
Version 2.6.1
This commit is contained in:
41
modules/game_bot/default_configs/vithrax_1.3/mwall_timer.lua
Normal file
41
modules/game_bot/default_configs/vithrax_1.3/mwall_timer.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
-- Magic wall & Wild growth timer
|
||||
|
||||
-- config
|
||||
local magicWallId = 2129
|
||||
local magicWallTime = 20000
|
||||
local wildGrowthId = 2130
|
||||
local wildGrowthTime = 45000
|
||||
|
||||
-- script
|
||||
local activeTimers = {}
|
||||
|
||||
onAddThing(function(tile, thing)
|
||||
if not thing:isItem() then
|
||||
return
|
||||
end
|
||||
local timer = 0
|
||||
if thing:getId() == magicWallId then
|
||||
timer = magicWallTime
|
||||
elseif thing:getId() == wildGrowthId then
|
||||
timer = wildGrowthTime
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
|
||||
if not activeTimers[pos] or activeTimers[pos] < now then
|
||||
activeTimers[pos] = now + timer
|
||||
end
|
||||
tile:setTimer(activeTimers[pos] - now)
|
||||
end)
|
||||
|
||||
onRemoveThing(function(tile, thing)
|
||||
if not thing:isItem() then
|
||||
return
|
||||
end
|
||||
if (thing:getId() == magicWallId or thing:getId() == wildGrowthId) and tile:getGround() then
|
||||
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
|
||||
activeTimers[pos] = nil
|
||||
tile:setTimer(0)
|
||||
end
|
||||
end)
|
Reference in New Issue
Block a user