DayZ 1.24
Loading...
Searching...
No Matches
PluginPlayerStatus.c
Go to the documentation of this file.
1class PluginPlayerStatus extends PluginBase
2{
5
7
9 {
10 m_NotifiersLabel = new multiMap<int, string>; // [key] label
11 m_NotifiersIndexColor = new multiMap<int, int>; // [key] index, color
12
13 m_NotifiersIcons = new multiMap<int, string>; // [key] iconName
14 m_NotifiersIcons.Insert(NTFKEY_HUNGRY, "iconHunger");
15 m_NotifiersIcons.Insert(NTFKEY_THIRSTY, "iconThirsty");
16 m_NotifiersIcons.Insert(NTFKEY_SICK, "iconHealth");
17 m_NotifiersIcons.Insert(NTFKEY_BACTERIA, "iconBacteria");
18 m_NotifiersIcons.Insert(NTFKEY_BLEEDISH, "iconBlood");
19 m_NotifiersIcons.Insert(NTFKEY_FEVERISH, "iconTemperature");
20 m_NotifiersIcons.Insert(NTFKEY_FRACTURE, "iconFracture");
21 }
22
23 void SetNotifier(int key, int index = 9, string label = "", int color = 0xFFFFFFFF)
24 {
25 if (key)
26 {
27 if (m_NotifiersLabel.HasKey(key))
28 {
29 m_NotifiersLabel.Remove(key);
30 m_NotifiersIndexColor.Remove(key);
31 }
32
33 if (label != "")
34 {
35 m_NotifiersLabel.Insert(key, label);
36 m_NotifiersIndexColor.Insert(key, index);
37 m_NotifiersIndexColor.Insert(key, color);
38 }
39 }
40 }
41
42 void DisplayTendency(int key, int tendency, int status = 1)
43 {
44 if (key)
45 {
46 // display icon
47 int icon_index = 0; // maybe we'll have several icons for different tendencies
48 if (m_NotifiersIcons.HasKey(key))
49 {
50 string icon_name = m_NotifiersIcons.Get(key).Get(icon_index);
51 Mission mission = GetGame().GetMission();
52 if (mission)
53 {
55 if (hud)
56 hud.DisplayNotifier(key, tendency, status);
57 }
58 }
59 }
60 }
61
62 void SetBadge(int key, int value)
63 {
64 if (key)
65 {
66 Mission mission = GetGame().GetMission();
67 if (mission)
68 {
70 if (hud)
71 hud.DisplayBadge(key, value);
72 }
73 }
74 }
75
76 void SetStamina(int value, int range)
77 {
78 // Log( String( "SetStamina" + itoa( value) ), LogTemplates.TEMPLATE_JANOSIK );
79 Mission mission = GetGame().GetMission();
80 if (mission)
81 {
83 if (hud)
84 hud.SetStamina(Math.Clamp(value, 0, range), range);
85 }
86 }
87
88 void SetStance(int value)
89 {
90 Mission mission = GetGame().GetMission();
91 if (mission)
92 {
94 if (hud)
95 hud.DisplayStance(value);
96 }
97 }
98}
const int NTFKEY_BACTERIA
Definition _constants.c:45
const int NTFKEY_SICK
Definition _constants.c:40
enum eBadgeLevel NTFKEY_THIRSTY
const int NTFKEY_HUNGRY
Definition _constants.c:34
const int NTFKEY_FRACTURE
Definition _constants.c:37
const int NTFKEY_BLEEDISH
Definition _constants.c:42
const int NTFKEY_FEVERISH
Definition _constants.c:39
Mission mission
Definition EnMath.c:7
Mission class.
Definition gameplay.c:668
Hud GetHud()
Definition gameplay.c:701
void SetStamina(int value, int range)
void PluginPlayerStatus()
void SetStance(int value)
void DisplayTendency(int key, int tendency, int status=1)
ref multiMap< int, string > m_NotifiersLabel
void SetNotifier(int key, int index=9, string label="", int color=0xFFFFFFFF)
ref multiMap< int, int > m_NotifiersIndexColor
ref multiMap< int, string > m_NotifiersIcons
void SetBadge(int key, int value)
proto native CGame GetGame()
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'.