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

Protected Member Functions

int CalculateTendency (float delta, float inctresholdlow, float inctresholdmed, float inctresholdhigh, float dectresholdlow, float dectresholdmed, float dectresholdhigh)
 
eBadgeLevel DetermineBadgeLevel (float value, float lvl_1, float lvl_2, float lvl_3)
 
void DisplayBadge ()
 
void HideBadge ()
 
float GetObservedValue ()
 

Private Member Functions

void NotifierBase (NotifiersManager manager)
 
bool IsTimeToTick (int current_time)
 
VirtualHud GetVirtualHud ()
 
int GetNotifierType ()
 
string GetName ()
 
bool IsActive ()
 
void SetActive (bool state)
 
void DisplayTendency (float delta)
 
void AddToCyclicBuffer (float value)
 
float ReadFromCyclicBuffer (int index)
 
float GetDeltaAvaraged ()
 
void SmoothOutFloatValues (array< float > values)
 
void OnTick (float current_time)
 

Private Attributes

float m_DeltaT
 
ref Timer m_Timer1
 
PlayerBase m_Player
 
int m_Type
 
NotifiersManager m_Manager
 
int m_TendencyBufferSize = 3
 
const int TENDENCY_BUFFER_SIZE = 30
 
bool m_ShowTendency
 
bool m_Active
 
int m_TickInterval
 
int m_TickIntervalLastTick
 
float m_TendencyBuffer [TENDENCY_BUFFER_SIZE]
 
int m_TendencyBufferWriteIterator
 
float m_LastTendency
 
float m_LastMA
 
bool m_FirstPass = true
 
PluginPlayerStatus m_ModulePlayerStatus
 

Detailed Description

Definition at line 1 of file NotifierBase.c.

Constructor & Destructor Documentation

◆ NotifierBase()

void NotifierBase::NotifierBase ( NotifiersManager manager)
inlineprivate

Definition at line 31 of file NotifierBase.c.

32 {
33
34 //m_Timer1 = new Timer();
35 m_ModulePlayerStatus = PluginPlayerStatus.Cast(GetPlugin(PluginPlayerStatus));
36 m_Active = true;
38 m_Player = manager.GetPlayer();
39 m_TickInterval = 1000;
40 manager.RegisterItself(GetNotifierType(), this);
41 }
PluginBase GetPlugin(typename plugin_type)
PluginPlayerStatus m_ModulePlayerStatus
PlayerBase m_Player
Definition NotifierBase.c:6
NotifiersManager m_Manager
Definition NotifierBase.c:8
int GetNotifierType()

References GetNotifierType(), GetPlugin(), m_Active, m_Manager, m_ModulePlayerStatus, m_Player, and m_TickInterval.

Member Function Documentation

◆ AddToCyclicBuffer()

void NotifierBase::AddToCyclicBuffer ( float value)
inlineprivate

◆ CalculateTendency()

int NotifierBase::CalculateTendency ( float delta,
float inctresholdlow,
float inctresholdmed,
float inctresholdhigh,
float dectresholdlow,
float dectresholdmed,
float dectresholdhigh )
inlineprotected

Definition at line 167 of file NotifierBase.c.

168 {
176 //Print(" " + delta + " tendency: " + tendency +" " + this);
177 return tendency;
178 }
const int TENDENCY_INC_LOW
Definition _constants.c:53
const int TENDENCY_DEC_HIGH
Definition _constants.c:58
const int TENDENCY_DEC_MED
Definition _constants.c:57
const int TENDENCY_INC_MED
Definition _constants.c:54
const int TENDENCY_DEC_LOW
Definition _constants.c:56
const int TENDENCY_INC_HIGH
Definition _constants.c:55
const int TENDENCY_STABLE
Definition _constants.c:52

References TENDENCY_DEC_HIGH, TENDENCY_DEC_LOW, TENDENCY_DEC_MED, TENDENCY_INC_HIGH, TENDENCY_INC_LOW, TENDENCY_INC_MED, and TENDENCY_STABLE.

Referenced by BloodNotfr::DisplayTendency(), HealthNotfr::DisplayTendency(), HungerNotfr::DisplayTendency(), ThirstNotfr::DisplayTendency(), and WarmthNotfr::DisplayTendency().

