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

View File

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