Version 2.2 - retro layout + bug fixes

This commit is contained in:
OTCv8
2020-03-31 21:34:09 +02:00
parent 1df9b82846
commit 6b39f061ae
189 changed files with 3384 additions and 4603 deletions

View File

@@ -1,13 +1,6 @@
Panel
Background
id: background
image-source: /images/background
image-smooth: true
image-fixed-ratio: true
anchors.top: topMenu.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
margin-top: 1
anchors.fill: parent
focusable: false
UILabel

View File

@@ -30,7 +30,6 @@ local function tryLogin(charInfo, tries)
end
CharacterList.hide()
g_game.loginWorld(G.account, G.password, charInfo.worldName, charInfo.worldHost, charInfo.worldPort, charInfo.characterName, G.authenticatorToken, G.sessionKey)
g_logger.info("Login to " .. charInfo.worldHost .. ":" .. charInfo.worldPort)
loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to game server...'))

View File

@@ -79,12 +79,12 @@ local function validateThings(things)
local thingsNode = {}
for thingtype, thingdata in pairs(things) do
thingsNode[thingtype] = thingdata[1]
if not g_resources.fileExists("/data/things/" .. thingdata[1]) then
if not g_resources.fileExists("/things/" .. thingdata[1]) then
incorrectThings = incorrectThings .. "Missing file: " .. thingdata[1] .. "\n"
missingFiles = true
versionForMissingFiles = thingdata[1]:split("/")[1]
else
local localChecksum = g_resources.fileChecksum("/data/things/" .. thingdata[1]):lower()
local localChecksum = g_resources.fileChecksum("/things/" .. thingdata[1]):lower()
if localChecksum ~= thingdata[2]:lower() and #thingdata[2] > 1 then
if g_resources.isLoadedFromArchive() then -- ignore checksum if it's test/debug version
incorrectThings = incorrectThings .. "Invalid checksum of file: " .. thingdata[1] .. " (is " .. localChecksum .. ", should be " .. thingdata[2]:lower() .. ")\n"
@@ -393,8 +393,8 @@ function EnterGame.doLogin()
g_game.setProtocolVersion(g_game.getClientProtocolVersion(G.clientVersion))
g_game.setCustomProtocolVersion(0)
g_game.chooseRsa(G.host)
if #server_params <= 3 then
g_game.setCustomOs(2) -- set os to windows
if #server_params <= 3 and not g_game.getFeature(GameExtendedOpcode) then
g_game.setCustomOs(2) -- set os to windows if opcodes are disabled
end
-- extra features from init.lua

View File

@@ -1,7 +1,3 @@
EnterGameWindow < StaticMainWindow
!text: tr('Enter Game')
size: 260 354
EnterGameWindow
id: enterGame
@onEnter: EnterGame.doLogin()

View File

@@ -370,12 +370,12 @@ function validateThings(things)
local thingsNode = {}
for thingtype, thingdata in pairs(things) do
thingsNode[thingtype] = thingdata[1]
if not g_resources.fileExists("/data/things/" .. thingdata[1]) then
if not g_resources.fileExists("/things/" .. thingdata[1]) then
incorrectThings = incorrectThings .. "Missing file: " .. thingdata[1] .. "\n"
missingFiles = true
versionForMissingFiles = thingdata[1]:split("/")[1]
else
local localChecksum = g_resources.fileChecksum("/data/things/" .. thingdata[1]):lower()
local localChecksum = g_resources.fileChecksum("/things/" .. thingdata[1]):lower()
if localChecksum ~= thingdata[2]:lower() and #thingdata[2] > 1 then
if g_resources.isLoadedFromArchive() then -- ignore checksum if it's test/debug version
incorrectThings = incorrectThings .. "Invalid checksum of file: " .. thingdata[1] .. " (is " .. localChecksum .. ", should be " .. thingdata[2]:lower() .. ")\n"

View File

@@ -1,7 +1,33 @@
Panel
Label
width: 130
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
id: layoutLabel
!text: tr("Layout (change requries client restart)")
ComboBox
id: layout
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 3
margin-right: 2
margin-left: 2
@onOptionChange: modules.client_options.setOption(self:getId(), self:getCurrentOption().text)
@onSetup: |
self:addOption("Default")
for _, file in ipairs(g_resources.listDirectoryFiles("/layouts", false, true)) do
if g_resources.directoryExists("/layouts/" .. file) then
self:addOption(file:gsub("^%l", string.upper))
end
end
OptionCheckBox
id: classicView
!text: tr('Classic view')
margin-top: 5
OptionCheckBox
id: cacheMap

View File

@@ -1,4 +1,5 @@
local defaultOptions = {
layout = DEFAULT_LAYOUT, -- set in init.lua
vsync = true,
showFps = true,
showPing = true,
@@ -33,8 +34,8 @@ local defaultOptions = {
displayHealth = true,
displayMana = true,
displayHealthOnTop = false,
showHealthManaCircle = true,
hidePlayerBars = true,
showHealthManaCircle = false,
hidePlayerBars = false,
highlightThingsUnderCursor = true,
topHealtManaBar = true,
displayText = true,
@@ -141,6 +142,8 @@ function setup()
setOption(k, g_settings.getBoolean(k), true)
elseif type(v) == 'number' then
setOption(k, g_settings.getNumber(k), true)
elseif type(v) == 'string' then
setOption(k, g_settings.getString(k), true)
end
end
@@ -208,6 +211,7 @@ function setOption(key, value, force)
end
return
end
if modules.game_interface == nil then
return
end
@@ -219,8 +223,14 @@ function setOption(key, value, force)
g_window.setVerticalSync(value)
elseif key == 'showFps' then
modules.client_topmenu.setFpsVisible(value)
if modules.game_stats and modules.game_stats.ui.fps then
modules.game_stats.ui.fps:setVisible(value)
end
elseif key == 'showPing' then
modules.client_topmenu.setPingVisible(value)
if modules.game_stats and modules.game_stats.ui.ping then
modules.game_stats.ui.ping:setVisible(value)
end
elseif key == 'fullscreen' then
g_window.setFullscreen(value)
elseif key == 'enableAudio' then
@@ -267,9 +277,9 @@ function setOption(key, value, force)
if value == 1 then
gameMapPanel:setCrosshair("")
elseif value == 2 then
gameMapPanel:setCrosshair("/data/images/crosshair/default.png")
gameMapPanel:setCrosshair("/images/crosshair/default.png")
elseif value == 3 then
gameMapPanel:setCrosshair("/data/images/crosshair/full.png")
gameMapPanel:setCrosshair("/images/crosshair/full.png")
end
elseif key == 'ambientLight' then
graphicsPanel:getChildById('ambientLightLabel'):setText(tr('Ambient light: %s%%', value))
@@ -322,7 +332,7 @@ function setOption(key, value, force)
generalPanel:getChildById('walkTeleportDelayLabel'):setText(tr('Walk delay after teleport: %s ms', value))
elseif key == 'walkCtrlTurnDelay' then
generalPanel:getChildById('walkCtrlTurnDelayLabel'):setText(tr('Walk delay after ctrl turn: %s ms', value))
end
end
-- change value for keybind updates
for _,panel in pairs(optionsTabBar:getTabsPanel()) do
@@ -333,11 +343,15 @@ function setOption(key, value, force)
elseif widget:getStyle().__class == 'UIScrollBar' then
widget:setValue(value)
elseif widget:getStyle().__class == 'UIComboBox' then
if valur ~= nil or value < 1 then
if type(value) == "string" then
widget:setCurrentOption(value, true)
break
end
if value == nil or value < 1 then
value = 1
end
if widget.currentIndex ~= value then
widget:setCurrentIndex(value)
widget:setCurrentIndex(value, true)
end
end
break

View File

@@ -20,7 +20,7 @@ OptionScrollbar < HorizontalScrollBar
MainWindow
id: optionsWindow
!text: tr('Options')
size: 480 420
size: 480 460
@onEnter: modules.client_options.hide()
@onEscape: modules.client_options.hide()
@@ -38,6 +38,7 @@ MainWindow
anchors.right: parent.right
anchors.bottom: optionsTabBar.bottom
margin-left: 10
margin-top: 3
Button
!text: tr('Ok')

View File

@@ -136,7 +136,10 @@ function sendStats()
lua_mem_usage = gcinfo(),
os_name = g_platform.getOSName(),
platform = g_window.getPlatformType(),
uptime = g_clock.seconds()
uptime = g_clock.seconds(),
layout = g_resources.getLayout(),
packets = g_game.getRecivedPacketsCount(),
packets_size = g_game.getRecivedPacketsSize()
}
}
if g_proxy then

View File

