Ir para conteúdo
  • 0
Entre para seguir isso  
Ayron5

OTClient Tela de login otc

Pergunta

Ayron5    2
Ayron5

Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:

https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/

https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/

Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).

Ex: The Forgotten Server 1.3, Versão: 10.98.

Base:

OTClient

Qual é a sua pergunta?

Hj me deparei com umas coisas estranhas no OTC que estou editando... vamos lá.

(Imagens em spoiler)

Vou deixar meu entergame.lua (código em spoiler). Valendo Rep! ^^ 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Spoiler

EnterGame = { }

-- private variables
local loadBox
local enterGame
local motdWindow
local protocolLogin
local motdEnabled = true

local host          = '127.0.0.1' 
local port          = 7171
local clientVersion = 854

-- private functions
local function onError(protocol, message, errorCode)
  if loadBox then
    loadBox:destroy()
    loadBox = nil
  end

  if not errorCode then
    EnterGame.clearAccountFields()
  end

  local errorBox = displayErrorBox(tr('Login Error'), message)
  connect(errorBox, { onOk = EnterGame.show })
end

local function onMotd(protocol, motd)
  G.motdNumber = tonumber(motd:sub(0, motd:find("\n")))
  G.motdMessage = motd:sub(motd:find("\n") + 1, #motd)
end

local function onCharacterList(protocol, characters, account, otui)
  -- Try add server to the server list
  ServerList.add(G.host, G.port, g_game.getClientVersion())

  if enterGame:getChildById('rememberPasswordBox'):isChecked() then
    local account = g_crypt.encrypt(G.account)
    local password = g_crypt.encrypt(G.password)

    g_settings.set('account', account)
    g_settings.set('password', password)

    ServerList.setServerAccount(G.host, account)
    ServerList.setServerPassword(G.host, password)

    g_settings.set('autologin', enterGame:getChildById('autoLoginBox'):isChecked())
  else
    -- reset server list account/password
    ServerList.setServerAccount(G.host, '')
    ServerList.setServerPassword(G.host, '')

    EnterGame.clearAccountFields()
  end

  loadBox:destroy()
  loadBox = nil

  for _, characterInfo in pairs(characters) do
    if characterInfo.previewState and characterInfo.previewState ~= PreviewState.Default then
      characterInfo.worldName = characterInfo.worldName .. ', Preview'
    end
  end

  CharacterList.create(characters, account, otui)
  CharacterList.show()

  if motdEnabled then
    local lastMotdNumber = g_settings.getNumber("motd")
    if G.motdNumber and G.motdNumber ~= lastMotdNumber then
      g_settings.set("motd", motdNumber)
      motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage)
      connect(motdWindow, { onOk = function() CharacterList.show() motdWindow = nil end })
      CharacterList.hide()
    end
  end
end

local function onUpdateNeeded(protocol, signature)
  loadBox:destroy()
  loadBox = nil

  if EnterGame.updateFunc then
    local continueFunc = EnterGame.show
    local cancelFunc = EnterGame.show
    EnterGame.updateFunc(signature, continueFunc, cancelFunc)
  else
    local errorBox = displayErrorBox(tr('Update needed'), tr('Your client needs updating, try redownloading it.'))
    connect(errorBox, { onOk = EnterGame.show })
  end
end

-- public functions
function EnterGame.init()
  function returnHost()
    return host
    end
  enterGame = g_ui.displayUI('entergame') 
  enterGame:hide()
  if g_app.isRunning() and not g_game.isOnline() then
    enterGame:show()
  end
  local account   = g_settings.get('account')
  local password  = g_settings.get('password')
  local autologin = g_settings.getBoolean('autologin')

  EnterGame.setAccountName(account)
  EnterGame.setPassword(password)
  --enterGame:getChildById('serverHostTextEdit'):setText(host)
  enterGame:getChildById('autoLoginBox'):setChecked(autologin)
  enterGame:hide()

  if g_app.isRunning() and not g_game.isOnline() then
    enterGame:show()
  end
end

function EnterGame.firstShow()
  EnterGame.show()

  local account   = g_crypt.decrypt(g_settings.get('account'))
  local password  = g_crypt.decrypt(g_settings.get('password'))
  local autologin = g_settings.getBoolean('autologin')
  
  if #host > 0 and #password > 0 and #account > 0 and autologin then
    addEvent(function()
      if not g_settings.getBoolean('autologin') then return end
      EnterGame.doLogin()
    end)
  end
end

