Some more on new skills/stats.

* Fixed updating issue.
* Fixed refreshing issue.
This commit is contained in:
BeniS 2012-08-19 23:03:44 +12:00
parent fdffa365b9
commit 8cd8829048
2 changed files with 14 additions and 6 deletions

View File

@ -20,8 +20,8 @@ function init()
onBaseSkillChange = onBaseSkillChange onBaseSkillChange = onBaseSkillChange
}) })
connect(g_game, { connect(g_game, {
onGameStart = update, onGameStart = refresh,
onGameEnd = update onGameEnd = refresh
}) })
skillsWindow = g_ui.loadUI('skills.otui', modules.game_interface.getRightPanel()) skillsWindow = g_ui.loadUI('skills.otui', modules.game_interface.getRightPanel())
@ -51,8 +51,8 @@ function terminate()
onBaseSkillChange = onBaseSkillChange onBaseSkillChange = onBaseSkillChange
}) })
disconnect(g_game, { disconnect(g_game, {
onGameStart = update, onGameStart = refresh,
onGameEnd = update onGameEnd = refresh
}) })
g_keyboard.unbindKeyDown('Ctrl+S') g_keyboard.unbindKeyDown('Ctrl+S')
@ -100,7 +100,7 @@ end
function setSkillPercent(id, percent, tooltip) function setSkillPercent(id, percent, tooltip)
local skill = skillsWindow:recursiveGetChildById(id) local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('percent') local widget = skill:getChildById('percent')
widget:setPercent(percent) widget:setPercent(math.floor(percent))
if tooltip then if tooltip then
widget:setTooltip(tooltip) widget:setTooltip(tooltip)
@ -145,6 +145,8 @@ function refresh()
onSkillChange(player, i, player:getSkillLevel(i), player:getSkillLevelPercent(i)) onSkillChange(player, i, player:getSkillLevel(i), player:getSkillLevelPercent(i))
onBaseSkillChange(player, i, player:getSkillBaseLevel(i)) onBaseSkillChange(player, i, player:getSkillBaseLevel(i))
end end
update()
end end
function toggle() function toggle()
@ -211,6 +213,9 @@ function onStaminaChange(localPlayer, stamina)
end end
function onOfflineTrainingChange(localPlayer, offlineTrainingTime) function onOfflineTrainingChange(localPlayer, offlineTrainingTime)
if not g_game.getFeature(GameOfflineTrainingTime) then
return
end
local hours = math.floor(offlineTrainingTime / 60) local hours = math.floor(offlineTrainingTime / 60)
local minutes = offlineTrainingTime % 60 local minutes = offlineTrainingTime % 60
if minutes < 10 then if minutes < 10 then
@ -223,6 +228,9 @@ function onOfflineTrainingChange(localPlayer, offlineTrainingTime)
end end
function onRegenerationChange(localPlayer, regenerationTime) function onRegenerationChange(localPlayer, regenerationTime)
if not g_game.getFeature(GamePlayerRegenerationTime) then
return
end
local hours = math.floor(regenerationTime / 60) local hours = math.floor(regenerationTime / 60)
local minutes = regenerationTime % 60 local minutes = regenerationTime % 60
if minutes < 10 then if minutes < 10 then

View File

@ -521,7 +521,7 @@ void Creature::setSpeed(uint16 speed)
if(m_walking) if(m_walking)
nextWalkUpdate(); nextWalkUpdate();
callLuaField("onSpeedChange", speed, oldSpeed); callLuaField("onSpeedChange", m_speed, oldSpeed);
} }
void Creature::setSkull(uint8 skull) void Creature::setSkull(uint8 skull)