@@ -1,27 +1,74 @@
function init()
local files
files = g_resources.listDirectoryFiles('/styles')
local loaded_files = {}
local layout = g_resources:getLayout()
local style_files = {}
if layout:len() > 0 then
loaded_files = {}
files = g_resources.listDirectoryFiles('/layouts/' .. layout .. '/styles')
for _,file in pairs(files) do
if g_resources.isFileType(file, 'otui') then
table.insert(style_files, file)
loaded_files[file] = true
end
end
end
files = g_resources.listDirectoryFiles('/data/styles')
for _,file in pairs(files) do
if g_resources.isFileType(file, 'otui') and not loaded_files[file] then
table.insert(style_files, file)
end
end
table.sort(style_files)
for _,file in pairs(style_files) do
if g_resources.isFileType(file, 'otui') then
g_ui.importStyle('/styles/' .. file)
end
end
files = g_resources.listDirectoryFiles('/fonts')
for _,file in pairs(files) do
if g_resources.isFileType(file, 'otfont') then
g_fonts.importFont('/fonts/' .. file)
if layout:len() > 0 then
files = g_resources.listDirectoryFiles('/layouts/' .. layout .. '/fonts')
loaded_files = {}
for _,file in pairs(files) do
if g_resources.isFileType(file, 'otfont') then
g_ui.importFont('/layouts/' .. layout .. '/fonts/' .. file)
loaded_files[file] = true
end
end
end
files = g_resources.listDirectoryFiles('/particles')
files = g_resources.listDirectoryFiles('/data/fonts')
for _,file in pairs(files) do
if g_resources.isFileType(file, 'otps')then
g_particles.importParticle('/particles/' .. file)
if g_resources.isFileType(file, 'otfont') and not loaded_files[file] then
g_fonts.importFont('/data/fonts/' .. file)
end
end
g_mouse.loadCursors('/cursors/cursors')
if layout:len() > 0 then
files = g_resources.listDirectoryFiles('/layouts/' .. layout .. '/particles')
loaded_files = {}
for _,file in pairs(files) do
if g_resources.isFileType(file, 'otps') then
g_ui.importParticle('/layouts/' .. layout .. '/particles/' .. file)
loaded_files[file] = true
end
end
end
files = g_resources.listDirectoryFiles('/data/particles')
for _,file in pairs(files) do
if g_resources.isFileType(file, 'otps') and not loaded_files[file] then
g_particles.importParticle('/data/particles/' .. file)
end
end
g_mouse.loadCursors('/data/cursors/cursors')
if layout:len() > 0 and g_resources.directoryExists('/layouts/' .. layout .. '/cursors/cursors') then
g_mouse.loadCursors('/layouts/' .. layout .. '/cursors/cursors')
end
end
function terminate()

View File

@@ -1,17 +1,20 @@
-- private variables
local topMenu
local fpsUpdateEvent = nil
local HIDE_TOPMENU = false
local statusUpdateEvent = nil
-- private functions
local function addButton(id, description, icon, callback, panel, toggle, front)
local function addButton(id, description, icon, callback, panel, toggle, front, index)
local class
if toggle then
class = 'TopToggleButton'
else
class = 'TopButton'
end
if topMenu.reverseButtons then
front = not front
end
local button = panel:getChildById(id)
if not button then
@@ -31,6 +34,9 @@ local function addButton(id, description, icon, callback, panel, toggle, front)
return true
end
end
if not button.index and type(index) == 'number' then
button.index = index
end
return button
end
@@ -40,24 +46,15 @@ function init()
onGameEnd = offline,
onPingBack = updatePing })
topMenu = g_ui.displayUI('topmenu')
topMenu = g_ui.createWidget('TopMenu', g_ui.getRootWidget())
g_keyboard.bindKeyDown('Ctrl+Shift+T', toggle)
if g_game.isOnline() then
online()
scheduleEvent(online, 10)
end
updateFps()
if not Services or not Services.feedback or Services.feedback:len() < 4 then
topMenu.reportBug:setVisible(false)
topMenu.reportBug:setWidth(0)
end
if HIDE_TOPMENU then
topMenu:setHeight(0)
topMenu:hide()
end
updateFps()
updateStatus()
end
function terminate()
@@ -65,34 +62,59 @@ function terminate()
onGameEnd = offline,
onPingBack = updatePing })
removeEvent(fpsUpdateEvent)
removeEvent(statusUpdateEvent)
g_keyboard.unbindKeyDown('Ctrl+Shift+T')
topMenu:destroy()
end
function online()
if topMenu.hideIngame then
hide()
else
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
end
if topMenu.onlineLabel then
topMenu.onlineLabel:hide()
end
showGameButtons()
addEvent(function()
if modules.client_options.getOption('showPing') and (g_game.getFeature(GameClientPing) or g_game.getFeature(GameExtendedClientPing)) then
topMenu.pingLabel:show()
else
topMenu.pingLabel:hide()
end
end)
if topMenu.pingLabel then
addEvent(function()
if modules.client_options.getOption('showPing') and (g_game.getFeature(GameClientPing) or g_game.getFeature(GameExtendedClientPing)) then
topMenu.pingLabel:show()
else
topMenu.pingLabel:hide()
end
end)
end
end
function offline()
if topMenu.hideIngame then
show()
end
if topMenu.onlineLabel then
topMenu.onlineLabel:show()
end
hideGameButtons()
topMenu.pingLabel:hide()
if topMenu.pingLabel then
topMenu.pingLabel:hide()
end
updateStatus()
end
function updateFps()
if not topMenu.fpsLabel then return end
fpsUpdateEvent = scheduleEvent(updateFps, 500)
text = 'FPS: ' .. g_app.getFps()
topMenu.fpsLabel:setText(text)
end
function updatePing(ping)
if not topMenu.pingLabel then return end
if g_proxy and g_proxy.getPing() > 0 then
ping = g_proxy.getPing()
end
@@ -117,49 +139,70 @@ function updatePing(ping)
end
function setPingVisible(enable)
if not topMenu.pingLabel then return end
topMenu.pingLabel:setVisible(enable)
topMenu.reportBug:setVisible(enable)
end
function setFpsVisible(enable)
if not topMenu.fpsLabel then return end
topMenu.fpsLabel:setVisible(enable)
end
function addLeftButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.leftButtonsPanel, false, front)
function addLeftButton(id, description, icon, callback, front, index)
return addButton(id, description, icon, callback, topMenu.leftButtonsPanel, false, front, index)
end
function addLeftToggleButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.leftButtonsPanel, true, front)
function addLeftToggleButton(id, description, icon, callback, front, index)
return addButton(id, description, icon, callback, topMenu.leftButtonsPanel, true, front, index)
end
function addRightButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.rightButtonsPanel, false, front)
function addRightButton(id, description, icon, callback, front, index)
return addButton(id, description, icon, callback, topMenu.rightButtonsPanel, false, front, index)
end
function addRightToggleButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.rightButtonsPanel, true, front)
function addRightToggleButton(id, description, icon, callback, front, index)
return addButton(id, description, icon, callback, topMenu.rightButtonsPanel, true, front, index)
end
function addLeftGameButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.leftGameButtonsPanel, false, front)
function addLeftGameButton(id, description, icon, callback, front, index)
local button = addButton(id, description, icon, callback, topMenu.leftGameButtonsPanel, false, front, index)
if modules.game_buttons then
modules.game_buttons.takeButton(button)
end
return button
end
function addLeftGameToggleButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.leftGameButtonsPanel, true, front)
function addLeftGameToggleButton(id, description, icon, callback, front, index)
local button = addButton(id, description, icon, callback, topMenu.leftGameButtonsPanel, true, front, index)
if modules.game_buttons then
modules.game_buttons.takeButton(button)
end
return button
end
function addRightGameButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.rightGameButtonsPanel, false, front)
function addRightGameButton(id, description, icon, callback, front, index)
local button = addButton(id, description, icon, callback, topMenu.rightGameButtonsPanel, false, front, index)
if modules.game_buttons then
modules.game_buttons.takeButton(button)
end
return button
end
function addRightGameToggleButton(id, description, icon, callback, front)
return addButton(id, description, icon, callback, topMenu.rightGameButtonsPanel, true, front)
function addRightGameToggleButton(id, description, icon, callback, front, index)
local button = addButton(id, description, icon, callback, topMenu.rightGameButtonsPanel, true, front, index)
if modules.game_buttons then
modules.game_buttons.takeButton(button)
end
return button
end
function showGameButtons()
topMenu.leftGameButtonsPanel:show()
topMenu.rightGameButtonsPanel:show()
if modules.game_buttons then
modules.game_buttons.takeButtons(topMenu.leftGameButtonsPanel:getChildren())
modules.game_buttons.takeButtons(topMenu.rightGameButtonsPanel:getChildren())
end
end
function hideGameButtons()
@@ -176,23 +219,61 @@ function getTopMenu()
end
function toggle()
local menu = getTopMenu()
if not menu then
if not topMenu then
return
end
if HIDE_TOPMENU then
return
end
if menu:isVisible() then
menu:hide()
modules.client_background.getBackground():addAnchor(AnchorTop, 'parent', AnchorTop)
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'parent', AnchorTop)
if topMenu:isVisible() then
hide()
else
menu:show()
topMenu:setHeight(36)
modules.client_background.getBackground():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
show()
end
end
function hide()
topMenu:hide()
if not topMenu.hideIngame then
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'parent', AnchorTop)
end
if modules.game_stats then
modules.game_stats.show()
end
end
function show()
topMenu:show()
if not topMenu.hideIngame then
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
end
if modules.game_stats then
modules.game_stats.hide()
end
end
function updateStatus()
removeEvent(statusUpdateEvent)
if not Services or not Services.status or Services.status:len() < 4 then return end
if not topMenu.onlineLabel then return end
if g_game.isOnline() then return end
HTTP.getJSON(Services.status, function(data, err)
if err then
g_logger.warning("HTTP error for " .. Services.status .. ": " .. err)
statusUpdateEvent = scheduleEvent(updateStatus, 5000)
return
end
if data.online and topMenu.onlineLabel then
topMenu.onlineLabel:setText(data.online)
end
if data.discord_online and topMenu.discordLabel then
topMenu.discordLabel:setText(data.discord_online)
end
if data.discord_link and topMenu.discordLabel and topMenu.discord then
local discordOnClick = function()
g_platform.openUrl(data.discord_link)
end
topMenu.discordLabel.onClick = discordOnClick
topMenu.discord.onClick = discordOnClick
end
statusUpdateEvent = scheduleEvent(updateStatus, 60000)
end)
end