function EnterGame.terminate()
  --[[g_keyboard.unbindKeyDown('Ctrl+G')
  enterGame:destroy()
  enterGame = nil
  clientBox = nil
  if motdWindow then
    motdWindow:destroy()
    motdWindow = nil
  end
  if loadBox then
    loadBox:destroy()
    loadBox = nil
  end
  if protocolLogin then
    protocolLogin:cancelLogin()
    protocolLogin = nil
  end
  EnterGame = nil]]
end

function EnterGame.show()
  if loadBox then return end
  enterGame:show()
  enterGame:raise()
  enterGame:focus()
end

function EnterGame.hide()
  enterGame:hide()
end

function EnterGame.openWindow()
  if g_game.isOnline() then
    CharacterList.show()
  elseif not g_game.isLogging() and not CharacterList.isVisible() then
    EnterGame.show()
  end
end

function EnterGame.setAccountName(account)
  local account = g_crypt.decrypt(account)
  enterGame:getChildById('accountNameTextEdit'):setText(account)
  enterGame:getChildById('accountNameTextEdit'):setCursorPos(-1)
  enterGame:getChildById('rememberPasswordBox'):setChecked(#account > 0)
end

function EnterGame.setPassword(password)
  local password = g_crypt.decrypt(password)
  enterGame:getChildById('accountPasswordTextEdit'):setText(password)
end

function EnterGame.clearAccountFields()
  enterGame:getChildById('accountNameTextEdit'):clearText()
  enterGame:getChildById('accountPasswordTextEdit'):clearText()
  enterGame:getChildById('accountNameTextEdit'):focus()
  g_settings.remove('account')
  g_settings.remove('password')
end

function EnterGame.doLogin()
  G.account  = enterGame:getChildById('accountNameTextEdit'):getText()
  G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
  G.host = host
  G.port     = port
  EnterGame.hide()

  if g_game.isOnline() then
    local errorBox = displayErrorBox(tr('Login Error'), tr('Cannot login while already in game.'))
    connect(errorBox, { onOk = EnterGame.show })
    return
  end
  
  g_settings.set('host', G.host)
  g_settings.set('port', G.port)
  g_settings.set('client-version', clientVersion)

  protocolLogin = ProtocolLogin.create()
  protocolLogin.onLoginError = onError
  protocolLogin.onMotd = onMotd
  protocolLogin.onCharacterList = onCharacterList
  protocolLogin.onUpdateNeeded = onUpdateNeeded

  loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to login server...'))
  connect(loadBox, { onCancel = function(msgbox)
                                  loadBox = nil
                                  protocolLogin:cancelLogin()
                                  EnterGame.show()
                                end })
  
  g_game.chooseRsa(G.host)
  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)
  else
    loadBox:destroy()
    loadBox = nil
    EnterGame.show()
  end
end

function EnterGame.displayMotd()
  if not motdWindow then
    motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage)
    motdWindow.onOk = function() motdWindow = nil end
  end
end

function EnterGame.setServerInfo(message)
  local label = enterGame:getChildById('serverInfoLabel')
  label:setText(message)
end

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

Ao abrir para entrar nas contas me veio isso, mesmo com as informações de login corretas...

1028304063_seila2.png.ecb897fbca42b3037176b074892b9f16.png

Dou ok e tento novamente... agora vai, mas notei que a window de traz permanece.   .-. 

803503143_seila3.png.2f5efd4680cee0be9f33a62f1235975a.png

Aqui tbm...

1336611584_seila.png.de63459152d0c004f603793b0fceaa1e.png

 

Quando entro no jogo, ela ainda permanece.     .-. 

ultima.png.10dea7cf5d873fcfe34822d7665a3599.png

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

4 respostass a esta questão

Recommended Posts

  • 0
Gengo    19
Gengo

Troque seu entergame por um outro ja que outros otclient é praticamente a mesma coisa e veja se resolve seu problema

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Ayron5    2
Ayron5
1 hora atrás, Gengo disse:

Troque seu entergame por um outro ja que outros otclient é praticamente a mesma coisa e veja se resolve seu problema

Eu testei o do pokemon Mythology mas aconteceu a mesma coisa .-. 

Tentei outro mas não consegui logar, Vou analisar melhor amanhã, qualquer coisa eu volto a comentar. vlw 

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Gengo    19
Gengo

Blz, mas é estranho você pegar outro e não funcionar, ha nao ser que você esqueceu de alterar alguma coisa, pq praticamente ninguem sai mudando a estrutura desse entergame, logo deveria funcionar numa boa pegando outro modulo.

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Ayron5    2
Ayron5
Em 18/09/2019 em 21:38, Gengo disse:

Troque seu entergame por um outro ja que outros otclient é praticamente a mesma coisa e veja se resolve seu problema

Resolvi, troquei o entergame e fiz uma alteração, obg ^^ 

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×