mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-19 14:13:27 +02:00
Version 1.6 - important fix for high memory usage
This commit is contained in:
@@ -31,14 +31,6 @@ local function tryLogin(charInfo, tries)
|
||||
|
||||
CharacterList.hide()
|
||||
|
||||
-- proxies for not http login users
|
||||
if charInfo.worldHost == "0.0.0.0" and g_proxy then
|
||||
g_proxy.clear()
|
||||
-- g_proxy.addProxy(proxyHost, proxyPort, proxyPriority)
|
||||
g_proxy.addProxy("163.172.147.135", 7162, 0)
|
||||
g_proxy.addProxy("158.69.68.42", 7162, 0)
|
||||
end
|
||||
|
||||
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...'))
|
||||
@@ -243,9 +235,11 @@ function CharacterList.terminate()
|
||||
CharacterList = nil
|
||||
end
|
||||
|
||||
function CharacterList.create(characters, account, otui)
|
||||
function CharacterList.create(characters, account, otui, websocket)
|
||||
if not otui then otui = 'characterlist' end
|
||||
|
||||
if websocket then
|
||||
websocket:close()
|
||||
end
|
||||
if charactersWindow then
|
||||
charactersWindow:destroy()
|
||||
end
|
||||
|
@@ -15,7 +15,7 @@ local serverSelector
|
||||
local clientVersionSelector
|
||||
local serverHostTextEdit
|
||||
local rememberPasswordBox
|
||||
local protos = {"740", "760", "772", "800", "810", "854", "860", "1077", "1090", "1096", "1098", "1099", "1100"}
|
||||
local protos = {"740", "760", "772", "792", "800", "810", "854", "860", "1077", "1090", "1096", "1098", "1099", "1100"}
|
||||
|
||||
local webSocket
|
||||
local webSocketLoginPacket
|
||||
@@ -53,10 +53,14 @@ local function onCharacterList(protocol, characters, account, otui)
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
end
|
||||
|
||||
CharacterList.create(characters, account, otui)
|
||||
|
||||
CharacterList.create(characters, account, otui, webSocket)
|
||||
CharacterList.show()
|
||||
|
||||
if webSocket then
|
||||
webSocket = nil
|
||||
end
|
||||
|
||||
g_settings.save()
|
||||
end
|
||||
|
||||
@@ -76,18 +80,22 @@ end
|
||||
|
||||
local function validateThings(things)
|
||||
local incorrectThings = ""
|
||||
local missingFiles = false
|
||||
local versionForMissingFiles = 0
|
||||
if things ~= nil then
|
||||
local thingsNode = {}
|
||||
for thingtype, thingdata in pairs(things) do
|
||||
thingsNode[thingtype] = thingdata[1]
|
||||
if not g_resources.fileExists("/data/things/" .. thingdata[1]) then
|
||||
correctThings = false
|
||||
incorrectThings = incorrectThings .. "Missing file: " .. thingdata[1] .. "\n"
|
||||
end
|
||||
local localChecksum = g_resources.fileChecksum("/data/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"
|
||||
missingFiles = true
|
||||
versionForMissingFiles = thingdata[1]:split("/")[1]
|
||||
else
|
||||
local localChecksum = g_resources.fileChecksum("/data/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"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -95,6 +103,12 @@ local function validateThings(things)
|
||||
else
|
||||
g_settings.setNode("things", {})
|
||||
end
|
||||
if missingFiles then
|
||||
|
||||
incorrectThings = incorrectThings .. "\nYou should open data/things and create directory " .. versionForMissingFiles ..
|
||||
".\nIn this directory (data/things/" .. versionForMissingFiles .. ") you should put missing\nfiles (Tibia.dat and Tibia.spr) " ..
|
||||
"from correct Tibia version."
|
||||
end
|
||||
return incorrectThings
|
||||
end
|
||||
|
||||
@@ -177,10 +191,6 @@ local function onHTTPResult(data, err)
|
||||
end
|
||||
end
|
||||
|
||||
if webSocket then
|
||||
webSocket:close()
|
||||
webSocket = nil
|
||||
end
|
||||
onCharacterList(nil, characters, account, nil)
|
||||
end
|
||||
|
||||
@@ -310,22 +320,16 @@ function EnterGame.checkWebsocket()
|
||||
if webSocket then
|
||||
webSocket:close()
|
||||
webSocket = nil
|
||||
newLogin.code:setText("")
|
||||
end
|
||||
return
|
||||
end
|
||||
if webSocket then
|
||||
if webSocket.url == url then
|
||||
if newLogin:isHidden() and newLogin.code:getText():len() > 1 then
|
||||
newLogin:show()
|
||||
newLogin:raise()
|
||||
end
|
||||
return
|
||||
end
|
||||
webSocket:close()
|
||||
webSocket = nil
|
||||
end
|
||||
newLogin.code:setText("")
|
||||
webSocket = HTTP.WebSocketJSON(url, {
|
||||
onOpen = function(message, webSocketId)
|
||||
if webSocket and webSocket.id == webSocketId then
|
||||
@@ -338,8 +342,8 @@ function EnterGame.checkWebsocket()
|
||||
webSocketLoginPacket = nil
|
||||
EnterGame.hide()
|
||||
onHTTPResult(message, nil)
|
||||
elseif message.type == "quick_login" and message.code and message.qrcode then
|
||||
EnterGame.showNewLogin(message.code, message.qrcode)
|
||||
elseif message.type == "quick_login" and message.qrcode then
|
||||
EnterGame.showNewLogin(message.qrcode)
|
||||
end
|
||||
end
|
||||
end,
|
||||
@@ -365,10 +369,15 @@ function EnterGame.hideNewLogin()
|
||||
newLogin:hide()
|
||||
end
|
||||
|
||||
function EnterGame.showNewLogin(code, qrcode)
|
||||
function EnterGame.showNewLogin(qrcode)
|
||||
if enterGame:isHidden() then return end
|
||||
newLogin.code:setText(code)
|
||||
newLogin.qrcode:setQRCode(qrcode, 1)
|
||||
newLogin.qrcode:setQRCode("https://quath.co/0/" .. qrcode, 1)
|
||||
newLogin.qrcode:setEnabled(true)
|
||||
local clickFunction = function()
|
||||
g_platform.openUrl("qauth://" .. qrcode)
|
||||
end
|
||||
newLogin.qrcode.onClick = clickFunction
|
||||
newLogin.quathlogo.onClick = clickFunction
|
||||
if newLogin:isHidden() then
|
||||
newLogin:show()
|
||||
newLogin:raise()
|
||||
@@ -449,7 +458,7 @@ function EnterGame.doLogin()
|
||||
|
||||
local incorrectThings = validateThings(things)
|
||||
if #incorrectThings > 0 then
|
||||
g_logger.info(incorrectThings)
|
||||
g_logger.error(incorrectThings)
|
||||
if Updater then
|
||||
return Updater.updateThings(things, incorrectThings)
|
||||
else
|
||||
|
@@ -3,11 +3,11 @@ StaticWindow
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
margin-right: 20
|
||||
id: newLoginPanel
|
||||
width: 230
|
||||
height: 350
|
||||
width: 240
|
||||
height: 320
|
||||
!text: tr('Quick Login & Registration')
|
||||
|
||||
Label
|
||||
UIButton
|
||||
id: qrcode
|
||||
width: 200
|
||||
height: 200
|
||||
@@ -17,7 +17,7 @@ StaticWindow
|
||||
image-smooth: false
|
||||
margin-top: 5
|
||||
|
||||
Label
|
||||
UIButton
|
||||
id: quathlogo
|
||||
width: 66
|
||||
height: 40
|
||||
@@ -33,28 +33,18 @@ StaticWindow
|
||||
anchors.right: qrcode.right
|
||||
text-align: center
|
||||
text-auto-resize: true
|
||||
!text: tr("Scan QR code or process\nbellow code to register or login")
|
||||
!text: tr("Scan or click QR code\nto register or login")
|
||||
height: 40
|
||||
margin-top: 10
|
||||
margin-bottom: 5
|
||||
|
||||
Label
|
||||
id: code
|
||||
height: 20
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: prev.left
|
||||
anchors.right: prev.right
|
||||
text-align: center
|
||||
font: sans-bold-16px
|
||||
margin-top: 10
|
||||
text: XXXXXX
|
||||
|
||||
Label
|
||||
Button
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: prev.left
|
||||
anchors.right: prev.right
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text-align: center
|
||||
!text: tr("Click to get Android/iOS app")
|
||||
!text: tr("Click to get PC/Android/iOS app")
|
||||
height: 20
|
||||
margin-top: 10
|
||||
color: #FFFFFF
|
||||
color: #FFFFFF
|
||||
@onClick: g_platform.openUrl("http://qauth.co")
|
Reference in New Issue
Block a user