mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 15:26:49 +01:00
Fix signalCall, healthinfo tooltips
This commit is contained in:
@@ -54,7 +54,7 @@ end
|
||||
|
||||
function init()
|
||||
connect(g_app, { onRun = startup,
|
||||
onClose = exit })
|
||||
onExit = exit })
|
||||
|
||||
g_window.setMinimumSize({ width = 600, height = 480 })
|
||||
g_sounds.preload(musicFilename)
|
||||
@@ -99,7 +99,7 @@ end
|
||||
|
||||
function terminate()
|
||||
disconnect(g_app, { onRun = startup,
|
||||
onClose = exit })
|
||||
onExit = exit })
|
||||
-- save window configs
|
||||
g_settings.set('window-size', g_window.getUnmaximizedSize())
|
||||
g_settings.set('window-pos', g_window.getUnmaximizedPos())
|
||||
@@ -113,4 +113,4 @@ end
|
||||
|
||||
function exit()
|
||||
g_logger.info("Exiting application..")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,6 @@ UIProgressBar = extends(UIWidget)
|
||||
function UIProgressBar.create()
|
||||
local progressbar = UIProgressBar.internalCreate()
|
||||
progressbar:setFocusable(false)
|
||||
progressbar:setPhantom(true)
|
||||
progressbar.min = 0
|
||||
progressbar.max = 100
|
||||
progressbar.value = 0
|
||||
|
||||
@@ -23,6 +23,9 @@ manaBar = nil
|
||||
experienceBar = nil
|
||||
soulLabel = nil
|
||||
capLabel = nil
|
||||
healthTooltip = 'Your character health is %d out of %d.'
|
||||
manaTooltip = 'Your character mana is %d out of %d.'
|
||||
experienceTooltip = 'You have %d%% to advance to level %d.'
|
||||
|
||||
function init()
|
||||
connect(LocalPlayer, { onHealthChange = onHealthChange,
|
||||
@@ -96,19 +99,6 @@ function toggleIcon(bitChanged)
|
||||
end
|
||||
end
|
||||
|
||||
function hideLabels()
|
||||
local removeHeight = math.max(capLabel:getMarginRect().height, soulLabel:getMarginRect().height)
|
||||
capLabel:setOn(false)
|
||||
soulLabel:setOn(false)
|
||||
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
|
||||
end
|
||||
|
||||
function hideExperience()
|
||||
local removeHeight = experienceBar:getMarginRect().height
|
||||
experienceBar:setOn(false)
|
||||
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
|
||||
end
|
||||
|
||||
function offline()
|
||||
healthInfoWindow:recursiveGetChildById('conditionPanel'):destroyChildren()
|
||||
end
|
||||
@@ -120,16 +110,19 @@ end
|
||||
|
||||
function onHealthChange(localPlayer, health, maxHealth)
|
||||
healthBar:setText(health .. ' / ' .. maxHealth)
|
||||
healthBar:setTooltip(tr(healthTooltip, health, maxHealth))
|
||||
healthBar:setValue(health, 0, maxHealth)
|
||||
end
|
||||
|
||||
function onManaChange(localPlayer, mana, maxMana)
|
||||
manaBar:setText(mana .. ' / ' .. maxMana)
|
||||
manaBar:setTooltip(tr(manaTooltip, mana, maxMana))
|
||||
manaBar:setValue(mana, 0, maxMana)
|
||||
end
|
||||
|
||||
function onLevelChange(localPlayer, value, percent)
|
||||
experienceBar:setText(percent .. "%")
|
||||
experienceBar:setText(percent .. '%')
|
||||
experienceBar:setTooltip(tr(experienceTooltip, percent, value+1))
|
||||
experienceBar:setPercent(percent)
|
||||
end
|
||||
|
||||
@@ -154,3 +147,29 @@ function onStatesChange(localPlayer, now, old)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- personalization functions
|
||||
function hideLabels()
|
||||
local removeHeight = math.max(capLabel:getMarginRect().height, soulLabel:getMarginRect().height)
|
||||
capLabel:setOn(false)
|
||||
soulLabel:setOn(false)
|
||||
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
|
||||
end
|
||||
|
||||
function hideExperience()
|
||||
local removeHeight = experienceBar:getMarginRect().height
|
||||
experienceBar:setOn(false)
|
||||
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
|
||||
end
|
||||
|
||||
function setHealthTooltip(tooltip)
|
||||
healthTooltip = tooltip
|
||||
end
|
||||
|
||||
function setManaTooltip(tooltip)
|
||||
manaTooltip = tooltip
|
||||
end
|
||||
|
||||
function setExperienceTooltip(tooltip)
|
||||
experienceTooltip = tooltip
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user