Ir para conteúdo

Featured Replies

Postado

de                                                  Para

       spacer.png       spacer.png

 

 

TUTORIAL otclient Mehah 3.1

 

Bem-vindo ao tutorial sobre como personalizar a tela de login do OTclient Mehah 3.1! Neste guia, vamos explorar passo a passo como você pode transformar a experiência de login dos seus usuários, tornando-a mais envolvente e personalizada.

 

Versão oficial Atualizada: https://github.com/mehah/otclient

 

Depois de baixar vai na pasta /modules/client_entergame e abra o arquivo entergame.lua e ache isso

 

function EnterGame.init()

  enterGame = g_ui.displayUI('entergame')
  enterGameButton = modules.client_topmenu.addLeftButton('enterGameButton', tr('Login') .. ' (Ctrl + G)',
    '/images/topbuttons/login', EnterGame.openWindow)
  motdButton = modules.client_topmenu.addLeftButton('motdButton', tr('Message of the day'), '/images/topbuttons/motd',
    EnterGame.displayMotd)
  motdButton:hide()
  g_keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow)

  if motdEnabled and G.motdNumber then
    motdButton:show()
  end

  local account = g_settings.get('account')
  local password = g_settings.get('password')
  local host = g_settings.get('host')
  local port = g_settings.get('port')
  local stayLogged = g_settings.getBoolean('staylogged')
  local autologin = g_settings.getBoolean('autologin')
  local httpLogin = g_settings.getBoolean('httpLogin')
  local clientVersion = g_settings.getInteger('client-version')
  if clientVersion == 0 then
    clientVersion = 1074
  end

  if port == nil or port == 0 then
    port = 7171
  end

  EnterGame.setAccountName(account)
  EnterGame.setPassword(password)

  enterGame:getChildById('serverHostTextEdit'):setText(host)
  enterGame:getChildById('serverPortTextEdit'):setText(port)
  enterGame:getChildById('autoLoginBox'):setChecked(autologin)
  enterGame:getChildById('stayLoggedBox'):setChecked(stayLogged)
  enterGame:getChildById('httpLoginBox'):setChecked(httpLogin)

  local installedClients = {}
  local installed_qty = 0
  for _, dirItem in ipairs(g_resources.listDirectoryFiles('/data/things/')) do
    if tonumber(dirItem) ~= nil then
      installedClients[dirItem] = true
      installed_qty = installed_qty + 1
    end
  end
  clientBox = enterGame:getChildById('clientComboBox')
  for _, proto in pairs(g_game.getSupportedClients()) do
    local proto_str = tostring(proto)
    if installedClients[proto_str] or installed_qty == 0 then
      installedClients[proto_str] = nil
      clientBox:addOption(proto)
    end
  end
  for proto_str, status in pairs(installedClients) do
    if status == true then
      print(string.format('Warning: %s recognized as an installed client, but not supported.', proto_str))
    end
  end
  clientBox:setCurrentOption(clientVersion)

  EnterGame.toggleAuthenticatorToken(clientVersion, true)
  EnterGame.toggleStayLoggedBox(clientVersion, true)
  connect(clientBox, {
    onOptionChange = EnterGame.onClientVersionChange
  })

  enterGame:hide()

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

 

troque por

 

function EnterGame.init()

  enterGame = g_ui.displayUI('entergame')
  enterGameButton = modules.client_topmenu.addLeftButton('enterGameButton', tr('Login') .. ' (Ctrl + G)',
    '/images/topbuttons/login', EnterGame.openWindow)
  motdButton = modules.client_topmenu.addLeftButton('motdButton', tr('Message of the day'), '/images/topbuttons/motd',
    EnterGame.displayMotd)
  motdButton:hide()
  g_keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow)

  if motdEnabled and G.motdNumber then
    motdButton:show()
  end

  local account = g_settings.get('account')
  local password = g_settings.get('password')
  local host = g_settings.get('host')
  local port = g_settings.get('port')
  local stayLogged = g_settings.getBoolean('staylogged')
  local autologin = g_settings.getBoolean('autologin')
  local httpLogin = g_settings.getBoolean('httpLogin')
  local clientVersion = g_settings.getInteger('client-version')
  if clientVersion == 0 then
    clientVersion = 1074
  end

  if port == nil or port == 0 then
    port = 7171
  end

  EnterGame.setAccountName(account)
  EnterGame.setPassword(password)

  enterGame:getChildById('serverHostTextEdit'):setText(host)
  enterGame:getChildById('serverPortTextEdit'):setText(port)
  enterGame:getChildById('autoLoginBox'):setChecked(autologin)
  enterGame:getChildById('stayLoggedBox'):setChecked(stayLogged)
  enterGame:getChildById('httpLoginBox'):setChecked(httpLogin)

  local installedClients = {}
  local installed_qty = 0
  for _, dirItem in ipairs(g_resources.listDirectoryFiles('/data/things/')) do
    if tonumber(dirItem) ~= nil then
      installedClients[dirItem] = true
      installed_qty = installed_qty + 1
    end
  end
  clientBox = enterGame:getChildById('clientComboBox')
  for _, proto in pairs(g_game.getSupportedClients()) do
    local proto_str = tostring(proto)
    if installedClients[proto_str] or installed_qty == 0 then
      installedClients[proto_str] = nil
      clientBox:addOption(proto)
    end
  end
  for proto_str, status in pairs(installedClients) do
    if status == true then
      print(string.format('Warning: %s recognized as an installed client, but not supported.', proto_str))
    end
  end
  clientBox:setCurrentOption(clientVersion)

  EnterGame.toggleAuthenticatorToken(clientVersion, true)
  EnterGame.toggleStayLoggedBox(clientVersion, true)
  connect(clientBox, {
    onOptionChange = EnterGame.onClientVersionChange
  })

  enterGame:hide()

  if g_app.isRunning() and not g_game.isOnline() then
    enterGame:show()
  end
  
  EnterGame.setUniqueServer("SEU IP SERVER", 7171, 860) --8.60 ver~soa do cliente sem .

end

feito isso a sua tela de login mudará ^^ 

EnterGame.setUniqueServer("SEU IP SERVER", PORTA, 860) --8.60 ver~soa do cliente sem .

resultado: 

 

Editado por L3K0T (veja o histórico de edições)

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

  • L3K0T mudou o título para Removendo host e porta do login do OTcliente Mehah 3.1 versão atual

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.9k

Informação Importante

Confirmação de Termo