View File

@@ -1,57 +0,0 @@
TopMenuPanel
id: topMenu
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
TopMenuButtonsPanel
id: leftButtonsPanel
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
TopMenuButtonsPanel
id: leftGameButtonsPanel
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: prev.right
visible: false
TopMenuFrameCounterLabel
id: fpsLabel
text-auto-resize: true
anchors.top: parent.top
anchors.left: leftGameButtonsPanel.right
TopMenuPingLabel
color: white
id: pingLabel
text-auto-resize: true
anchors.top: fpsLabel.bottom
anchors.left: fpsLabel.left
Button
id: reportBug
text: Report bug
text-align: center
color: white
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: leftGameButtonsPanel.right
margin-left: 80
margin-top: 5
margin-bottom: 5
@onClick: modules.client_feedback.show()
TopMenuButtonsPanel
id: rightButtonsPanel
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
TopMenuButtonsPanel
id: rightGameButtonsPanel
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: prev.left
visible: false

View File

@@ -34,7 +34,9 @@ function UIMiniWindow:minimize(dontSave)
self:getChildById('contentsPanel'):hide()
self:getChildById('miniwindowScrollBar'):hide()
self:getChildById('bottomResizeBorder'):hide()
self:getChildById('minimizeButton'):setOn(true)
if self.minimizeButton then
self.minimizeButton:setOn(true)
end
self.maximizedHeight = self:getHeight()
self:setHeight(self.minimizedHeight)
@@ -50,7 +52,9 @@ function UIMiniWindow:maximize(dontSave)
self:getChildById('contentsPanel'):show()
self:getChildById('miniwindowScrollBar'):show()
self:getChildById('bottomResizeBorder'):show()
self:getChildById('minimizeButton'):setOn(false)
if self.minimizeButton then
self.minimizeButton:setOn(false)
end
self:setHeight(self:getSettings('height') or self.maximizedHeight)
if not dontSave then
@@ -96,18 +100,21 @@ function UIMiniWindow:setup()
self:close()
end
if self.forceOpen then
self:getChildById('closeButton'):hide()
self:getChildById('minimizeButton'):addAnchor(AnchorRight, 'parent', AnchorRight)
if self.closeButton then
self.closeButton:hide()
end
end
self:getChildById('minimizeButton').onClick =
function()
if self:isOn() then
self:maximize()
else
self:minimize()
if(self.minimizeButton) then
self.minimizeButton.onClick =
function()
if self:isOn() then
self:maximize()
else
self:minimize()
end
end
end
end
local lockButton = self:getChildById('lockButton')
if lockButton then

View File

