mirror of
https://github.com/mehah/otclient
synced 2026-08-15 16:29:06 -04:00
parent
c7cc6c32c3
commit
09f5033dec
4 changed files with 54 additions and 3 deletions
|
|
@ -668,3 +668,32 @@ function StatsBar.terminate()
|
|||
|
||||
StatsBar.destroyAllBars()
|
||||
end
|
||||
|
||||
function StatsBar.onHungryChange(regenerationTime, alert)
|
||||
local contents = getStatsBarsIconContent()
|
||||
local info = Icons[PlayerStates.Hungry]
|
||||
if regenerationTime <= alert then
|
||||
for _, contentData in ipairs(contents) do
|
||||
local icon = contentData.content:getChildById(info.id)
|
||||
if not icon then
|
||||
icon = g_ui.createWidget('ConditionWidget', contentData.content)
|
||||
icon:setId(info.id)
|
||||
icon:setImageSource("/images/game/states/player-state-flags")
|
||||
icon:setImageClip(((info.clip - 1) * 9) .. ' 0 9 9')
|
||||
icon:setTooltip(info.tooltip)
|
||||
icon:setImageSize(tosize("9 9"))
|
||||
if contentData.loadIconTransparent then
|
||||
icon:setMarginTop(5)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for _, contentData in ipairs(contents) do
|
||||
local icon = contentData.content:getChildById(info.id)
|
||||
if icon then
|
||||
icon:destroy()
|
||||
icon = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -235,6 +235,9 @@ end
|
|||
function online()
|
||||
skillsWindow:setupOnStart() -- load character window configuration
|
||||
refresh()
|
||||
if g_game.getFeature(GameEnterGameShowAppearance) then
|
||||
skillsWindow:recursiveGetChildById('regenerationTime'):getChildByIndex(1):setText('Food')
|
||||
end
|
||||
end
|
||||
|
||||
function refresh()
|
||||
|
|
@ -509,14 +512,31 @@ function onRegenerationChange(localPlayer, regenerationTime)
|
|||
if not g_game.getFeature(GamePlayerRegenerationTime) or regenerationTime < 0 then
|
||||
return
|
||||
end
|
||||
local hours = math.floor(regenerationTime / 3600)
|
||||
local minutes = math.floor(regenerationTime / 60)
|
||||
local seconds = regenerationTime % 60
|
||||
if seconds < 10 then
|
||||
seconds = '0' .. seconds
|
||||
end
|
||||
|
||||
setSkillValue('regenerationTime', minutes .. ':' .. seconds)
|
||||
checkAlert('regenerationTime', regenerationTime, false, 300)
|
||||
if minutes < 10 then
|
||||
minutes = '0' .. minutes
|
||||
end
|
||||
if hours < 10 then
|
||||
hours = '0' .. hours
|
||||
end
|
||||
local fmt = ""
|
||||
local alert = 300
|
||||
if g_game.getFeature(GameEnterGameShowAppearance) then
|
||||
fmt = string.format("%02d:%02d:%02d", hours, minutes, seconds)
|
||||
alert = 0
|
||||
else
|
||||
fmt = string.format("%02d:%02d", minutes, seconds)
|
||||
end
|
||||
setSkillValue('regenerationTime', fmt)
|
||||
checkAlert('regenerationTime', regenerationTime, false, alert)
|
||||
if g_game.getFeature(GameEnterGameShowAppearance) then
|
||||
modules.game_interface.StatsBar.onHungryChange(regenerationTime, alert)
|
||||
end
|
||||
end
|
||||
|
||||
function onSpeedChange(localPlayer, speed)
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ Icons[PlayerStates.GoshnarTaint5] = { clip = 26, tooltip = tr('You are GoshnarTa
|
|||
Icons[PlayerStates.NewManaShield] = { clip = 27, tooltip = tr('You are NewManaShield'), id = 'condition_NewManaShield' }
|
||||
Icons[PlayerStates.Agony] = { clip = 28, tooltip = tr('You are Agony'), id = 'condition_Agony' }
|
||||
Icons[PlayerStates.Rewards] = { clip = 30, tooltip = tr('Rewards'), id = 'condition_Rewards' }
|
||||
Icons[PlayerStates.Hungry] = { clip = 32, tooltip = tr('You are hungry'), id = 'condition_hungry' }
|
||||
|
||||
InventorySlotOther = 0
|
||||
InventorySlotHead = 1
|
||||
|
|
|
|||
|
|
@ -5,3 +5,4 @@ sonar.projectVersion=1.0
|
|||
sonar.sources=./src
|
||||
sonar.sourceEncoding=UTF-8
|
||||
sonar.cfamily.cpp20=true
|
||||
sonar.exclusions=**/*.html, **/*.css
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue