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,18 +80,20 @@ local ignoreSettings = {
} }
function init() function init()
connect(g_game, { onTalk = onTalk, connect(g_game, {
onChannelList = onChannelList, onTalk = onTalk,
onOpenChannel = onOpenChannel, onChannelList = onChannelList,
onOpenPrivateChannel = onOpenPrivateChannel, onOpenChannel = onOpenChannel,
onOpenOwnPrivateChannel = onOpenOwnPrivateChannel, onOpenPrivateChannel = onOpenPrivateChannel,
onCloseChannel = onCloseChannel, onOpenOwnPrivateChannel = onOpenOwnPrivateChannel,
onRuleViolationChannel = onRuleViolationChannel, onCloseChannel = onCloseChannel,
onRuleViolationRemove = onRuleViolationRemove, onRuleViolationChannel = onRuleViolationChannel,
onRuleViolationCancel = onRuleViolationCancel, onRuleViolationRemove = onRuleViolationRemove,
onRuleViolationLock = onRuleViolationLock, onRuleViolationCancel = onRuleViolationCancel,
onGameStart = online, onRuleViolationLock = onRuleViolationLock,
onGameEnd = offline }) onGameStart = online,
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,18 +144,20 @@ end
function terminate() function terminate()
save() save()
disconnect(g_game, { onTalk = onTalk, disconnect(g_game, {
onChannelList = onChannelList, onTalk = onTalk,
onOpenChannel = onOpenChannel, onChannelList = onChannelList,
onOpenPrivateChannel = onOpenPrivateChannel, onOpenChannel = onOpenChannel,
onOpenOwnPrivateChannel = onOpenPrivateChannel, onOpenPrivateChannel = onOpenPrivateChannel,
onCloseChannel = onCloseChannel, onOpenOwnPrivateChannel = onOpenPrivateChannel,
onRuleViolationChannel = onRuleViolationChannel, onCloseChannel = onCloseChannel,
onRuleViolationRemove = onRuleViolationRemove, onRuleViolationChannel = onRuleViolationChannel,
onRuleViolationCancel = onRuleViolationCancel, onRuleViolationRemove = onRuleViolationRemove,
onRuleViolationLock = onRuleViolationLock, onRuleViolationCancel = onRuleViolationCancel,
onGameStart = online, onRuleViolationLock = onRuleViolationLock,
onGameEnd = offline }) onGameStart = online,
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)
@ -984,15 +989,15 @@ function onClickIgnoreButton()
removeButton:disable() removeButton:disable()
ignoreListPanel.onChildFocusChange = function() removeButton:enable() end ignoreListPanel.onChildFocusChange = function() removeButton:enable() end
removeButton.onClick = function() removeButton.onClick = function()
local selection = ignoreListPanel:getFocusedChild() local selection = ignoreListPanel:getFocusedChild()
if selection then if selection then
ignoreListPanel:removeChild(selection) ignoreListPanel:removeChild(selection)
selection:destroy() selection:destroy()
end end
if ignoreListPanel:getChildCount() == 0 then if ignoreListPanel:getChildCount() == 0 then
removeButton:disable() removeButton:disable()
end end
end end
local newlyIgnoredPlayers = {} local newlyIgnoredPlayers = {}
local addName = ignoreWindow:getChildById('ignoreNameEdit') local addName = ignoreWindow:getChildById('ignoreNameEdit')

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)