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

Protected Member Functions

void WrittenNoteData (ItemBase parent)
 
void OnRPC (PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
 
void InitNoteInfo (ItemBase pen=null, ItemBase paper=null)
 
bool GetNoteInfo (out ItemBase pen, out ItemBase paper)
 
string GetNoteText ()
 
void SetNoteText (string text)
 
void DepleteWritingImplement (notnull ItemBase pen, string old_text, string new_text)
 

Protected Attributes

ItemBase m_WritingImplement
 
ItemBase m_Paper
 
string m_SimpleText
 

Detailed Description

Definition at line 1 of file WrittenNoteData.c.

Constructor & Destructor Documentation

◆ WrittenNoteData()

void WrittenNoteData::WrittenNoteData ( ItemBase parent)
inlineprotected

Definition at line 8 of file WrittenNoteData.c.

9 {
10
11 }

Member Function Documentation

◆ DepleteWritingImplement()

void WrittenNoteData::DepleteWritingImplement ( notnull ItemBase pen,
string old_text,
string new_text )
inlineprotected

Definition at line 77 of file WrittenNoteData.c.

78 {
79 float qty_per_char = 1.0;
80 float decrease = Math.Clamp((new_text.Length() - old_text.Length()), 0, pen.GetQuantityMax());
81 pen.AddQuantity(-(qty_per_char * decrease));
82 }
Definition EnMath.c:7
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 Math::Clamp().

Referenced by OnRPC().

◆ GetNoteInfo()

bool WrittenNoteData::GetNoteInfo ( out ItemBase pen,
out ItemBase paper )
inlineprotected

Definition at line 59 of file WrittenNoteData.c.

60 {
62 paper = m_Paper;
63 //handwriting = m_Handwriting;
64 return pen && paper;
65 }
ItemBase m_WritingImplement

References m_Paper, and m_WritingImplement.

Referenced by OnRPC().

◆ GetNoteText()

string WrittenNoteData::GetNoteText ( )
inlineprotected

Definition at line 67 of file WrittenNoteData.c.

68 {
69 return m_SimpleText;
70 }

References m_SimpleText.

◆ InitNoteInfo()

void WrittenNoteData::InitNoteInfo ( ItemBase pen = null,
ItemBase paper = null )
inlineprotected

Definition at line 52 of file WrittenNoteData.c.

53 {
55 m_Paper = paper;
56 //m_Handwriting = handwriting;
57 }

References m_Paper, and m_WritingImplement.

◆ OnRPC()

void WrittenNoteData::OnRPC ( PlayerIdentity sender,
int rpc_type,
ParamsReadContext ctx )
inlineprotected

Definition at line 13 of file WrittenNoteData.c.

14 {
16
17 //sent from server, executed on client
18 if (rpc_type == ERPCs.RPC_WRITE_NOTE)
19 {
20 if (ctx.Read(param))
21 SetNoteText(param.param1);
22
23 g_Game.GetMission().SetNoteMenu(g_Game.GetUIManager().EnterScriptedMenu(MENU_NOTE, GetGame().GetUIManager().GetMenu())); //NULL means no parent
24
27 //int handwriting;
28
29 if (GetNoteInfo(pen, paper))
30 g_Game.GetMission().GetNoteMenu().InitNoteWrite(paper, pen, m_SimpleText);
31 }
32 //sent from client (NoteMenu), executed on server
33 if (rpc_type == ERPCs.RPC_WRITE_NOTE_CLIENT)
34 {
35 if (ctx.Read(param))
36 {
37 string old_string = m_SimpleText;
38 SetNoteText(param.param1);
40 }
41 }
42 if (rpc_type == ERPCs.RPC_READ_NOTE)
43 {
44 if (ctx.Read(param))
45 SetNoteText(param.param1);
46
47 g_Game.GetMission().SetNoteMenu(g_Game.GetUIManager().EnterScriptedMenu(MENU_NOTE, GetGame().GetUIManager().GetMenu())); //NULL means no parent
48 g_Game.GetMission().GetNoteMenu().InitNoteRead(m_SimpleText);
49 }
50 }
DayZGame g_Game
Definition DayZGame.c:3528
ERPCs
Definition ERPCs.c:2
void DepleteWritingImplement(notnull ItemBase pen, string old_text, string new_text)
bool GetNoteInfo(out ItemBase pen, out ItemBase paper)
void SetNoteText(string text)
proto native CGame GetGame()
const int MENU_NOTE
Definition constants.c:180

References DepleteWritingImplement(), g_Game, GetGame(), GetNoteInfo(), m_SimpleText, m_WritingImplement, MENU_NOTE, and SetNoteText().

◆ SetNoteText()

void WrittenNoteData::SetNoteText ( string text)
inlineprotected

Definition at line 72 of file WrittenNoteData.c.

73 {
74 m_SimpleText = MiscGameplayFunctions.SanitizeString(text);
75 }

References m_SimpleText.

Referenced by OnRPC().

Member Data Documentation

◆ m_Paper

ItemBase WrittenNoteData::m_Paper
protected

Definition at line 4 of file WrittenNoteData.c.

Referenced by GetNoteInfo(), and InitNoteInfo().

◆ m_SimpleText

string WrittenNoteData::m_SimpleText
protected

Definition at line 6 of file WrittenNoteData.c.

Referenced by GetNoteText(), OnRPC(), and SetNoteText().

◆ m_WritingImplement

ItemBase WrittenNoteData::m_WritingImplement
protected

Definition at line 3 of file WrittenNoteData.c.

Referenced by GetNoteInfo(), InitNoteInfo(), and OnRPC().


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