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

Update fn_weaponShopMags.sqf #644

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
52 changes: 44 additions & 8 deletions Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf
Original file line number Diff line number Diff line change
@@ -1,23 +1,59 @@
#include "..\..\script_macros.hpp"
/*
File: fn_weaponShopMags.sqf
Author: Daniel Stuart
Authors: Daniel Stuart, Faron, TaktischerSpeck


Description:
Set Weapon Shop in magazine mode
*/
disableSerialization;

if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 0) then {
private _weapon = lbData[38403,lbCurSel (38403)];
private _magArray = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"magazines");
private _weapon = 0;
private _magArray = [];
private _magWell = [];
private _subClass = 0;
private _muzzles = [];
private _subCfgClass = 0;

_weapon = lbData[38403,lbCurSel (38403)];
_magArray = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");

_magWell = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazineWell");
{
if (_x in FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"muzzles")) then {
_magArray append FETCH_CONFIG(getArray,"CfgWeapons",_weapon,_x,"magazines");
};
} count ["EGLM", "GL_3GL_F"];
_subClass = _x;
_subCfgClass = configProperties [configFile >> "CfgMagazineWells" >> _subClass];

{
_magArray append getArray _x;
true;
} count _subCfgClass;
true;
} count _magWell;

//GL and stuff
_muzzles = (getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles")) - ["this"];
if (_muzzles isEqualTo []) then {
{
_magArray append getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
_magWell = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazineWell");
{
_subClass = _x;
_subCfgClass = configProperties [configFile >> "CfgMagazineWells" >> _subClass];

{
_magArray append getArray _x;
true;
} count _subCfgClass;
true;
} count _magWell;
true;
} count _muzzles;
};

uiNamespace setVariable ["Magazine_Array",_magArray];
uiNamespace setVariable ["Weapon_Magazine",1];
} else {
uiNamespace setVariable ["Weapon_Magazine",0];
};
};