mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
Spell Cooldowns for 8.70+
- Moved SpelllistSettings to spells.lua - Added cooldownbar for 8.70+
This commit is contained in:
@@ -10,6 +10,7 @@ mouseGrabberWidget = nil
|
||||
countWindow = nil
|
||||
logoutWindow = nil
|
||||
exitWindow = nil
|
||||
cooldownPanel = nil
|
||||
|
||||
function init()
|
||||
g_ui.importStyle('styles/countwindow.otui')
|
||||
@@ -22,6 +23,8 @@ function init()
|
||||
gameRootPanel:hide()
|
||||
gameRootPanel:lower()
|
||||
|
||||
cooldownPanel = gameRootPanel:getChildById('spellPanel')
|
||||
|
||||
mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
|
||||
mouseGrabberWidget.onMouseRelease = onMouseGrabberRelease
|
||||
|
||||
@@ -79,6 +82,8 @@ function terminate()
|
||||
onLoginAdvice = onLoginAdvice })
|
||||
disconnect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
|
||||
|
||||
cooldownPanel:destroy()
|
||||
|
||||
logoutButton:destroy()
|
||||
gameRootPanel:destroy()
|
||||
end
|
||||
@@ -90,6 +95,8 @@ function show()
|
||||
gameRootPanel:show()
|
||||
gameRootPanel:focus()
|
||||
gameMapPanel:followCreature(g_game.getLocalPlayer())
|
||||
|
||||
cooldownPanel:setVisible((g_game.getClientVersion() >= 870))
|
||||
end
|
||||
|
||||
function hide()
|
||||
@@ -545,3 +552,30 @@ function onLeftPanelVisibilityChange(leftPanel, visible)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function setGroupCooldown(groupId, duration)
|
||||
if not SpellGroups[groupId] then return end
|
||||
|
||||
local icon = gameRootPanel:getChildById('groupIcon' .. SpellGroups[groupId])
|
||||
if icon then
|
||||
icon:setOn(true)
|
||||
removeEvent(icon.event)
|
||||
icon.event = scheduleEvent(function() icon:setOn(false) end, duration)
|
||||
end
|
||||
end
|
||||
|
||||
function setCooldown(iconFile, iconId, spellformula, duration)
|
||||
local icon = cooldownPanel:getChildById(spellformula)
|
||||
|
||||
if icon then
|
||||
removeEvent(icon.event)
|
||||
icon.event = scheduleEvent(function() icon:destroy() end, duration)
|
||||
else
|
||||
icon = g_ui.createWidget('SpellIcon', cooldownPanel)
|
||||
icon:setId(spellformula)
|
||||
icon:setImageSource('/game_spelllist/icons/' .. iconFile)
|
||||
icon:setTooltip(spellformula)
|
||||
icon:setImageClip(modules.game_spelllist.getIconImageClip(iconId))
|
||||
icon.event = scheduleEvent(function() icon:destroy() end, duration)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user