<commit_before>/*
 * Start up and loop the player HUD.
 */

#include "playerHud_defines.hpp"

waitUntil { !isNil "flagPossession" && !isNil "flagInformation" };

while {true} do
{
    sleep 1;

    1000 cutRsc ["PlayerHud", "PLAIN", 0, false];
    _display = uiNameSpace getVariable "PlayerHud";

    // Set Player Health Bar
    _healthBar = _display displayCtrl health_bar;
    _damage = (1 - (damage player));
    _healthBar progressSetPosition (_damage);
    switch (true) do
    {
        case (_damage <= 0.25):
        {
            _healthBar ctrlSetTextColor [0.73,0.12,0.02,0.8];
        };
        case (_damage <= 0.50):
        {
            _healthBar ctrlSetTextColor [1,0.52,0.08,0.8];
        };
        case (_damage <= 0.75):
        {
            _healthBar ctrlSetTextColor [0.78,0.78,0.02,0.8];
        };
        case (_damage <= 1):
        {
            _healthBar ctrlSetTextColor [0.2,0.73,0.14,0.8];
        };
    };

    // Money
    _moneyDisplayBank = _display displayCtrl money_display_bank;
    _moneyDisplayHand = _display displayCtrl money_display_hand;

    _bankString = format ["<t color='#bbbbbb' align='right' size='1.2'>%1<img size='1' image='assets\image\austral.paa'/></t>", [profileNamespace getVariable ["uk_var_cashInBank", 0]] call fnc_formatNumber];
    _handString = format ["<t color='#ffffff' align='right' size='1.2'>%1<img size='1' image='assets\image\austral.paa'/></t>", [profileNamespace getVariable ["uk_var_cashOnHand", 0]] call fnc_formatNumber];
    _moneyDisplayBank ctrlSetStructuredText (parseText _bankString);
    _moneyDisplayHand ctrlSetStructuredText (parseText _handString);

    // Flags
    _flagInterface = [flag_0, flag_1, flag_2, flag_3];

    // Hide unused flag boxes
    if( (count _flagInterface) > (count flagPossession) ) then
    {
        _diff = (count _flagInterface) - (count flagPossession);
        for [{_i = 0}, {_i < _diff}, {_i=_i+1}] do
        {
            (_display displayCtrl (_flagInterface select _i)) ctrlShow false;
            _flagInterface = _flagInterface - [(_flagInterface select _i)];
        };
    };

    {
        _currentInterface = _flagInterface select _forEachIndex;
        _interface = _display displayCtrl _currentInterface;
        _interface ctrlSetText ((flagInformation select _forEachIndex) select 5);

        _holders = _x select 3;
        _contestors = _x select 4;

        if ( _contestors != _holders && _holders != civilian) then
        {
            // TODO: show some sort of contestor notification..
        };

        switch (_holders) do
        {
            case west:
            {
                _interface ctrlSetBackgroundColor [0,0.3,0.94,0.5];
                _interface ctrlSetTextColor [1,1,1,1];
            };
            case east:
            {
                _interface ctrlSetBackgroundColor [0.5,0,0,0.5];
                _interface ctrlSetTextColor [1,1,1,1];
            };
            case resistance:
            {
                _interface ctrlSetBackgroundColor [0,0.5,0,0.5];
                _interface ctrlSetTextColor [1,1,1,1];
            };
            default
            {
                _interface ctrlSetBackgroundColor [1,1,1,0.5];
                _interface ctrlSetTextColor [0,0,0,0.7];
            };
        };
    } forEach flagPossession;
};<commit_msg>use config values for hud colors<commit_after>/*
 * Start up and loop the player HUD.
 */

#include "playerHud_defines.hpp"

waitUntil { !isNil "flagPossession" && !isNil "flagInformation" };

while {true} do
{
    sleep 1;

    1000 cutRsc ["PlayerHud", "PLAIN", 0, false];
    _display = uiNameSpace getVariable "PlayerHud";

    // Set Player Health Bar
    _healthBar = _display displayCtrl health_bar;
    _damage = (1 - (damage player));
    _healthBar progressSetPosition (_damage);
    switch (true) do
    {
        case (_damage <= 0.25):
        {
            _healthBar ctrlSetTextColor [0.73,0.12,0.02,0.8];
        };
        case (_damage <= 0.50):
        {
            _healthBar ctrlSetTextColor [1,0.52,0.08,0.8];
        };
        case (_damage <= 0.75):
        {
            _healthBar ctrlSetTextColor [0.78,0.78,0.02,0.8];
        };
        case (_damage <= 1):
        {
            _healthBar ctrlSetTextColor [0.2,0.73,0.14,0.8];
        };
    };

    // Money
    _moneyDisplayBank = _display displayCtrl money_display_bank;
    _moneyDisplayHand = _display displayCtrl money_display_hand;

    _bankString = format ["<t color='#bbbbbb' align='right' size='1.2'>%1<img size='1' image='assets\image\austral.paa'/></t>", [profileNamespace getVariable ["uk_var_cashInBank", 0]] call fnc_formatNumber];
    _handString = format ["<t color='#ffffff' align='right' size='1.2'>%1<img size='1' image='assets\image\austral.paa'/></t>", [profileNamespace getVariable ["uk_var_cashOnHand", 0]] call fnc_formatNumber];
    _moneyDisplayBank ctrlSetStructuredText (parseText _bankString);
    _moneyDisplayHand ctrlSetStructuredText (parseText _handString);

    // Flags
    _flagInterface = [flag_0, flag_1, flag_2, flag_3];

    // Hide unused flag boxes
    if( (count _flagInterface) > (count flagPossession) ) then
    {
        _diff = (count _flagInterface) - (count flagPossession);
        for [{_i = 0}, {_i < _diff}, {_i=_i+1}] do
        {
            (_display displayCtrl (_flagInterface select _i)) ctrlShow false;
            _flagInterface = _flagInterface - [(_flagInterface select _i)];
        };
    };

    {
        _currentInterface = _flagInterface select _forEachIndex;
        _interface = _display displayCtrl _currentInterface;
        _interface ctrlSetText ((flagInformation select _forEachIndex) select 5);

        _holders = _x select 3;
        _contestors = _x select 4;

        if ( _contestors != _holders && _holders != civilian) then
        {
            // TODO: show some sort of contestor notification..
        };

        _interfaceColors = switch (_holders) do
        {
            case west:
            {
                [(call westColor), [1,1,1,1]];
            };
            case east:
            {
                [(call eastColor), [1,1,1,1]];
            };
            case resistance:
            {
                [(call resistanceColor), [1,1,1,1]];
            };
            default
            {
                [[1,1,1,1], [0,0,0,1]];
            };
        };
        (_interfaceColors select 0) set [3, 0.5];
        _interface ctrlSetBackgroundColor (_interfaceColors select 0);
        _interface ctrlSetTextColor (_interfaceColors select 1);
    } forEach flagPossession;
};
{'fraction_non_alphanumeric': 0.12208421690396849, 'fraction_numerical': 0.033626173886701, 'mean_word_length': 2.225696140693698, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2221907', 'n_tokens_mistral': 2145, 'n_tokens_neox': 2024, 'n_words': 467}