move-battalion-struct-to-missioncfg #15

Merged
hizumi merged 4 commits from move-battalion-struct-to-missioncfg into main 2024-02-01 23:19:36 -06:00
19 changed files with 672 additions and 119 deletions

View File

@@ -1,4 +1,4 @@
//-------------------------------------------DESCRIPTION.EXT-----------------------------------------------------------------
//-------------------------------------------DESCRIPTION.EXT-----------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -18,6 +18,7 @@
#include "mission_settings.hpp"
#include "functions\definitions\DisallowedEquipment.hpp"
#include "functions\definitions\BattalionInfo.hpp"
//-------------------------------------------MISSION INFO--------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -15,15 +15,22 @@ class milsim
};
class fbcb2 {
class addFBCB2DiaryEntries { postInit = 1; };
class initFBCB2 { postInit = 1; };
class processFBCB2Callsigns {};
class processFBCB2FixedWingAssets {};
class processFBCB2RotaryAssets {};
class processFBCB2RadioFrequencies {};
class processFBCB2SmokeColors {};
class processFBCB2Environment {};
class messageFBCB2AssetStatus {};
class hintFBCB2AssetStatus {};
};
class fbcb2_util {
file = "functions\fbcb2\util";
class createOrUpdateDiaryRecord {};
};
class fbcb2_radioFrequencies {
file = "functions\fbcb2\radioFrequencies";
class formatRadioElementForDiary {};
class generateElementFrequencyRecordText {};
};
class client {
@@ -75,6 +82,9 @@ class milsim
class logMissionInfo { postInit = 1; };
class addPlayerInfoToArray {};
class log {};
class padString {};
class recurseSubclasses {};
class getBattalionCfg {};
};
};

View File

