Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
pluginplayerstatus.c
Go to the documentation of this file.
1class PluginPlayerStatus extends PluginBase
2{
3 ref multiMap<int, string> m_NotifiersLabel;
4 ref multiMap<int, int> m_NotifiersIndexColor;
5
6 private ref multiMap<int, string> m_NotifiersIcons;
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_HEALTHY, "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 = g_Game.GetMission();
52 if ( mission )
53 {
54 Hud hud = mission.GetHud();
55 if ( hud )
56 {
57 hud.DisplayNotifier( key, tendency, status );
58 }
59 }
60 }
61 }
62 }
63
64 void SetBadge( int key, int value )
65 {
66 if ( key )
67 {
68 Mission mission = g_Game.GetMission();
69 if ( mission )
70 {
71 Hud hud = mission.GetHud();
72 if ( hud )
73 {
74 hud.DisplayBadge( key, value );
75 }
76 }
77 }
78 }
79
80 void SetStamina( int value , int range )
81 {
82 // Log( String( "SetStamina" + itoa( value) ), LogTemplates.TEMPLATE_JANOSIK );
83 Mission mission = g_Game.GetMission();
84 if ( mission )
85 {
86 Hud hud = mission.GetHud();
87 if ( hud )
88 {
89 hud.SetStamina( Math.Clamp( value, 0, range ), range );
90 }
91 }
92 }
93
94 void SetStance( int value )
95 {
96 Mission mission = g_Game.GetMission();
97 if ( mission )
98 {
99 Hud hud = mission.GetHud();
100 if ( hud )
101 {
102 hud.DisplayStance( value );
103 }
104 }
105 }
106}
const int NTFKEY_BACTERIA
Definition _constants.c:45
enum eBadgeLevel NTFKEY_THIRSTY
const int NTFKEY_HUNGRY
Definition _constants.c:34
const int NTFKEY_HEALTHY
Definition _constants.c:38
const int NTFKEY_FRACTURE
Definition _constants.c:37
const int NTFKEY_BLEEDISH
Definition _constants.c:42
const int NTFKEY_FEVERISH
Definition _constants.c:39
void DisplayBadge(int key, int value)
Definition gameplay.c:642
void DisplayStance(int stance)
Definition gameplay.c:644
void DisplayNotifier(int key, int tendency, int status)
Definition gameplay.c:641
void SetStamina(int value, int range)
Definition gameplay.c:643
Definition enmath.c:7
Mission class.
Definition gameplay.c:686
Class PluginMessageManager provides some basic Message Distribution mechanics, if you get instance of...
Definition pluginbase.c:2
ref multiMap< int, string > m_NotifiersIcons
void SetStance(int value)
ref multiMap< int, string > m_NotifiersLabel
void DisplayTendency(int key, int tendency, int status=1)
void SetNotifier(int key, int index=9, string label="", int color=0xFFFFFFFF)
void PluginPlayerStatus()
void SetBadge(int key, int value)
void SetStamina(int value, int range)
ref multiMap< int, int > m_NotifiersIndexColor
DayZGame g_Game
Definition dayzgame.c:3942
Mission mission
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'.