mirror of
https://github.com/edubart/otclient.git
synced 2025-10-18 21:43:26 +02:00
Buffer condition/cooldown icons on module init
* This should hopefully avoid some lag with slow hdd computers
This commit is contained in:
@@ -48,6 +48,11 @@ function init()
|
||||
soulLabel = healthInfoWindow:recursiveGetChildById('soulLabel')
|
||||
capLabel = healthInfoWindow:recursiveGetChildById('capLabel')
|
||||
|
||||
-- load condition icons
|
||||
for k,v in pairs(Icons) do
|
||||
loadIcon(k):destroy()
|
||||
end
|
||||
|
||||
if g_game.isOnline() then
|
||||
local localPlayer = g_game.getLocalPlayer()
|
||||
onHealthChange(localPlayer, localPlayer:getHealth(), localPlayer:getMaxHealth())
|
||||
@@ -92,13 +97,19 @@ function toggleIcon(bitChanged)
|
||||
if icon then
|
||||
icon:destroy()
|
||||
else
|
||||
icon = g_ui.createWidget('ConditionWidget', content)
|
||||
icon:setId(Icons[bitChanged].id)
|
||||
icon:setImageSource(Icons[bitChanged].path)
|
||||
icon:setTooltip(Icons[bitChanged].tooltip)
|
||||
icon = loadIcon(bitChanged)
|
||||
icon:setParent(content)
|
||||
end
|
||||
end
|
||||
|
||||
function loadIcon(bitChanged)
|
||||
local icon = g_ui.createWidget('ConditionWidget', content)
|
||||
icon:setId(Icons[bitChanged].id)
|
||||
icon:setImageSource(Icons[bitChanged].path)
|
||||
icon:setTooltip(Icons[bitChanged].tooltip)
|
||||
return icon
|
||||
end
|
||||
|
||||
function offline()
|
||||
healthInfoWindow:recursiveGetChildById('conditionPanel'):destroyChildren()
|
||||
end
|
||||
|
Reference in New Issue
Block a user