@@ -0,0 +1,253 @@
// BattalionInfo.hpp
// Defines the structure of the Battalion, allowing properties to be easily changed and updated
// This file is included in description.ext
// Define the callsigns for the Battalion
#define COMMAND_CALLSIGN SPARTAN
#define RRC_CALLSIGN TIGER
#define MEDIC_CALLSIGN LIFELINE
#define ALPHA_CALLSIGN BLACKJACK
#define ECHO_CALLSIGN ZOOMER
#define WPN_CALLSIGN BLACKFOOT
// Define the frequencies for the Battalion
#define FREQ_BATTALION 45
#define FREQ_BATTALION_MEDICAL_INTERCOM 91.1
#define FREQ_ALL_MEDICAL_SR 121.5
#define FREQ_ALPHA_COMPANY 40
#define FREQ_PLATOON1_SR 100
#define FREQ_PLATOON1_LR 41
#define FREQ_PLATOON1_RTO 101
#define FREQ_PLATOON2_SR 200
#define FREQ_PLATOON2_LR 42
#define FREQ_PLATOON2_RTO 201
#define FREQ_ECHO_FLIGHT_INTERCOM 30
#define FREQ_ECHO_FLIGHT_CAS 35
#define FREQ_ECHO_FLIGHT_LOGISTICS 35.1
#define FREQ_ECHO_GROUND 80
#define FREQ_ECHO_GROUND_LOGISTICS 81
#define FREQ_ECHO_ARTY 82
#define FREQ_ECHO_ARTY_INTERCOM 155
#define FREQ_CONVOY 50
// Define the text colors to appear in diary entries
#define LVL1_TEXT_COLOR "#7c887e"
#define LVL2_TEXT_COLOR "#bab79f"
#define LVL3_TEXT_COLOR "#91967f"
#define LVL4_TEXT_COLOR "#d3d2cd"
// All elements and subclasses should have the following properties:
// callsign: the callsign of the element
// textColor: the color of the text for the element
// frequencies: an array of frequencies for the element in the format:
// {roleWithinElement, {primarySR, additionalSR}, {primaryLR, additionalLR}}
// Battalion-level elements under Command should have the following additional properties:
// shortDescription: a short description of the element's place in the Battalion
// System macros
#define CALLSIGN_ELEMENT(callsign,element) callsign##element
class BattalionInfo {
class Command {
callsign = COMMAND_CALLSIGN;
shortDescription = "Battalion Command";
textColor = LVL1_TEXT_COLOR;
// frequencies are in format:
// {roleWithinElement, {primarySR, additionalSR}, {primaryLR, additionalLR}}
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}},
{"Actual", {}, {FREQ_BATTALION}},
{"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
};
class RRC { // WIP
callsign = RRC_CALLSIGN;
shortDescription = "RRC";
textColor = LVL2_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}},
{"Actual", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
};
};
class BattalionMedical { // WIP
callsign = MEDIC_CALLSIGN;
shortDescription = "Battalion Medical";
textColor = LVL2_TEXT_COLOR;
frequencies[] = {
{"Contact", {FREQ_ALL_MEDICAL_SR}, {FREQ_BATTALION}},
{"Actual", {FREQ_BATTALION_MEDICAL_INTERCOM, FREQ_ALL_MEDICAL_SR}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_LOGISTICS}},
{"General", {FREQ_BATTALION_MEDICAL_INTERCOM, FREQ_ALL_MEDICAL_SR}, {}}
};
};
class WeaponsSquad { // WIP
callsign = WPN_CALLSIGN;
shortDescription = "Special Weapons Squad";
textColor = LVL2_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}}
};
};
class AlphaCompany {
callsign = ALPHA_CALLSIGN;
shortDescription = "Alpha Company";
textColor = LVL2_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_ALPHA_COMPANY, FREQ_BATTALION}}
};
class Platoon1 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-6);
textColor = LVL3_TEXT_COLOR;
frequencies[] = {
{"Actual", {FREQ_PLATOON1_SR, FREQ_PLATOON1_RTO}, {FREQ_PLATOON1_LR, FREQ_ALPHA_COMPANY}},
{"Romeo", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS, FREQ_ECHO_FLIGHT_LOGISTICS}}
};
class Squad1 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-1);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Actual", {110, FREQ_PLATOON1_SR}, {FREQ_PLATOON1_LR}},
{"Alpha Team", {111, 110}, {}},
{"Bravo Team", {112, 110}, {}},
{"Medic", {110, FREQ_ALL_MEDICAL_SR}, {}}
};
};
class Squad2 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-2);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Actual", {120, FREQ_PLATOON1_SR}, {FREQ_PLATOON1_LR}},
{"Alpha Team", {121, 120}, {}},
{"Bravo Team", {122, 120}, {}},
{"Medic", {120, FREQ_ALL_MEDICAL_SR}, {}}
};
};
class Squad3 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 1-3);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Actual", {130, FREQ_PLATOON1_SR}, {FREQ_PLATOON1_LR}},
{"Alpha Team", {131, 130}, {}},
{"Bravo Team", {132, 130}, {}},
{"Medic", {130, FREQ_ALL_MEDICAL_SR}, {}}
};
};
};
class Platoon2 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-6);
textColor = LVL3_TEXT_COLOR;
frequencies[] = {
{"Actual", {FREQ_PLATOON2_SR, FREQ_PLATOON2_RTO}, {FREQ_PLATOON2_LR, FREQ_ALPHA_COMPANY}}
};
class Squad1 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-1);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Actual", {210, FREQ_PLATOON2_SR}, {FREQ_PLATOON2_LR}},
{"Alpha Team", {211, 210}, {}},
{"Bravo Team", {212, 210}, {}},
{"Medic", {210, FREQ_ALL_MEDICAL_SR}, {}}
};
};
class Squad2 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-2);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Actual", {220, FREQ_PLATOON2_SR}, {FREQ_PLATOON2_LR}},
{"Alpha Team", {221, 220}, {}},
{"Bravo Team", {222, 220}, {}},
{"Medic", {220, FREQ_ALL_MEDICAL_SR}, {}}
};
};
class Squad3 {
callsign = CALLSIGN_ELEMENT(ALPHA_CALLSIGN, 2-3);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Actual", {230, FREQ_PLATOON2_SR}, {FREQ_PLATOON2_LR}},
{"Alpha Team", {231, 230}, {}},
{"Bravo Team", {232, 230}, {}},
{"Medic", {230, FREQ_ALL_MEDICAL_SR}, {}}
};
};
};
};
class EchoCompany {
callsign = ECHO_CALLSIGN;
shortDescription = "Echo Company";
textColor = LVL2_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}},
{"Actual", {}, {FREQ_BATTALION}}
};
class Flight {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, FLIGHT);
textColor = LVL3_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}},
{"Actual", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_BATTALION}},
{"CAS Support", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_ECHO_FLIGHT_CAS}},
{"Logistics", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_ECHO_FLIGHT_LOGISTICS}}
};
};
class Ground {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, GROUND);
textColor = LVL3_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}},
{"Actual", {}, {FREQ_ECHO_GROUND, FREQ_BATTALION}}
};
class Logistics {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, LOGISTICS);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_ECHO_GROUND}},
{"Actual", {}, {FREQ_ECHO_GROUND_LOGISTICS, FREQ_ECHO_GROUND}},
{"General", {}, {FREQ_ECHO_GROUND_LOGISTICS}},
{"Convoy", {}, {FREQ_CONVOY}}
};
};
class Attack {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ATTACK);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}},
{"Actual", {}, {FREQ_ECHO_GROUND}},
{"General", {}, {FREQ_ECHO_GROUND}},
{"Convoy", {}, {FREQ_CONVOY}}
};
};
class Artillery {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ARTILLERY);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"General", {FREQ_ECHO_ARTY_INTERCOM}, {FREQ_ECHO_GROUND, FREQ_ECHO_ARTY}}
};
};
};
};
};
};

