Skip to content

Instantly share code, notes, and snippets.

@harakka
Last active February 20, 2020 06:06
Show Gist options
  • Save harakka/6822529 to your computer and use it in GitHub Desktop.
Save harakka/6822529 to your computer and use it in GitHub Desktop.
Dump Arma 3 equipment configs from ingame to csv output in log file. Used primarily to generate diffs for Arma 3 equipment changes between versions when the game was still in major development.
// todo: figure out common class for bipod/tripod
_allCfgs = [];
{
for "_i" from 0 to ((count _x) -1) do {
_item = _x select _i;
_cfgName = configName(_item);
if (isClass _item && getText(_x >> _cfgName >> "displayName") != "" && getText(_x >> _cfgName >> "picture") != "") then {
_allCfgs = _allCfgs + [([_item] call BIS_fnc_configPath)];
};
};
} forEach [configFile >> "CfgWeapons", configFile >> "CfgVehicles", configFile >> "CfgMagazines"];
diag_log text("type;cfgName;name;mass;capacity;armor;passthrough;mags;parents;cfgFullName");
{
_cfgPath = [_x] call BIS_fnc_configPath;
//_item = _cfgs select _i;
_cfgName = configName(_cfgPath);
_cfgFullName = [_x, "STRING"] call BIS_fnc_configPath;
_parents = [_cfgPath, true] call BIS_fnc_returnParents;
_type = switch true do {
case ("Rifle" in _parents): {"rifle"};
case ("Pistol" in _parents): {"pistol"};
case ("Launcher" in _parents): {"launcher"};
case ("H_HelmetB" in _parents): {"helmet"};
case ("Uniform_Base" in _parents): {"uniform"};
case ("Vest_Camo_Base" in _parents || "Vest_NoCamo_Base" in _parents): {"vest"};
case ("Weapon_Bag_Base" in _parents): {"bag_static"};
case ("Bag_Base" in _parents): {"bag"};
case ("HandGrenade" in _parents): {"grenade"};
case ("CA_Magazine" in _parents && !("VehicleMagazine" in _parents)): {"magazine"};
case ("CA_LauncherMagazine" in _parents): {"launcherammo"};
case ("ItemCore" in _parents || "DetectorCore" in _parents || "Binocular" in _parents): {"misc"};
default {"unknown"};
};
_name = getText(_cfgPath >> "displayName");
_desc = getText(_cfgPath >> "descriptionShort");
_icon = getText(_cfgPath >> "picture");
_mags = getArray(_cfgPath >> "magazines");
if (format["%1", _mags] == "[]") then {_mags = "N/A";};
_capacity = switch _type do {
case "uniform";
case "vest": {parseNumber([getText(_cfgPath >> "ItemInfo" >> "containerClass"), 6] call BIS_fnc_trimString)};
case "bag": {getNumber(_cfgPath >> "maximumLoad")};
default {"N/A"};
};
_mass = switch _type do {
case "magazine";
case "bag_static";
case "grenade";
case "launcherammo";
case "bag": {getNumber(_cfgPath >> "mass")};
case "helmet";
case "uniform";
case "vest";
case "misc": {getNumber(_cfgPath >> "ItemInfo" >> "mass")};
case "rifle";
case "pistol";
case "launcher": {getNumber(_cfgPath >> "WeaponSlotsInfo" >> "mass")};
default {"N/A"};
};
_armor = switch _type do {
case "helmet";
case "uniform";
case "vest": {getNumber(_cfgPath >> "ItemInfo" >> "armor")};
default {"N/A"};
};
_passthrough = switch _type do {
case "helmet";
case "uniform";
case "vest": {getNumber(_cfgPath >> "ItemInfo" >> "passThrough")};
default {"N/A"};
};
if (_name != "" && _icon != "" && _type != "unknown") then {
diag_log text(format["%1;%2;%3;%4;%5;%6;%7;%8;%9;%10", _type, _cfgName, _name, _mass, _capacity, _armor, _passthrough, _mags, _parents, _cfgFullName]);
}
} forEach _allCfgs;
hint "Done!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment