Compare commits
3 Commits
4f54edf467
...
6282080cb4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6282080cb4 | ||
|
|
69acbaef4c | ||
|
|
510c1a77b6 |
@ -42,12 +42,16 @@ class CfgStore {
|
||||
patches[] = {"rhs_main", "rhsusf_main"};
|
||||
addons[] = {"rhs_", "rhsusf_", "rhsgref_", "rhsafrf_"};
|
||||
prefixes[] = {"rhs_", "rhsusf_", "rhsgref_", "rhsafrf_"};
|
||||
contains[] = {"rhs_", "rhsusf_", "rhsgref_", "rhsafrf_"};
|
||||
dlcs[] = {};
|
||||
};
|
||||
|
||||
class ace3 {
|
||||
patches[] = {"ace_main"};
|
||||
addons[] = {"ace_"};
|
||||
prefixes[] = {"ace_"};
|
||||
contains[] = {"ace_"};
|
||||
dlcs[] = {};
|
||||
};
|
||||
};
|
||||
|
||||
@ -76,9 +80,11 @@ uses the same prices and descriptions the UI displays.
|
||||
filtering. `allowlist` only keeps generated entries that match one of the
|
||||
configured `mods[]`; `denylist` removes matching entries. Each `ModSources`
|
||||
child can define `patches[]` to detect whether the mod is loaded, `addons[]`
|
||||
for exact config source addon/source mod names, and `prefixes[]` for classname,
|
||||
source addon, or source mod prefixes. If a mod source defines no patches, it is
|
||||
treated as available and only the source/prefix checks are used.
|
||||
for exact config source addon/source mod names, `prefixes[]` for classname,
|
||||
source addon, or source mod prefixes, `contains[]` for classname/source
|
||||
metadata tokens that can appear anywhere, and `dlcs[]` for DLC/source/author
|
||||
labels used by Creator DLC content. If a mod source defines no patches, it is
|
||||
treated as available and only the source/prefix/contains/DLC checks are used.
|
||||
|
||||
`units[]` follows the same `dynamic`, `allowlist`, and `denylist` behavior as
|
||||
item and vehicle categories. Unit purchases are immediate spawn grants, not
|
||||
|
||||
@ -87,6 +87,30 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
|
||||
_loaded
|
||||
}],
|
||||
["describeMissionStoreModSources", compileFinal {
|
||||
params [["_mods", [], [[]]]];
|
||||
|
||||
_mods apply {
|
||||
private _modID = _x;
|
||||
private _patches = _self call ["getMissionStoreModSourceValues", [_modID, "patches"]];
|
||||
private _addons = _self call ["getMissionStoreModSourceValues", [_modID, "addons"]];
|
||||
private _prefixes = _self call ["getMissionStoreModSourceValues", [_modID, "prefixes"]];
|
||||
private _contains = _self call ["getMissionStoreModSourceValues", [_modID, "contains"]];
|
||||
private _dlcs = _self call ["getMissionStoreModSourceValues", [_modID, "dlcs"]];
|
||||
private _loaded = _self call ["isMissionStoreModLoaded", [_modID]];
|
||||
|
||||
format [
|
||||
"%1 loaded=%2 patches=%3 addons=%4 prefixes=%5 contains=%6 dlcs=%7",
|
||||
_modID,
|
||||
_loaded,
|
||||
_patches,
|
||||
_addons,
|
||||
_prefixes,
|
||||
_contains,
|
||||
_dlcs
|
||||
]
|
||||
}
|
||||
}],
|
||||
["doesValueMatchAnyPrefix", compileFinal {
|
||||
params [["_value", "", [""]], ["_prefixes", [], [[]]]];
|
||||
|
||||
@ -100,6 +124,19 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
|
||||
_matches
|
||||
}],
|
||||
["doesValueContainAnyToken", compileFinal {
|
||||
params [["_value", "", [""]], ["_tokens", [], [[]]]];
|
||||
|
||||
private _normalizedValue = toLowerANSI _value;
|
||||
private _matches = false;
|
||||
{
|
||||
private _token = toLowerANSI _x;
|
||||
if (_token isEqualTo "") then { continue; };
|
||||
if ((_normalizedValue find _token) >= 0) exitWith { _matches = true; };
|
||||
} forEach _tokens;
|
||||
|
||||
_matches
|
||||
}],
|
||||
["doesItemMatchMissionStoreMod", compileFinal {
|
||||
params [["_item", createHashMap, [createHashMap]], ["_modID", "", [""]]];
|
||||
|
||||
@ -109,20 +146,35 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
private _className = _item getOrDefault ["className", ""];
|
||||
private _sourceAddons = (_item getOrDefault ["sourceAddons", []]) apply { toLowerANSI _x };
|
||||
private _sourceMod = _item getOrDefault ["sourceMod", ""];
|
||||
private _sourceDLC = _item getOrDefault ["sourceDLC", ""];
|
||||
private _sourceAuthor = _item getOrDefault ["sourceAuthor", ""];
|
||||
private _addons = (_self call ["getMissionStoreModSourceValues", [_modID, "addons"]]) apply { toLowerANSI _x };
|
||||
private _prefixes = (_self call ["getMissionStoreModSourceValues", [_modID, "prefixes"]]) apply { toLowerANSI _x };
|
||||
private _contains = (_self call ["getMissionStoreModSourceValues", [_modID, "contains"]]) apply { toLowerANSI _x };
|
||||
private _dlcs = (_self call ["getMissionStoreModSourceValues", [_modID, "dlcs"]]) apply { toLowerANSI _x };
|
||||
private _matchPrefixes = _addons + _prefixes;
|
||||
private _sourceModLower = toLowerANSI _sourceMod;
|
||||
private _sourceDLCLower = toLowerANSI _sourceDLC;
|
||||
private _sourceAuthorLower = toLowerANSI _sourceAuthor;
|
||||
|
||||
if (_sourceModLower in _addons) exitWith { true };
|
||||
if (_sourceDLCLower in _dlcs) exitWith { true };
|
||||
if (_sourceAuthorLower in _dlcs) exitWith { true };
|
||||
private _sourceAddonMatched = false;
|
||||
{
|
||||
if (_x in _addons) exitWith { _sourceAddonMatched = true; };
|
||||
if (_self call ["doesValueMatchAnyPrefix", [_x, _matchPrefixes]]) exitWith { _sourceAddonMatched = true; };
|
||||
if (_self call ["doesValueContainAnyToken", [_x, _contains]]) exitWith { _sourceAddonMatched = true; };
|
||||
} forEach _sourceAddons;
|
||||
if (_sourceAddonMatched) exitWith { true };
|
||||
if (_self call ["doesValueMatchAnyPrefix", [_className, _matchPrefixes]]) exitWith { true };
|
||||
if (_self call ["doesValueContainAnyToken", [_className, _contains]]) exitWith { true };
|
||||
if (_self call ["doesValueMatchAnyPrefix", [_sourceMod, _matchPrefixes]]) exitWith { true };
|
||||
if (_self call ["doesValueContainAnyToken", [_sourceMod, _contains]]) exitWith { true };
|
||||
if (_self call ["doesValueMatchAnyPrefix", [_sourceDLC, _dlcs]]) exitWith { true };
|
||||
if (_self call ["doesValueContainAnyToken", [_sourceDLC, _contains]]) exitWith { true };
|
||||
if (_self call ["doesValueMatchAnyPrefix", [_sourceAuthor, _dlcs]]) exitWith { true };
|
||||
if (_self call ["doesValueContainAnyToken", [_sourceAuthor, _contains]]) exitWith { true };
|
||||
|
||||
false
|
||||
}],
|
||||
@ -141,9 +193,18 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
|
||||
private _mode = _self call ["getMissionStoreModMode", []];
|
||||
private _mods = _self call ["getMissionStoreModList", []];
|
||||
if (_mode isEqualTo "dynamic" || { _mods isEqualTo [] }) exitWith { +_items };
|
||||
private _beforeCount = count _items;
|
||||
if (_mode isEqualTo "dynamic" || { _mods isEqualTo [] }) exitWith {
|
||||
["INFO", format [
|
||||
"Store mod filter skipped. Mode=%1 Mods=%2 Items=%3",
|
||||
_mode,
|
||||
_mods,
|
||||
_beforeCount
|
||||
]] call EFUNC(common,log);
|
||||
+_items
|
||||
};
|
||||
|
||||
switch (_mode) do {
|
||||
private _filteredItems = switch (_mode) do {
|
||||
case "allowlist": {
|
||||
_items select { _self call ["doesItemMatchMissionStoreMods", [_x, _mods]] }
|
||||
};
|
||||
@ -153,7 +214,18 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
default {
|
||||
+_items
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
["INFO", format [
|
||||
"Store mod filter applied. Mode=%1 Mods=%2 Items=%3 -> %4 Sources=[%5]",
|
||||
_mode,
|
||||
_mods,
|
||||
_beforeCount,
|
||||
count _filteredItems,
|
||||
(_self call ["describeMissionStoreModSources", [_mods]]) joinString "; "
|
||||
]] call EFUNC(common,log);
|
||||
|
||||
_filteredItems
|
||||
}],
|
||||
["getMissionStoreCategoryList", compileFinal {
|
||||
params [["_category", "", [""]]];
|
||||
@ -304,6 +376,8 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
private _displayName = getText (_cfg >> "displayName");
|
||||
private _sourceAddons = configSourceAddonList _cfg;
|
||||
private _sourceMod = configSourceMod _cfg;
|
||||
private _sourceDLC = getText (_cfg >> "DLC");
|
||||
private _sourceAuthor = getText (_cfg >> "author");
|
||||
private _picture = getText (_cfg >> _imageField);
|
||||
if (_picture isEqualTo "" && { _imageField isNotEqualTo "picture" }) then {
|
||||
_picture = getText (_cfg >> "picture");
|
||||
@ -321,17 +395,25 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
["image", _picture],
|
||||
["type", _typeLabel],
|
||||
["sourceAddons", _sourceAddons],
|
||||
["sourceMod", _sourceMod]
|
||||
["sourceMod", _sourceMod],
|
||||
["sourceDLC", _sourceDLC],
|
||||
["sourceAuthor", _sourceAuthor]
|
||||
]
|
||||
}],
|
||||
["appendCfgWeaponsByItemInfoType", compileFinal {
|
||||
params [["_items", [], [[]]], ["_itemInfoType", -1, [0]], ["_typeLabel", "", [""]], ["_fallbackDescription", "", [""]]];
|
||||
params [["_items", [], [[]]], ["_itemInfoType", -1, [0]], ["_itemKind", "", [""]], ["_typeLabel", "", [""]], ["_fallbackDescription", "", [""]]];
|
||||
|
||||
{
|
||||
private _cfg = _x;
|
||||
private _className = configName _cfg;
|
||||
private _itemType = [_className] call BIS_fnc_itemType;
|
||||
private _kind = _itemType param [1, ""];
|
||||
if (
|
||||
_self call ["isVisibleConfig", [_cfg]]
|
||||
&& { getNumber (_cfg >> "ItemInfo" >> "type") isEqualTo _itemInfoType }
|
||||
&& {
|
||||
(getNumber (_cfg >> "ItemInfo" >> "type") isEqualTo _itemInfoType)
|
||||
|| { _kind isEqualTo _itemKind }
|
||||
}
|
||||
) then {
|
||||
_items pushBack (_self call ["buildCatalogItem", [_cfg, _typeLabel, _fallbackDescription]]);
|
||||
};
|
||||
@ -466,9 +548,9 @@ GVAR(StoreCatalogServiceBaseClass) = compileFinal createHashMapFromArray [
|
||||
private _items = [];
|
||||
|
||||
switch (_categoryKey) do {
|
||||
case "uniforms": { _items = _self call ["appendCfgWeaponsByItemInfoType", [_items, TYPE_UNIFORM, "Uniform", "Live uniform entry generated from the game inventory."]]; };
|
||||
case "headgear": { _items = _self call ["appendCfgWeaponsByItemInfoType", [_items, TYPE_HEADGEAR, "Headgear", "Live headgear entry generated from the game inventory."]]; };
|
||||
case "vests": { _items = _self call ["appendCfgWeaponsByItemInfoType", [_items, TYPE_VEST, "Vest", "Live vest entry generated from the game inventory."]]; };
|
||||
case "uniforms": { _items = _self call ["appendCfgWeaponsByItemInfoType", [_items, TYPE_UNIFORM, "Uniform", "Uniform", "Live uniform entry generated from the game inventory."]]; };
|
||||
case "headgear": { _items = _self call ["appendCfgWeaponsByItemInfoType", [_items, TYPE_HEADGEAR, "Headgear", "Headgear", "Live headgear entry generated from the game inventory."]]; };
|
||||
case "vests": { _items = _self call ["appendCfgWeaponsByItemInfoType", [_items, TYPE_VEST, "Vest", "Vest", "Live vest entry generated from the game inventory."]]; };
|
||||
case "backpacks": { _items = _self call ["appendCfgBackpacks", [_items, "Backpack", "Live backpack entry generated from the game inventory."]]; };
|
||||
case "attachments": {
|
||||
_items = _self call ["appendCfgAttachments", [_items, "Live attachment entry generated from the game inventory."]];
|
||||
|
||||
@ -42,12 +42,16 @@ class CfgStore {
|
||||
patches[] = {"rhs_main", "rhsusf_main"};
|
||||
addons[] = {"rhs_", "rhsusf_", "rhsgref_", "rhsafrf_"};
|
||||
prefixes[] = {"rhs_", "rhsusf_", "rhsgref_", "rhsafrf_"};
|
||||
contains[] = {"rhs_", "rhsusf_", "rhsgref_", "rhsafrf_"};
|
||||
dlcs[] = {};
|
||||
};
|
||||
|
||||
class ace3 {
|
||||
patches[] = {"ace_main"};
|
||||
addons[] = {"ace_"};
|
||||
prefixes[] = {"ace_"};
|
||||
contains[] = {"ace_"};
|
||||
dlcs[] = {};
|
||||
};
|
||||
};
|
||||
|
||||
@ -76,9 +80,11 @@ server-side and are used by both the UI payload and checkout validation.
|
||||
filtering. `allowlist` only keeps generated entries that match one of the
|
||||
configured `mods[]`; `denylist` removes matching entries. Each `ModSources`
|
||||
child can define `patches[]` to detect whether the mod is loaded, `addons[]`
|
||||
for exact config source addon/source mod names, and `prefixes[]` for classname,
|
||||
source addon, or source mod prefixes. If a mod source defines no patches, it is
|
||||
treated as available and only the source/prefix checks are used.
|
||||
for exact config source addon/source mod names, `prefixes[]` for classname,
|
||||
source addon, or source mod prefixes, `contains[]` for classname/source
|
||||
metadata tokens that can appear anywhere, and `dlcs[]` for DLC/source/author
|
||||
labels used by Creator DLC content. If a mod source defines no patches, it is
|
||||
treated as available and only the source/prefix/contains/DLC checks are used.
|
||||
|
||||
For example, to show only RHS-sourced generated inventory:
|
||||
|
||||
@ -91,6 +97,18 @@ The matching `class rhs` must exist under `ModSources`. Category `mode` is still
|
||||
applied afterward, so leave `mode = "dynamic"` if the mod filter should be the
|
||||
only inventory filter.
|
||||
|
||||
For Creator DLCs such as RF or WS, prefer both prefixes and DLC labels:
|
||||
|
||||
```cpp
|
||||
class rf {
|
||||
patches[] = {};
|
||||
addons[] = {"lxrf_", "rf_"};
|
||||
prefixes[] = {"lxrf_", "rf_"};
|
||||
contains[] = {"lxrf", "_rf_", "_rf", "rf_"};
|
||||
dlcs[] = {"rf", "reactionforces", "reaction forces"};
|
||||
};
|
||||
```
|
||||
|
||||
The current filter is global for the mission. Revisit per-store profile support
|
||||
if individual vendors need different inventories.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user