@@ -38,7 +38,7 @@ function init()
})
if g_game.isOnline() then
show()
online()
end
end
@@ -51,14 +51,7 @@ function terminate()
saveConfig()
-- remove hotkeys
for index, panel in ipairs({actionPanel1, actionPanel2}) do
for i, child in ipairs(panel.tabBar:getChildren()) do
local gameRootPanel = modules.game_interface.getRootPanel()
if child.hotkey then
g_keyboard.unbindKeyPress(child.hotkey, child.callback, gameRootPanel)
end
end
end
offline()
actionPanel1:destroy()
actionPanel2:destroy()
@@ -66,8 +59,6 @@ end
function show()
if not g_game.isOnline() then return end
setupActionPanel(1, actionPanel1)
setupActionPanel(2, actionPanel2)
actionPanel1:setOn(g_settings.getBoolean("actionBar1", false))
actionPanel2:setOn(g_settings.getBoolean("actionBar2", false))
end
@@ -88,6 +79,8 @@ function switchMode(newMode)
end
function online()
setupActionPanel(1, actionPanel1)
setupActionPanel(2, actionPanel2)
show()
end
@@ -98,6 +91,15 @@ function offline()
hotkeyAssignWindow = nil
end
saveConfig()
for index, panel in ipairs({actionPanel1, actionPanel2}) do
for i, child in ipairs(panel.tabBar:getChildren()) do
local gameRootPanel = modules.game_interface.getRootPanel()
if child.hotkey then
g_keyboard.unbindKeyPress(child.hotkey, child.callback, gameRootPanel)
end
end
end
end
function setupActionPanel(index, panel)
@@ -143,8 +145,14 @@ function setupAction(index, action, config)
action.callback = function(k, c, ticks) executeAction(action, ticks) end
if config then
if type(config.text) == 'number' then
config.text = tostring(config.text)
end
if type(config.hotkey) == 'number' then
config.hotkey = tostring(config.hotkey)
end
action.hotkey = config.hotkey
if action.hotkey and action.hotkey:len() > 0 then
if type(action.hotkey) == 'string' and action.hotkey:len() > 0 then
local gameRootPanel = modules.game_interface.getRootPanel()
g_keyboard.bindKeyPress(action.hotkey, action.callback, gameRootPanel)
end
@@ -156,6 +164,7 @@ function setupAction(index, action, config)
if config.item > 0 then
setupActionType(action, config.action)
end
action.item:setOn(config.item > 0)
action.item:setItemId(config.item)
action.item:setItemCount(config.count)
end
@@ -274,6 +283,7 @@ function actionOnMouseRelease(action, mousePosition, mouseButton)
menu:addSeparator()
menu:addOption(tr('Set text'), function()
modules.game_textedit.singlelineEditor(action.text:getText(), function(newText)
action.item:setOn(false)
action.item:setItemId(0)
action.text:setText(newText)
if action.text:getText():len() > 0 then
@@ -303,7 +313,7 @@ function actionOnMouseRelease(action, mousePosition, mouseButton)
if action.hotkey and action.hotkey:len() > 0 then
g_keyboard.unbindKeyPress(action.hotkey, action.callback, gameRootPanel)
end
action.hotkey = assignWindow.comboPreview.keyCombo
action.hotkey = tostring(assignWindow.comboPreview.keyCombo)
if action.hotkey and action.hotkey:len() > 0 then
g_keyboard.bindKeyPress(action.hotkey, action.callback, gameRootPanel)
end
@@ -338,6 +348,7 @@ function actionOnItemChange(widget)
local action = widget:getParent()
if action.item:getItemId() > 0 then
action.text:setText("")
action.item:setOn(true)
if action.item:getItem():isMultiUse() then
if not action.actionType or action.actionType <= 1 then
setupActionType(action, ActionTypes.USE_WITH)

View File

@@ -20,6 +20,9 @@ ActionButton < Panel
&editable: false
virtual: true
$!on:
image-source: /images/game/actionbarslot
Label
id: text
anchors.fill: parent
@@ -43,8 +46,7 @@ Panel
id: actionBar
anchors.left: parent.left
anchors.right: parent.right
image-source: /images/ui/panel_bottom
image-border: 6
image-source: /images/ui/panel_map
focusable: false
$first:

View File

@@ -16,7 +16,7 @@ local ageNumber = 1
function init()
g_ui.importStyle('battlebutton')
battleButton = modules.client_topmenu.addRightGameToggleButton('battleButton', tr('Battle') .. ' (Ctrl+B)', '/images/topbuttons/battle', toggle)
battleButton = modules.client_topmenu.addRightGameToggleButton('battleButton', tr('Battle') .. ' (Ctrl+B)', '/images/topbuttons/battle', toggle, false, 2)
battleButton:setOn(true)
battleWindow = g_ui.loadUI('battle', modules.game_interface.getRightPanel())
g_keyboard.bindKeyDown('Ctrl+B', toggle)

View File

@@ -33,7 +33,7 @@ function init()
initCallbacks()
botButton = modules.client_topmenu.addRightGameToggleButton('botButton', tr('Bot'), '/images/topbuttons/bot', toggle)
botButton = modules.client_topmenu.addRightGameToggleButton('botButton', tr('Bot'), '/images/topbuttons/bot', toggle, false, 99999)
botButton:setOn(false)
botButton:hide()

View File

@@ -17,11 +17,9 @@ UI.Container = function(callback, unique, parent)
local updateItems = function()
local items = widget:getItems()
widget:setItems(items)
-- callback part
if not callback then return end
local somethingNew = false
local somethingNew = (#items ~= #oldItems)
for i, item in ipairs(items) do
if type(oldItems[i]) ~= "table" then
somethingNew = true
@@ -32,10 +30,13 @@ UI.Container = function(callback, unique, parent)
break
end
end
if somethingNew then
oldItems = items
callback(items)
end
widget:setItems(items)
end
widget.setItems = function(self, items)

View File

@@ -42,6 +42,7 @@ BotSeparator < HorizontalSeparator
BotSmallScrollBar < SmallScrollBar
BotPanel < Panel
margin-top: 1
ScrollablePanel
id: content
anchors.fill: parent

View File

@@ -0,0 +1,40 @@
buttonsWindow = nil
contentsPanel = nil
function init()
buttonsWindow = g_ui.loadUI('buttons', modules.game_interface.getRightPanel())
buttonsWindow:disableResize()
buttonsWindow:setup()
contentsPanel = buttonsWindow.contentsPanel
if not buttonsWindow.forceOpen or not contentsPanel.buttons then
buttonsWindow:close()
end
end
function terminate()
buttonsWindow:destroy()
end
function takeButtons(buttons)
if not buttonsWindow.forceOpen or not contentsPanel.buttons then return end
for i, button in ipairs(buttons) do
takeButton(button, true)
end
updateOrder()
end
function takeButton(button, dontUpdateOrder)
if not buttonsWindow.forceOpen or not contentsPanel.buttons then return end
button:setParent(contentsPanel.buttons)
if not dontUpdateOrder then
updateOrder()
end
end
function updateOrder()
local children = contentsPanel.buttons:getChildren()
table.sort(children, function(a, b)
return (a.index or 1000) < (b.index or 1000)
end)
contentsPanel.buttons:reorderChildren(children)
end

View File

@@ -0,0 +1,8 @@
Module
name: game_buttons
description: Shows miniwindow with buttons
author: otclient@otclient.ovh
sandboxed: true
scripts: [ buttons ]
@onLoad: init()
@onUnload: terminate()

View File

@@ -0,0 +1,6 @@
GameButtonsWindow
id: buttons
&save: true
!text: tr("Buttons")
icon: /images/topbuttons/buttons

View File

@@ -1,187 +1,3 @@
ConsoleLabel < UITextEdit
font: verdana-11px-antialised
height: 14
color: yellow
margin-left: 2
text-wrap: true
text-auto-resize: true
selection-color: #111416
selection-background-color: #999999
change-cursor-image: false
cursor-visible: false
editable: false
draggable: true
selectable: false
focusable: false
ConsolePhantomLabel < UILabel
font: verdana-11px-antialised
height: 14
color: yellow
text-wrap: true
text-auto-resize: true
selection-color: #111416
selection-background-color: #999999
ConsoleTabBar < MoveableTabBar
height: 28
ConsoleTabBarPanel < MoveableTabBarPanel
id: consoleTab
ScrollablePanel
id: consoleBuffer
anchors.fill: parent
margin-right: 12
vertical-scrollbar: consoleScrollBar
layout:
type: verticalBox
align-bottom: true
border-width: 1
border-color: #202327
background: #00000066
inverted-scroll: true
padding: 1
VerticalScrollBar
id: consoleScrollBar
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
step: 14
pixels-scroll: true
ConsoleTabBarButton < MoveableTabBarButton
height: 28
padding: 15
Panel
ConsolePanel
id: consolePanel
image-source: /images/ui/panel_bottom
image-border: 4
phantom: false
$first:
anchors.fill: parent
$!first:
anchors.top: prev.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
CheckBox
id: toggleChat
!tooltip: tr('Disable chat mode, allow to walk using ASDW')
anchors.left: parent.left
anchors.top: parent.top
margin-left: 13
margin-top: 8
@onCheckChange: toggleChat()
TabButton
id: prevChannelButton
icon: /images/game/console/leftarrow
anchors.left: toggleChat.right
anchors.top: parent.top
margin-left: 3
margin-top: 6
ConsoleTabBar
id: consoleTabBar
anchors.left: prev.right
anchors.top: parent.top
anchors.right: next.left
margin-left: 5
margin-top: 3
margin-right: 5
tab-spacing: 2
movable: true
TabButton
id: nextChannelButton
icon: /images/game/console/rightarrow
anchors.right: next.left
anchors.top: parent.top
margin-right: 5
margin-top: 6
TabButton
id: closeChannelButton
!tooltip: tr('Close this channel') .. ' (Ctrl+E)'
icon: /images/game/console/closechannel
anchors.right: next.left
anchors.top: parent.top
enabled: false
margin-right: 5
margin-top: 6
@onClick: removeCurrentTab()
TabButton
id: clearChannelButton
!tooltip: tr('Clear current message window')
icon: /images/game/console/clearchannel
anchors.right: next.left
anchors.top: parent.top
margin-right: 5
margin-top: 6
@onClick: |
local consoleTabBar = self:getParent():getChildById('consoleTabBar')
clearChannel(consoleTabBar)
TabButton
id: channelsButton
!tooltip: tr('Open new channel') .. ' (Ctrl+O)'
icon: /images/game/console/channels
anchors.right: next.left
anchors.top: parent.top
margin-right: 5
margin-top: 6
@onClick: g_game.requestChannels()
TabButton
id: ignoreButton
!tooltip: tr('Ignore players')
icon: /images/game/console/ignore
anchors.right: parent.right
anchors.top: parent.top
margin-right: 5
margin-top: 6
@onClick: onClickIgnoreButton()
Panel
id: consoleContentPanel
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: consoleTextEdit.top
margin-left: 6
margin-right: 6
margin-bottom: 4
margin-top: 4
padding: 1
focusable: false
phantom: true
TabButton
id: sayModeButton
icon: /images/game/console/say
!tooltip: tr('Adjust volume')
&sayMode: 2
size: 20 20
anchors.left: parent.left
anchors.bottom: parent.bottom
margin-left: 6
margin-bottom: 6
@onClick: sayModeChange()
TextEdit
id: consoleTextEdit
anchors.left: sayModeButton.right
anchors.right: parent.right
anchors.bottom: parent.bottom
margin-right: 6
margin-left: 6
margin-bottom: 6
shift-navigation: true
max-length: 255

View File

@@ -1,67 +0,0 @@
PageButton < Button
size: 30 18
margin: 1
ContainerWindow < MiniWindow
height: 150
UIItem
id: containerItemWidget
virtual: true
size: 16 16
anchors.top: parent.top
anchors.left: parent.left
margin-top: 4
margin-left: 4
UIButton
id: upButton
anchors.top: lockButton.top
anchors.right: lockButton.left
margin-right: 3
size: 14 14
image-source: /images/ui/miniwindow_buttons
image-clip: 42 0 14 14
$hover:
image-clip: 42 14 14 14
$pressed:
image-clip: 42 28 14 14
Panel
id: pagePanel
anchors.left: parent.left
anchors.right: parent.right
anchors.top: miniwindowTopBar.bottom
height: 20
margin: 2 3 0 3
background: #00000066
visible: false
Label
id: pageLabel
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin-top: 2
text-auto-resize: true
PageButton
id: prevPageButton
text: <
anchors.top: parent.top
anchors.left: parent.left
PageButton
id: nextPageButton
text: >
anchors.top: parent.top
anchors.right: parent.right
MiniWindowContents
padding-right: 0
layout:
type: grid
cell-size: 34 34
flow: true

View File

@@ -1,6 +1,4 @@
function init()
g_ui.importStyle('container')
connect(Container, { onOpen = onContainerOpen,
onClose = onContainerClose,
onSizeChange = onContainerChangeSize,
@@ -50,10 +48,18 @@ function refreshContainerItems(container)
end
end
function toggleContainerPages(containerWindow, pages)
containerWindow:getChildById('miniwindowScrollBar'):setMarginTop(pages and 42 or 22)
containerWindow:getChildById('contentsPanel'):setMarginTop(pages and 42 or 22)
containerWindow:getChildById('pagePanel'):setVisible(pages)
function toggleContainerPages(containerWindow, hasPages)
if hasPages == containerWindow.pagePanel:isOn() then
return
end
containerWindow.pagePanel:setOn(hasPages)
if hasPages then
containerWindow.miniwindowScrollBar:setMarginTop(containerWindow.miniwindowScrollBar:getMarginTop() + containerWindow.pagePanel:getHeight())
containerWindow.contentsPanel:setMarginTop(containerWindow.contentsPanel:getMarginTop() + containerWindow.pagePanel:getHeight())
else
containerWindow.miniwindowScrollBar:setMarginTop(containerWindow.miniwindowScrollBar:getMarginTop() - containerWindow.pagePanel:getHeight())
containerWindow.contentsPanel:setMarginTop(containerWindow.contentsPanel:getMarginTop() - containerWindow.pagePanel:getHeight())
end
end
function refreshContainerPages(container)

View File

@@ -18,7 +18,7 @@ function init()
onSpellCooldown = onSpellCooldown })
cooldownButton = modules.client_topmenu.addRightGameToggleButton('cooldownButton',
tr('Cooldowns'), '/images/topbuttons/cooldowns', toggle)
tr('Cooldowns'), '/images/topbuttons/cooldowns', toggle, false, 5)
cooldownButton:setOn(true)
cooldownButton:hide()

View File

@@ -14,7 +14,7 @@ function updateFeatures(version)
-- you can add custom features here, list of them is in the modules\gamelib\const.lua
g_game.enableFeature(GameBot)
g_game.enableFeature(GameExtendedOpcode)
--g_game.enableFeature(GameExtendedOpcode)
--g_game.enableFeature(GameMinimapLimitedToSingleFloor) -- it will generate minimap only for current floor
--g_game.enableFeature(GameSpritesAlphaChannel)

View File

@@ -45,11 +45,14 @@ function init()
connect(g_game, { onGameEnd = offline })
healthInfoButton = modules.client_topmenu.addRightGameToggleButton('healthInfoButton', tr('Health Information'), '/images/topbuttons/healthinfo', toggle)
healthInfoButton:setOn(true)
healthInfoWindow = g_ui.loadUI('healthinfo', modules.game_interface.getRightPanel())
healthInfoWindow:disableResize()
if not healthInfoWindow.forceOpen then
healthInfoButton = modules.client_topmenu.addRightGameToggleButton('healthInfoButton', tr('Health Information'), '/images/topbuttons/healthinfo', toggle)
healthInfoButton:setOn(true)
end
healthBar = healthInfoWindow:recursiveGetChildById('healthBar')
manaBar = healthInfoWindow:recursiveGetChildById('manaBar')
experienceBar = healthInfoWindow:recursiveGetChildById('experienceBar')
@@ -100,11 +103,14 @@ function terminate()
disconnect(overlay, { onGeometryChange = onOverlayGeometryChange })
healthInfoWindow:destroy()
healthInfoButton:destroy()
if healthInfoButton then
healthInfoButton:destroy()
end
overlay:destroy()
end
function toggle()
if not healthInfoButton then return end
if healthInfoButton:isOn() then
healthInfoWindow:close()
healthInfoButton:setOn(false)
@@ -140,7 +146,9 @@ end
-- hooked events
function onMiniWindowClose()
healthInfoButton:setOn(false)
if healthInfoButton then
healthInfoButton:setOn(false)
end
end
function onHealthChange(localPlayer, health, maxHealth)

View File

@@ -1,158 +1,5 @@
HealthBar < ProgressBar
id: healthBar
background-color: #ff4444
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
margin: 1
ManaBar < ProgressBar
id: manaBar
background-color: #4444ff
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin: 1
margin-top: 3
ExperienceBar < ProgressBar
id: experienceBar
background-color: #B6E866
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
margin: 1
margin-top: 3
SoulLabel < GameLabel
id: soulLabel
text-align: right
color: white
font: verdana-11px-rounded
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.horizontalCenter
margin-top: 5
margin-right: 3
on: true
$!on:
visible: false
margin-top: 0
height: 0
CapLabel < GameLabel
id: capLabel
color: white
font: verdana-11px-rounded
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.horizontalCenter
margin-top: 5
margin-left: 3
on: true
$!on:
visible: false
margin-top: 0
height: 0
ConditionWidget < UIWidget
size: 18 18
$!first:
margin-left: 2
HealthOverlay < UIWidget
id: healthOverlay
anchors.fill: parent
phantom: true
ProgressBar
id: topHealthBar
background-color: #ff4444
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.horizontalCenter
height: 16
phantom: true
ProgressBar
id: topManaBar
background-color: #4444ff
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.horizontalCenter
height: 16
phantom: true
UIProgressBar
id: healthCircle
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
image-source: /images/game/circle/left_empty
margin-right: 169
margin-bottom: 16
opacity: 0.5
phantom: true
UIProgressBar
id: healthCircleFront
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
image-source: /images/game/circle/left_full
margin-right: 169
margin-bottom: 16
opacity: 0.5
phantom: true
UIProgressBar
id: manaCircle
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
image-source: /images/game/circle/right_empty
margin-left: 130
margin-bottom: 16
opacity: 0.5
phantom: true
UIProgressBar
id: manaCircleFront
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
image-source: /images/game/circle/right_full
margin-left: 130
margin-bottom: 16
opacity: 0.4
image-color: #0000FFFF
phantom: true
MiniWindow
icon: /images/topbuttons/healthinfo
HealthInfoWindow
id: healthInfoWindow
!text: tr('Health Info')
height: 123
@onClose: modules.game_healthinfo.onMiniWindowClose()
&save: true
&autoOpen: 2
MiniWindowContents
HealthBar
ManaBar
ExperienceBar
Panel
id: conditionPanel
layout:
type: horizontalBox
height: 22
margin-top: 4
padding: 2
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
border-width: 1
border-color: #00000077
background-color: #ffffff11
SoulLabel
CapLabel

View File

@@ -43,7 +43,7 @@ configValueChanged = false
-- public functions
function init()
hotkeysButton = modules.client_topmenu.addLeftGameButton('hotkeysButton', tr('Hotkeys') .. ' (Ctrl+K)', '/images/topbuttons/hotkeys', toggle)
hotkeysButton = modules.client_topmenu.addLeftGameButton('hotkeysButton', tr('Hotkeys') .. ' (Ctrl+K)', '/images/topbuttons/hotkeys', toggle, false, 7)
g_keyboard.bindKeyDown('Ctrl+K', toggle)
hotkeysWindow = g_ui.displayUI('hotkeys_manager')
hotkeysWindow:setVisible(false)

View File

@@ -553,9 +553,9 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
if g_game.getFeature(GameBot) and useThing and useThing:isItem() then
menu:addSeparator()
if useThing:getSubType() > 1 then
menu:addOption("ID: " .. useThing:getId() .. " SubType: " .. useThing:getSubType())
menu:addOption("ID: " .. useThing:getId() .. " SubType: " .. useThing:getSubType(), function() end)
else
menu:addOption("ID: " .. useThing:getId())
menu:addOption("ID: " .. useThing:getId(), function() end)
end
end
@@ -877,7 +877,9 @@ function refreshViewMode()
if classic then
g_game.changeMapAwareRange(19, 15)
gameRootPanel:addAnchor(AnchorTop, 'topMenu', AnchorBottom)
if not modules.client_topmenu.getTopMenu().hideIngame then
gameRootPanel:addAnchor(AnchorTop, 'topMenu', AnchorBottom)
end
gameMapPanel:addAnchor(AnchorLeft, 'gameLeftPanels', AnchorRight)
gameMapPanel:addAnchor(AnchorRight, 'gameRightPanels', AnchorLeft)
gameMapPanel:addAnchor(AnchorBottom, 'gameBottomPanel', AnchorTop)
@@ -943,6 +945,9 @@ function updateSize()
maxWidth = tileSize * (awareRange.width - 1)
end
gameMapPanel:setMarginTop(-tileSize)
if modules.game_stats then
modules.game_stats.ui:setMarginTop(tileSize)
end
if g_settings.getBoolean("cacheMap") then
gameMapPanel:setMarginLeft(0)
gameMapPanel:setMarginRight(0)
@@ -958,7 +963,11 @@ function updateSize()
child.onGeometryChange(child)
end
end
end
end
else
if modules.game_stats then
modules.game_stats.ui:setMarginTop(0)
end
end
--[[

View File

@@ -23,7 +23,6 @@ GameMapPanel < UIGameMap
UIWidget
id: gameRootPanel
anchors.fill: parent
anchors.top: topMenu.bottom
GameMapPanel
id: gameMapPanel
@@ -77,4 +76,3 @@ UIWidget
id: mouseGrabber
focusable: false
visible: false

View File

@@ -6,6 +6,7 @@ Module
sandboxed: true
scripts: [ widgets/uigamemap, gameinterface ]
load-later:
- game_buttons
- game_hotkeys
- game_questlog
- game_textmessage
@@ -37,6 +38,7 @@ Module
- game_actionbar
- game_prey
- game_imbuing
- game_stats
- game_bot
@onLoad: init()
@onUnload: terminate()

View File

@@ -34,7 +34,6 @@ inventoryWindow = nil
inventoryPanel = nil
inventoryButton = nil
purseButton = nil
marketButton = nil
combatControlsWindow = nil
fightOffensiveBox = nil
@@ -76,13 +75,6 @@ function init()
end
end
marketButton = inventoryWindow:recursiveGetChildById('marketButton')
marketButton.onClick = function()
if modules.game_shop then
modules.game_shop.toggle()
end
end
-- controls
fightOffensiveBox = inventoryWindow:recursiveGetChildById('fightOffensiveBox')
fightBalancedBox = inventoryWindow:recursiveGetChildById('fightBalancedBox')
@@ -211,7 +203,6 @@ function refresh()
end
purseButton:setVisible(g_game.getFeature(GamePurseSlot))
marketButton:setVisible(g_game.getFeature(GameIngameStore))
end
function toggle()
@@ -281,9 +272,9 @@ function update()
safeFightButton:setChecked(not safeFight)
if buttonPvp then
if safeFight then
buttonPvp:setColor("#00BB00FF")
buttonPvp:setOn(false)
else
buttonPvp:setColor("#FF0000FF")
buttonPvp:setOn(true)
end
end
@@ -384,9 +375,9 @@ function onSetSafeFight(self, checked)
g_game.setSafeFight(not checked)
if buttonPvp then
if not checked then
buttonPvp:setColor("#00BB00FF")
buttonPvp:setOn(false)
else
buttonPvp:setColor("#FF0000FF")
buttonPvp:setOn(true)
end
end
end

View File

@@ -1,299 +1,6 @@
InventoryItem < Item
$on:
image-source: /images/ui/item-blessed
HeadSlot < InventoryItem
id: slot1
image-source: /images/game/slots/head
&position: {x=65535, y=1, z=0}
$on:
image-source: /images/game/slots/head-blessed
BodySlot < InventoryItem
id: slot4
image-source: /images/game/slots/body
&position: {x=65535, y=4, z=0}
$on:
image-source: /images/game/slots/body-blessed
LegSlot < InventoryItem
id: slot7
image-source: /images/game/slots/legs
&position: {x=65535, y=7, z=0}
$on:
image-source: /images/game/slots/legs-blessed
FeetSlot < InventoryItem
id: slot8
image-source: /images/game/slots/feet
&position: {x=65535, y=8, z=0}
$on:
image-source: /images/game/slots/feet-blessed
NeckSlot < InventoryItem
id: slot2
image-source: /images/game/slots/neck
&position: {x=65535, y=2, z=0}
$on:
image-source: /images/game/slots/neck-blessed
LeftSlot < InventoryItem
id: slot6
image-source: /images/game/slots/left-hand
&position: {x=65535, y=6, z=0}
$on:
image-source: /images/game/slots/left-hand-blessed
FingerSlot < InventoryItem
id: slot9
image-source: /images/game/slots/finger
&position: {x=65535, y=9, z=0}
$on:
image-source: /images/game/slots/finger-blessed
BackSlot < InventoryItem
id: slot3
image-source: /images/game/slots/back
&position: {x=65535, y=3, z=0}
$on:
image-source: /images/game/slots/back-blessed
RightSlot < InventoryItem
id: slot5
image-source: /images/game/slots/right-hand
&position: {x=65535, y=5, z=0}
$on:
image-source: /images/game/slots/right-hand-blessed
AmmoSlot < InventoryItem
id: slot10
image-source: /images/game/slots/ammo
&position: {x=65535, y=10, z=0}
$on:
image-source: /images/game/slots/ammo-blessed
PurseButton < UIButton
id: purseButton
size: 24 24
!tooltip: tr('Open purse')
icon-source: /images/game/slots/purse
icon-size: 24 24
MarketButton < UIButton
id: marketButton
size: 24 24
!tooltip: tr('Open Market')
icon-source: /images/game/slots/coins
icon-size: 24 24
CombatBox < UICheckBox
size: 20 20
image-clip: 0 0 20 20
margin-left: 4
$checked:
image-clip: 0 20 20 20
InventoryButton < Button
font: verdana-11px-antialised
height: 18
margin-top: 1
SoulCapLabel < GameLabel
text-align: center
color: #FFFFFF
font: cipsoftFont
margin-top: 4
text-offset: 0 3
width: 36
height: 20
icon-source: /images/game/slots/soulcap
FightOffensiveBox < CombatBox
image-source: /images/game/combatmodes/fightoffensive
FightBalancedBox < CombatBox
image-source: /images/game/combatmodes/fightbalanced
FightDefensiveBox < CombatBox
image-source: /images/game/combatmodes/fightdefensive
ChaseModeBox < CombatBox
image-source: /images/game/combatmodes/chasemode
SafeFightBox < CombatBox
image-source: /images/game/combatmodes/safefight
MountButton < CombatBox
image-source: /images/game/combatmodes/mount
MiniWindow
InventoryWindow
id: inventoryWindow
!text: tr('Inventory')
icon: /images/topbuttons/inventory
height: 200
@onClose: modules.game_inventory.onMiniWindowClose()
&save: true
&autoOpen: 3
--&forceOpen: true
MiniWindowContents
anchors.left: parent.left
Panel
id: inventoryPanel
margin-right: 63
margin-top: 2
anchors.fill: parent
HeadSlot
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin-top: 3
BodySlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 3
LegSlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 3
FeetSlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 3
NeckSlot
anchors.top: slot1.top
anchors.right: slot1.left
margin-top: 10
margin-right: 5
LeftSlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 3
FingerSlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 3
BackSlot
anchors.top: slot1.top
anchors.left: slot1.right
margin-top: 10
margin-left: 5
RightSlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 3
AmmoSlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 3
SoulCapLabel
id: soulLabel
anchors.top: slot10.bottom
anchors.horizontalCenter: slot10.horizontalCenter
SoulCapLabel
id: capLabel
anchors.top: slot9.bottom
anchors.horizontalCenter: slot9.horizontalCenter
Panel
id: conditionPanel
layout:
type: horizontalBox
height: 22
padding: 2
anchors.top: slot8.bottom
anchors.left: slot6.left
anchors.right: slot5.right
margin-top: 4
border-width: 1
border-color: #00000077
background-color: #ffffff11
Panel
margin-top: 5
anchors.fill: parent
anchors.left: prev.right
FightOffensiveBox
id: fightOffensiveBox
anchors.left: parent.left
anchors.top: parent.top
margin-left: 8
ChaseModeBox
id: chaseModeBox
anchors.left: prev.right
anchors.top: parent.top
FightBalancedBox
id: fightBalancedBox
margin-top: 22
anchors.left: parent.left
anchors.top: parent.top
margin-left: 8
SafeFightBox
id: safeFightBox
margin-top: 22
anchors.left: prev.right
anchors.top: parent.top
FightDefensiveBox
id: fightDefensiveBox
margin-top: 44
anchors.left: parent.left
anchors.top: parent.top
margin-left: 8
MountButton
id: mountButton
margin-top: 44
anchors.left: prev.right
anchors.top: parent.top
Panel
id: buttonsPanel
margin-top: 4
margin-right: 5
anchors.fill: parent
anchors.top: prev.bottom
layout:
type: verticalBox
InventoryButton
!text: tr('Stop')
@onClick: g_game.stop(); g_game.cancelAttackAndFollow()
InventoryButton
!text: tr('Options')
@onClick: modules.client_options.toggle()
InventoryButton
!text: tr('Hotkeys')
@onClick: modules.game_hotkeys.toggle()
InventoryButton
!text: tr('Logout')
@onClick: modules.game_interface.tryLogout()
MarketButton
anchors.left: buttonsPanel.left
anchors.bottom: buttonsPanel.bottom
margin-bottom: 3
margin-left: 3
PurseButton
anchors.right: buttonsPanel.right
anchors.bottom: buttonsPanel.bottom
margin-bottom: 3
margin-right: 2

View File

@@ -832,18 +832,9 @@ local function initInterface()
slotFilterList:addOption(MarketSlotFilters[255])
slotFilterList:setEnabled(false)
for i = MarketCategory.First, MarketCategory.Last do
if i >= MarketCategory.Ammunition and i <= MarketCategory.WandsRods then
subCategoryList:addOption(getMarketCategoryName(i))
else
categoryList:addOption(getMarketCategoryName(i))
end
end
categoryList:addOption(getMarketCategoryName(255)) -- meta weapons
categoryList:setCurrentOption(getMarketCategoryName(MarketCategory.First))
subCategoryList:setEnabled(false)
Market.updateCategories()
-- hook item filters
categoryList.onOptionChange = onChangeCategory
subCategoryList.onOptionChange = onChangeSubCategory
@@ -897,6 +888,7 @@ function init()
protocol.initProtocol()
connect(g_game, { onGameEnd = Market.reset })
connect(g_game, { onGameEnd = Market.close })
connect(g_game, { onGameStart = Market.updateCategories })
marketWindow = g_ui.createWidget('MarketWindow', rootWidget)
marketWindow:hide()
@@ -911,6 +903,7 @@ function terminate()
protocol.terminateProtocol()
disconnect(g_game, { onGameEnd = Market.reset })
disconnect(g_game, { onGameEnd = Market.close })
disconnect(g_game, { onGameStart = Market.updateCategories })
destroyAmountWindow()
marketWindow:destroy()
@@ -929,6 +922,28 @@ function Market.reset()
end
end
function Market.updateCategories()
categoryList:clearOptions()
subCategoryList:clearOptions()
local categories = {}
for _, c in ipairs(g_things.getMarketCategories()) do
table.insert(categories, getMarketCategoryName(c) or "Unknown")
end
table.sort(categories)
for _, c in ipairs(categories) do
categoryList:addOption(c)
end
for i = MarketCategory.Ammunition, MarketCategory.WandsRods do
subCategoryList:addOption(getMarketCategoryName(i))
end
categoryList:addOption(getMarketCategoryName(255)) -- meta weapons
categoryList:setCurrentOption(getMarketCategoryName(MarketCategory.First))
subCategoryList:setEnabled(false)
end
function Market.displayMessage(message)
if marketWindow:isHidden() then return end
@@ -1100,6 +1115,10 @@ function Market.loadMarketItems(category)
category = MarketCategory.All
end
end
if not marketItems[category] then
return
end
if category == MarketCategory.All then
-- loop all categories
@@ -1107,7 +1126,6 @@ function Market.loadMarketItems(category)
for i = 1, #marketItems[category] do
local item = marketItems[category][i]
if isItemValid(item, category, searchFilter) then
table.insert(currentItems, item)
end
end

View File

@@ -1,4 +1,4 @@
MarketComboBoxPopupMenuButton < ComboBoxRoundedPopupMenuButton
MarketComboBoxPopupMenuButton < ComboBoxPopupMenuButton
height: 18
font: verdana-11px-rounded
text-offset: 2 2
@@ -10,9 +10,9 @@ MarketComboBoxPopupMenuSeparator < UIWidget
height: 1
phantom: true
MarketComboBoxPopupMenu < ComboBoxRoundedPopupMenu
MarketComboBoxPopupMenu < ComboBoxPopupMenu
MarketComboBox < ComboBoxRounded
MarketComboBox < ComboBox
font: verdana-11px-rounded
size: 86 20
text-offset: 3 2

View File

@@ -8,13 +8,15 @@ oldZoom = nil
oldPos = nil
function init()
minimapButton = modules.client_topmenu.addRightGameToggleButton('minimapButton',
tr('Minimap') .. ' (Ctrl+M)', '/images/topbuttons/minimap', toggle)
minimapButton:setOn(true)
minimapWindow = g_ui.loadUI('minimap', modules.game_interface.getRightPanel())
minimapWindow:setContentMinimumHeight(64)
if not minimapWindow.forceOpen then
minimapButton = modules.client_topmenu.addRightGameToggleButton('minimapButton',
tr('Minimap') .. ' (Ctrl+M)', '/images/topbuttons/minimap', toggle)
minimapButton:setOn(true)
end
minimapWidget = minimapWindow:recursiveGetChildById('minimap')
local gameRootPanel = modules.game_interface.getRootPanel()
@@ -64,10 +66,13 @@ function terminate()
g_keyboard.unbindKeyDown('Ctrl+Shift+M')
minimapWindow:destroy()
minimapButton:destroy()
if minimapButton then
minimapButton:destroy()
end
end
function toggle()
if not minimapButton then return end
if minimapButton:isOn() then
minimapWindow:close()
minimapButton:setOn(false)
@@ -78,7 +83,9 @@ function toggle()
end
function onMiniWindowClose()
minimapButton:setOn(false)
if minimapButton then
minimapButton:setOn(false)
end
end
function preload()
@@ -104,12 +111,16 @@ function loadMap(clean)
if otmm then
local minimapFile = '/minimap.otmm'
if g_resources.fileExists(minimapFile) then
if g_resources.fileExists('/data' .. minimapFile) then
g_minimap.loadOtmm('/data' .. minimapFile)
elseif g_resources.fileExists(minimapFile) then
g_minimap.loadOtmm(minimapFile)
end
else
local minimapFile = '/minimap_' .. clientVersion .. '.otcm'
if g_resources.fileExists(minimapFile) then
if g_resources.fileExists('/data' .. minimapFile) then
g_map.loadOtcm('/data' .. minimapFile)
elseif g_resources.fileExists(minimapFile) then
g_map.loadOtcm(minimapFile)
end
end

View File

@@ -1,30 +1,7 @@
MiniWindow
MinimapWindow
id: minimapWindow
!text: tr('Minimap')
height: 150
icon: /images/topbuttons/minimap
@onClose: modules.game_minimap.onMiniWindowClose()
&save: true
&autoOpen: 1
--&forceOpen: true
Label
text: ?
text-align: center
phantom: false
!tooltip: tr('Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks\nPress Ctrl+Shift+M to view the entire game map')
anchors.top: lockButton.top
anchors.right: lockButton.left
margin-right: 3
size: 14 14
MiniWindowContents
Minimap
id: minimap
anchors.fill: parent
ResizeBorder
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
enabled: true

View File

@@ -32,7 +32,7 @@ ignoreCapacity = nil
ignoreEquipped = nil
showAllItems = nil
sellAllButton = nil
sellAllWithDelayButton = nil
playerFreeCapacity = 0
playerMoney = 0
tradeItems = {}
@@ -41,6 +41,8 @@ selectedItem = nil
cancelNextRelease = nil
sellAllWithDelayEvent = nil
function init()
npcWindow = g_ui.displayUI('npctrade')
npcWindow:setVisible(false)
@@ -65,7 +67,7 @@ function init()
ignoreEquipped = npcWindow:recursiveGetChildById('ignoreEquipped')
showAllItems = npcWindow:recursiveGetChildById('showAllItems')
sellAllButton = npcWindow:recursiveGetChildById('sellAllButton')
sellAllWithDelayButton = npcWindow:recursiveGetChildById('sellAllWithDelayButton')
buyTab = npcWindow:getChildById('buyTab')
sellTab = npcWindow:getChildById('sellTab')
@@ -95,7 +97,8 @@ end
function terminate()
initialized = false
npcWindow:destroy()
removeEvent(sellAllWithDelayEvent)
disconnect(g_game, { onGameEnd = hide,
onOpenNpcTrade = onOpenNpcTrade,
onCloseNpcTrade = onCloseNpcTrade,
@@ -120,6 +123,8 @@ function show()
end
function hide()
removeEvent(sellAllWithDelayEvent)
npcWindow:hide()
local layout = itemsPanel:getLayout()
@@ -171,12 +176,14 @@ function onTradeTypeChange(radioTabs, selected, deselected)
ignoreEquipped:setVisible(currentTradeType == SELL)
showAllItems:setVisible(currentTradeType == SELL)
sellAllButton:setVisible(currentTradeType == SELL)
sellAllWithDelayButton:setVisible(currentTradeType == SELL)
refreshTradeItems()
refreshPlayerGoods()
end
function onTradeClick()
removeEvent(sellAllWithDelayEvent)
if getCurrentTradeType() == BUY then
g_game.buyItem(selectedItem.ptr, quantityScroll:getValue(), ignoreCapacity:isChecked(), buyWithBackpack:isChecked())
else
@@ -414,7 +421,6 @@ end
function onOpenNpcTrade(items)
tradeItems[BUY] = {}
tradeItems[SELL] = {}
for key,item in pairs(items) do
if item[4] > 0 then
local newItem = {}
@@ -502,6 +508,8 @@ end
function checkSellAllTooltip()
sellAllButton:setEnabled(true)
sellAllButton:removeTooltip()
sellAllWithDelayButton:setEnabled(true)
sellAllWithDelayButton:removeTooltip()
local total = 0
local info = ''
@@ -527,8 +535,10 @@ function checkSellAllTooltip()
if info ~= '' then
info = info.."\nTotal: "..total.." gold"
sellAllButton:setTooltip(info)
sellAllWithDelayButton:setTooltip(info)
else
sellAllButton:setEnabled(false)
sellAllWithDelayButton:setEnabled(false)
end
end
@@ -547,14 +557,23 @@ function getMaxAmount()
return 100
end
function sellAll()
for itemid,item in pairs(playerItems) do
local item = Item.create(itemid)
local amount = getSellQuantity(item)
while amount > 0 do
local maxAmount = math.min(amount, getMaxAmount())
g_game.sellItem(item, maxAmount, ignoreEquipped:isChecked())
amount = amount - maxAmount
function sellAll(delayed)
removeEvent(sellAllWithDelayEvent)
local queue = {}
for _,entry in ipairs(tradeItems[SELL]) do
local sellQuantity = getSellQuantity(entry.ptr)
while sellQuantity > 0 do
local maxAmount = math.min(sellQuantity, getMaxAmount())
if delayed then
g_game.sellItem(entry.ptr, maxAmount, ignoreEquipped:isChecked())
sellAllWithDelayEvent = scheduleEvent(function() sellAll(true) end, 1100)
return
end
table.insert(queue, {entry.ptr, maxAmount, ignoreEquipped:isChecked()})
sellQuantity = sellQuantity - maxAmount
end
end
for _, entry in ipairs(queue) do
g_game.sellItem(entry[1], entry[2], entry[3])
end
end

View File

@@ -254,9 +254,19 @@ MainWindow
checked: true
@onCheckChange: modules.game_npctrade.onShowAllItemsChange()
Button
id: sellAllWithDelayButton
!text: tr('Sell all with delay')
width: 128
anchors.right: next.left
anchors.bottom: parent.bottom
margin-right: 10
visible: false
@onClick: modules.game_npctrade.sellAll(true)
Button
id: sellAllButton
!text: tr('Sell All')
!text: tr('Sell all')
width: 64
anchors.right: next.left
anchors.bottom: parent.bottom

View File

@@ -20,6 +20,7 @@ MainWindow
padding: 4 4 4 4
size: 96 96
fixed-creature-size: true
raw: true
Label
id: outfitName
@@ -54,6 +55,7 @@ MainWindow
padding: 4 4 4 4
size: 96 96
fixed-creature-size: true
raw: true
Label
id: mountName

View File

@@ -39,16 +39,20 @@ function fillTrade(name, items, counter)
local tradeContainer
local label
local countLabel
if counter then
tradeContainer = tradeWindow:recursiveGetChildById('counterTradeContainer')
label = tradeWindow:recursiveGetChildById('counterTradeLabel')
countLabel = tradeWindow:recursiveGetChildById('counterTradeCountLabel')
tradeWindow:recursiveGetChildById('acceptButton'):enable()
else
tradeContainer = tradeWindow:recursiveGetChildById('ownTradeContainer')
label = tradeWindow:recursiveGetChildById('ownTradeLabel')
countLabel = tradeWindow:recursiveGetChildById('ownTradeCountLabel')
end
label:setText(name)
countLabel:setText(tr("Items") .. ": " .. #items)
for index,item in ipairs(items) do
local itemWidget = g_ui.createWidget('Item', tradeContainer)

View File

@@ -12,16 +12,43 @@ TradeWindow < MiniWindow
margin-left: 4
MiniWindowContents
padding: 4
padding: 2
Label
id: ownTradeLabel
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.horizontalCenter
Label
id: counterTradeLabel
anchors.top: parent.top
anchors.left: parent.horizontalCenter
anchors.right: parent.right
Label
id: ownTradeCountLabel
anchors.top: ownTradeLabel.bottom
anchors.left: ownTradeLabel.left
anchors.right: ownTradeLabel.right
font: verdana-9px-bold
text-align: center
Label
id: counterTradeCountLabel
anchors.top: counterTradeLabel.bottom
anchors.left: counterTradeLabel.left
anchors.right: counterTradeLabel.right
font: verdana-9px-bold
text-align: center
ScrollableFlatPanel
id: ownTradeContainer
anchors.top: parent.top
anchors.top: ownTradeCountLabel.bottom
anchors.bottom: acceptButton.top
anchors.left: parent.left
anchors.right: ownTradeScrollBar.left
margin-top: 16
margin-bottom: 4
anchors.left: ownTradeCountLabel.left
anchors.right: ownTradeCountLabel.right
margin-bottom: 3
padding: 2
layout:
type: grid
@@ -32,12 +59,9 @@ TradeWindow < MiniWindow
VerticalScrollBar
id: ownTradeScrollBar
anchors.top: parent.top
anchors.bottom: acceptButton.top
anchors.top: ownTradeContainer.top
anchors.bottom: ownTradeContainer.bottom
anchors.right: parent.horizontalCenter
margin-top: 16
margin-bottom: 4
margin-right: 2
step: 14
pixels-scroll: true
$!on:
@@ -45,13 +69,11 @@ TradeWindow < MiniWindow
ScrollableFlatPanel
id: counterTradeContainer
anchors.top: parent.top
anchors.top: counterTradeCountLabel.bottom
anchors.bottom: acceptButton.top
anchors.left: parent.horizontalCenter
anchors.right: counterTradeScrollBar.left
margin-top: 16
margin-bottom: 4
margin-left: 2
anchors.left: counterTradeCountLabel.left
anchors.right: counterTradeCountLabel.right
margin-bottom: 3
padding: 2
layout:
type: grid
@@ -62,31 +84,14 @@ TradeWindow < MiniWindow
VerticalScrollBar
id: counterTradeScrollBar
anchors.top: parent.top
anchors.bottom: acceptButton.top
anchors.top: counterTradeContainer.top
anchors.bottom: counterTradeContainer.bottom
anchors.right: parent.right
margin-top: 16
margin-bottom: 4
margin-right: 1
step: 14
pixels-scroll: true
$!on:
width: 0
Label
id: ownTradeLabel
anchors.bottom: ownTradeContainer.top
anchors.left: ownTradeContainer.left
anchors.right: parent.horizontalCenter
margin-bottom: 2
Label
id: counterTradeLabel
anchors.bottom: counterTradeContainer.top
anchors.left: parent.horizontalCenter
anchors.right: counterTradeScrollBar.right
margin-bottom: 2
Button
!text: tr('Accept')
id: acceptButton

View File

@@ -129,7 +129,7 @@ function show()
end
preyWindow:show()
preyWindow:raise()
preyWindow:focus()
preyWindow:focus()
--g_game.preyRequest() -- update preys, it's for tibia 12
end
@@ -201,7 +201,18 @@ function onPreyInactive(slot, timeUntilFreeReroll)
prey.description:hide()
prey.bonuses:hide()
prey.button:hide()
prey.bottomLabel:hide()
prey.bottomLabel:hide()
prey.bottomLabel:setText(tr("Free list reroll")..": \n" .. timeleftTranslation(timeUntilFreeReroll * 60))
prey.bottomLabel:show()
if timeUntilFreeReroll > 0 then
prey.bottomButton:setText(tr("Buy list reroll"))
else
prey.bottomButton:setText(tr("Free list reroll"))
end
prey.bottomButton:show()
prey.bottomButton.onClick = function()
g_game.preyAction(slot, PREY_ACTION_LISTREROLL, 0)
end
end

View File

@@ -5,7 +5,7 @@ function init()
g_ui.importStyle('questlogwindow')
g_ui.importStyle('questlinewindow')
questLogButton = modules.client_topmenu.addLeftGameButton('questLogButton', tr('Quest Log'), '/images/topbuttons/questlog', function() g_game.requestQuestLog() end)
questLogButton = modules.client_topmenu.addLeftGameButton('questLogButton', tr('Quest Log'), '/images/topbuttons/questlog', function() g_game.requestQuestLog() end, false, 8)
connect(g_game, { onQuestLog = onGameQuestLog,
onQuestLine = onGameQuestLine,

View File

@@ -122,7 +122,7 @@ function createShop()
if shop then return end
shop = g_ui.displayUI('shop')
shop:hide()
shopButton = modules.client_topmenu.addRightGameToggleButton('shopButton', tr('Shop'), '/images/topbuttons/shop', toggle)
shopButton = modules.client_topmenu.addRightGameToggleButton('shopButton', tr('Shop'), '/images/topbuttons/shop', toggle, false, 8)
connect(shop.categories, { onChildFocusChange = changeCategory })
end

View File

@@ -39,6 +39,7 @@ ShopCategoryCreature < ShopCategory
margin-bottom: 2
margin-left: 2
size: 32 32
raw: true
ShopCategoryImage < ShopCategory
Label
@@ -116,7 +117,8 @@ ShopOfferCreature < ShopOffer
margin-top: 4
margin-bottom: 4
margin-left: 2
size: 64 64
size: 48 48
raw: true
ShopOfferImage < ShopOffer
Label

View File

@@ -25,7 +25,7 @@ function init()
onGameEnd = offline
})
skillsButton = modules.client_topmenu.addRightGameToggleButton('skillsButton', tr('Skills'), '/images/topbuttons/skills', toggle)
skillsButton = modules.client_topmenu.addRightGameToggleButton('skillsButton', tr('Skills'), '/images/topbuttons/skills', toggle, false, 1)
skillsButton:setOn(true)
skillsWindow = g_ui.loadUI('skills', modules.game_interface.getRightPanel())

View File

@@ -101,7 +101,7 @@ function init()
spelllistWindow = g_ui.displayUI('spelllist', modules.game_interface.getRightPanel())
spelllistWindow:hide()
spelllistButton = modules.client_topmenu.addRightGameToggleButton('spelllistButton', tr('Spell List'), '/images/topbuttons/spelllist', toggle)
spelllistButton = modules.client_topmenu.addRightGameToggleButton('spelllistButton', tr('Spell List'), '/images/topbuttons/spelllist', toggle, false, 4)
spelllistButton:setOn(false)
nameValueLabel = spelllistWindow:getChildById('labelNameValue')

View File

@@ -0,0 +1,58 @@
ui = nil
updateEvent = nil
function init()
ui = g_ui.loadUI('stats', modules.game_interface.getMapPanel())
if not modules.client_options.getOption("showPing") then
ui.fps:hide()
end
if not modules.client_options.getOption("showFps") then
ui.ping:hide()
end
updateEvent = scheduleEvent(update, 200)
end
function terminate()
removeEvent(updateEvent)
end
function update()
updateEvent = scheduleEvent(update, 500)
if ui:isHidden() then return end
text = 'FPS: ' .. g_app.getFps()
ui.fps:setText(text)
local ping = g_game.getPing()
if g_proxy and g_proxy.getPing() > 0 then
ping = g_proxy.getPing()
end
local text = 'Ping: '
local color
if ping < 0 then
text = text .. "??"
color = 'yellow'
else
text = text .. ping .. ' ms'
if ping >= 500 then
color = 'red'
elseif ping >= 250 then
color = 'yellow'
else
color = 'green'
end
end
ui.ping:setText(text)
ui.ping:setColor(color)
end
function show()
ui:setVisible(true)
end
function hide()
ui:setVisible(false)
end

View File

@@ -0,0 +1,9 @@
Module
name: game_stats
description: Display ping and fps
author: otclient.ovh
website: http://otclient.ovh
sandboxed: true
scripts: [ stats ]
@onLoad: init()
@onUnload: terminate()

View File

@@ -0,0 +1,17 @@
UIWidget
id: game_stats
anchors.top: parent.top
anchors.left: parent.left
margin-left: 3
size: 100 100
visible: false
layout:
type: verticalBox
Label
id: fps
font: verdana-11px-rounded
Label
id: ping
font: verdana-11px-rounded

View File

@@ -1,4 +1,4 @@
local windows = {}
windows = {}
function init()
g_ui.importStyle('textwindow')

View File

@@ -15,11 +15,11 @@ function load()
local datPath, sprPath
if things["data"] ~= nil and things["sprites"] ~= nil then
datPath = '/data/things/' .. things["data"]
datPath = '/things/' .. things["data"]
if G.hdSprites and things["sprites_hd"] then
sprPath = '/data/things/' .. things["sprites_hd"]
sprPath = '/things/' .. things["sprites_hd"]
else
sprPath = '/data/things/' .. things["sprites"]
sprPath = '/things/' .. things["sprites"]
end
else
if filename then

View File

@@ -13,7 +13,7 @@ function init()
g_keyboard.bindKeyDown('Ctrl+P', toggle)
vipButton = modules.client_topmenu.addRightGameToggleButton('vipListButton', tr('VIP List') .. ' (Ctrl+P)', '/images/topbuttons/viplist', toggle)
vipButton = modules.client_topmenu.addRightGameToggleButton('vipListButton', tr('VIP List') .. ' (Ctrl+P)', '/images/topbuttons/viplist', toggle, false, 3)
vipButton:setOn(true)
vipWindow = g_ui.loadUI('viplist', modules.game_interface.getRightPanel())

View File

@@ -158,6 +158,7 @@ GameIngameStoreServiceType = 75
GameAdditionalSkills = 76
GameDistanceEffectU16 = 77
GamePrey = 78
GameDoubleMagicLevel = 79
GameExtendedOpcode = 80
GameMinimapLimitedToSingleFloor = 81

View File

@@ -46,11 +46,19 @@ MarketCategory = {
WandsRods = 21,
PremiumScrolls = 22,
TibiaCoins = 23,
CreatureProducs = 24,
Unknown1 = 25,
Unknown2 = 26,
StashRetrieve = 27,
Unknown3 = 28,
Unknown4 = 29,
Gold = 30,
Unassigned = 31,
MetaWeapons = 255
}
MarketCategory.First = MarketCategory.Armors
MarketCategory.Last = MarketCategory.TibiaCoins
MarketCategory.Last = MarketCategory.Unassigned
MarketCategoryWeapons = {
[MarketCategory.Ammunition] = { slots = {255} },
@@ -86,6 +94,14 @@ MarketCategoryStrings = {
[21] = 'Wands and Rods',
[22] = 'Premium Scrolls',
[23] = 'Tibia Coins',
[24] = 'Creature Products',
[25] = 'Unknown 1',
[26] = 'Unknown 2',
[27] = 'Stash Retrieve',
[28] = 'Unknown 3',
[29] = 'Unknown 4',
[30] = 'Gold',
[31] = 'Unassigned',
[255] = 'Weapons'
}