DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PluginPlayerStatus.c
См. документацию.
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_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 );
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 {
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 );
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 {
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
Определения _constants.c:45
const int NTFKEY_SICK
Определения _constants.c:40
enum eBadgeLevel NTFKEY_THIRSTY
const int NTFKEY_HUNGRY
Определения _constants.c:34
const int NTFKEY_FRACTURE
Определения _constants.c:37
const int NTFKEY_BLEEDISH
Определения _constants.c:42
const int NTFKEY_FEVERISH
Определения _constants.c:39
Mission mission
Определения DisplayStatus.c:28
proto native Mission GetMission()
void SetStamina(int value, int range)
Определения gameplay.c:644
void DisplayStance(int stance)
Определения gameplay.c:645
void DisplayBadge(int key, int value)
Определения gameplay.c:643
void DisplayNotifier(int key, int tendency, int status)
Определения gameplay.c:642
Определения gameplay.c:639
Определения EnMath.c:7
Mission class.
Определения gameplay.c:687
void SetStamina(int value, int range)
Определения PluginPlayerStatus.c:80
void PluginPlayerStatus()
Определения PluginPlayerStatus.c:8
void SetStance(int value)
Определения PluginPlayerStatus.c:94
void DisplayTendency(int key, int tendency, int status=1)
Определения PluginPlayerStatus.c:42
ref multiMap< int, string > m_NotifiersLabel
Определения PluginPlayerStatus.c:3
void SetNotifier(int key, int index=9, string label="", int color=0xFFFFFFFF)
Определения PluginPlayerStatus.c:23
ref multiMap< int, int > m_NotifiersIndexColor
Определения PluginPlayerStatus.c:4
ref multiMap< int, string > m_NotifiersIcons
Определения PluginPlayerStatus.c:6
void SetBadge(int key, int value)
Определения PluginPlayerStatus.c:64
Определения PluginBase.c:2
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'.