Headers and Finish Notice

This commit is contained in:
PabstMirror 2015-02-08 17:35:21 -06:00
parent e770a74630
commit da9fc39103
4 changed files with 71 additions and 2 deletions

View File

@ -2,6 +2,7 @@
ADDON = false;
PREP(magazineRepackFinish);
PREP(magazineRepackProgress);
PREP(openSelectMagazineUI);
PREP(simulateRepackEvents);

View File

@ -0,0 +1,52 @@
/*
* Author: PabstMirror
* Simulates repacking a set of magazines.
* Returns the timing and magazines counts at every stage.
*
* Arguments:
* 0: Arguments [classname,lastAmmoStatus,events] <ARRAY>
* 1: Elapsed Time <NUMBER>
* 2: Total Time Repacking Will Take <NUMBER>
* 3: Error Code <NUMBER>
*
* Return Value:
* Nothing
*
* Example:
* (args from progressBar) call ace_magazinerepack_fnc_magazineRepackFinish
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_4(_args,_elapsedTime,_totalTime,_errorCode);
EXPLODE_2_PVT(_args,_magazineClassname,_lastAmmoCount);
_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count");
_structuredOutputText =
if (_errorCode == 0) then {
format ["<t align='center'>%1</t><br/>", (localize "STR_ACE_MagazineRepack_RepackComplete")];
} else {
format ["<t align='center'>%1</t><br/>", (localize "STR_ACE_MagazineRepack_RepackInterrupted")];
};
_picture = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "picture");
_structuredOutputText = _structuredOutputText + format ["<img align='center' size='1.8' color='#ffffff' image='%1'/> <br/>", _picture];
_fullMags = 0;
_partialMags = 0;
{
EXPLODE_2_PVT(_x,_xClassname,_xCount);
if ((_xClassname == _magazineClassname) && {_xCount > 0}) then {
if (_xCount == _fullMagazineCount) then {
_fullMags = _fullMags + 1;
} else {
_partialMags = _partialMags + 1;
};
};
} forEach (magazinesAmmoFull ACE_player);
_structuredOutputText = _structuredOutputText + format [("<t align='center'>" + (localize "STR_ACE_MagazineRepack_RepackedMagazinesCount") + "</t>"), _fullMags, _partialMags];
[parseText _structuredOutputText] call EFUNC(common,displayTextStructured);

View File

@ -56,4 +56,11 @@ if ((count _startingAmmoCounts) < 2) exitwith {ERROR("Not Enough Mags to Repack"
_simEvents = [_fullMagazineCount, _startingAmmoCounts] call FUNC(simulateRepackEvents);
_totalTime = (_simEvents select ((count _simEvents) - 1) select 0);
[_totalTime, [_magazineClassname, _startingAmmoCounts, _simEvents], {hint "done"}, {hint "fail"}, (localize "STR_ACE_MagazineRepack_RepackingMagazine"), {_this call FUNC(magazineRepackProgress)}] call EFUNC(common,progressBar);
[
_totalTime,
[_magazineClassname, _startingAmmoCounts, _simEvents],
{_this call FUNC(magazineRepackFinish)},
{_this call FUNC(magazineRepackFinish)},
(localize "STR_ACE_MagazineRepack_RepackingMagazine"),
{_this call FUNC(magazineRepackProgress)}
] call EFUNC(common,progressBar);

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-17 -->
<!-- Edited with tabler - 2015-02-08 -->
<Project name="ACE">
<Package name="MagazineRepack">
<Key ID="STR_ACE_MagazineRepack_RepackMagazines">
@ -74,5 +74,14 @@
<Hungarian>%1 tejles tár és %2 extra lőszer.</Hungarian>
<Russian>%1 полных магазина(ов) и %2 патрона(ов)</Russian>
</Key>
<Key ID="STR_ACE_MagazineRepack_RepackComplete">
<English>Repacking Finished</English>
</Key>
<Key ID="STR_ACE_MagazineRepack_RepackInterrupted">
<English>Repacking Interrupted</English>
</Key>
<Key ID="STR_ACE_MagazineRepack_RepackedMagazinesCount">
<English>%1 Full and %2 Partial</English>
</Key>
</Package>
</Project>