mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-19 14:13:27 +02:00
Minor bug fixes
This commit is contained in:
@@ -60,6 +60,7 @@ function timeleftTranslation(timeleft, forPreyTimeleft) -- in seconds
|
||||
end
|
||||
|
||||
function init()
|
||||
connect(g_game, {
|
||||
onGameStart = check,
|
||||
onGameEnd = hide,
|
||||
onResourceBalance = onResourceBalance,
|
||||
@@ -73,11 +74,14 @@ function init()
|
||||
})
|
||||
|
||||
preyWindow = g_ui.displayUI('prey')
|
||||
preyWindow:hide()
|
||||
preyWindow:hide()
|
||||
if g_game.isOnline() then
|
||||
check()
|
||||
end
|
||||
end
|
||||
|
||||
function terminate()
|
||||
disconnect(g_game, {
|
||||
onGameStart = check,
|
||||
onGameEnd = hide,
|
||||
onResourceBalance = onResourceBalance,
|
||||
@@ -89,7 +93,9 @@ function terminate()
|
||||
onPreyActive = onPreyActive,
|
||||
onPreySelection = onPreySelection
|
||||
})
|
||||
|
||||
|
||||
if preyButton then
|
||||
preyButton:destroy()
|
||||
end
|
||||
preyWindow:destroy()
|
||||
if msgWindow then
|
||||
@@ -97,6 +103,17 @@ function terminate()
|
||||
msgWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
function check()
|
||||
if g_game.getFeature(GamePrey) then
|
||||
if not preyButton then
|
||||
preyButton = modules.client_topmenu.addRightGameToggleButton('preyButton', tr('Preys'), '/images/topbuttons/prey', toggle)
|
||||
end
|
||||
elseif preyButton then
|
||||
preyButton:destroy()
|
||||
preyButton = nil
|
||||
end
|
||||
end
|
||||
|
||||
function hide()
|
||||
preyWindow:hide()
|
||||
@@ -106,6 +123,9 @@ function hide()
|
||||
end
|
||||
end
|
||||
|
||||
function show()
|
||||
if not g_game.getFeature(GamePrey) then
|
||||
return hide()
|
||||
end
|
||||
preyWindow:show()
|
||||
preyWindow:raise()
|
||||
|
Reference in New Issue
Block a user