mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
add chat panel, send text messages, guard forbidden functions with an ifdef
This commit is contained in:
19
modules/chat/chat.lua
Normal file
19
modules/chat/chat.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
Chat = {}
|
||||
|
||||
-- private variables
|
||||
local chatPanel
|
||||
|
||||
-- public functions
|
||||
function Chat.create()
|
||||
chatPanel = loadUI("/chat/chat.otui", Game.gameBottomPanel)
|
||||
end
|
||||
|
||||
function Chat.destroy()
|
||||
chatPanel:destroy()
|
||||
chatPanel = nil
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
|
||||
connect(Game, { onLogin = Chat.create,
|
||||
onLogout = Chat.destroy })
|
14
modules/chat/chat.otmod
Normal file
14
modules/chat/chat.otmod
Normal file
@@ -0,0 +1,14 @@
|
||||
Module
|
||||
name: chat
|
||||
description: Manage chat window
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
dependencies:
|
||||
- game
|
||||
|
||||
onLoad: |
|
||||
require 'chat'
|
||||
return true
|
||||
|
||||
|
30
modules/chat/chat.otui
Normal file
30
modules/chat/chat.otui
Normal file
@@ -0,0 +1,30 @@
|
||||
ChatLabel < UILabel
|
||||
font: verdana-11px-monochrome
|
||||
height: 16
|
||||
|
||||
Panel
|
||||
id: chatPanel
|
||||
anchors.fill: parent
|
||||
|
||||
Panel
|
||||
id: chatBuffer
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: next.top
|
||||
margin.right: 6
|
||||
margin.left: 6
|
||||
margin.bottom: 2
|
||||
margin.top: 6
|
||||
layout: verticalBox
|
||||
focusable: false
|
||||
|
||||
LineEdit
|
||||
id: chatLineEdit
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
margin.right: 6
|
||||
margin.left: 6
|
||||
margin.bottom: 6
|
||||
always focused: true
|
Reference in New Issue
Block a user