Battle modules filtering buttons no longer scroll, fixed skill modules regeneration alert.

This commit is contained in:
BeniS 2012-08-21 18:13:16 +12:00
parent 2142ee765d
commit 01a8e57a3c
2 changed files with 90 additions and 54 deletions

View File

@ -44,14 +44,13 @@ MiniWindow
@onClose: modules.game_battle.onMiniWindowClose() @onClose: modules.game_battle.onMiniWindowClose()
&save: true &save: true
MiniWindowContents
BattlePlayers BattlePlayers
id: hidePlayers id: hidePlayers
!tooltip: tr('Hide players') !tooltip: tr('Hide players')
anchors.top: parent.top anchors.top: parent.top
anchors.right: next.left anchors.right: next.left
margin-right: 5 margin-right: 5
margin-top: 3 margin-top: 26
@onCheckChange: modules.game_battle.checkCreatures() @onCheckChange: modules.game_battle.checkCreatures()
BattleNPCs BattleNPCs
@ -60,7 +59,7 @@ MiniWindow
anchors.top: parent.top anchors.top: parent.top
anchors.right: next.left anchors.right: next.left
margin-right: 5 margin-right: 5
margin-top: 3 margin-top: 26
@onCheckChange: modules.game_battle.checkCreatures() @onCheckChange: modules.game_battle.checkCreatures()
BattleMonsters BattleMonsters
@ -68,7 +67,7 @@ MiniWindow
!tooltip: tr('Hide monsters') !tooltip: tr('Hide monsters')
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
margin-top: 3 margin-top: 26
@onCheckChange: modules.game_battle.checkCreatures() @onCheckChange: modules.game_battle.checkCreatures()
BattleSkulls BattleSkulls
@ -85,6 +84,7 @@ MiniWindow
anchors.top: prev.top anchors.top: prev.top
anchors.left: prev.right anchors.left: prev.right
margin-left: 5 margin-left: 5
phantom: true
@onCheckChange: modules.game_battle.checkCreatures() @onCheckChange: modules.game_battle.checkCreatures()
HorizontalSeparator HorizontalSeparator
@ -93,11 +93,15 @@ MiniWindow
anchors.right: parent.right anchors.right: parent.right
margin-top: 5 margin-top: 5
MiniWindowContents
anchors.top: parent.top
margin-top: 50
Panel Panel
id: battlePanel id: battlePanel
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: prev.bottom anchors.top: parent.top
margin-top: 5 margin-top: 5
padding-right: 5 padding-right: 5
layout: layout:

View File

@ -115,12 +115,44 @@ function setSkillPercent(id, percent, tooltip)
end end
end end
function checkAlert(id, value, maxValue, threshold) function checkAlert(id, value, maxValue, threshold, greaterThan)
if value > maxValue or maxValue < 1 then if greaterThan == nil then greaterThan = false end
local alert = false
-- maxValue can be set to false to check value and threshold
-- used for regeneration checking
if type(maxValue) == 'boolean' then
if maxValue then
return return
end end
if greaterThan then
if value > threshold then
alert = true
end
else
if value < threshold then
alert = true
end
end
elseif type(maxValue) == 'number' then
if maxValue < 0 then
return
end
local percent = math.floor((value / maxValue) * 100) local percent = math.floor((value / maxValue) * 100)
if greaterThan then
if percent > threshold then
alert = true
end
else
if percent < threshold then if percent < threshold then
alert = true
end
end
end
if alert then
setSkillColor(id, '#b22222') -- red setSkillColor(id, '#b22222') -- red
else else
resetSkillColor(id) resetSkillColor(id)
@ -267,7 +299,7 @@ function onRegenerationChange(localPlayer, regenerationTime)
end end
setSkillValue('regenerationTime', hours .. ":" .. minutes) setSkillValue('regenerationTime', hours .. ":" .. minutes)
checkAlert('regenerationTime', regenerationTime, 30, 20) -- what is max regeneration? checkAlert('regenerationTime', regenerationTime, false, 300)
end end
function onSpeedChange(localPlayer, speed) function onSpeedChange(localPlayer, speed)