View File

@@ -1,10 +0,0 @@
if ( !hasInterface ) exitWith {};
player createDiarySubject["Status","FBCB2 - Status"];
player createDiarySubject["Intel","FBCB2 - Combat Msgs"];
player createDiarySubject["Messages","FBCB2 - Messages"];
diag_log text "[MILSIM] (fbcb2) diary entries added";
nil;

View File

@@ -1,8 +1,32 @@
if ( !hasInterface ) exitWith {};
waitUntil { !isNil "milsim_complete" };
[] call milsim_fnc_processFBCB2Callsigns;
milsim_fbcb2_recordTitleColor = "#ff6666";
milsim_fbcb2_recordTitleFont = "PuristaMedium";
milsim_fbcb2_recordTitleSize = 20;
milsim_fbcb2_recordTextHeaderSize = 16;
milsim_fbcb2_recordTextBodySize = 14;
milsim_fbcb2_subjectStatusID = "FBCB2_Status";
milsim_fbcb2_subjectIntelID = "FBCB2_Intel";
milsim_fbcb2_subjectMessagesID = "FBCB2_Messages";
milsim_fbcb2_subjectFrequenciesID = "FBCB2_Frequencies";
player createDiarySubject[milsim_fbcb2_subjectStatusID, "FBCB2 - Status"];
player createDiarySubject[milsim_fbcb2_subjectMessagesID, "FBCB2 - Messages"];
player createDiarySubject[milsim_fbcb2_subjectIntelID, "FBCB2 - Intel"];
player createDiarySubject[milsim_fbcb2_subjectFrequenciesID, "FBCB2 - Frequencies"];
// store records in format:
// [subject, [
// [title, diaryRecord]
// ]]
milsim_fbcb2_diaryRecords = createHashMap;
// populate diary
[] call milsim_fnc_processFBCB2FixedWingAssets;
[] call milsim_fnc_processFBCB2RotaryAssets;
[] call milsim_fnc_processFBCB2RadioFrequencies;

View File

