mirror of
https://github.com/edubart/otclient.git
synced 2025-05-02 18:49:21 +02:00
Fix hotkeys reload and implement filters for console
This commit is contained in:
parent
44bf4dcb6e
commit
10a16169a4
@ -72,6 +72,7 @@ violationsChannelId = nil
|
||||
violationWindow = nil
|
||||
violationReportTab = nil
|
||||
ignoredChannels = {}
|
||||
filters = {}
|
||||
|
||||
local ignoreSettings = {
|
||||
privateMessages = false,
|
||||
@ -591,10 +592,24 @@ function sendCurrentMessage()
|
||||
sendMessage(message)
|
||||
end
|
||||
|
||||
function addFilter(filter)
|
||||
table.insert(filters, filter)
|
||||
end
|
||||
|
||||
function removeFilter(filter)
|
||||
table.removevalue(filters, filter)
|
||||
end
|
||||
|
||||
function sendMessage(message, tab)
|
||||
local tab = tab or getCurrentTab()
|
||||
if not tab then return end
|
||||
|
||||
for k,func in pairs(filters) do
|
||||
if func(message) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- when talking on server log, the message goes to default channel
|
||||
local name = tab:getText()
|
||||
if tab == serverTab or tab == getRuleViolationsTab() then
|
||||
|
@ -76,6 +76,8 @@ function init()
|
||||
onGameStart = online,
|
||||
onGameEnd = offline
|
||||
})
|
||||
|
||||
load()
|
||||
end
|
||||
|
||||
function terminate()
|
||||
@ -96,6 +98,7 @@ end
|
||||
function configure(savePerServer, savePerCharacter)
|
||||
perServer = savePerServer
|
||||
perCharacter = savePerCharacter
|
||||
reload()
|
||||
end
|
||||
|
||||
function online()
|
||||
|
Loading…
x
Reference in New Issue
Block a user