Version 0.98 BETA

This commit is contained in:
OTCv8
2019-10-04 11:08:01 +02:00
parent 2b925dc52d
commit bb3782fb03
17 changed files with 271 additions and 43 deletions

View File

@@ -214,7 +214,6 @@ function EnterGame.init()
local server = g_settings.get('server')
local host = g_settings.get('host')
local clientVersion = g_settings.get('client-version')
local hdSprites = g_settings.getBoolean('hdSprites', false)
if serverSelector:isOption(server) then
serverSelector:setCurrentOption(server, false)
@@ -230,11 +229,7 @@ function EnterGame.init()
enterGame:getChildById('accountPasswordTextEdit'):setText(password)
enterGame:getChildById('accountNameTextEdit'):setText(account)
rememberPasswordBox:setChecked(#account > 0)
if enterGame.hdSprites then
enterGame.hdSprites:setChecked(hdSprites)
end
g_keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow)
if g_game.isOnline() then
@@ -361,7 +356,6 @@ function EnterGame.doLogin()
G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
--G.authenticatorToken = enterGame:getChildById('authenticatorTokenTextEdit'):getText()
G.authenticatorToken = ""
G.hdSprites = enterGame.hdSprites and enterGame.hdSprites:isChecked()
G.stayLogged = true
G.server = serverSelector:getText():trim()
G.host = serverHostTextEdit:getText()
@@ -374,7 +368,6 @@ function EnterGame.doLogin()
g_settings.set('host', G.host)
g_settings.set('server', G.server)
g_settings.set('client-version', G.clientVersion)
g_settings.set('hdSprites', G.hdSprites)
g_settings.save()
if G.host:find("http") ~= nil then
@@ -399,10 +392,6 @@ function EnterGame.doLogin()
sprites = {G.clientVersion .. "/Tibia.spr", ""},
}
if G.hdSprites then
things.sprites_hd = {G.clientVersion .. "/Tibia_hd.spr", ""}
end
local incorrectThings = validateThings(things)
if #incorrectThings > 0 then
g_logger.info(incorrectThings)
@@ -432,10 +421,12 @@ function EnterGame.doLogin()
g_game.setProtocolVersion(g_game.getClientProtocolVersion(G.clientVersion))
g_game.setCustomProtocolVersion(0)
g_game.chooseRsa(G.host)
g_game.setCustomOs(2) -- windows
-- g_game.setCustomOs(2) -- windows, optional
-- you can add custom features here
g_game.enableFeature(GameBot)
-- extra features from init.lua
for i = 4, #server_params do
g_game.enableFeature(tonumber(server_params[i]))
end
-- proxies
if g_proxy then
@@ -443,7 +434,7 @@ function EnterGame.doLogin()
end
if modules.game_things.isLoaded() then
g_logger.info("Connection to: " .. server_ip .. ":" .. server_port)
g_logger.info("Connecting to: " .. server_ip .. ":" .. server_port)
protocolLogin:login(server_ip, server_port, G.account, G.password, G.authenticatorToken, G.stayLogged)
else
loadBox:destroy()
@@ -467,7 +458,6 @@ function EnterGame.doLoginHttp()
account = G.account,
password = G.password,
token = G.authenticatorToken,
hdSprites = G.hdSprites,
version = APP_VERSION,
uid = G.UUID
}

View File

@@ -8,13 +8,13 @@ HTTP = {
function HTTP.get(url, callback)
local operation = g_http.get(url, HTTP.timeout)
HTTP.operations[operation] = {type="get", url=url, callback=callback}
return opreation
return operation
end
function HTTP.getJSON(url, callback)
local operation = g_http.get(url, HTTP.timeout)
HTTP.operations[operation] = {type="get", json=true, url=url, callback=callback}
return opreation
return operation
end
function HTTP.post(url, data, callback)
@@ -23,7 +23,7 @@ function HTTP.post(url, data, callback)
end
local operation = g_http.post(url, data, HTTP.timeout)
HTTP.operations[operation] = {type="post", url=url, callback=callback}
return opreation
return operation
end
function HTTP.postJSON(url, data, callback)
@@ -32,13 +32,13 @@ function HTTP.postJSON(url, data, callback)
end
local operation = g_http.post(url, data, HTTP.timeout)
HTTP.operations[operation] = {type="post", json=true, url=url, callback=callback}
return opreation
return operation
end
function HTTP.download(url, file, callback, progressCallback)
local operation = g_http.download(url, file, HTTP.timeout)
HTTP.operations[operation] = {type="download", url=url, file=file, callback=callback, progressCallback=progressCallback}
return opreation
return operation
end
function HTTP.downloadImage(url, callback)
@@ -52,7 +52,7 @@ function HTTP.downloadImage(url, callback)
HTTP.imageId = HTTP.imageId + 1
local operation = g_http.download(url, file, HTTP.timeout)
HTTP.operations[operation] = {type="image", url=url, file=file, callback=callback}
return opreation
return operation
end
function HTTP.progress(operationId)
@@ -154,4 +154,5 @@ connect(g_http,
onPostProgress = HTTP.onPostProgress,
onDownload = HTTP.onDownload,
onDownloadProgress = HTTP.onDownloadProgress
})
})

View File

@@ -208,6 +208,7 @@ function enableChat(temporarily)
if temporarily then
local quickFunc = function()
if not g_game.isOnline() then return end
g_keyboard.unbindKeyDown("Enter")
g_keyboard.unbindKeyDown("Escape")
disableChat(temporarily)
@@ -233,6 +234,7 @@ function disableChat()
consoleTextEdit:setText("")
local quickFunc = function()
if not g_game.isOnline() then return end
if consoleToggleChat:isChecked() then
consoleToggleChat:setChecked(false)
end

View File

@@ -862,13 +862,13 @@ function refreshViewMode()
modules.client_topmenu.getTopMenu():setImageColor('white')
gameBottomPanel:setImageColor('white')
g_game.changeMapAwareRange(20, 16)
g_game.changeMapAwareRange(19, 15)
if modules.game_console then
modules.game_console.switchMode(false)
end
else
g_game.changeMapAwareRange(30, 20)
g_game.changeMapAwareRange(29, 19)
gameMapPanel:fill('parent')
gameRootPanel:fill('parent')
gameMapPanel:setKeepAspectRatio(false)

View File

@@ -283,7 +283,7 @@ function walk(dir)
dir = nextWalkDir
end
local toPos = player:getNewPreWalkingPosition(true)
local toPos = player:getPrewalkingPosition(true)
if dir == North then
toPos.y = toPos.y - 1
elseif dir == East then
@@ -324,11 +324,7 @@ function walk(dir)
local preWalked = false
if toTile and toTile:isWalkable() then
if g_game.getFeature(GameNewWalking) then
player:newPreWalk(dir)
else
player:preWalk(dir)
end
player:preWalk(dir)
preWalked = true
else
local playerTile = player:getTile()
@@ -339,8 +335,7 @@ function walk(dir)
end
end
g_game.callOnWalk(dir)
g_game.forceWalk(dir, preWalked)
g_game.walk(dir, preWalked)
if not firstStep and lastWalkDir ~= dir then
walkLock = g_clock.millis() + g_settings.getNumber('walkTurnDelay')