mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
@@ -15,10 +15,6 @@ Panel
|
||||
id: enableMusicSound
|
||||
!text: tr('Enable music sound')
|
||||
|
||||
OptionCheckBox
|
||||
id: enableEffectsSound
|
||||
!text: tr('Enable effects sound')
|
||||
|
||||
Label
|
||||
id: musicSoundVolumeLabel
|
||||
!text: tr('Music volume: %d', 100)
|
||||
|
@@ -25,7 +25,6 @@ local defaultOptions = {
|
||||
enableLights = true,
|
||||
enableShaders = true,
|
||||
ambientLight = 25,
|
||||
enableEffectsSound = 0
|
||||
}
|
||||
|
||||
local optionsWindow
|
||||
|
@@ -38,7 +38,7 @@ function UIMiniWindowContainer:fitAll(noRemoveChild)
|
||||
end
|
||||
end
|
||||
|
||||
local selfHeight = self:getHeight() - (self:getMarginTop() + self:getMarginBottom() + self:getPaddingTop() + self:getPaddingBottom())
|
||||
local selfHeight = self:getHeight() - (self:getPaddingTop() + self:getPaddingBottom())
|
||||
if sumHeight <= selfHeight then
|
||||
return
|
||||
end
|
||||
|
@@ -33,7 +33,7 @@ ConsoleTabBarPanel < MoveableTabBarPanel
|
||||
align-bottom: true
|
||||
border-width: 1
|
||||
border-color: #202327
|
||||
background: #00000044
|
||||
background: #00000066
|
||||
inverted-scroll: true
|
||||
padding: 1
|
||||
|
||||
@@ -45,8 +45,6 @@ ConsoleTabBarPanel < MoveableTabBarPanel
|
||||
layout:
|
||||
type: verticalBox
|
||||
align-bottom: true
|
||||
border-width: 1
|
||||
border-color: #202327
|
||||
inverted-scroll: true
|
||||
padding: 1
|
||||
@onScrollbarChange: |
|
||||
|
@@ -660,8 +660,7 @@ function setupViewMode(mode)
|
||||
gameMapPanel:addAnchor(AnchorRight, 'gameRightPanel', AnchorLeft)
|
||||
gameMapPanel:addAnchor(AnchorBottom, 'gameBottomPanel', AnchorTop)
|
||||
gameRootPanel:addAnchor(AnchorTop, 'topMenu', AnchorBottom)
|
||||
gameLeftPanel:setOn(false)
|
||||
gameLeftPanel:setVisible(false)
|
||||
gameLeftPanel:setOn(modules.client_options.getOption('showLeftPanel'))
|
||||
gameLeftPanel:setImageColor('white')
|
||||
gameRightPanel:setImageColor('white')
|
||||
gameLeftPanel:setMarginTop(0)
|
||||
@@ -689,12 +688,13 @@ function setupViewMode(mode)
|
||||
gameRootPanel:fill('parent')
|
||||
gameLeftPanel:setImageColor('alpha')
|
||||
gameRightPanel:setImageColor('alpha')
|
||||
gameLeftPanel:setMarginTop(36)
|
||||
gameRightPanel:setMarginTop(36)
|
||||
gameLeftPanel:setMarginTop(modules.client_topmenu.getTopMenu():getHeight() - gameLeftPanel:getPaddingTop())
|
||||
gameRightPanel:setMarginTop(modules.client_topmenu.getTopMenu():getHeight() - gameRightPanel:getPaddingTop())
|
||||
gameLeftPanel:setOn(true)
|
||||
gameLeftPanel:setVisible(true)
|
||||
gameRightPanel:setOn(true)
|
||||
gameBottomPanel:setImageColor('#00000099')
|
||||
gameMapPanel:setOn(true)
|
||||
gameBottomPanel:setImageColor('#ffffff88')
|
||||
modules.client_topmenu.getTopMenu():setImageColor('#ffffff66')
|
||||
if not limitZoom then
|
||||
g_game.changeMapAwareRange(24, 20)
|
||||
|
@@ -4,6 +4,9 @@ GameSidePanel < UIMiniWindowContainer
|
||||
image-border: 4
|
||||
padding: 4
|
||||
width: 198
|
||||
layout:
|
||||
type: verticalBox
|
||||
//spacing: 1
|
||||
|
||||
GameBottomPanel < Panel
|
||||
image-source: /images/ui/panel_bottom
|
||||
@@ -14,6 +17,9 @@ GameMapPanel < UIGameMap
|
||||
image-source: /images/ui/panel_map
|
||||
image-border: 4
|
||||
|
||||
$on:
|
||||
padding: 0
|
||||
|
||||
UIWidget
|
||||
id: gameRootPanel
|
||||
anchors.fill: parent
|
||||
@@ -36,7 +42,6 @@ UIWidget
|
||||
|
||||
GameSidePanel
|
||||
id: gameLeftPanel
|
||||
layout: verticalBox
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
@@ -49,7 +54,6 @@ UIWidget
|
||||
|
||||
GameSidePanel
|
||||
id: gameRightPanel
|
||||
layout: verticalBox
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
@@ -189,7 +189,7 @@ function addMapFlag(pos, icon, message, flagId, version)
|
||||
flagWidget.icon = icon
|
||||
flagWidget.description = message
|
||||
if message and message:len() > 0 then
|
||||
flagWidget:setTooltip(tr(message))
|
||||
flagWidget:setTooltip(message)
|
||||
end
|
||||
flagWidget.id = flagId
|
||||
flagWidget.version = version
|
||||
|
@@ -21,7 +21,8 @@ function init()
|
||||
onBaseSkillChange = onBaseSkillChange
|
||||
})
|
||||
connect(g_game, {
|
||||
onGameStart = refresh
|
||||
onGameStart = refresh,
|
||||
onGameEnd = offline
|
||||
})
|
||||
|
||||
skillsButton = modules.client_topmenu.addRightGameToggleButton('skillsButton', tr('Skills') .. ' (Ctrl+S)', '/images/topbuttons/skills', toggle)
|
||||
@@ -55,7 +56,7 @@ function terminate()
|
||||
})
|
||||
disconnect(g_game, {
|
||||
onGameStart = refresh,
|
||||
onGameEnd = refresh
|
||||
onGameEnd = offline
|
||||
})
|
||||
|
||||
g_keyboard.unbindKeyDown('Ctrl+S')
|
||||
@@ -63,6 +64,14 @@ function terminate()
|
||||
skillsWindow:destroy()
|
||||
end
|
||||
|
||||
function expForLevel(level)
|
||||
return math.floor((50*level*level*level)/3 - 100*level*level + (850*level)/3 - 200)
|
||||
end
|
||||
|
||||
function expToAdvance(currentLevel, currentExp)
|
||||
return expForLevel(currentLevel+1) - currentExp
|
||||
end
|
||||
|
||||
function resetSkillColor(id)
|
||||
local skill = skillsWindow:recursiveGetChildById(id)
|
||||
local widget = skill:getChildById('value')
|
||||
@@ -180,6 +189,9 @@ function refresh()
|
||||
local player = g_game.getLocalPlayer()
|
||||
if not player then return end
|
||||
|
||||
if expSpeedEvent then expSpeedEvent:cancel() end
|
||||
expSpeedEvent = cycleEvent(checkExpSpeed, 30*1000)
|
||||
|
||||
onExperienceChange(player, player:getExperience())
|
||||
onLevelChange(player, player:getLevel(), player:getLevelPercent())
|
||||
onHealthChange(player, player:getHealth(), player:getMaxHealth())
|
||||
@@ -204,6 +216,10 @@ function refresh()
|
||||
skillsWindow:setContentMaximumHeight(contentsPanel:getChildrenRect().height)
|
||||
end
|
||||
|
||||
function offline()
|
||||
expSpeedEvent:cancel()
|
||||
end
|
||||
|
||||
function toggle()
|
||||
if skillsButton:isOn() then
|
||||
skillsWindow:close()
|
||||
@@ -214,6 +230,22 @@ function toggle()
|
||||
end
|
||||
end
|
||||
|
||||
function checkExpSpeed()
|
||||
local player = g_game.getLocalPlayer()
|
||||
local currentExp = player:getExperience()
|
||||
local currentTime = g_clock.seconds()
|
||||
if player.lastExps ~= nil then
|
||||
player.expSpeed = (currentExp - player.lastExps[1][1])/(currentTime - player.lastExps[1][2])
|
||||
onLevelChange(player, player:getLevel(), player:getLevelPercent())
|
||||
else
|
||||
player.lastExps = {}
|
||||
end
|
||||
table.insert(player.lastExps, {currentExp, currentTime})
|
||||
if #player.lastExps > 10 then
|
||||
table.remove(player.lastExps, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function onMiniWindowClose()
|
||||
skillsButton:setOn(false)
|
||||
end
|
||||
@@ -231,21 +263,36 @@ function onSkillButtonClick(button)
|
||||
end
|
||||
|
||||
function onExperienceChange(localPlayer, value)
|
||||
setSkillValue('experience', tr(value))
|
||||
setSkillValue('experience', value)
|
||||
end
|
||||
|
||||
function onLevelChange(localPlayer, value, percent)
|
||||
setSkillValue('level', tr(value))
|
||||
setSkillPercent('level', percent, tr('You have %s percent to go', 100 - percent))
|
||||
setSkillValue('level', value)
|
||||
local text = tr('You have %s percent to go', 100 - percent) .. '\n' ..
|
||||
tr('%s of experience left', expToAdvance(localPlayer:getLevel(), localPlayer:getExperience()))
|
||||
|
||||
if localPlayer.expSpeed ~= nil then
|
||||
local expPerHour = math.floor(localPlayer.expSpeed * 3600)
|
||||
if expPerHour > 0 then
|
||||
local nextLevelExp = expForLevel(localPlayer:getLevel()+1)
|
||||
local hoursLeft = (nextLevelExp - localPlayer:getExperience()) / expPerHour
|
||||
local minutesLeft = math.floor((hoursLeft - math.floor(hoursLeft))*60)
|
||||
hoursLeft = math.floor(hoursLeft)
|
||||
text = text .. '\n' .. tr('%d of experience per hour', expPerHour)
|
||||
text = text .. '\n' .. tr('Next level in %d hours and %d minutes', hoursLeft, minutesLeft)
|
||||
end
|
||||
end
|
||||
|
||||
setSkillPercent('level', percent, text)
|
||||
end
|
||||
|
||||
function onHealthChange(localPlayer, health, maxHealth)
|
||||
setSkillValue('health', tr(health))
|
||||
setSkillValue('health', health)
|
||||
checkAlert('health', health, maxHealth, 30)
|
||||
end
|
||||
|
||||
function onManaChange(localPlayer, mana, maxMana)
|
||||
setSkillValue('mana', tr(mana))
|
||||
setSkillValue('mana', mana)
|
||||
checkAlert('mana', mana, maxMana, 30)
|
||||
end
|
||||
|
||||
@@ -333,4 +380,4 @@ end
|
||||
|
||||
function onBaseSkillChange(localPlayer, id, baseLevel)
|
||||
setSkillBase('skillId'..id, localPlayer:getSkillLevel(id), baseLevel)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user