fix guild channel chat

This commit is contained in:
AndreFaramir 2012-04-24 01:01:59 -03:00
parent c903cc7ec4
commit 6d6534f57e
1 changed files with 13 additions and 11 deletions

View File

@ -81,6 +81,7 @@ end
-- hooked events -- hooked events
local function onCreatureSpeak(name, level, speaktype, message, channelId, creaturePos) local function onCreatureSpeak(name, level, speaktype, message, channelId, creaturePos)
local defaultMessage = speaktype < 3 and true or false
speaktype = SpeakTypes[speaktype] speaktype = SpeakTypes[speaktype]
if speaktype.hideInConsole then return end if speaktype.hideInConsole then return end
@ -89,8 +90,11 @@ local function onCreatureSpeak(name, level, speaktype, message, channelId, creat
if speaktype.private then if speaktype.private then
Console.addPrivateText(message, speaktype, name, false) Console.addPrivateText(message, speaktype, name, false)
else else
local channel = channels[channelId] local channel = 'Default'
if not defaultMessage then
channel = channels[channelId]
end
if channel then if channel then
Console.addText(message, speaktype, channel) Console.addText(message, speaktype, channel)
else else
@ -176,7 +180,7 @@ function Console.init()
consoleTabBar:setContentWidget(consoleContentPanel) consoleTabBar:setContentWidget(consoleContentPanel)
channels = {} channels = {}
Console.addChannel('Default', 0) Console.addTab('Default', true)
Console.addTab('Server Log', false) Console.addTab('Server Log', false)
Keyboard.bindKeyPress('Shift+Up', function() navigateMessageHistory(1) end, consolePanel) Keyboard.bindKeyPress('Shift+Up', function() navigateMessageHistory(1) end, consolePanel)
@ -229,13 +233,11 @@ end
function Console.clear() function Console.clear()
for channelid, channelname in pairs(channels) do for channelid, channelname in pairs(channels) do
if channelid ~= 0 then local tab = consoleTabBar:getTab(channelname)
local tab = consoleTabBar:getTab(channelname) consoleTabBar:removeTab(tab)
consoleTabBar:removeTab(tab)
end
end end
channels = {} channels = {}
channels[0] = 'Default'
consoleTabBar:getTab('Default').tabPanel:getChildById('consoleBuffer'):destroyChildren() consoleTabBar:getTab('Default').tabPanel:getChildById('consoleBuffer'):destroyChildren()
consoleTabBar:getTab('Server Log').tabPanel:getChildById('consoleBuffer'):destroyChildren() consoleTabBar:getTab('Server Log').tabPanel:getChildById('consoleBuffer'):destroyChildren()
@ -400,10 +402,10 @@ function Console.sendCurrentMessage()
tab = Console.getTab('Default') tab = Console.getTab('Default')
name = 'Default' name = 'Default'
end end
local speaktypedesc local speaktypedesc
if (tab.channelId or name == 'Default') and not chatCommandPrivateReady then
if tab.channelId and not chatCommandPrivateReady then if name == 'Default' then
if tab.channelId == 0 then
speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc
if speaktypedesc ~= 'say' then Console.sayModeChange(2) end -- head back to say mode if speaktypedesc ~= 'say' then Console.sayModeChange(2) end -- head back to say mode
else else