|
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>; |
|
m_NotifiersIndexColor = new multiMap<int, int>; |
|
|
|
m_NotifiersIcons = new multiMap<int, string>; |
|
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 ) |
|
{ |
|
|
|
int icon_index = 0; |
|
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 ) |
|
{ |
|
|
|
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 ); |
|
} |
|
} |
|
} |
|
} |
|
|