Improve logout speed via Ctrl+G
This commit is contained in:
		
							parent
							
								
									9f69c71b6d
								
							
						
					
					
						commit
						7c06a00f82
					
				| 
						 | 
					@ -13,22 +13,19 @@ local resendWaitEvent
 | 
				
			||||||
local function tryLogin(charInfo, tries)
 | 
					local function tryLogin(charInfo, tries)
 | 
				
			||||||
  tries = tries or 1
 | 
					  tries = tries or 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if tries > 4 then
 | 
					  if tries > 50 then
 | 
				
			||||||
    CharacterList.destroyLoadBox()
 | 
					 | 
				
			||||||
    displayErrorBox(tr('Error'), tr('Unable to logout.'))
 | 
					 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if g_game.isOnline() then
 | 
					  if g_game.isOnline() then
 | 
				
			||||||
    if tries == 1 then
 | 
					    if tries == 1 then
 | 
				
			||||||
      g_game.safeLogout()
 | 
					      g_game.safeLogout()
 | 
				
			||||||
      loadBox = displayCancelBox(tr('Please wait'), tr('Logging out...'))
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    scheduleEvent(function() tryLogin(charInfo, tries+1) end, 250)
 | 
					    scheduleEvent(function() tryLogin(charInfo, tries+1) end, 100)
 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  CharacterList.destroyLoadBox()
 | 
					  CharacterList.hide()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  local locale = modules.client_locales.getCurrentLocale().name
 | 
					  local locale = modules.client_locales.getCurrentLocale().name
 | 
				
			||||||
  g_game.loginWorld(G.account, G.password, charInfo.worldName, charInfo.worldHost, charInfo.worldPort, charInfo.characterName, locale)
 | 
					  g_game.loginWorld(G.account, G.password, charInfo.worldName, charInfo.worldHost, charInfo.worldPort, charInfo.characterName, locale)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -127,6 +127,7 @@ end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function onGameEnd()
 | 
					function onGameEnd()
 | 
				
			||||||
  logoutButton:setTooltip(tr('Exit'))
 | 
					  logoutButton:setTooltip(tr('Exit'))
 | 
				
			||||||
 | 
					  setupViewMode(0)
 | 
				
			||||||
  hide()
 | 
					  hide()
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue