DayZ 1.24
Loading...
Searching...
No Matches
Chat Class Reference
Collaboration diagram for Chat:
[legend]

Protected Member Functions

void Chat ()
 
void ~Chat ()
 
void Init (Widget root_widget)
 
void Destroy ()
 
void Clear ()
 
void Add (ChatMessageEventParams params)
 
void AddInternal (ChatMessageEventParams params)
 

Protected Attributes

Widget m_RootWidget
 
int m_LineHeight
 
int m_LastLine
 
ref array< ref ChatLinem_Lines
 

Private Attributes

const int LINE_COUNT = 12
 

Detailed Description

channel type, possible values CCSystem(1) CCAdmin(2) CCDirect(4) CCMegaphone(8) CCTransmitter(16) CCPublicAddressSystem(32) CCBattlEye(64)

Definition at line 14 of file Chat.c.

Constructor & Destructor Documentation

◆ Chat()

void Chat::Chat ( )
inlineprotected

Definition at line 23 of file Chat.c.

24 {
26 }
ref array< ref ChatLine > m_Lines
Definition Chat.c:21

References m_Lines.

◆ ~Chat()

void Chat::~Chat ( )
inlineprotected

Definition at line 28 of file Chat.c.

29 {
30 Destroy();
31 }
void Destroy()
Definition Chat.c:55

References Destroy().

Member Function Documentation

◆ Add()

void Chat::Add ( ChatMessageEventParams params)
inlineprotected

Definition at line 66 of file Chat.c.

67 {
69 int name_lenght = params.param2.Length();
70 int text_lenght = params.param3.Length();
72 int channel = params.param1;
73
74 if (channel & CCSystem || channel & CCBattlEye) //TODO separate battleye bellow
75 {
76 if (g_Game.GetProfileOption(EDayZProfilesOptions.GAME_MESSAGES))
77 return;
78
79 max_lenght = ChatMaxSystemLength; // system messages can be longer
80 }
81 //TODO add battleye filter to options
82 /*else if( channel & CCBattlEye )
83 {
84 if( g_Game.GetProfileOption( EDayZProfilesOptions.BATTLEYE_MESSAGES ) )
85 return;
86 }*/
87 else if (channel & CCAdmin)
88 {
89 if (g_Game.GetProfileOption(EDayZProfilesOptions.ADMIN_MESSAGES))
90 return;
91 }
93 {
94 if (g_Game.GetProfileOption(EDayZProfilesOptions.PLAYER_MESSAGES))
95 return;
96 }
97 else if (channel != 0) // 0 should be local messages to self
98 {
99 Print("Chat: Unknown channel " + channel);
100 return;
101 }
102
104 {
105 int pos = 0;
107 ref ChatMessageEventParams tmp = new ChatMessageEventParams(params.param1, params.param2, "", params.param4);
108
109 while (pos < text_lenght)
110 {
111 tmp.param3 = params.param3.Substring(pos, lenght);
113
114 tmp.param2 = "";
115 pos += lenght;
117 }
118 }
119 else
121 }
DayZGame g_Game
Definition DayZGame.c:3528
EDayZProfilesOptions
void AddInternal(ChatMessageEventParams params)
Definition Chat.c:123
Definition EnMath.c:7
Param4< int, string, string, string > ChatMessageEventParams
channel, from, text, color config class
Definition gameplay.c:394
proto void Print(void var)
Prints content of variable to console/log.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

References AddInternal(), Math::Clamp(), g_Game, and Print().

◆ AddInternal()

void Chat::AddInternal ( ChatMessageEventParams params)
inlineprotected

Definition at line 123 of file Chat.c.

124 {
125 m_LastLine = (m_LastLine + 1) % m_Lines.Count();
126
128 line.Set(params);
129
130 for (int i = 0; i < m_Lines.Count(); i++)
131 {
132 line = m_Lines.Get((m_LastLine + 1 + i) % LINE_COUNT);
133 line.m_RootWidget.SetPos(0, i * m_LineHeight);
134
135 float x = 0;
136 float y = 0;
137
138 line.m_RootWidget.GetPos(x, y);
139 }
140 }
Icon x
Icon y
int m_LastLine
Definition Chat.c:20
const int LINE_COUNT
Definition Chat.c:16
int m_LineHeight
Definition Chat.c:19

References LINE_COUNT, m_LastLine, m_LineHeight, m_Lines, x, and y.

Referenced by Add().

◆ Clear()

void Chat::Clear ( )
inlineprotected

Definition at line 60 of file Chat.c.

61 {
62 for (int i = 0; i < LINE_COUNT; i++)
63 m_Lines.Get(i).Clear();
64 }

References LINE_COUNT, and m_Lines.

◆ Destroy()

void Chat::Destroy ( )
inlineprotected

Definition at line 55 of file Chat.c.

56 {
57 m_Lines.Clear();
58 }

References m_Lines.

Referenced by Init(), and ~Chat().

◆ Init()

void Chat::Init ( Widget root_widget)
inlineprotected

Definition at line 33 of file Chat.c.

34 {
35 Destroy();
36
38
39 if (m_RootWidget)
40 {
41 float w;
42 float h;
43 m_RootWidget.GetSize(w, h);
45 m_LastLine = 0;
46
47 for (int i = 0; i < LINE_COUNT; i++)
48 {
50 m_Lines.Insert(line);
51 }
52 }
53 }
Widget m_RootWidget
Definition Chat.c:18

References Destroy(), LINE_COUNT, m_LastLine, m_LineHeight, m_Lines, and m_RootWidget.

Member Data Documentation

◆ LINE_COUNT

const int Chat::LINE_COUNT = 12
private

Definition at line 16 of file Chat.c.

Referenced by AddInternal(), Clear(), and Init().

◆ m_LastLine

int Chat::m_LastLine
protected

Definition at line 20 of file Chat.c.

Referenced by AddInternal(), and Init().

◆ m_LineHeight

int Chat::m_LineHeight
protected

Definition at line 19 of file Chat.c.

Referenced by AddInternal(), and Init().

◆ m_Lines

ref array<ref ChatLine> Chat::m_Lines
protected

Definition at line 21 of file Chat.c.

Referenced by AddInternal(), Chat(), Clear(), Destroy(), and Init().

◆ m_RootWidget

Widget Chat::m_RootWidget
protected

Definition at line 18 of file Chat.c.

Referenced by Init().


The documentation for this class was generated from the following file: