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

Protected Member Functions

void PlayerStat (T min, T max, T init, string label, int flags)
 
override void Init (int id)
 
override void SerializeValue (array< ref StatDebugObject > objects, int flags)
 
PlayerStats GetManager ()
 
void Set (T value, string system="")
 
void SetByFloat (float value, string system="")
 
override void SetByFloatEx (float value, string system="")
 
void Add (T value, string system="")
 
override float Get ()
 
override string GetLabel ()
 
override float GetMax ()
 
override float GetMin ()
 
override float GetNormalized ()
 
override array< PlayerStatRecordGetRecords ()
 
void CreateRecord (float value, string system)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx)
 

Protected Attributes

T m_MinValue
 
T m_MaxValue
 
T m_Value
 
string m_ValueLabel
 
int m_Flags
 
ref array< PlayerStatRecordm_Records
 
PlayerStats m_Manager
 

Private Member Functions

void OnStoreSave (ParamsWriteContext ctx)
 
bool OnStoreLoad (ParamsReadContext ctx)
 
void OnRPC (ParamsReadContext ctx)
 
float Get ()
 
string GetLabel ()
 
void SetByFloat (float value)
 
void SetByFloatEx (float value, string system="")
 
bool IsSynced ()
 
array< PlayerStatRecordGetRecords ()
 
void Init (int id)
 
void SerializeValue (array< ref StatDebugObject > objects, int flags)
 
float GetNormalized ()
 
float GetMax ()
 
float GetMin ()
 
int GetType ()
 

Private Attributes

int m_Type
 

Detailed Description

Definition at line 1 of file PlayerStatBase.c.

Member Function Documentation

◆ Add()

void PlayerStatBase::Add ( T value,
string system = "" )
inlineprotected

Definition at line 100 of file PlayerStatBase.c.

101 {
103 }
void Set(T value, string system="")

References m_Value, and Set().

◆ CreateRecord()

void PlayerStatBase::CreateRecord ( float value,
string system )
inlineprotected

Definition at line 135 of file PlayerStatBase.c.

136 {
138 }
float GetTime()
ref array< PlayerStatRecord > m_Records
proto native CGame GetGame()

References GetGame(), and GetTime().

◆ Get() [1/2]

float PlayerStatBase::Get ( )
private

Referenced by GetNormalized(), and SerializeValue().

◆ Get() [2/2]

override float PlayerStatBase::Get ( )
inlineprotected

Definition at line 105 of file PlayerStatBase.c.

106 {
107 return m_Value;
108 }

References m_Value.

◆ GetLabel() [1/2]

string PlayerStatBase::GetLabel ( )
private

Referenced by SerializeValue().

◆ GetLabel() [2/2]

override string PlayerStatBase::GetLabel ( )
inlineprotected

Definition at line 110 of file PlayerStatBase.c.

111 {
112 return m_ValueLabel;
113 }

References m_ValueLabel.

◆ GetManager()

PlayerStats PlayerStatBase::GetManager ( )
inlineprotected

Definition at line 58 of file PlayerStatBase.c.

59 {
60 return m_Manager;
61 }
PlayerStats m_Manager

References m_Manager.

◆ GetMax() [1/2]

float PlayerStatBase::GetMax ( )
private

Referenced by GetNormalized().

◆ GetMax() [2/2]

override float PlayerStatBase::GetMax ( )
inlineprotected

Definition at line 115 of file PlayerStatBase.c.

116 {
117 return m_MaxValue;
118 }

References m_MaxValue.

◆ GetMin() [1/2]

float PlayerStatBase::GetMin ( )
private

Referenced by GetNormalized().

◆ GetMin() [2/2]

override float PlayerStatBase::GetMin ( )
inlineprotected

Definition at line 120 of file PlayerStatBase.c.

121 {
122 return m_MinValue;
123 }

References m_MinValue.

◆ GetNormalized() [1/2]

float PlayerStatBase::GetNormalized ( )
private

◆ GetNormalized() [2/2]

override float PlayerStatBase::GetNormalized ( )
inlineprotected

Definition at line 125 of file PlayerStatBase.c.

126 {
127 return Math.InverseLerp(GetMin(), GetMax(), Get());
128 }
Definition EnMath.c:7
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...

References Get(), GetMax(), GetMin(), and Math::InverseLerp().

◆ GetRecords() [1/2]

array< PlayerStatRecord > PlayerStatBase::GetRecords ( )
private

◆ GetRecords() [2/2]

override array< PlayerStatRecord > PlayerStatBase::GetRecords ( )
inlineprotected

Definition at line 130 of file PlayerStatBase.c.

131 {
132 return m_Records;
133 }

References m_Records.

◆ GetType()

int PlayerStatBase::GetType ( )
inlineprivate

Definition at line 18 of file PlayerStatBase.c.

19 {
20 return m_Type;
21 }

References m_Type.

◆ Init() [1/2]

void PlayerStatBase::Init ( int id)
private

◆ Init() [2/2]

override void PlayerStatBase::Init ( int id)
inlineprotected

Definition at line 47 of file PlayerStatBase.c.

