restore inventory and healthbar

* make inventory/healthbar work again allowing reload
* changes in top menu toggle buttons
* all modules are now reloadable by default
* fix warning when using fade in
* remove some unused files
This commit is contained in:
Eduardo Bart
2012-03-23 10:48:05 -03:00
parent b301aa1a2b
commit 239f58296e
41 changed files with 134 additions and 407 deletions

View File

@@ -5,6 +5,7 @@ Module
website: https://github.com/edubart/otclient
autoload: true
autoload-priority: 10
reloadable: false
@onLoad: |
dofile 'ext/table'

View File

@@ -1,26 +1,34 @@
Effects = {}
function Effects.fadeIn(widget, time, elapsed)
if not elapsed then elapsed = 0 end
if not time then time = 250 end
widget:setOpacity(math.min(elapsed/time, 1))
if elapsed < time then
scheduleEvent(function()
Effects.fadeIn(widget, time, elapsed + 30)
end, 30)
end
if not elapsed then elapsed = 0 end
if not time then time = 250 end
widget:setOpacity(math.min(elapsed/time, 1))
if elapsed < time then
removeEvent(widget.fadeEvent)
widget.fadeEvent = scheduleEvent(function()
Effects.fadeIn(widget, time, elapsed + 30)
end, 30)
else
widget.fadeEvent = nil
end
end
function Effects.fadeOut(widget, time, elapsed)
if not elapsed then elapsed = 0 end
if not time then time = 250 end
widget:setOpacity(math.max((time - elapsed)/time, 0))
if elapsed < time then
scheduleEvent(function()
Effects.fadeOut(widget, time, elapsed + 30)
end, 30)
else
widget:destroy()
end
if not elapsed then elapsed = 0 end
if not time then time = 250 end
widget:setOpacity(math.max((time - elapsed)/time, 0))
if elapsed < time then
removeEvent(widget.fadeEvent)
widget.fadeEvent = scheduleEvent(function()
Effects.fadeOut(widget, time, elapsed + 30)
end, 30)
else
widget.fadeEvent = nil
widget:destroy()
end
end
function Effects.cancelFade(widget)
removeEvent(widget.fadeEvent)
end