◆ DetermineBadgeLevel()

eBadgeLevel NotifierBase::DetermineBadgeLevel ( float value,
float lvl_1,
float lvl_2,
float lvl_3 )
inlineprotected

Definition at line 181 of file NotifierBase.c.

182 {
184 if (value >= lvl_1) level = eBadgeLevel.FIRST;
185 if (value >= lvl_2) level = eBadgeLevel.SECOND;
186 if (value >= lvl_3) level = eBadgeLevel.THIRD;
187 return level;
188 }
eBadgeLevel
Definition _constants.c:2

Referenced by InjuredLegNotfr::DisplayBadge(), and StuffedNotfr::DisplayBadge().

◆ DisplayBadge()

void NotifierBase::DisplayBadge ( )
inlineprotected

Definition at line 191 of file NotifierBase.c.

192 {
193 }

Referenced by OnTick().

◆ DisplayTendency()

void NotifierBase::DisplayTendency ( float delta)
inlineprivate

Definition at line 75 of file NotifierBase.c.

76 {
77 }

Referenced by OnTick().

◆ GetDeltaAvaraged()

float NotifierBase::GetDeltaAvaraged ( )
inlineprivate

Definition at line 98 of file NotifierBase.c.

99 {
101 for (int i = 0; i < m_TendencyBufferSize; i++)
103 //SmoothOutFloatValues(values);
104
105 //--------------------------------------------------------------------------
106
107 float values_sum = 0;
108 //PrintString("----------------------------");
109 //PrintString("tendency:" + this.ClassName() );
110 for (i = 0; i < values.Count(); i++)
111 {
112 float value = values.Get(i);
113 values_sum += value;
114 //PrintString( value.ToString() );
115 }
116
118 if (m_FirstPass)
119 {
120 m_LastMA = sma;
121 m_FirstPass = false;
122 }
123
124 float tnd = sma - m_LastMA;
125 m_LastMA = sma;
126 /*
127 PrintString(GetName()+" tendency:" + tnd.ToString() );
128 PrintString("----------------------------");
129 */
130 return tnd;
131
132 //--------------------------------------------------------------------------
133
134 }
float ReadFromCyclicBuffer(int index)

References m_FirstPass, m_LastMA, m_TendencyBufferSize, and ReadFromCyclicBuffer().

Referenced by OnTick().

◆ GetName()

string NotifierBase::GetName ( )
inlineprivate

Definition at line 59 of file NotifierBase.c.

60 {
61 return this.ClassName() + " Notifier";
62 }

◆ GetNotifierType()

int NotifierBase::GetNotifierType ( )
inlineprivate

Definition at line 54 of file NotifierBase.c.

55 {
56 return m_Type;
57 }

References m_Type.

Referenced by NotifierBase().

◆ GetObservedValue()

float NotifierBase::GetObservedValue ( )
inlineprotected

Definition at line 199 of file NotifierBase.c.

200 {
201 return 0;
202 }

Referenced by OnTick().

◆ GetVirtualHud()

◆ HideBadge()

void NotifierBase::HideBadge ( )
inlineprotected

Definition at line 195 of file NotifierBase.c.

196 {
197 }

Referenced by SetActive().

◆ IsActive()

bool NotifierBase::IsActive ( )
inlineprivate

Definition at line 64 of file NotifierBase.c.

65 {
66 return m_Active;
67 }

References m_Active.

◆ IsTimeToTick()

bool NotifierBase::IsTimeToTick ( int current_time)
inlineprivate

Definition at line 43 of file NotifierBase.c.

44 {
46 }
int m_TickIntervalLastTick

References m_TickInterval, and m_TickIntervalLastTick.

◆ OnTick()

void NotifierBase::OnTick ( float current_time)
inlineprivate

Definition at line 152 of file NotifierBase.c.

153 {
154 //------------
155 /*
156 float time = GetGame().GetTime();
157 Print("ticking notifier "+ this.ClassName() +" for player " + m_Player.ToString() + " at time:" + time.ToString());
158 */
159 //------------
161 DisplayBadge();
164
165 }
void DisplayTendency(float delta)
void AddToCyclicBuffer(float value)
float GetDeltaAvaraged()
void DisplayBadge()
float GetObservedValue()

