Permalink
Browse files

migrating files to new organization

  • Loading branch information...
dbenson24 committed Jul 7, 2016
1 parent d366b46 commit 8720a159f055f161865deada9cc4b50fc00b00ec
View
@@ -1,10 +1,10 @@
language: python
python:
- '3.5'
- '3.4'
before_script:
# Credits to ACE3 for these validators
- wget https://raw.githubusercontent.com/ArmaLife/travis_files/master/sqf_validator.py
- wget https://raw.githubusercontent.com/ArmaLife/travis_files/master/config_style_checker.py
- wget https://www.dropbox.com/s/wzj5js0kc2xlanc/sqf_validator.py
- wget https://www.dropbox.com/s/jza43yuxswvx2hz/config_style_checker.py
script:
- python3 sqf_validator.py
- python3 config_style_checker.py
@@ -0,0 +1,40 @@
#include "..\..\script_macros.hpp"
/*
File: fn_levelCheck.sqf
Author: BoGuu
Description:
Level check function for the weapon config.
WIP - Other shop configs
*/
private "_return";
_itemConfig = param [0, [], []];
_return = false;
if (_itemConfig isEqualTo []) exitWith {diag_log "An empty array was passed to fn_levelCheck.sqf"; _return};
if (count _itemConfig > 3) then {
_levelArray = _itemConfig param [4,[],[]];
_levelName = _levelArray select 0;
_levelType = _levelArray select 1;
_levelValue = _levelArray select 2;
if !(_levelValue isEqualTo -1) then {
_level = missionNamespace getVariable _levelName;
if (typeName _level isEqualTo "CODE") then {_level = FETCH_CONST(_level);};
_return = switch(_levelType) do {
case "SCALAR": {_level >= _levelValue};
case "BOOL": {_level};
case "EQUAL": {_level isEqualTo _levelValue};
default {false};
};
} else {
_return = true;
};
} else {
_return = true;
};
_return;
@@ -2,6 +2,7 @@
/*
File: fn_weaponShopFilter.sqf
Author: Bryan "Tonic" Boardwine
Edit: Added level checks - BoGuu
Description:
Applies the filter selected and changes the list.
@@ -23,14 +24,17 @@ if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 1 || (uiNamespace
if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 1) then {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"mags");
{
_var = _x select 0;
_count = {_x == _var} count (uiNamespace getVariable ["Magazine_Array",[]]);
if (_count > 0) then {
_itemInfo = [(_x select 0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
_bool = [_x] call life_fnc_levelCheck;
if (_bool) then {
_var = _x select 0;
_count = {_x == _var} count (uiNamespace getVariable ["Magazine_Array",[]]);
if (_count > 0) then {
_itemInfo = [(_x select 0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
} forEach (_config);
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Weapons";
@@ -39,14 +43,17 @@ if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 1 || (uiNamespace
} else {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"accs");
{
_var = _x select 0;
_count = {_x == _var} count (uiNamespace getVariable ["Accessories_Array",[]]);
if (_count > 0) then {
_itemInfo = [(_x select 0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
_bool = [_x] call life_fnc_levelCheck;
if (_bool) then {
_var = _x select 0;
_count = {_x == _var} count (uiNamespace getVariable ["Accessories_Array",[]]);
if (_count > 0) then {
_itemInfo = [(_x select 0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
} forEach (_config);
((findDisplay 38400) displayCtrl 38407) ctrlSetText localize "STR_Global_Weapons";
@@ -56,18 +63,25 @@ if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 1 || (uiNamespace
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
ctrlShow [38402,false];
} else {
switch (_index) do {
case 0: {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
{
_itemInfo = [(_x select 0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
_bool = [_x] call life_fnc_levelCheck;
if (_bool) then {
_itemInfo = [_x select 0] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {_x select 1} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,_x select 2];
};
} forEach (_config);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
((findDisplay 38400) displayCtrl 38407) ctrlSetText localize "STR_Global_Accs";
@@ -97,27 +111,42 @@ if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 1 || (uiNamespace
ctrlShow [38406,false];
ctrlShow [38407,false];
_itemArray = M_CONFIG(getArray,"WeaponShops",_shop,"items");
_itemArray = [];
_itemArray pushBack M_CONFIG(getArray,"WeaponShops",_shop,"items");
_itemArray pushBack M_CONFIG(getArray,"WeaponShops",_shop,"mags");
_itemArray pushBack M_CONFIG(getArray,"WeaponShops",_shop,"accs");
{
if (!(_x in _listedItems) && _x != "") then {
_iS = [_x,_itemArray] call TON_fnc_index;
if (_iS != -1) then {
if (!(((_itemArray select _iS) select 3) isEqualTo -1)) then {
_itemInfo = [_x] call life_fnc_fetchCfgDetails;
_listedItems pushBack _x;
_y = _x;
{
if (!(_x in _listedItems) && _x != "") then {
_iS = [_x,_y] call TON_fnc_index;
if (_iS != -1) then {
_z = _y select _iS;
if (!((_z select 3) isEqualTo -1)) then {
_bool = [_z] call life_fnc_levelCheck;
if (_bool) then {
_itemInfo = [_x] call life_fnc_fetchCfgDetails;
_listedItems pushBack _x;
_itemCount = {_x == (_itemInfo select 0)} count _config;
if (_itemCount > 1) then {
_itemList lbAdd format["[%2] %1",(_itemInfo select 1),_itemCount];
} else {
_itemList lbAdd format["%1",(_itemInfo select 1)];
_itemCount = {_x == (_itemInfo select 0)} count _config;
if (_itemCount > 1) then {
_itemList lbAdd format["[%2] %1",_itemInfo select 1,_itemCount];
} else {
_itemList lbAdd format["%1",_itemInfo select 1];
};
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
};
};
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
};
};
};
} forEach _config;
} forEach _config;
} forEach _itemArray;
};
};
};
@@ -124,7 +124,7 @@ for "_i" from 0 to 1 step 0 do {
};
_vehicle_data = _vehicle getVariable ["Trunk",[[],0]];
_inv = (_vehicle_data select 0);
_inv = +(_vehicle_data select 0);
_space = (_vehicle_data select 1);
_itemIndex = [_resource,_inv] call TON_fnc_index;
_weight = [_vehicle] call life_fnc_vehicleWeight;
@@ -1,57 +1,57 @@
/*
File: fn_fuelStore.sqf
Author: Ulrich "Zero" Werren
Description:
Fuel Tank Job, Fill Truck with Fuel.
*/
private["_vehicle","_fuelSpace","_fuelState","_fuelLevel","_ui","_progress","_pgText"];
_vehicle = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _vehicle) exitWith {};
if (!isNil {_vehicle getVariable "fuelTankWork"}) exitWith {titleText[localize "STR_FuelTank_InUse","PLAIN"];};
closeDialog 0;
life_action_inUse = true;
if (isNil {_vehicle getVariable "fuelTank"}) then{
_fuelSpace = getNumber(missionConfigFile >> "LifeCfgVehicles" >> (typeOf _vehicle) >> "vFuelSpace");
_fuelState = 0;
_vehicle setVariable ["fuelTank",[_fuelSpace,_fuelState],true];
}else{
_fuelSpace = (_vehicle getVariable "fuelTank") select 0;
_fuelState = (_vehicle getVariable "fuelTank") select 1;
};
_vehicle setVariable ["fuelTankWork",true,true];
_vehicle remoteExec ["life_fnc_soundDevice",-2];
life_action_inUse = false;
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["Tank %1 Ltr / %2 Ltr",_fuelState,_fuelSpace];
_fuelLevel = (1 / _fuelSpace) * _fuelState;
_progress progressSetPosition _fuelLevel;
waitUntil {
if (!alive _vehicle || isNull _vehicle) exitWith {true};
if (isEngineOn _vehicle) exitWith {titleText[localize "STR_FuelTank_Stopped","PLAIN"]; true};
if (isNil {_vehicle getVariable "fuelTankWork"}) exitWith {titleText[localize "STR_FuelTank_Stopped","PLAIN"]; true};
if (player distance _vehicle > 20) exitWith {titleText[localize "STR_FuelTank_Stopped","PLAIN"]; true};
_fuelState = _fuelState + 100;
_vehicle setVariable ["fuelTank",[_fuelSpace,_fuelState],true];
_fuelLevel = (1 / _fuelSpace) * _fuelState;
_progress progressSetPosition _fuelLevel;
_pgText ctrlSetText format["Tank %1 Ltr / %2 Ltr",_fuelState,_fuelSpace];
if (_fuelState >= _fuelSpace) exitWith {titleText [localize "STR_FuelTank_Full","PLAIN"]; true};
sleep 0.5;
false
};
5 cutText ["","PLAIN"];
/*
File: fn_fuelStore.sqf
Author: Ulrich "Zero" Werren
Description:
Fuel Tank Job, Fill Truck with Fuel.
*/
private["_vehicle","_fuelSpace","_fuelState","_fuelLevel","_ui","_progress","_pgText"];
_vehicle = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _vehicle) exitWith {};
if (!isNil {_vehicle getVariable "fuelTankWork"}) exitWith {titleText[localize "STR_FuelTank_InUse","PLAIN"];};
closeDialog 0;
life_action_inUse = true;
if (isNil {_vehicle getVariable "fuelTank"}) then{
_fuelSpace = getNumber(missionConfigFile >> "LifeCfgVehicles" >> (typeOf _vehicle) >> "vFuelSpace");
_fuelState = 0;
_vehicle setVariable ["fuelTank",[_fuelSpace,_fuelState],true];
}else{
_fuelSpace = (_vehicle getVariable "fuelTank") select 0;
_fuelState = (_vehicle getVariable "fuelTank") select 1;
};
_vehicle setVariable ["fuelTankWork",true,true];
_vehicle remoteExec ["life_fnc_soundDevice",-2];
life_action_inUse = false;
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["Tank %1 Ltr / %2 Ltr",_fuelState,_fuelSpace];
_fuelLevel = (1 / _fuelSpace) * _fuelState;
_progress progressSetPosition _fuelLevel;
waitUntil {
if (!alive _vehicle || isNull _vehicle) exitWith {true};
if (isEngineOn _vehicle) exitWith {titleText[localize "STR_FuelTank_Stopped","PLAIN"]; true};
if (isNil {_vehicle getVariable "fuelTankWork"}) exitWith {titleText[localize "STR_FuelTank_Stopped","PLAIN"]; true};
if (player distance _vehicle > 20) exitWith {titleText[localize "STR_FuelTank_Stopped","PLAIN"]; true};
_fuelState = _fuelState + 100;
_vehicle setVariable ["fuelTank",[_fuelSpace,_fuelState],true];
_fuelLevel = (1 / _fuelSpace) * _fuelState;
_progress progressSetPosition _fuelLevel;
_pgText ctrlSetText format["Tank %1 Ltr / %2 Ltr",_fuelState,_fuelSpace];
if (_fuelState >= _fuelSpace) exitWith {titleText [localize "STR_FuelTank_Full","PLAIN"]; true};
sleep 0.5;
false
};
5 cutText ["","PLAIN"];
_vehicle setVariable ["fuelTankWork",nil,true];
Oops, something went wrong.

0 comments on commit 8720a15

Please sign in to comment.