Use client version instead of entergame
This commit is contained in:
parent
5fbb71157d
commit
b5911cf1de
|
@ -1,7 +1,7 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
project(otclient)
|
||||
|
||||
set(VERSION "0.6.2")
|
||||
set(VERSION "0.6.3")
|
||||
|
||||
option(FRAMEWORK_SOUND "Use SOUND " ON)
|
||||
option(FRAMEWORK_GRAPHICS "Use GRAPHICS " ON)
|
||||
|
|
|
@ -104,11 +104,6 @@ function terminate()
|
|||
g_settings.set('window-size', g_window.getUnmaximizedSize())
|
||||
g_settings.set('window-pos', g_window.getUnmaximizedPos())
|
||||
g_settings.set('window-maximized', g_window.isMaximized())
|
||||
|
||||
local protocolVersion = g_game.getProtocolVersion()
|
||||
if protocolVersion ~= 0 then
|
||||
g_settings.set('protocol-version', protocolVersion)
|
||||
end
|
||||
end
|
||||
|
||||
function exit()
|
||||
|
|
|
@ -19,4 +19,4 @@ Module
|
|||
- client_terminal
|
||||
- client_modulemanager
|
||||
- client_serverlist
|
||||
//- client_stats
|
||||
- client_stats
|
||||
|
|
|
@ -6,7 +6,7 @@ local enterGame
|
|||
local motdWindow
|
||||
local motdButton
|
||||
local enterGameButton
|
||||
local protocolBox
|
||||
local clientBox
|
||||
local protocolLogin
|
||||
local motdEnabled = true
|
||||
|
||||
|
@ -73,11 +73,6 @@ local function onCharacterList(protocol, characters, account, otui)
|
|||
end
|
||||
end
|
||||
|
||||
local function onChangeProtocol(combobox, option)
|
||||
local clients = g_game.getSupportedClients(option)
|
||||
protocolBox:setTooltip("Supports Client" .. (#clients > 1 and "s" or "") .. ": " .. table.tostring(clients))
|
||||
end
|
||||
|
||||
local function onUpdateNeeded(protocol, signature)
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
|
@ -109,7 +104,8 @@ function EnterGame.init()
|
|||
local host = g_settings.get('host')
|
||||
local port = g_settings.get('port')
|
||||
local autologin = g_settings.getBoolean('autologin')
|
||||
local protocolVersion = g_settings.getInteger('protocol-version')
|
||||
local clientVersion = g_settings.getInteger('client-version')
|
||||
if clientVersion == 0 then clientVersion = 860 end
|
||||
|
||||
if port == nil or port == 0 then port = 7171 end
|
||||
|
||||
|
@ -120,11 +116,11 @@ function EnterGame.init()
|
|||
enterGame:getChildById('serverPortTextEdit'):setText(port)
|
||||
enterGame:getChildById('autoLoginBox'):setChecked(autologin)
|
||||
|
||||
protocolBox = enterGame:getChildById('protocolComboBox')
|
||||
protocolBox.onOptionChange = onChangeProtocol
|
||||
if protocolVersion then
|
||||
protocolBox:setCurrentOption(protocolVersion)
|
||||
clientBox = enterGame:getChildById('clientComboBox')
|
||||
for _, proto in pairs(g_game.getSupportedClients()) do
|
||||
clientBox:addOption(proto)
|
||||
end
|
||||
clientBox:setCurrentOption(clientVersion)
|
||||
|
||||
enterGame:hide()
|
||||
|
||||
|
@ -154,7 +150,7 @@ function EnterGame.terminate()
|
|||
enterGame = nil
|
||||
enterGameButton:destroy()
|
||||
enterGameButton = nil
|
||||
protocolBox = nil
|
||||
clientBox = nil
|
||||
if motdWindow then
|
||||
motdWindow:destroy()
|
||||
motdWindow = nil
|
||||
|
@ -218,8 +214,7 @@ function EnterGame.doLogin()
|
|||
G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
|
||||
G.host = enterGame:getChildById('serverHostTextEdit'):getText()
|
||||
G.port = tonumber(enterGame:getChildById('serverPortTextEdit'):getText())
|
||||
local protocolVersion = tonumber(protocolBox:getText())
|
||||
local clientVersions = g_game.getSupportedClients(protocolVersion)
|
||||
local clientVersion = tonumber(clientBox:getText())
|
||||
EnterGame.hide()
|
||||
|
||||
if g_game.isOnline() then
|
||||
|
@ -230,6 +225,7 @@ function EnterGame.doLogin()
|
|||
|
||||
g_settings.set('host', G.host)
|
||||
g_settings.set('port', G.port)
|
||||
g_settings.set('client-version', clientVersion)
|
||||
|
||||
protocolLogin = ProtocolLogin.create()
|
||||
protocolLogin.onLoginError = onError
|
||||
|
@ -245,10 +241,8 @@ function EnterGame.doLogin()
|
|||
end })
|
||||
|
||||
g_game.chooseRsa(G.host)
|
||||
g_game.setProtocolVersion(protocolVersion)
|
||||
if #clientVersions > 0 then
|
||||
g_game.setClientVersion(clientVersions[#clientVersions])
|
||||
end
|
||||
g_game.setClientVersion(clientVersion)
|
||||
g_game.setProtocolVersion(g_game.getProtocolVersionForClient(clientVersion))
|
||||
|
||||
if modules.game_things.isLoaded() then
|
||||
protocolLogin:login(G.host, G.port, G.account, G.password)
|
||||
|
@ -269,14 +263,14 @@ end
|
|||
function EnterGame.setDefaultServer(host, port, protocol)
|
||||
local hostTextEdit = enterGame:getChildById('serverHostTextEdit')
|
||||
local portTextEdit = enterGame:getChildById('serverPortTextEdit')
|
||||
local protocolLabel = enterGame:getChildById('protocolLabel')
|
||||
local clientLabel = enterGame:getChildById('clientLabel')
|
||||
local accountTextEdit = enterGame:getChildById('accountNameTextEdit')
|
||||
local passwordTextEdit = enterGame:getChildById('accountPasswordTextEdit')
|
||||
|
||||
if hostTextEdit:getText() ~= host then
|
||||
hostTextEdit:setText(host)
|
||||
portTextEdit:setText(port)
|
||||
protocolBox:setCurrentOption(protocol)
|
||||
clientBox:setCurrentOption(protocol)
|
||||
accountTextEdit:setText('')
|
||||
passwordTextEdit:setText('')
|
||||
end
|
||||
|
@ -292,9 +286,9 @@ function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeig
|
|||
portTextEdit:setVisible(false)
|
||||
portTextEdit:setHeight(0)
|
||||
|
||||
protocolBox:setCurrentOption(protocol)
|
||||
protocolBox:setVisible(false)
|
||||
protocolBox:setHeight(0)
|
||||
clientBox:setCurrentOption(protocol)
|
||||
clientBox:setVisible(false)
|
||||
clientBox:setHeight(0)
|
||||
|
||||
local serverLabel = enterGame:getChildById('serverLabel')
|
||||
serverLabel:setVisible(false)
|
||||
|
@ -302,9 +296,9 @@ function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeig
|
|||
local portLabel = enterGame:getChildById('portLabel')
|
||||
portLabel:setVisible(false)
|
||||
portLabel:setHeight(0)
|
||||
local protocolLabel = enterGame:getChildById('protocolLabel')
|
||||
protocolLabel:setVisible(false)
|
||||
protocolLabel:setHeight(0)
|
||||
local clientLabel = enterGame:getChildById('clientLabel')
|
||||
clientLabel:setVisible(false)
|
||||
clientLabel:setHeight(0)
|
||||
|
||||
local serverListButton = enterGame:getChildById('serverListButton')
|
||||
serverListButton:setVisible(false)
|
||||
|
|
|
@ -68,7 +68,7 @@ EnterGameWindow
|
|||
|
||||
TextEdit
|
||||
id: serverHostTextEdit
|
||||
!tooltip: tr('Make sure that your client uses\nthe correct game protocol version')
|
||||
!tooltip: tr('Make sure that your client uses\nthe correct game client version')
|
||||
anchors.left: parent.left
|
||||
anchors.right: serverListButton.left
|
||||
anchors.top: serverLabel.bottom
|
||||
|
@ -76,8 +76,8 @@ EnterGameWindow
|
|||
margin-right: 4
|
||||
|
||||
MenuLabel
|
||||
id: protocolLabel
|
||||
!text: tr('Protocol')
|
||||
id: clientLabel
|
||||
!text: tr('Client Version')
|
||||
anchors.left: parent.left
|
||||
anchors.top: serverHostTextEdit.bottom
|
||||
text-auto-resize: true
|
||||
|
@ -85,17 +85,13 @@ EnterGameWindow
|
|||
margin-top: 8
|
||||
|
||||
ComboBox
|
||||
id: protocolComboBox
|
||||
id: clientComboBox
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.horizontalCenter
|
||||
anchors.top: protocolLabel.bottom
|
||||
anchors.top: clientLabel.bottom
|
||||
margin-top: 2
|
||||
margin-right: 3
|
||||
width: 90
|
||||
@onSetup: |
|
||||
for _, proto in pairs(g_game.getSupportedProtocols()) do
|
||||
self:addOption(proto)
|
||||
end
|
||||
|
||||
MenuLabel
|
||||
id: portLabel
|
||||
|
@ -110,7 +106,7 @@ EnterGameWindow
|
|||
text: 7171
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.horizontalCenter
|
||||
anchors.top: protocolComboBox.top
|
||||
anchors.top: clientComboBox.top
|
||||
margin-left: 3
|
||||
|
||||
CheckBox
|
||||
|
|
|
@ -49,7 +49,7 @@ MainWindow
|
|||
anchors.left: protocolLabel.left
|
||||
anchors.right: port.right
|
||||
@onSetup: |
|
||||
for _, proto in pairs(g_game.getSupportedProtocols()) do
|
||||
for _, proto in pairs(g_game.getSupportedClients()) do
|
||||
self:addOption(proto)
|
||||
end
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ function enableChat()
|
|||
gameInterface.unbindWalkKey("S")
|
||||
gameInterface.unbindWalkKey("A")
|
||||
|
||||
consoleToggleChat:setTooltip(tr("Disable chat mode"))
|
||||
consoleToggleChat:setTooltip(tr("Disable chat mode, allow to walk using ASDW"))
|
||||
end
|
||||
|
||||
function disableChat()
|
||||
|
|
|
@ -58,7 +58,7 @@ Panel
|
|||
|
||||
CheckBox
|
||||
id: toggleChat
|
||||
!tooltip: tr('Disable chat mode')
|
||||
!tooltip: tr('Disable chat mode, allow to walk using ASDW')
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
margin-left: 13
|
||||
|
|
|
@ -18,7 +18,7 @@ function isLoaded()
|
|||
end
|
||||
|
||||
function load()
|
||||
local version = g_game.getProtocolVersion()
|
||||
local version = g_game.getClientVersion()
|
||||
|
||||
local datPath, sprPath
|
||||
if filename then
|
||||
|
|
|
@ -32,29 +32,29 @@ function g_game.isOfficialTibia()
|
|||
return currentRsa == CIPSOFT_RSA
|
||||
end
|
||||
|
||||
function g_game.getSupportedProtocols()
|
||||
function g_game.getSupportedClients()
|
||||
return {
|
||||
810, 811, 840, 842, 850, 853, 854,
|
||||
860, 861, 862, 870, 910, 940, 944,
|
||||
953, 954, 960, 961, 963, 970, 971,
|
||||
973, 974, 975, 976, 977, 978, 979,
|
||||
980, 1010
|
||||
953, 954, 960, 961, 963, 970, 980,
|
||||
981, 982, 983, 984, 985, 986, 1001,
|
||||
1002, 1010
|
||||
}
|
||||
end
|
||||
|
||||
function g_game.getSupportedClients(protocol)
|
||||
function g_game.getProtocolVersionForClient(client)
|
||||
clients = {
|
||||
[971] = {980},
|
||||
[973] = {981},
|
||||
[974] = {982},
|
||||
[975] = {983},
|
||||
[976] = {984},
|
||||
[977] = {985},
|
||||
[978] = {986},
|
||||
[979] = {1001},
|
||||
[980] = {1002}
|
||||
[980] = 971,
|
||||
[981] = 973,
|
||||
[982] = 974,
|
||||
[983] = 975,
|
||||
[984] = 976,
|
||||
[985] = 977,
|
||||
[986] = 978,
|
||||
[1001] = 979,
|
||||
[1002] = 980,
|
||||
}
|
||||
return clients[protocol] or {protocol}
|
||||
return clients[client] or client
|
||||
end
|
||||
|
||||
g_game.setRsa(OTSERV_RSA)
|
||||
|
|
Loading…
Reference in New Issue