mirror of
https://github.com/edubart/otclient.git
synced 2025-05-03 11:09:20 +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
|
violationWindow = nil
|
||||||
violationReportTab = nil
|
violationReportTab = nil
|
||||||
ignoredChannels = {}
|
ignoredChannels = {}
|
||||||
|
filters = {}
|
||||||
|
|
||||||
local ignoreSettings = {
|
local ignoreSettings = {
|
||||||
privateMessages = false,
|
privateMessages = false,
|
||||||
@ -591,10 +592,24 @@ function sendCurrentMessage()
|
|||||||
sendMessage(message)
|
sendMessage(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function addFilter(filter)
|
||||||
|
table.insert(filters, filter)
|
||||||
|
end
|
||||||
|
|
||||||
|
function removeFilter(filter)
|
||||||
|
table.removevalue(filters, filter)
|
||||||
|
end
|
||||||
|
|
||||||
function sendMessage(message, tab)
|
function sendMessage(message, tab)
|
||||||
local tab = tab or getCurrentTab()
|
local tab = tab or getCurrentTab()
|
||||||
if not tab then return end
|
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
|
-- when talking on server log, the message goes to default channel
|
||||||
local name = tab:getText()
|
local name = tab:getText()
|
||||||
if tab == serverTab or tab == getRuleViolationsTab() then
|
if tab == serverTab or tab == getRuleViolationsTab() then
|
||||||
|
@ -76,6 +76,8 @@ function init()
|
|||||||
onGameStart = online,
|
onGameStart = online,
|
||||||
onGameEnd = offline
|
onGameEnd = offline
|
||||||
})
|
})
|
||||||
|
|
||||||
|
load()
|
||||||
end
|
end
|
||||||
|
|
||||||
function terminate()
|
function terminate()
|
||||||
@ -96,6 +98,7 @@ end
|
|||||||
function configure(savePerServer, savePerCharacter)
|
function configure(savePerServer, savePerCharacter)
|
||||||
perServer = savePerServer
|
perServer = savePerServer
|
||||||
perCharacter = savePerCharacter
|
perCharacter = savePerCharacter
|
||||||
|
reload()
|
||||||
end
|
end
|
||||||
|
|
||||||
function online()
|
function online()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user