mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 22:43:27 +02:00
Implemented client_serverlist module! Close #200
* Will store servers that are not already in the list when logging in * Can add servers manually if required too * Fixed a bug in table.size
This commit is contained in:
38
modules/client_serverlist/addserver.lua
Normal file
38
modules/client_serverlist/addserver.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
AddServer = {}
|
||||
|
||||
-- private variables
|
||||
local addServerWindow = nil
|
||||
|
||||
-- public functions
|
||||
function AddServer.init()
|
||||
addServerWindow = g_ui.displayUI('addserver')
|
||||
end
|
||||
|
||||
function AddServer.terminate()
|
||||
addServerWindow:destroy()
|
||||
end
|
||||
|
||||
function AddServer.add()
|
||||
local host = addServerWindow:getChildById('host'):getText()
|
||||
local port = addServerWindow:getChildById('port'):getText()
|
||||
local protocol = addServerWindow:getChildById('protocol'):getCurrentOption().text
|
||||
|
||||
local added, error = ServerList.add(host, port, protocol)
|
||||
if not added then
|
||||
displayErrorBox(tr('Add Error'), tr(error))
|
||||
else
|
||||
AddServer.hide()
|
||||
end
|
||||
end
|
||||
|
||||
function AddServer.show()
|
||||
addServerWindow:show()
|
||||
addServerWindow:raise()
|
||||
addServerWindow:focus()
|
||||
addServerWindow:lock()
|
||||
end
|
||||
|
||||
function AddServer.hide()
|
||||
addServerWindow:hide()
|
||||
addServerWindow:unlock()
|
||||
end
|
Reference in New Issue
Block a user