Re-add destroying for unloading, other clean up:
* Cleaned some module terminate code * Fixed "reload all" issues
This commit is contained in:
parent
35e5dd8af8
commit
7f5dda5c8f
|
@ -25,7 +25,6 @@ function terminate()
|
|||
|
||||
g_effects.cancelFade(background:getChildById('clientVersionLabel'))
|
||||
background:destroy()
|
||||
background = nil
|
||||
|
||||
Background = nil
|
||||
end
|
||||
|
|
|
@ -136,11 +136,17 @@ function EnterGame.terminate()
|
|||
removeEvent(autoLoginEvent)
|
||||
enterGame:destroy()
|
||||
enterGame = nil
|
||||
enterGameButton:destroy()
|
||||
enterGameButton = nil
|
||||
protocolBox = nil
|
||||
if motdWindow then
|
||||
motdWindow:destroy()
|
||||
motdWindow = nil
|
||||
end
|
||||
if motdButton then
|
||||
motdButton:destroy()
|
||||
motdButton = nil
|
||||
end
|
||||
if loadBox then
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
|
|
|
@ -22,7 +22,7 @@ end
|
|||
|
||||
function terminate()
|
||||
moduleManagerWindow:destroy()
|
||||
moduleManagerWindow = nil
|
||||
moduleManagerButton:destroy()
|
||||
moduleList = nil
|
||||
end
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ function terminate()
|
|||
--g_keyboard.unbindKeyDown('Ctrl+D')
|
||||
g_keyboard.unbindKeyDown('Ctrl+Shift+F')
|
||||
optionsWindow:destroy()
|
||||
optionsWindow = nil
|
||||
optionsButton:destroy()
|
||||
audioButton:destroy()
|
||||
optionsTabBar = nil
|
||||
generalPanel = nil
|
||||
consolePanel = nil
|
||||
|
|
|
@ -150,10 +150,8 @@ function terminate()
|
|||
g_settings.setList('terminal-history', commandHistory)
|
||||
g_keyboard.unbindKeyDown('Ctrl+T')
|
||||
g_logger.setOnLog(nil)
|
||||
commandTextEdit = nil
|
||||
terminalBuffer = nil
|
||||
terminalWindow:destroy()
|
||||
terminalWindow = nil
|
||||
terminalButton:destroy()
|
||||
commandEnv = nil
|
||||
end
|
||||
|
||||
|
|
|
@ -57,13 +57,7 @@ function terminate()
|
|||
disconnect(g_game, { onGameStart = showGameButtons,
|
||||
onGameEnd = hideGameButtons })
|
||||
|
||||
leftButtonsPanel = nil
|
||||
rightButtonsPanel = nil
|
||||
leftGameButtonsPanel = nil
|
||||
rightGameButtonsPanel = nil
|
||||
|
||||
topMenu:destroy()
|
||||
topMenu = nil
|
||||
end
|
||||
|
||||
function addLeftButton(id, description, icon, callback, front)
|
||||
|
|
|
@ -51,6 +51,7 @@ function terminate()
|
|||
|
||||
fightModeRadioGroup:destroy()
|
||||
combatControlsWindow:destroy()
|
||||
combatControlsButton:destroy()
|
||||
|
||||
disconnect(g_game, {
|
||||
onGameStart = online,
|
||||
|
|
|
@ -73,9 +73,9 @@ violationWindow = nil
|
|||
violationReportTab = nil
|
||||
|
||||
local ignoreSettings = {
|
||||
privateMessages = false,
|
||||
yelling = false,
|
||||
players = {}
|
||||
privateMessages = false,
|
||||
yelling = false,
|
||||
players = {}
|
||||
}
|
||||
|
||||
function init()
|
||||
|
@ -164,25 +164,17 @@ function terminate()
|
|||
|
||||
if channelsWindow then
|
||||
channelsWindow:destroy()
|
||||
channelsWindow = nil
|
||||
end
|
||||
|
||||
if ignoreWindow then
|
||||
ignoreWindow:destroy()
|
||||
ignoreWindow = nil
|
||||
end
|
||||
|
||||
if violationWindow then
|
||||
violationWindow:destroy()
|
||||
violationWindow = nil
|
||||
end
|
||||
|
||||
|
||||
consolePanel:destroy()
|
||||
consolePanel = nil
|
||||
consoleTextEdit = nil
|
||||
consoleContentPanel = nil
|
||||
consoleTabBar = nil
|
||||
|
||||
ownPrivateName = nil
|
||||
|
||||
Console = nil
|
||||
|
|
|
@ -36,6 +36,7 @@ function terminate()
|
|||
onSpellCooldown = onSpellCooldown })
|
||||
|
||||
cooldownWindow:destroy()
|
||||
cooldownButton:destroy()
|
||||
end
|
||||
|
||||
function onMiniWindowClose()
|
||||
|
|
|
@ -70,19 +70,7 @@ function terminate()
|
|||
disconnect(g_game, { onGameEnd = offline })
|
||||
|
||||
healthInfoWindow:destroy()
|
||||
healthInfoWindow = nil
|
||||
healthInfoButton = nil
|
||||
|
||||
healthBar = nil
|
||||
manaBar = nil
|
||||
soulBar = nil
|
||||
|
||||
healthLabel = nil
|
||||
manaLabel = nil
|
||||
soulLabel = nil
|
||||
capLabel = nil
|
||||
|
||||
HealthInfo = nil
|
||||
healthInfoButton:destroy()
|
||||
end
|
||||
|
||||
function toggle()
|
||||
|
|
|
@ -88,6 +88,7 @@ function terminate()
|
|||
unload()
|
||||
|
||||
hotkeysWindow:destroy()
|
||||
hotkeysButton:destroy()
|
||||
mouseGrabberWidget:destroy()
|
||||
end
|
||||
|
||||
|
|
|
@ -123,11 +123,11 @@ function terminate()
|
|||
|
||||
disconnect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
|
||||
|
||||
logoutButton:destroy()
|
||||
gameRootPanel:destroy()
|
||||
end
|
||||
|
||||
function onGameStart()
|
||||
logoutButton:setTooltip(tr('Logout'))
|
||||
show()
|
||||
|
||||
-- open tibia has delay in auto walking
|
||||
|
@ -139,7 +139,6 @@ function onGameStart()
|
|||
end
|
||||
|
||||
function onGameEnd()
|
||||
logoutButton:setTooltip(tr('Exit'))
|
||||
setupViewMode(0)
|
||||
hide()
|
||||
end
|
||||
|
@ -151,10 +150,13 @@ function show()
|
|||
gameRootPanel:focus()
|
||||
gameMapPanel:followCreature(g_game.getLocalPlayer())
|
||||
updateStretchShrink()
|
||||
logoutButton:setTooltip(tr('Logout'))
|
||||
end
|
||||
|
||||
function hide()
|
||||
disconnect(g_app, { onClose = tryExit })
|
||||
logoutButton:setTooltip(tr('Exit'))
|
||||
|
||||
if logoutWindow then
|
||||
logoutWindow:destroy()
|
||||
logoutWindow = nil
|
||||
|
|
|
@ -39,6 +39,7 @@ function terminate()
|
|||
g_keyboard.unbindKeyDown('Ctrl+I')
|
||||
|
||||
inventoryWindow:destroy()
|
||||
inventoryButton:destroy()
|
||||
end
|
||||
|
||||
function refresh()
|
||||
|
|
|
@ -737,9 +737,7 @@ function terminate()
|
|||
disconnect(g_game, { onGameEnd = Market.reset })
|
||||
disconnect(g_game, { onGameEnd = Market.close })
|
||||
|
||||
if marketWindow then
|
||||
marketWindow:destroy()
|
||||
end
|
||||
marketWindow:destroy()
|
||||
|
||||
Market = nil
|
||||
end
|
||||
|
|
|
@ -49,6 +49,7 @@ function terminate()
|
|||
g_keyboard.unbindKeyDown('Ctrl+M')
|
||||
|
||||
minimapWindow:destroy()
|
||||
minimapButton:destroy()
|
||||
end
|
||||
|
||||
function toggle()
|
||||
|
|
|
@ -17,7 +17,6 @@ end
|
|||
function reset()
|
||||
if deathWindow then
|
||||
deathWindow:destroy()
|
||||
deathWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ function terminate()
|
|||
onGameStart = online,
|
||||
onGameEnd = offline
|
||||
})
|
||||
offline()
|
||||
end
|
||||
|
||||
function online()
|
||||
|
|
|
@ -18,17 +18,16 @@ function terminate()
|
|||
onGameEnd = destroyWindows})
|
||||
|
||||
destroyWindows()
|
||||
questLogButton:destroy()
|
||||
end
|
||||
|
||||
function destroyWindows()
|
||||
if questLogWindow then
|
||||
questLogWindow:destroy()
|
||||
questLogWindow = nil
|
||||
end
|
||||
|
||||
if questLineWindow then
|
||||
questLineWindow:destroy()
|
||||
questLineWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ function terminate()
|
|||
|
||||
g_keyboard.unbindKeyDown('Ctrl+S')
|
||||
skillsWindow:destroy()
|
||||
skillsButton:destroy()
|
||||
end
|
||||
|
||||
function expForLevel(level)
|
||||
|
@ -231,6 +232,8 @@ end
|
|||
|
||||
function checkExpSpeed()
|
||||
local player = g_game.getLocalPlayer()
|
||||
if not player then return end
|
||||
|
||||
local currentExp = player:getExperience()
|
||||
local currentTime = g_clock.seconds()
|
||||
if player.lastExps ~= nil then
|
||||
|
|
|
@ -173,41 +173,11 @@ function terminate()
|
|||
end })
|
||||
|
||||
spelllistWindow:destroy()
|
||||
spelllistWindow = nil
|
||||
spelllistButton:destroy()
|
||||
|
||||
vocationRadioGroup:destroy()
|
||||
vocationRadioGroup = nil
|
||||
groupRadioGroup:destroy()
|
||||
groupRadioGroup = nil
|
||||
premiumRadioGroup:destroy()
|
||||
premiumRadioGroup = nil
|
||||
|
||||
spellList = nil
|
||||
nameValueLabel = nil
|
||||
formulaValueLabel = nil
|
||||
vocationValueLabel = nil
|
||||
groupValueLabel = nil
|
||||
typeValueLabel = nil
|
||||
cooldownValueLabel = nil
|
||||
levelValueLabel = nil
|
||||
manaValueLabel = nil
|
||||
premiumValueLabel = nil
|
||||
descriptionValueLabel = nil
|
||||
|
||||
vocationBoxAny = nil
|
||||
vocationBoxSorcerer = nil
|
||||
vocationBoxDruid = nil
|
||||
vocationBoxPaladin = nil
|
||||
vocationBoxKnight = nil
|
||||
|
||||
groupBoxAny = nil
|
||||
groupBoxAttack = nil
|
||||
groupBoxHealing = nil
|
||||
groupBoxSupport = nil
|
||||
|
||||
premiumBoxAny = nil
|
||||
premiumBoxNo = nil
|
||||
premiumBoxYes = nil
|
||||
end
|
||||
|
||||
function initialiseSpelllist()
|
||||
|
|
|
@ -35,7 +35,6 @@ function refresh()
|
|||
end
|
||||
|
||||
vipWindow:setContentMinimumHeight(38)
|
||||
--vipWindow:setContentMaximumHeight(256)
|
||||
end
|
||||
|
||||
function clear()
|
||||
|
|
Loading…
Reference in New Issue