Browse Source

Use client version instead of entergame

Eduardo Bart 7 years ago
parent
commit
b5911cf1de

+ 1
- 1
CMakeLists.txt View File

@@ -1,7 +1,7 @@
1 1
 cmake_minimum_required(VERSION 2.6)
2 2
 project(otclient)
3 3
 
4
-set(VERSION "0.6.2")
4
+set(VERSION "0.6.3")
5 5
 
6 6
 option(FRAMEWORK_SOUND "Use SOUND " ON)
7 7
 option(FRAMEWORK_GRAPHICS "Use GRAPHICS " ON)

+ 0
- 5
modules/client/client.lua View File

@@ -104,11 +104,6 @@ function terminate()
104 104
   g_settings.set('window-size', g_window.getUnmaximizedSize())
105 105
   g_settings.set('window-pos', g_window.getUnmaximizedPos())
106 106
   g_settings.set('window-maximized', g_window.isMaximized())
107
-
108
-  local protocolVersion = g_game.getProtocolVersion()
109
-  if protocolVersion ~= 0 then
110
-    g_settings.set('protocol-version', protocolVersion)
111
-  end
112 107
 end
113 108
 
114 109
 function exit()

+ 1
- 1
modules/client/client.otmod View File

@@ -19,4 +19,4 @@ Module
19 19
     - client_terminal
20 20
     - client_modulemanager
21 21
     - client_serverlist
22
-    //- client_stats
22
+    - client_stats

+ 20
- 26
modules/client_entergame/entergame.lua View File

@@ -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)

+ 6
- 10
modules/client_entergame/entergame.otui View File

@@ -68,7 +68,7 @@ EnterGameWindow
68 68
 
69 69
   TextEdit
70 70
     id: serverHostTextEdit
71
-    !tooltip: tr('Make sure that your client uses\nthe correct game protocol version')
71
+    !tooltip: tr('Make sure that your client uses\nthe correct game client version')
72 72
     anchors.left: parent.left
73 73
     anchors.right: serverListButton.left
74 74
     anchors.top: serverLabel.bottom
@@ -76,8 +76,8 @@ EnterGameWindow
76 76
     margin-right: 4
77 77
 
78 78
   MenuLabel
79
-    id: protocolLabel
80
-    !text: tr('Protocol')
79
+    id: clientLabel
80
+    !text: tr('Client Version')
81 81
     anchors.left: parent.left
82 82
     anchors.top: serverHostTextEdit.bottom
83 83
     text-auto-resize: true
@@ -85,17 +85,13 @@ EnterGameWindow
85 85
     margin-top: 8
86 86
 
87 87
   ComboBox
88
-    id: protocolComboBox
88
+    id: clientComboBox
89 89
     anchors.left: parent.left
90 90
     anchors.right: parent.horizontalCenter
91
-    anchors.top: protocolLabel.bottom
91
+    anchors.top: clientLabel.bottom
92 92
     margin-top: 2
93 93
     margin-right: 3
94 94
     width: 90
95
-    @onSetup: |
96
-      for _, proto in pairs(g_game.getSupportedProtocols()) do
97
-        self:addOption(proto)
98
-      end
99 95
 
100 96
   MenuLabel
101 97
     id: portLabel
@@ -110,7 +106,7 @@ EnterGameWindow
110 106
     text: 7171
111 107
     anchors.right: parent.right
112 108
     anchors.left: parent.horizontalCenter
113
-    anchors.top: protocolComboBox.top
109
+    anchors.top: clientComboBox.top
114 110
     margin-left: 3
115 111
 
116 112
   CheckBox

+ 1
- 1
modules/client_serverlist/addserver.otui View File

@@ -49,7 +49,7 @@ MainWindow
49 49
     anchors.left: protocolLabel.left
50 50
     anchors.right: port.right
51 51
     @onSetup: |
52
-      for _, proto in pairs(g_game.getSupportedProtocols()) do
52
+      for _, proto in pairs(g_game.getSupportedClients()) do
53 53
         self:addOption(proto)
54 54
       end
55 55
 

+ 1
- 1
modules/game_console/console.lua View File

@@ -170,7 +170,7 @@ function enableChat()
170 170
   gameInterface.unbindWalkKey("S")
171 171
   gameInterface.unbindWalkKey("A")
172 172
 
173
-  consoleToggleChat:setTooltip(tr("Disable chat mode"))
173
+  consoleToggleChat:setTooltip(tr("Disable chat mode, allow to walk using ASDW"))
174 174
 end
175 175
 
176 176
 function disableChat()

+ 1
- 1
modules/game_console/console.otui View File

@@ -58,7 +58,7 @@ Panel
58 58
 
59 59
   CheckBox
60 60
     id: toggleChat
61
-    !tooltip: tr('Disable chat mode')
61
+    !tooltip: tr('Disable chat mode, allow to walk using ASDW')
62 62
     anchors.left: parent.left
63 63
     anchors.top: parent.top
64 64
     margin-left: 13

+ 1
- 1
modules/game_things/things.lua View File

@@ -18,7 +18,7 @@ function isLoaded()
18 18
 end
19 19
 
20 20
 function load()
21
-  local version = g_game.getProtocolVersion()
21
+  local version = g_game.getClientVersion()
22 22
 
23 23
   local datPath, sprPath
24 24
   if filename then

+ 15
- 15
modules/gamelib/game.lua View File

@@ -32,29 +32,29 @@ function g_game.isOfficialTibia()
32 32
   return currentRsa == CIPSOFT_RSA
33 33
 end
34 34
 
35
-function g_game.getSupportedProtocols()
35
+function g_game.getSupportedClients()
36 36
   return {
37 37
     810, 811, 840, 842, 850, 853, 854,
38 38
     860, 861, 862, 870, 910, 940, 944,
39
-    953, 954, 960, 961, 963, 970, 971,
40
-    973, 974, 975, 976, 977, 978, 979,
41
-	980, 1010
39
+    953, 954, 960, 961, 963, 970, 980,
40
+    981, 982, 983, 984, 985, 986, 1001,
41
+    1002, 1010
42 42
   }
43 43
 end
44 44
 
45
-function g_game.getSupportedClients(protocol)
45
+function g_game.getProtocolVersionForClient(client)
46 46
   clients = {
47
-    [971] = {980},
48
-    [973] = {981},
49
-    [974] = {982},
50
-	[975] = {983},
51
-	[976] = {984},
52
-	[977] = {985},
53
-	[978] = {986},
54
-	[979] = {1001},
55
-	[980] = {1002}
47
+    [980] = 971,
48
+    [981] = 973,
49
+    [982] = 974,
50
+	  [983] = 975,
51
+	  [984] = 976,
52
+	  [985] = 977,
53
+	  [986] = 978,
54
+	  [1001] = 979,
55
+	  [1002] = 980,
56 56
   }
57
-  return clients[protocol] or {protocol}
57
+  return clients[client] or client
58 58
 end
59 59
 
60 60
 g_game.setRsa(OTSERV_RSA)

Loading…
Cancel
Save