Add a function to port BI VA loadouts to ACE Arsenal (#5943)

* Add a function to port BI VA loadouts to ACE Arsenal

* Fix typos in the header

* Remove override argument, add button in 3DEN

* Add null player exception

* Remove unused passed argument

* Add error messages to portVALoadouts

* Change error messages

* Add missing dot in string
This commit is contained in:
Josuan Albin 2017-12-27 00:43:33 +01:00 committed by PabstMirror
parent 54320eb451
commit 69f7484f12
4 changed files with 70 additions and 0 deletions

View File

@ -34,6 +34,7 @@ PREP(onSelChangedRight);
PREP(onSelChangedRightListnBox);
PREP(open3DEN);
PREP(openBox);
PREP(portVALoadouts);
PREP(removeBox);
PREP(removeVirtualItems);
PREP(scanConfig);

View File

@ -0,0 +1,43 @@
/*
* Author: alganthe
* Port VA loadouts to ACE Arsenal.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
private _VALoadouts = +(profilenamespace getvariable ["bis_fnc_saveInventory_data",[]]);
private _aceLoadouts = +(profileNamespace getVariable [QGVAR(saved_loadouts),[]]);
if (isNull player) exitWith {
[localize LSTRING(portLoadoutsPlayerError)] call BIS_fnc_error;
};
if (_VALoadouts isEqualTo []) exitWith {
[localize LSTRING(portLoadoutsLoadoutError)] call BIS_fnc_error;
};
for "_i" from 0 to (count _VALoadouts - 1) step 2 do {
_name = _VALoadouts select _i;
_inventory = _VALoadouts select (_i + 1);
private _sameNameLoadoutsList = _aceLoadouts select {_x select 0 == _name};
[player, [profilenamespace, _name]] call bis_fnc_loadinventory;
private _loadout = getUnitLoadout player;
if (count _sameNameLoadoutsList > 0) then {
_aceLoadouts set [_aceLoadouts find (_sameNameLoadoutsList select 0), [_name, _loadout]];
} else {
_aceLoadouts pushBack [_name, _loadout];
};
};
profileNamespace setVariable [QGVAR(saved_loadouts), _aceLoadouts];

View File

@ -433,5 +433,17 @@
<Italian>Impossibile aprire l'arsenale ACE</Italian>
<Japanese>ACE 武器庫を開けません</Japanese>
</Key>
<Key ID= "STR_ACE_Arsenal_portLoadoutsText">
<English>Import BI VA loadouts to ACE Arsenal</English>
<French>Importe les loadouts de BI VA dans ACE Arsenal</French>
</Key>
<Key ID= "STR_ACE_Arsenal_portLoadoutsPlayerError">
<English>No player unit available! Place a unit and mark it as "Player".</English>
<French>Aucune unité joueur disponible ! Placez une unité et marquez la en tant que "joueur".</French>
</Key>
<Key ID= "STR_ACE_Arsenal_portLoadoutsLoadoutError">
<English>No loadouts to import.</English>
<French>Aucun loadout à importer.</French>
</Key>
</Package>
</Project>

View File

@ -275,4 +275,18 @@ class Display3DEN {
};
};
};
class Controls {
class MenuStrip: ctrlMenuStrip {
class Items {
class Tools {
items[] += {"ACE_arsenal_portVALoadouts"};
};
class ACE_arsenal_portVALoadouts {
text = CSTRING(portLoadoutsText);
picture = "\z\ace\logo_ace3_ca.paa";
action = "call ace_arsenal_fnc_portVALoadouts;";
};
};
};
};
};