Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arsenal - Show DLC Requirement Image #10506

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions addons/arsenal/functions/fnc_addListBoxItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ if (_skip) exitWith {};
private _configPath = ([configFile, campaignConfigFile, missionConfigFile] select _configRoot) >> _configCategory >> _className;
private _dlcName = _configPath call EFUNC(common,getAddon);

// Get DLC requirements
([_configPath] call EFUNC(common,getDLC)) params ["_dlcClass", "_dlcSteamID"];
private _dlcPicture = "";
if (_dlcClass != "") then {
_dlcPicture = getText (configFile >> "CfgMods" >> _dlcClass >> "logo");
};

// If _pictureEntryName is empty, then this item has no picture (e.g. faces)
[configName _configPath, getText (_configPath >> "displayName"), if (_pictureEntryName == "") then {""} else {getText (_configPath >> _pictureEntryName)}, if (_dlcName != "") then {(modParams [_dlcName, ["logo"]]) param [0, ""]} else {""}]
}, true]) params ["_className", "_displayName", "_itemPicture", "_modPicture"];
[configName _configPath, getText (_configPath >> "displayName"), if (_pictureEntryName == "") then {""} else {getText (_configPath >> _pictureEntryName)}, if (_dlcName != "") then {(modParams [_dlcName, ["logo"]]) param [0, ""]} else {""}, _dlcPicture]
}, true]) params ["_className", "_displayName", "_itemPicture", "_modPicture", "_dlcPicture"];

private _lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _className];
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture, _dlcPicture] select GVAR(enableModIcons)];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];

if ((toLowerANSI _className) in GVAR(favorites)) then {
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_fillLeftPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private _selectedItem = if (_idxVirt != -1) then { // Items
_lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _x];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _x]];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture, ""] select GVAR(enableModIcons)];
} forEach GVAR(faceCache); // HashMap, not array

GVAR(currentFace)
Expand Down
4 changes: 2 additions & 2 deletions addons/arsenal/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ private _category = LLSTRING(settingCategory);

[
QGVAR(enableModIcons),
"CHECKBOX",
"LIST",
[LSTRING(modIconsSetting), LSTRING(modIconsTooltip)],
_category,
true
[[0, 1, 2], [ELSTRING(common,Disabled), ELSTRING(common,Enabled), LSTRING(DLCRequirement)], 1]
] call CBA_fnc_addSetting;

[
Expand Down
16 changes: 16 additions & 0 deletions addons/arsenal/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@
<Chinesesimp>无法开启 ACE 虚拟军火库</Chinesesimp>
<Turkish>ACE Arsenal açılamıyor</Turkish>
</Key>
<Key ID="STR_ACE_Arsenal_DLCRequirement">
<English>DLC Required</English>
<Czech>Vyžadováno DLC</Czech>
<French>DLC requis</French>
<Spanish>Requiere DLC</Spanish>
<Italian>DLC richiesto</Italian>
<Polish>Wymagane DLC</Polish>
<Portuguese>DLC necessário</Portuguese>
<Russian>Требуется DLC</Russian>
<German>DLC erforderlich</German>
<Korean>DLC 필요</Korean>
<Japanese>DLCが必要です</Japanese>
<Chinese>需要DLC</Chinese>
<Chinesesimp>需要DLC</Chinesesimp>
<Turkish>DLC gereklidir</Turkish>
</Key>
<Key ID="STR_ACE_Arsenal_DetonatesOnImpact">
<English>Detonates on impact</English>
<French>Détonation à l'impact</French>
Expand Down
1 change: 1 addition & 0 deletions addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ PREP(getDefaultAnim);
PREP(getDefinedVariable);
PREP(getDefinedVariableDefault);
PREP(getDefinedVariableInfo);
PREP(getDLC);
PREP(getFiremodeIndex);
PREP(getFirstObjectIntersection);
PREP(getFirstTerrainIntersection);
Expand Down
68 changes: 68 additions & 0 deletions addons/common/functions/fnc_getDLC.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "..\script_component.hpp"
/*
* Author: Brett Mayson
* Get the DLC information of a class.
*
* Arguments:
* 0: Classname <STRING> or Config <CONFIG>
* 1: Config root, searches if unspecified or null <CONFIG> (default: configNull)
*
* Return Value:
* DLC Info <ARRAY>
* 0: DLC Classname <STRING>
* 1: Steam ID <NUMBER>
*
* Example:
* "launch_NLAW_F" call ace_common_fnc_getDLC
*
* Public: Yes
*/

params [["_class", configNull, ["", configNull]], ["_root", configNull, [configNull]]];

private _config = if (_class isEqualType configNull) then {
_class
} else {
if !(isNull _root) then {
_root >> _class
} else {
_class call CBA_fnc_getItemConfig
};
};
if (isNull _config) exitWith {
["", 0]
};

if (getNumber (_config >> "ItemInfo" >> "type") == TYPE_UNIFORM) then {
_config = configFile >> "CfgVehicles" >> getText (_config >> "itemInfo" >> "uniformClass")
};

(getAssetDLCInfo getText (_config >> "model")) params [
"_isDLC", "", "", "", "_id"
];

if (!_isDLC) exitWith {
["", 0]
};

private _name = switch (_id) do {
case "1021790": { "Enoch" };
case "395180": { "Expansion" };
case "304380": { "Heli" };
case "601670": { "Jets" };
case "288520": { "Kart" };
case "332350": { "Mark" };
case "288520": { "Orange" };
case "744950": { "Tacops" };
case "798390": { "Tank" };
case "1042220": { "GM" };
case "1227700": { "VN" };
case "1294440": { "CSLA" };
case "1681170": { "WS" };
case "1175380": { "SPE" };
case "2647760": { "RF" };
case "2647830": { "EF" };
default { "" };
};

[_name, _id]
7 changes: 7 additions & 0 deletions docs/src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"rollup-plugin-scss": "^4.0.0",
"rollup-plugin-svg-icons": "^2.1.2",
"rollup-plugin-svg-sprite-loader": "^0.0.4"
},
"dependencies": {
"ace3": "file:"
}
}