References AddToCyclicBuffer(), DisplayBadge(), DisplayTendency(), GetDeltaAvaraged(), GetObservedValue(), m_ShowTendency, and m_TickIntervalLastTick.

◆ ReadFromCyclicBuffer()

float NotifierBase::ReadFromCyclicBuffer ( int index)
inlineprivate

◆ SetActive()

void NotifierBase::SetActive ( bool state)
inlineprivate

Definition at line 69 of file NotifierBase.c.

70 {
72 if (!state) HideBadge();
73 }

References HideBadge(), and m_Active.

Referenced by ActivateByType(), and DeactivateByType().

◆ SmoothOutFloatValues()

void NotifierBase::SmoothOutFloatValues ( array< float > values)
inlineprivate

Definition at line 136 of file NotifierBase.c.

137 {
138 float value1;
139 float value2;
140 for (int i = 0; i < values.Count() - 1; i++)
141 {
142 value1 = values.Get(i);
143 value2 = values.Get(i + 1);
144 float average = (value1 + value2) / 2;
145 values.Set(i, average);
146 values.Set(i + 1, average);
147 }
148 int index = values.Count() - 1;
149 values.Set(index, value2);
150 }

Member Data Documentation

◆ m_Active

◆ m_DeltaT

float NotifierBase::m_DeltaT
private

Definition at line 4 of file NotifierBase.c.

◆ m_FirstPass

bool NotifierBase::m_FirstPass = true
private

Definition at line 26 of file NotifierBase.c.

Referenced by GetDeltaAvaraged().

◆ m_LastMA

float NotifierBase::m_LastMA
private

Definition at line 25 of file NotifierBase.c.

Referenced by GetDeltaAvaraged().

◆ m_LastTendency

float NotifierBase::m_LastTendency
private

Definition at line 24 of file NotifierBase.c.

◆ m_Manager

NotifiersManager NotifierBase::m_Manager
private

Definition at line 8 of file NotifierBase.c.

Referenced by NotifierBase().

◆ m_ModulePlayerStatus

PluginPlayerStatus NotifierBase::m_ModulePlayerStatus
private

Definition at line 29 of file NotifierBase.c.

Referenced by NotifierBase().

◆ m_Player

◆ m_ShowTendency

bool NotifierBase::m_ShowTendency
private

Definition at line 11 of file NotifierBase.c.

Referenced by AddToCyclicBuffer(), and OnTick().

◆ m_TendencyBuffer

float NotifierBase::m_TendencyBuffer[TENDENCY_BUFFER_SIZE]
private

Definition at line 22 of file NotifierBase.c.

Referenced by AddToCyclicBuffer(), and ReadFromCyclicBuffer().

◆ m_TendencyBufferSize

int NotifierBase::m_TendencyBufferSize = 3
private

◆ m_TendencyBufferWriteIterator

int NotifierBase::m_TendencyBufferWriteIterator
private

Definition at line 23 of file NotifierBase.c.

Referenced by AddToCyclicBuffer(), and ReadFromCyclicBuffer().

◆ m_TickInterval

int NotifierBase::m_TickInterval
private

Definition at line 20 of file NotifierBase.c.

Referenced by HealthNotfr::HealthNotfr(), IsTimeToTick(), and NotifierBase().

◆ m_TickIntervalLastTick

int NotifierBase::m_TickIntervalLastTick
private

Definition at line 21 of file NotifierBase.c.

Referenced by IsTimeToTick(), and OnTick().

◆ m_Timer1

ref Timer NotifierBase::m_Timer1
private

Definition at line 5 of file NotifierBase.c.

◆ m_Type

int NotifierBase::m_Type
private

Definition at line 7 of file NotifierBase.c.

Referenced by GetNotifierType().

◆ TENDENCY_BUFFER_SIZE

const int NotifierBase::TENDENCY_BUFFER_SIZE = 30
private

Definition at line 10 of file NotifierBase.c.


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