@@ -1,22 +0,0 @@
_text = "
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
<br/><br/>
<font color='#00FF00' size='16'>SPARTAN</font><br/>
Command
<br/><br/>
<font color='#00FF00' size='16'>BLACKJACK</font><br/>
Alpha Platoon
<br/><br/>
<font color='#00FF00' size='16'>ZOOMER</font><br/>
Echo
<br/><br/>
<font color='#00FF00' size='16'>TIGER</font><br/>
RRC
<br/><br/>
<font color='#00FF00' size='16'>BLACKFOOT</font><br/>
Weapons Squad
<br/><br/>
";
player createDiaryRecord ["Status", ["MDS - COMMAND - CALLSIGNS", _text]];

View File

@@ -1,16 +1,45 @@
_sunTimes = date call BIS_fnc_sunriseSunsetTime;
private _recordTitle = "MDS - INTEL - ENVIRONMENT";
_text = "
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
<br/><br/>
<font size='16' color='#4A86E8'>Local Sunrise</font>
<br/>
<font size='20' color='#FF0000'>" + ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString) + "</font>
<br/><br/>
<font size='16' color='#6AA84F'>Local Sunset</font>
<br/>
<font size='20' color='#FF0000'>" + ([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString) + "</font>
<br/><br/>
";
private _text = [
format[
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
]
];
player createDiaryRecord ["Status", ["MDS - INTEL - ENVIRONMENT", _text]];
private _sunriseColor = "#4A86E8";
private _sunsetColor = "#6AA84F";
private _whiteColor = "#FFFFFF";
private _sunTimes = date call BIS_fnc_sunriseSunsetTime;
_text pushBack format[
"<font size='%1' color='%2'>Local Sunrise</font><br/>
<font size='%3' color='%4'>%5</font><br/><br/>",
milsim_fbcb2_recordTextHeaderSize,
_sunriseColor,
milsim_fbcb2_recordTextBodySize,
_whiteColor,
([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString)
];
_text pushBack format[
"<font size='%1' color='%2'>Local Sunset</font><br/>
<font size='%3' color='%4'>%5</font><br/><br/>",
milsim_fbcb2_recordTextHeaderSize,
_sunsetColor,
milsim_fbcb2_recordTextBodySize,
_whiteColor,
([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)
];
_text = _text joinString "";
[
milsim_fbcb2_subjectIntelID,
_recordTitle,
_text
] call milsim_fnc_createOrUpdateDiaryRecord;

View File

@@ -1,4 +1,6 @@
_assetList = missionNamespace getVariable "milsim_var_fixedAssets";
private _recordTitle = "MDS - ASSETS - FIXED";
private _assetList = missionNamespace getVariable "milsim_var_fixedAssets";
_text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>";
@@ -14,6 +16,11 @@ _text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ----
} foreach _assetList;
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_fixedAssets""] call milsim_fnc_messageFBCB2AssetStatus'>Run Report on local node?</execute>";
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_fixedAssets""] call milsim_fnc_hintFBCB2AssetStatus'>Run Report on local node?</execute>";
player createDiaryRecord ["Status", ["MDS - ASSETS - FIXED", _text]];
[
milsim_fbcb2_subjectStatusID,
_recordTitle,
_text
] call milsim_fnc_createOrUpdateDiaryRecord;

View File

