Pt translations, some helper functions

This commit is contained in:
Henrique Santiago
2013-01-24 14:01:28 -02:00
parent c3eede9872
commit bc55cbbbd1
9 changed files with 90 additions and 68 deletions

View File

@@ -130,6 +130,7 @@ end
function setLocale(name)
local locale = installedLocales[name]
if locale == currentLocale then return end
if not locale then
pwarning("Locale " .. name .. ' does not exist.')
return false

View File

@@ -20,10 +20,6 @@ function init()
addEvent(listModules)
end
function hideButton()
moduleManagerButton:hide()
end
function terminate()
moduleManagerWindow:destroy()
moduleManagerWindow = nil
@@ -32,6 +28,10 @@ function terminate()
moduleList = nil
end
function disable()
moduleManagerButton:hide()
end
function hide()
moduleManagerWindow:hide()
end

View File

@@ -37,3 +37,4 @@ Panel
anchors.top: prev.bottom
anchors.left: prev.left
margin-top: 5
width: 120

View File

@@ -178,6 +178,11 @@ function hide()
terminalWindow:hide()
end
function disable()
terminalButton:hide()
g_keyboard.unbindKeyDown('Ctrl+T')
end
function addLine(text, color)
-- delete old lines if needed
local numLines = terminalBuffer:getChildCount() + 1

View File

@@ -50,7 +50,7 @@ function init()
gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel')
connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
logoutButton = modules.client_topmenu.addLeftButton('logoutButton', 'Exit', '/images/topbuttons/logout', tryLogout, true)
logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'), '/images/topbuttons/logout', tryLogout, true)
bindKeys()

View File

@@ -15,13 +15,15 @@ quantityScroll = nil
nameLabel = nil
priceLabel = nil
moneyLabel = nil
weightDesc = nil
weightLabel = nil
capacityDesc = nil
capacityLabel = nil
tradeButton = nil
buyTab = nil
sellTab = nil
showCapacity = true
showWeight = true
buyWithBackpack = nil
ignoreCapacity = nil
ignoreEquipped = nil
@@ -47,7 +49,9 @@ function init()
nameLabel = setupPanel:getChildById('name')
priceLabel = setupPanel:getChildById('price')
moneyLabel = setupPanel:getChildById('money')
weightDesc = setupPanel:getChildById('weightDesc')
weightLabel = setupPanel:getChildById('weight')
capacityDesc = setupPanel:getChildById('capacityDesc')
capacityLabel = setupPanel:getChildById('capacity')
tradeButton = npcWindow:recursiveGetChildById('tradeButton')
@@ -195,8 +199,16 @@ function setCurrency(currency)
CURRENCY = currency
end
function showCapacity(state)
showCapacity = state
function setShowWeight(state)
showWeight = state
weightDesc:setVisible(state)
weightLabel:setVisible(state)
end
function setShowYourCapacity(state)
capacityDesc:setVisible(state)
capacityLabel:setVisible(state)
ignoreCapacity:setVisible(state)
end
function clearSelectedItem()
@@ -320,7 +332,7 @@ function refreshTradeItems()
local text = ''
local name = item.name
text = text .. name
if showCapacity then
if showWeight then
local weight = string.format('%.2f', item.weight) .. ' ' .. WEIGHT_UNIT
text = text .. '\n' .. weight
end
@@ -378,7 +390,6 @@ function onOpenNpcTrade(items)
tradeItems[SELL] = {}
for key,item in pairs(items) do
if item[4] > 0 then
local newItem = {}
newItem.ptr = item[1]
@@ -387,7 +398,7 @@ function onOpenNpcTrade(items)
newItem.price = item[4]
table.insert(tradeItems[BUY], newItem)
end
if item[5] > 0 then
local newItem = {}
newItem.ptr = item[1]

View File

@@ -134,6 +134,7 @@ MainWindow
id: money
Label
id: weightDesc
!text: tr('Weight') .. ':'
anchors.left: parent.left
anchors.top: prev.bottom
@@ -145,6 +146,7 @@ MainWindow
id: weight
Label
id: capacityDesc
!text: tr('Your Capacity') .. ':'
anchors.left: parent.left
anchors.top: prev.bottom

View File

@@ -88,6 +88,8 @@ function setOptions()
end
function init()
if g_game.getProtocolVersion() < 870 then return end
connect(g_game, { onGameStart = setOptions,
onGameEnd = resetWindow })
@@ -160,6 +162,8 @@ function init()
end
function terminate()
if g_game.getProtocolVersion() < 870 then return end
disconnect(g_game, { onGameStart = setOptions,
onGameEnd = resetWindow,
onSpellGroupCooldown = modules.game_interface.setGroupCooldown,