mirror of
https://github.com/edubart/otclient.git
synced 2025-10-18 05:23:26 +02:00
protocol 860 fixes
This commit is contained in:
@@ -1,22 +1,27 @@
|
||||
Chat = {}
|
||||
|
||||
-- private variables
|
||||
--[[
|
||||
local SpeakTypes = {
|
||||
say = { color = },
|
||||
whisper = { color = },
|
||||
yell,
|
||||
monsterSay,
|
||||
npcToPlayer,
|
||||
cgannelYellow,
|
||||
channelWhite,
|
||||
channelRed,
|
||||
channelOrange,
|
||||
private,
|
||||
playerToNpc,
|
||||
broadcast,
|
||||
privateRed
|
||||
}
|
||||
]]--
|
||||
|
||||
local chatPanel
|
||||
local chatBuffer
|
||||
|
||||
-- private functions
|
||||
local function onCreatureSpeak(name, level, msgtype, message)
|
||||
style = 'ChatLabel'
|
||||
if name and level > 0 then
|
||||
message = name .. ' [' .. level .. ']: ' .. message
|
||||
style = 'YellowChatLabel'
|
||||
end
|
||||
|
||||
local label = createWidget(style)
|
||||
label:setText(message)
|
||||
chatBuffer:addChild(label)
|
||||
end
|
||||
|
||||
-- public functions
|
||||
function Chat.create()
|
||||
chatPanel = displayUI('chat.otui', { parent = Game.gameBottomPanel } )
|
||||
@@ -29,6 +34,17 @@ function Chat.destroy()
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
local function onCreatureSpeak(name, level, msgtype, message)
|
||||
style = 'ChatLabel'
|
||||
if name and level > 0 then
|
||||
message = name .. ' [' .. level .. ']: ' .. message
|
||||
style = 'YellowChatLabel'
|
||||
end
|
||||
|
||||
local label = createWidget(style)
|
||||
label:setText(message)
|
||||
chatBuffer:addChild(label)
|
||||
end
|
||||
|
||||
connect(Game, { onLogin = Chat.create,
|
||||
onLogout = Chat.destroy,
|
||||
|
Reference in New Issue
Block a user