@@ -1,35 +1,50 @@
// updated 2024-02-01 by IndigoFox
// now reads from the battalion config structure to generate the diary entries
_text = "
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
<br/><br/>
<font size='16' color='#4A86E8'>EXODUS</font>
<br/>
<font color='#FF0000'>6 - 45</font>
<br/>
<font color='#FF0000'>RTO - 45 / 35</font>
<br/><br/>
<font size='16' color='#6AA84F'>RIPTIDE</font>
<br/>
<font color='#FF0000'>Actual - 45 / 100</font>
<br/>
<font color='#FF0000'>Romeo - 45 / 35</font>
<br/>
<font color='#FF0000'>1 - 110 / 100</font>
<br/>
<font color='#FF0000'>2 - 120 / 100</font>
<br/>
<font color='#FF0000'>3 - 130 / 110</font>
<br/>
<font color='#FF0000'>Blackfoot - 150 / 100</font>
<br/><br/>
<font size='16' color='#F1C232'>ECHO</font>
<br/>
<font color='#FF0000'>Impaler - 45 / 35</font>
<br/>
<font color='#FF0000'>JTAC - 35 / 82</font>
<br/>
<font color='#FF0000'>IDF - 82 / 100</font>
<br/><br/>
";
////////////////////////////////////////
// Get info from missionConfigFile
////////////////////////////////////////
private _battalionInfoCfg = call milsim_fnc_getBattalionCfg;
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
player createDiaryRecord ["Status", ["MDS - INTEL - RADIO FREQS", _text]];
////////////////////////////////////////
// Define formatting constants
////////////////////////////////////////
private _ELEMENT_NAME_SIZE = 10;
private _ELEMENT_NAME_FONT = "EtelkaMonospaceProBold";
private _ELEMENT_FREQ_SIZE = 9;
private _ELEMENT_FREQ_FONT = "EtelkaMonospacePro";
private _FREQ_INDENT_CONSTANT = 6;
private _FREQ_PAD_LENGTH = 17;
private _FREQ_TEXT_COLOR = "#CCCCCC";
// Note: Element colors are defined in the battalion config
////////////////////////////////////////
// ADD DIARY ENTRIES
////////////////////////////////////////
// First is all the battalion-level elements beneath command
// To have the records listed in the order they appear in the battalion config, we need to reverse the array
// Since each entry is added to the top of the list, this will result in the entries being added in the correct order
reverse _battalionElementCfgs;
{
// recursively generate diary text for all child elements of battalion-level elements
private _diaryTitleText = [_x, true] call milsim_fnc_generateElementFrequencyRecordText;
[
milsim_fbcb2_subjectFrequenciesID,
_diaryTitleText#0,
_diaryTitleText#1
] call milsim_fnc_createOrUpdateDiaryRecord;
} forEach _battalionElementCfgs;
// add the battalion command to the top of the list
// don't process child elements
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fnc_generateElementFrequencyRecordText;
[
milsim_fbcb2_subjectFrequenciesID,
_diaryTitleText#0,
_diaryTitleText#1
] call milsim_fnc_createOrUpdateDiaryRecord;
true;

View File

@@ -1,4 +1,6 @@
_assetList = missionNamespace getVariable "milsim_var_rotaryAssets";
private _recordTitle = "MDS - ASSETS - ROTARY";
_assetList = missionNamespace getVariable "milsim_var_rotaryAssets";
_text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>";
@@ -14,6 +16,11 @@ _text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ----
} foreach _assetList;
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_rotaryAssets""] call milsim_fnc_messageFBCB2AssetStatus'>Run Report on local node?</execute>";
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_rotaryAssets""] call milsim_fnc_hintFBCB2AssetStatus'>Run Report on local node?</execute>";
player createDiaryRecord ["Status", ["MDS - ASSETS - ROTARY", _text]];
[
milsim_fbcb2_subjectStatusID,
_recordTitle,
_text
] call milsim_fnc_createOrUpdateDiaryRecord;

View File

