File size: 2,521 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
class PluginPlayerStatus extends PluginBase
{
	ref multiMap<int, string> 	m_NotifiersLabel;
	ref multiMap<int, int>		m_NotifiersIndexColor;

	private ref multiMap<int, string>	m_NotifiersIcons;

	void PluginPlayerStatus()
	{
		m_NotifiersLabel = new multiMap<int, string>; // [key] label
		m_NotifiersIndexColor = new multiMap<int, int>; // [key] index, color

		m_NotifiersIcons = new multiMap<int, string>; // [key] iconName
		m_NotifiersIcons.Insert( NTFKEY_HUNGRY, "iconHunger" );
		m_NotifiersIcons.Insert( NTFKEY_THIRSTY, "iconThirsty" );
		m_NotifiersIcons.Insert( NTFKEY_SICK, "iconHealth" );
		m_NotifiersIcons.Insert( NTFKEY_BACTERIA, "iconBacteria" );
		m_NotifiersIcons.Insert( NTFKEY_BLEEDISH, "iconBlood" );
		m_NotifiersIcons.Insert( NTFKEY_FEVERISH, "iconTemperature" );
		m_NotifiersIcons.Insert( NTFKEY_FRACTURE, "iconFracture" );
	}
	
	void SetNotifier( int key, int index = 9, string label = "", int color =  0xFFFFFFFF )
	{
		if ( key )
		{
			if ( m_NotifiersLabel.HasKey( key ) )
			{
				m_NotifiersLabel.Remove( key );
				m_NotifiersIndexColor.Remove( key );
			}

			if ( label != "" ) 
			{
				m_NotifiersLabel.Insert( key, label );
				m_NotifiersIndexColor.Insert( key, index );
				m_NotifiersIndexColor.Insert( key, color );
			}
		}
	}

	void DisplayTendency( int key, int tendency, int status = 1 )
	{
		if ( key )
		{
			// display icon
			int icon_index = 0;  // maybe we'll have several icons for different tendencies
			if ( m_NotifiersIcons.HasKey( key ) )
			{
				string icon_name = m_NotifiersIcons.Get( key ).Get( icon_index );
				Mission mission = GetGame().GetMission();
				if ( mission )
				{
					Hud hud = mission.GetHud();
					if ( hud )
					{
						hud.DisplayNotifier( key, tendency, status );
					}
				}
			}
		}
	}

	void SetBadge( int key, int value )
	{
		if ( key )
		{
			Mission mission = GetGame().GetMission();
			if ( mission )
			{
				Hud hud = mission.GetHud();
				if ( hud )
				{
					hud.DisplayBadge( key, value );
				}
			}
		}
	}

	void SetStamina( int value , int range )
	{
		// Log( String( "SetStamina" + itoa( value) ), LogTemplates.TEMPLATE_JANOSIK );
		Mission mission = GetGame().GetMission();
		if ( mission )
		{
			Hud hud = mission.GetHud();
			if ( hud )
			{
				hud.SetStamina( Math.Clamp( value, 0, range ), range );
			}
		}
	}
	
	void SetStance( int value  )
	{
		Mission mission = GetGame().GetMission();
		if ( mission )
		{
			Hud hud = mission.GetHud();
			if ( hud )
			{
				hud.DisplayStance( value );
			}
		}
	}
}