Should resolve #289 (please test and give feedback)

This commit is contained in:
BeniS 2013-02-28 10:22:46 +13:00
parent 864ac3fdd9
commit ccbe491e3c
2 changed files with 51 additions and 40 deletions

View File

@ -51,7 +51,7 @@ SayModes = {
[3] = { speakTypeDesc = 'yell', icon = '/images/game/console/yell' }
}
MAX_HISTORY = 1000
MAX_HISTORY = 500
MAX_LINES = 100
HELP_CHANNEL = 9
@ -80,7 +80,8 @@ local ignoreSettings = {
}
function init()
connect(g_game, { onTalk = onTalk,
connect(g_game, {
onTalk = onTalk,
onChannelList = onChannelList,
onOpenChannel = onOpenChannel,
onOpenPrivateChannel = onOpenPrivateChannel,
@ -91,7 +92,8 @@ function init()
onRuleViolationCancel = onRuleViolationCancel,
onRuleViolationLock = onRuleViolationLock,
onGameStart = online,
onGameEnd = offline })
onGameEnd = offline
})
consolePanel = g_ui.loadUI('console', modules.game_interface.getBottomPanel())
consoleTextEdit = consolePanel:getChildById('consoleTextEdit')
@ -142,7 +144,8 @@ end
function terminate()
save()
disconnect(g_game, { onTalk = onTalk,
disconnect(g_game, {
onTalk = onTalk,
onChannelList = onChannelList,
onOpenChannel = onOpenChannel,
onOpenPrivateChannel = onOpenPrivateChannel,
@ -153,7 +156,8 @@ function terminate()
onRuleViolationCancel = onRuleViolationCancel,
onRuleViolationLock = onRuleViolationLock,
onGameStart = online,
onGameEnd = offline })
onGameEnd = offline
})
if g_game.isOnline() then clear() end
@ -308,15 +312,17 @@ function removeTab(tab)
tab = consoleTabBar:getTab(tab)
end
if tab == defaultTab or tab == serverTab then return end
if tab == defaultTab or tab == serverTab then
return
end
if tab == violationReportTab then
g_game.cancelRuleViolation()
violationReportTab = nil
elseif tab.violationChatName then
g_game.closeRuleViolation(tab.violationChatName)
-- notificate the server that we are leaving the channel
elseif tab.channelId then
-- notificate the server that we are leaving the channel
for k, v in pairs(channels) do
if (k == tab.channelId) then channels[k] = nil end
end
@ -329,8 +335,7 @@ function removeTab(tab)
end
function removeCurrentTab()
local tab = consoleTabBar:getCurrentTab()
removeTab(tab)
removeTab(consoleTabBar:getCurrentTab())
end
function getTab(name)

View File

@ -193,12 +193,18 @@ function save()
local hotkeys = hotkeySettings
if perServer then
if not hotkeys[G.host] then
hotkeys[G.host] = {}
end
hotkeys = hotkeys[G.host]
end
if perCharacter then
hotkeys[g_game.getCharacterName()] = {}
hotkeys = hotkeys[g_game.getCharacterName()]
local char = g_game.getCharacterName()
if not hotkeys[char] then
hotkeys[hotkeys[char]] = {}
end
hotkeys = hotkeys[char]
end
table.clear(hotkeys)