@@ -1,30 +1,41 @@
private _recordTitle = "MDS - INTEL - SMOKES";
_text = "
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
<br/><br/>
Smoke is a Guideline Not a Rule
<br/><br/>
<font color='#FFFFFF' size='16'>WHITE</font><br/>
Concealment
<br/><br/>
<font color='#008800' size='16'>GREEN</font><br/>
Friendly Forces
<br/><br/>
<font color='#0000FF' size='16'>BLUE</font><br/>
LZ Markers
<br/><br/>
<font color='#FF0000' size='16'>RED</font><br/>
Enemy Location
<br/><br/>
<font color='#FFA500' size='16'>ORANGE</font><br/>
Resupply Marker
<br/><br/>
<font color='#FFFF00' size='16'>YELLOW</font><br/>
Medical Emergency
<br/><br/>
<font color='#800080' size='16'>PURPLE</font><br/>
Broken Arrow - 100m radius
<br/><br/>
";
private _text = [
// Title
format[
"<font size='%1' color='%2' face='%3'>%4</font>",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
]
];
player createDiaryRecord ["Status", ["MDS - INTEL - SMOKES", _text]];
private _smokeColors = [
["#FFFFFF", "WHITE", "Concealment"],
["#008800", "GREEN", "Friendly Forces"],
["#0000FF", "BLUE", "LZ Markers"],
["#FF0000", "RED", "Enemy Location"],
["#FFA500", "ORANGE", "Resupply Marker"],
["#FFFF00", "YELLOW", "Medical Emergency"],
["#800080", "PURPLE", "Broken Arrow - 100m radius"]
];
{
_x params ["_color", "_name", "_description"];
_text pushBack format[
"<font size='%1'><font color='%2'>%3</font> - %4</font>",
milsim_fbcb2_recordTextHeaderSize,
_color,
_name,
_description
];
} forEach _smokeColors;
_text = _text joinString "<br/><br/>";
[
milsim_fbcb2_subjectIntelID,
_recordTitle,
_text
] call milsim_fnc_createOrUpdateDiaryRecord;

View File

@@ -0,0 +1,73 @@
// called from milsim_fnc_processFBCB2RadioFrequencies
params ["_cfg", ["_indentCount", 1, [5]]];
//////////////////////////////////////////////////////
// Define leading space/hyphenation for element name
//////////////////////////////////////////////////////
private _leadingSpace = [
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
];
for "_i" from 1 to _indentCount do {
_leadingSpace pushBack "-";
};
_leadingSpace pushBack " | </font>";
/////////////////////////////////////////////////////////
// Create the header line for the provided config entry
/////////////////////////////////////////////////////////
private _lines = [
format[
"<font color='%1'>%2%3</font>",
getText(_cfg >> "textColor"),
_leadingSpace joinString "",
getText (_cfg >> "callsign")
]
];
////////////////////////////////////////////////////////////
// Create the frequency lines for the provided config entry
////////////////////////////////////////////////////////////
// Generate leading space
private _freqLeadingSpace = [
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
];
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
_freqLeadingSpace pushBack " ";
};
_freqLeadingSpace pushBack "</font>";
_freqLeadingSpace = _freqLeadingSpace joinString "";
// Process config values for frequencies
{
_x params ["_role", "_sr", "_lr"];
private ["_srStr", "_lrStr"];
if (count _sr > 0) then {
_srStr = format["%1", _sr joinString " / "];
} else {
_srStr = "----";
};
if (count _lr > 0) then {
_lrStr = format["%1", _lr joinString " / "];
} else {
_lrStr = "----";
};
// Add formatted line to the array
_lines pushBack format[
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
_freqLeadingSpace,
_ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR,
[_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
_lrStr
];
} forEach (getArray (_cfg >> "frequencies"));
// diag_log text (_lines joinString endl);
// Return the formatted lines in ARRAY format
_lines;

View File

@@ -0,0 +1,87 @@
// called from milsim_fnc_processFBCB2RadioFrequencies ONLY
// this function is called recursively to process all child elements of a battalion element in missionConfigFile
params [
["_elementCfg", configNull, [configNull]],
["_shouldProcessChildCfgs", true]
];
if (isNull _elementCfg) exitWith {
["_elementCfg parameter is NULL"] call BIS_fnc_error;
};
// change reference variable for clarity
private _battalionElement = _elementCfg;
// Generate title from callsign and shortDescription
private _recordTitle = format[
"%1 (%2)",
getText(_battalionElement >> "callsign"),
getText(_battalionElement >> "shortDescription")
];
// systemChat _recordTitle;
//////////////////////////////////////////////////////////
// Generate frequency table header line's leading space
//////////////////////////////////////////////////////////
private _freqLeadingSpace = [
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
];
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
_freqLeadingSpace pushBack " ";
};
_freqLeadingSpace pushBack "</font>";
_freqLeadingSpace = _freqLeadingSpace joinString "";
//////////////////////////////////////////////////////////
// Generate header line and frequency table header line
//////////////////////////////////////////////////////////
private _headers = [
format[
"<font size='%1' color='%2' face='%3'>%4</font>",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
],
format[
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
_freqLeadingSpace,
_ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR,
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
"LR"
]
];
//////////////////////////////////////////////////////////
// Generate the list of element headers and frequencies
//////////////////////////////////////////////////////////
private _allText = [];
// get all child elements recursively and format them
if (_shouldProcessChildCfgs) then {
[_battalionElement, {
params ["_cfg", "_recurseCounter"];
// add config
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary;
// private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "<br/>");
}] call milsim_fnc_recurseSubclasses;
} else {
// or if the param was false, just add the battalion element
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;
// private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "<br/>");
};
// add headers, add all other lines and format them as monospace
_allText = format[
"%1<br/><br/><font face='EtelkaMonospaceProBold'>%2</font>", _headers joinString "<br/>", _allText joinString "<br/><br/>"];
// return the title and all text
[_recordTitle, _allText];

