|
@@ -6,7 +6,7 @@ local enterGame
|
6
|
6
|
local motdWindow
|
7
|
7
|
local motdButton
|
8
|
8
|
local enterGameButton
|
9
|
|
-local protocolBox
|
|
9
|
+local clientBox
|
10
|
10
|
local protocolLogin
|
11
|
11
|
local motdEnabled = true
|
12
|
12
|
|
|
@@ -73,11 +73,6 @@ local function onCharacterList(protocol, characters, account, otui)
|
73
|
73
|
end
|
74
|
74
|
end
|
75
|
75
|
|
76
|
|
-local function onChangeProtocol(combobox, option)
|
77
|
|
- local clients = g_game.getSupportedClients(option)
|
78
|
|
- protocolBox:setTooltip("Supports Client" .. (#clients > 1 and "s" or "") .. ": " .. table.tostring(clients))
|
79
|
|
-end
|
80
|
|
-
|
81
|
76
|
local function onUpdateNeeded(protocol, signature)
|
82
|
77
|
loadBox:destroy()
|
83
|
78
|
loadBox = nil
|
|
@@ -109,7 +104,8 @@ function EnterGame.init()
|
109
|
104
|
local host = g_settings.get('host')
|
110
|
105
|
local port = g_settings.get('port')
|
111
|
106
|
local autologin = g_settings.getBoolean('autologin')
|
112
|
|
- local protocolVersion = g_settings.getInteger('protocol-version')
|
|
107
|
+ local clientVersion = g_settings.getInteger('client-version')
|
|
108
|
+ if clientVersion == 0 then clientVersion = 860 end
|
113
|
109
|
|
114
|
110
|
if port == nil or port == 0 then port = 7171 end
|
115
|
111
|
|
|
@@ -120,11 +116,11 @@ function EnterGame.init()
|
120
|
116
|
enterGame:getChildById('serverPortTextEdit'):setText(port)
|
121
|
117
|
enterGame:getChildById('autoLoginBox'):setChecked(autologin)
|
122
|
118
|
|
123
|
|
- protocolBox = enterGame:getChildById('protocolComboBox')
|
124
|
|
- protocolBox.onOptionChange = onChangeProtocol
|
125
|
|
- if protocolVersion then
|
126
|
|
- protocolBox:setCurrentOption(protocolVersion)
|
|
119
|
+ clientBox = enterGame:getChildById('clientComboBox')
|
|
120
|
+ for _, proto in pairs(g_game.getSupportedClients()) do
|
|
121
|
+ clientBox:addOption(proto)
|
127
|
122
|
end
|
|
123
|
+ clientBox:setCurrentOption(clientVersion)
|
128
|
124
|
|
129
|
125
|
enterGame:hide()
|
130
|
126
|
|
|
@@ -154,7 +150,7 @@ function EnterGame.terminate()
|
154
|
150
|
enterGame = nil
|
155
|
151
|
enterGameButton:destroy()
|
156
|
152
|
enterGameButton = nil
|
157
|
|
- protocolBox = nil
|
|
153
|
+ clientBox = nil
|
158
|
154
|
if motdWindow then
|
159
|
155
|
motdWindow:destroy()
|
160
|
156
|
motdWindow = nil
|
|
@@ -218,8 +214,7 @@ function EnterGame.doLogin()
|
218
|
214
|
G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
|
219
|
215
|
G.host = enterGame:getChildById('serverHostTextEdit'):getText()
|
220
|
216
|
G.port = tonumber(enterGame:getChildById('serverPortTextEdit'):getText())
|
221
|
|
- local protocolVersion = tonumber(protocolBox:getText())
|
222
|
|
- local clientVersions = g_game.getSupportedClients(protocolVersion)
|
|
217
|
+ local clientVersion = tonumber(clientBox:getText())
|
223
|
218
|
EnterGame.hide()
|
224
|
219
|
|
225
|
220
|
if g_game.isOnline() then
|
|
@@ -230,6 +225,7 @@ function EnterGame.doLogin()
|
230
|
225
|
|
231
|
226
|
g_settings.set('host', G.host)
|
232
|
227
|
g_settings.set('port', G.port)
|
|
228
|
+ g_settings.set('client-version', clientVersion)
|
233
|
229
|
|
234
|
230
|
protocolLogin = ProtocolLogin.create()
|
235
|
231
|
protocolLogin.onLoginError = onError
|
|
@@ -245,10 +241,8 @@ function EnterGame.doLogin()
|
245
|
241
|
end })
|
246
|
242
|
|
247
|
243
|
g_game.chooseRsa(G.host)
|
248
|
|
- g_game.setProtocolVersion(protocolVersion)
|
249
|
|
- if #clientVersions > 0 then
|
250
|
|
- g_game.setClientVersion(clientVersions[#clientVersions])
|
251
|
|
- end
|
|
244
|
+ g_game.setClientVersion(clientVersion)
|
|
245
|
+ g_game.setProtocolVersion(g_game.getProtocolVersionForClient(clientVersion))
|
252
|
246
|
|
253
|
247
|
if modules.game_things.isLoaded() then
|
254
|
248
|
protocolLogin:login(G.host, G.port, G.account, G.password)
|
|
@@ -269,14 +263,14 @@ end
|
269
|
263
|
function EnterGame.setDefaultServer(host, port, protocol)
|
270
|
264
|
local hostTextEdit = enterGame:getChildById('serverHostTextEdit')
|
271
|
265
|
local portTextEdit = enterGame:getChildById('serverPortTextEdit')
|
272
|
|
- local protocolLabel = enterGame:getChildById('protocolLabel')
|
|
266
|
+ local clientLabel = enterGame:getChildById('clientLabel')
|
273
|
267
|
local accountTextEdit = enterGame:getChildById('accountNameTextEdit')
|
274
|
268
|
local passwordTextEdit = enterGame:getChildById('accountPasswordTextEdit')
|
275
|
269
|
|
276
|
270
|
if hostTextEdit:getText() ~= host then
|
277
|
271
|
hostTextEdit:setText(host)
|
278
|
272
|
portTextEdit:setText(port)
|
279
|
|
- protocolBox:setCurrentOption(protocol)
|
|
273
|
+ clientBox:setCurrentOption(protocol)
|
280
|
274
|
accountTextEdit:setText('')
|
281
|
275
|
passwordTextEdit:setText('')
|
282
|
276
|
end
|
|
@@ -292,9 +286,9 @@ function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeig
|
292
|
286
|
portTextEdit:setVisible(false)
|
293
|
287
|
portTextEdit:setHeight(0)
|
294
|
288
|
|
295
|
|
- protocolBox:setCurrentOption(protocol)
|
296
|
|
- protocolBox:setVisible(false)
|
297
|
|
- protocolBox:setHeight(0)
|
|
289
|
+ clientBox:setCurrentOption(protocol)
|
|
290
|
+ clientBox:setVisible(false)
|
|
291
|
+ clientBox:setHeight(0)
|
298
|
292
|
|
299
|
293
|
local serverLabel = enterGame:getChildById('serverLabel')
|
300
|
294
|
serverLabel:setVisible(false)
|
|
@@ -302,9 +296,9 @@ function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeig
|
302
|
296
|
local portLabel = enterGame:getChildById('portLabel')
|
303
|
297
|
portLabel:setVisible(false)
|
304
|
298
|
portLabel:setHeight(0)
|
305
|
|
- local protocolLabel = enterGame:getChildById('protocolLabel')
|
306
|
|
- protocolLabel:setVisible(false)
|
307
|
|
- protocolLabel:setHeight(0)
|
|
299
|
+ local clientLabel = enterGame:getChildById('clientLabel')
|
|
300
|
+ clientLabel:setVisible(false)
|
|
301
|
+ clientLabel:setHeight(0)
|
308
|
302
|
|
309
|
303
|
local serverListButton = enterGame:getChildById('serverListButton')
|
310
|
304
|
serverListButton:setVisible(false)
|