mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
getName can return raw or sanatized html tags
This commit is contained in:
parent
c7b6375092
commit
db50b5313d
@ -5,24 +5,27 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Object <OBJECT>
|
* 0: Object <OBJECT>
|
||||||
* 1: Use effective commander name when used on vehicles (default: false) <BOOL>
|
* 1: Use effective commander name when used on vehicles (default: false) <BOOL>
|
||||||
|
* 1: Get Raw Name (Don't sanatize HTML tags `</>`) (default: false) <BOOL>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Object Name <STRING>
|
* Object Name <STRING>
|
||||||
*
|
*
|
||||||
|
* Example:
|
||||||
|
* [player, false, true] call ace_common_fnc_getName;
|
||||||
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", ["_showEffective", false]];
|
params ["_unit", ["_showEffective", false], ["_useRaw", false]];
|
||||||
|
|
||||||
private "_name";
|
private _name = "";
|
||||||
_name = "";
|
|
||||||
|
|
||||||
if (_unit isKindOf "CAManBase") then {
|
if (_unit isKindOf "CAManBase") then {
|
||||||
_name = _unit getVariable ["ACE_Name", localize QUOTE(DOUBLES(STR,GVAR(Unknown)))];
|
_name = _unit getVariable [(["ACE_Name", "ACE_NameRaw"] select _useRaw), localize QUOTE(DOUBLES(STR,GVAR(Unknown)))];
|
||||||
} else {
|
} else {
|
||||||
if (_showEffective) then {
|
if (_showEffective) then {
|
||||||
_name = [effectiveCommander _unit] call FUNC(getName);
|
_name = [effectiveCommander _unit, false, _useRaw] call FUNC(getName);
|
||||||
} else {
|
} else {
|
||||||
_name = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayName");
|
_name = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayName");
|
||||||
};
|
};
|
||||||
|
@ -19,9 +19,9 @@ _requestID = ("ace_recieveRequest_f_id_"+_requestID);
|
|||||||
_target setVariable [_requestID, _this];
|
_target setVariable [_requestID, _this];
|
||||||
|
|
||||||
if (isLocalized _requestMessage) then {
|
if (isLocalized _requestMessage) then {
|
||||||
_requestMessage = format [localize _requestMessage, [_caller] call FUNC(getName)];
|
_requestMessage = format [localize _requestMessage, [_caller, false, true] call FUNC(getName)];
|
||||||
} else {
|
} else {
|
||||||
_requestMessage = format [_requestMessage, [_caller] call FUNC(getName)];
|
_requestMessage = format [_requestMessage, [_caller, false, true] call FUNC(getName)];
|
||||||
};
|
};
|
||||||
|
|
||||||
hint format ["%1", _requestMessage]; // @todo ?
|
hint format ["%1", _requestMessage]; // @todo ?
|
||||||
|
@ -25,14 +25,14 @@ _array = [];
|
|||||||
switch _x do {
|
switch _x do {
|
||||||
case 60 : { // less than symbol: `<`
|
case 60 : { // less than symbol: `<`
|
||||||
if (_removeTags) then {
|
if (_removeTags) then {
|
||||||
_array append toArray "[";
|
_array append toArray "<";
|
||||||
} else {
|
} else {
|
||||||
_array pushBack _x;
|
_array pushBack _x;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
case 62 : { // greater than symbol: `>`
|
case 62 : { // greater than symbol: `>`
|
||||||
if (_removeTags) then {
|
if (_removeTags) then {
|
||||||
_array append toArray "]";
|
_array append toArray ">";
|
||||||
} else {
|
} else {
|
||||||
_array pushBack _x;
|
_array pushBack _x;
|
||||||
};
|
};
|
||||||
|
@ -17,9 +17,15 @@ params ["_unit"];
|
|||||||
if (isNull _unit || {!alive _unit}) exitWith {};
|
if (isNull _unit || {!alive _unit}) exitWith {};
|
||||||
|
|
||||||
if (_unit isKindOf "CAManBase") then {
|
if (_unit isKindOf "CAManBase") then {
|
||||||
_name = [name _unit, true] call FUNC(sanitizeString);
|
private _sanitizedName = [name _unit, true] call FUNC(sanitizeString);
|
||||||
|
private _rawName = [name _unit, false] call FUNC(sanitizeString);
|
||||||
|
|
||||||
|
//Debug Testing Code (with html tags):
|
||||||
|
// private _sanitizedName = ["<TAG>Name", true] call FUNC(sanitizeString);
|
||||||
|
// private _rawName = ["<TAG>Name", false] call FUNC(sanitizeString);
|
||||||
|
|
||||||
//if (_name != _unit getVariable ["ACE_Name", ""]) then {
|
//if (_name != _unit getVariable ["ACE_Name", ""]) then {
|
||||||
_unit setVariable ["ACE_Name", _name, true];
|
_unit setVariable ["ACE_Name", _sanitizedName, true];
|
||||||
|
_unit setVariable ["ACE_NameRaw", _rawName, true];
|
||||||
//};
|
//};
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ GVAR(disarmTarget) = _target;
|
|||||||
_icon = format [DEFUALTPATH, toLower (rank _target)];
|
_icon = format [DEFUALTPATH, toLower (rank _target)];
|
||||||
if (_icon isEqualTo DEFUALTPATH) then {_icon = ""};
|
if (_icon isEqualTo DEFUALTPATH) then {_icon = ""};
|
||||||
_rankPicture ctrlSetText _icon;
|
_rankPicture ctrlSetText _icon;
|
||||||
_playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName));
|
_playerName ctrlSetText ([GVAR(disarmTarget), false, true] call EFUNC(common,getName));
|
||||||
|
|
||||||
//Clear both inventory lists:
|
//Clear both inventory lists:
|
||||||
lbClear _groundContainer;
|
lbClear _groundContainer;
|
||||||
|
@ -27,7 +27,7 @@ _fingerPos = if (_sourceUnit == ACE_player) then {
|
|||||||
_fingerPosPrecise vectorAdd [random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y]
|
_fingerPosPrecise vectorAdd [random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y]
|
||||||
};
|
};
|
||||||
|
|
||||||
_data = [ACE_diagTime, _fingerPos, ([_sourceUnit] call EFUNC(common,getName))];
|
_data = [ACE_diagTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))];
|
||||||
HASH_SET(GVAR(fingersHash), _sourceUnit, _data);
|
HASH_SET(GVAR(fingersHash), _sourceUnit, _data);
|
||||||
|
|
||||||
if (GVAR(pfeh_id) == -1) then {
|
if (GVAR(pfeh_id) == -1) then {
|
||||||
|
@ -60,6 +60,6 @@ if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC(
|
|||||||
["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent);
|
["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent);
|
||||||
|
|
||||||
if (_logOutPut != "") then {
|
if (_logOutPut != "") then {
|
||||||
[_target,"activity", LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog);
|
[_target,"activity", LSTRING(Check_Bloodpressure_Log), [[_caller, false, true] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog);
|
||||||
[_target,"quick_view", LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog);
|
[_target,"quick_view", LSTRING(Check_Bloodpressure_Log), [[_caller, false, true] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog);
|
||||||
};
|
};
|
||||||
|
@ -21,5 +21,5 @@ _output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsi
|
|||||||
|
|
||||||
["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent);
|
["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent);
|
||||||
|
|
||||||
[_target,"activity",_output, [[_target] call EFUNC(common,getName)]] call FUNC(addToLog);
|
[_target,"activity",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||||
[_target,"quick_view",_output, [[_target] call EFUNC(common,getName)]] call FUNC(addToLog);
|
[_target,"quick_view",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||||
|
@ -30,7 +30,7 @@ if (GVAR(level) > 1 && {(random 1) >= 0.6}) then {
|
|||||||
_target setvariable [QGVAR(bloodPressure), [50,70]];
|
_target setvariable [QGVAR(bloodPressure), [50,70]];
|
||||||
};
|
};
|
||||||
|
|
||||||
[_target, "activity", LSTRING(Activity_CPR), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
[_target, "activity", LSTRING(Activity_CPR), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||||
[_target, "activity_view", LSTRING(Activity_CPR), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
[_target, "activity_view", LSTRING(Activity_CPR), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]];
|
params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]];
|
||||||
|
|
||||||
[_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
[_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||||
[_target, "activity_view", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
[_target, "activity_view", LSTRING(Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||||
|
|
||||||
if !([_target] call FUNC(hasMedicalEnabled)) exitwith {
|
if !([_target] call FUNC(hasMedicalEnabled)) exitwith {
|
||||||
_this call FUNC(treatmentBasic_bandage);
|
_this call FUNC(treatmentBasic_bandage);
|
||||||
|
@ -68,6 +68,6 @@ if (alive _target) exitwith {
|
|||||||
// Resetting damage
|
// Resetting damage
|
||||||
_target setDamage 0;
|
_target setDamage 0;
|
||||||
|
|
||||||
[_target, "activity", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
[_target, "activity", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||||
[_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
[_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||||
};
|
};
|
||||||
|
@ -24,8 +24,8 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
|||||||
{
|
{
|
||||||
if (_x != "") then {
|
if (_x != "") then {
|
||||||
[_target, _x] call FUNC(addToTriageCard);
|
[_target, _x] call FUNC(addToTriageCard);
|
||||||
[_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog);
|
[_target, "activity", LSTRING(Activity_usedItem), [[_caller, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog);
|
||||||
[_target, "activity_view", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog);
|
[_target, "activity_view", LSTRING(Activity_usedItem), [[_caller, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog);
|
||||||
};
|
};
|
||||||
} foreach _items;
|
} foreach _items;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ if (count _items == 0) exitwith {false};
|
|||||||
_removeItem = _items select 0;
|
_removeItem = _items select 0;
|
||||||
[[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
[[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||||
[_target, "activity", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
[_target, "activity", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||||
[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||||
|
|
||||||
true
|
true
|
||||||
|
@ -43,8 +43,8 @@ _removeItem = _items select 0;
|
|||||||
[[_target, _removeItem, _selectionName], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
[[_target, _removeItem, _selectionName], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||||
|
|
||||||
[_target, _removeItem] call FUNC(addToTriageCard);
|
[_target, _removeItem] call FUNC(addToTriageCard);
|
||||||
[_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
|
[_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||||
[_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
[_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message
|
||||||
|
|
||||||
|
|
||||||
true
|
true
|
||||||
|
@ -14,7 +14,7 @@ if (!hasInterface) exitWith {};
|
|||||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
_dialog displayCtrl 111 ctrlSetText format ["%1 - %2 %3", [ACE_player] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)];
|
_dialog displayCtrl 111 ctrlSetText format ["%1 - %2 %3", [ACE_player, false, true] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)];
|
||||||
|
|
||||||
}, 0, _this select 0] call CBA_fnc_addPerFrameHandler;
|
}, 0, _this select 0] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ if (_alpha < 0) exitWith {}; //Don't waste time if not visable
|
|||||||
|
|
||||||
//Set Text:
|
//Set Text:
|
||||||
_name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then {
|
_name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then {
|
||||||
[_target, true] call EFUNC(common,getName)
|
[_target, true, true] call EFUNC(common,getName)
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
params ["_unit", "_killer"];
|
params ["_unit", "_killer"];
|
||||||
|
|
||||||
if (_unit != _killer && {side group _unit in [side group ACE_player, civilian]} && {side group _killer == side group ACE_player}) then {
|
if (_unit != _killer && {side group _unit in [side group ACE_player, civilian]} && {side group _killer == side group ACE_player}) then {
|
||||||
systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)];
|
systemChat format ["%1 was killed by %2", [_unit, false, true] call EFUNC(common,getName), [_killer, false, true] call EFUNC(common,getName)];
|
||||||
|
|
||||||
// Raise ACE globalEvent
|
// Raise ACE globalEvent
|
||||||
["killedByFriendly", [_unit, _killer]] call EFUNC(common,globalEvent);
|
["killedByFriendly", [_unit, _killer]] call EFUNC(common,globalEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user