View File

@@ -0,0 +1,18 @@
params [
["_subjectID", milsim_fbcb2_subjectStatusID, [""]],
["_recordTitle", "", [""]],
["_recordText", "", [""]]
];
// Check if already created
private _subjectRecords = milsim_fbcb2_diaryRecords getOrDefault [_subjectID, createHashMap, true];
private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];
if (!isNull _existingRecord) then {
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText]];
systemChat format ["Updated diary record: %1", _recordTitle];
} else {
private _new = player createDiaryRecord [_subjectID, [_recordTitle, _recordText]];
_subjectRecords set [_recordTitle, _new];
milsim_fbcb2_diaryRecords set [_subjectID, _subjectRecords];
};

View File

@@ -0,0 +1 @@
(missionConfigFile >> "BattalionInfo")

View File

@@ -18,7 +18,11 @@ params [
private _hash = createHashMapFromArray _data;
// Replace square brackets with round brackets to avoid parsing issues.
_message regexReplace ["\[", "("];
_message regexReplace ["\]", ")"];
private _json = [_hash] call CBA_fnc_encodeJSON;
_log = format ["[milsim] (%1) (%2) (%3) :: %4", _component, _fnc_scriptNameParent, _message, _json];
_log = format ["[milsim] [%1] [%2] [%3] :: %4", _component, _fnc_scriptNameParent, _message, _json];
diag_log text _log;

View File

@@ -0,0 +1,20 @@
params [
["_text", "", [""]],
["_padSide", "left", ["left", "right"]],
["_padChar", " ", [" "]],
["_padLength", 4, [4]]
];
// pad a string with a character to a certain length
if (_padSide == "left") then {
for "_i" from 1 to _padLength - count _text do {
_text = _padChar + _text;
};
};
if (_padSide == "right") then {
for "_i" from 1 to _padLength - count _text do {
_text = _text + _padChar;
};
};
_text

View File

@@ -0,0 +1,25 @@
params [
["_cfg", configNull, [configNull]],
["_code", {}, [{}]]
];
if (isNull _cfg) exitWith {["Provided config is null!"] call BIS_fnc_error};
private _recurseFnc = {
params ["_cfg", "_code", ["_recurseCounter", 0]];
[_cfg, _recurseCounter] call _code;
// get children and recurse
private _childCfgs = _cfg call BIS_fnc_returnChildren;
if (count _childCfgs isEqualTo 0) exitWith {false};
{
[_x, _code, _recurseCounter + 1] call _recurseFnc;
} forEach _childCfgs;
false;
};
private _continue = true;
while {_continue} do {
_continue = [_cfg, _code] call _recurseFnc;
};