48 {
49 m_Type = id;
50 //m_Manager = manager;
51 }

References m_Type.

◆ IsSynced()

bool PlayerStatBase::IsSynced ( )
private

◆ OnRPC()

void PlayerStatBase::OnRPC ( ParamsReadContext ctx)
private

◆ OnStoreLoad() [1/2]

bool PlayerStatBase::OnStoreLoad ( ParamsReadContext ctx)
private

◆ OnStoreLoad() [2/2]

override bool PlayerStatBase::OnStoreLoad ( ParamsReadContext ctx)
inlineprotected

Definition at line 147 of file PlayerStatBase.c.

148 {
149 //string name;
150
151 //ctx.Read(name);
152 T value;
153 if (ctx.Read(value))
154 m_Value = value;
155 else
156 return false;
157 //PrintString("loading " + GetLabel()+" value:" +m_Value);
158 return true;
159 }

References m_Value.

◆ OnStoreSave() [1/2]

void PlayerStatBase::OnStoreSave ( ParamsWriteContext ctx)
private

◆ OnStoreSave() [2/2]

override void PlayerStatBase::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 140 of file PlayerStatBase.c.

141 {
142 //ctx.Write(m_ValueLabel);
143 //PrintString("saving " + GetLabel()+" value:" +m_Value);
144 ctx.Write(m_Value);
145 }

References m_Value.

◆ PlayerStat()

void PlayerStatBase::PlayerStat ( T min,
T max,
T init,
string label,
int flags )
inlineprotected

Definition at line 36 of file PlayerStatBase.c.

37 {
40 m_Value = init;
42 m_Flags = flags;
43
45 }
enum MagnumStableStateID init

References init, m_MaxValue, m_MinValue, and m_Value.

◆ SerializeValue() [1/2]

void PlayerStatBase::SerializeValue ( array< ref StatDebugObject > objects,
int flags )
private

◆ SerializeValue() [2/2]

override void PlayerStatBase::SerializeValue ( array< ref StatDebugObject > objects,
int flags )
inlineprotected

Definition at line 53 of file PlayerStatBase.c.

54 {
55 objects.Insert(new StatDebugObject(GetLabel(), Get(), eRemoteStatType.PLAYER_STATS));
56 }
string GetLabel()

References Get(), and GetLabel().

◆ Set()

void PlayerStatBase::Set ( T value,
string system = "" )
inlineprotected

Definition at line 63 of file PlayerStatBase.c.

64 {
65 /*
66 Print("setting stat: " + this.GetLabel() + "| value:" +value.ToString());
67
68 if( this.GetLabel() == "Toxicity" )
69 {
70 DebugPrint.LogAndTrace("stack");
71 }
72 */
73 if (value > m_MaxValue)
75 else if (value < m_MinValue)
77 else
78 m_Value = value;
79 //if( GetManager().GetAllowLogs() ) CreateRecord(value, system);
80 }

References m_MaxValue, m_MaxValue, m_MinValue, m_MinValue, and m_Value.

Referenced by Add(), and SetByFloat().

◆ SetByFloat() [1/2]

void PlayerStatBase::SetByFloat ( float value)
private

Referenced by SetByFloatEx().

◆ SetByFloat() [2/2]

void PlayerStatBase::SetByFloat ( float value,
string system = "" )
inlineprotected

Definition at line 82 of file PlayerStatBase.c.

83 {
84 T f = value;
85 Set(f, system);
86
87 }

References Set().

◆ SetByFloatEx() [1/2]

void PlayerStatBase::SetByFloatEx ( float value,
string system = "" )
private

◆ SetByFloatEx() [2/2]

override void PlayerStatBase::SetByFloatEx ( float value,
string system = "" )
inlineprotected

Definition at line 88 of file PlayerStatBase.c.

89 {
91 }
void SetByFloat(float value)

References SetByFloat().

Member Data Documentation

◆ m_Flags

int PlayerStatBase::m_Flags
protected

Definition at line 30 of file PlayerStatBase.c.

◆ m_Manager

PlayerStats PlayerStatBase::m_Manager
protected

Definition at line 33 of file PlayerStatBase.c.

Referenced by GetManager().

◆ m_MaxValue

T PlayerStatBase::m_MaxValue
protected

Definition at line 27 of file PlayerStatBase.c.

Referenced by GetMax(), and Set().

◆ m_MinValue

T PlayerStatBase::m_MinValue
protected

Definition at line 26 of file PlayerStatBase.c.

Referenced by GetMin(), and Set().

◆ m_Records

ref array<PlayerStatRecord> PlayerStatBase::m_Records
protected

Definition at line 32 of file PlayerStatBase.c.

Referenced by GetRecords().

◆ m_Type

int PlayerStatBase::m_Type
private

Definition at line 3 of file PlayerStatBase.c.

Referenced by GetType().

◆ m_Value

T PlayerStatBase::m_Value
protected

Definition at line 28 of file PlayerStatBase.c.

Referenced by Get().

◆ m_ValueLabel

string PlayerStatBase::m_ValueLabel
protected

Definition at line 29 of file PlayerStatBase.c.

Referenced by GetLabel().


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