Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
displayelementbase.c
Go to the documentation of this file.
2 {
3  int m_Value;
4  int m_ValueLast = -99999;
5  int m_Key = 0;
6  int m_Type = 0;
7  int m_Range = 0;
8  int m_Colors[7];
9  string m_Labels[7];
10  int m_Pos = 1;
11  int NUM_OF_BITS;
12  bool m_IsClientOnly = false;
14 
15  PluginPlayerStatus m_ModulePlayerStatus;
16 
17  void DisplayElementBase(PlayerBase player)
18  {
19  m_System = "VirtualHud";
20  m_ModulePlayerStatus = PluginPlayerStatus.Cast(GetPlugin(PluginPlayerStatus));
21  m_Player = player;
22  //SetMaxValue();
23  }
24 
25  //for elements which get their value client side and can be updated much more quickly
26  bool IsClientOnly()
27  {
28  return m_IsClientOnly;
29  }
30 
31  bool IsValueChanged()
32  {
33  return !(m_Value == m_ValueLast);
34  }
35 
36  void UpdateHUD()
37  {
38  m_ValueLast = m_Value;
39  }
40 
41  int GetNumberOfBits()
42  {
43  return NUM_OF_BITS;
44  }
45 
46  void SetValue(int value, int range = 0)
47  {
48  m_Value = value;
49  if (range != 0 )
50  {
51  m_Range = range;
52  }
53  }
54 
55  int GetValue()
56  {
57  return m_Value;
58  }
59 
60  int BitToDec(int mask, int index, int length)
61  {
62  int value = mask & (GetCompareMask() << index);
63  value = value >> index;
64  return value;
65  }
66 
67  int GetCompareMask()
68  {
69  int mask = Math.Pow(2, GetNumberOfBits() ) - 1;
70  return mask;
71  }
72 
73  int GetType()
74  {
75  return m_Type;
76  }
77 
78  int TranslateLevelToStatus(int level)
79  {
80  if( level == DSLevels.WARNING )
81  return 2;
82  if( level == DSLevels.CRITICAL )
83  return 3;
84  if( level == DSLevels.BLINKING )
85  return 4;
86  if( level == DSLevels.EXTRA )
87  return 5;
88  return 1;
89  }
90 }
m_Key
string m_Key
Definition: enentity.c:4
m_Type
eBleedingSourceType m_Type
Definition: bleedingsource.c:25
m_Value
string m_Value
Definition: enentity.c:5
m_System
string m_System
Definition: modifierbase.c:13
m_Pos
vector m_Pos
Definition: remoteplayerstatdebug.c:15
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
PlayerBase
Definition: playerbaseclient.c:1
BitToDec
int BitToDec(int mask, int index, int compareMask)
Definition: displaystatus.c:151
MessageReceiverBase
Definition: messagereceiverbase.c:1
DisplayElementBase
Definition: displayelementbadge.c:1
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
m_ModulePlayerStatus
PluginPlayerStatus m_ModulePlayerStatus
Definition: modifierbase.c:30
GetValue
string GetValue(int pIndex)
Definition: universaltemperaturesource.c:256
DSLevels
DSLevels
Definition: displaystatus.c:1
Math
Definition: enmath.c:6
SetValue
override void SetValue(int value, bool fire_event=true)
Definition: optionselectormultistate.c:226
GetType
override int GetType()
Definition: huddebugwincharagents.c:49