diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..25956163b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.gitignore +.idea +ArmA3_Wasteland.Altis.iml \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..4f82d49ec --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,163 @@ +###Contributing to this A3Wasteland fork### +This fork of A3Wasteland is an open source project and we love to receive contributions from the community — you! There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into A3Wasteland itself. + +####Why does this fork exist#### +This fork exists to provide an alternate way of stats persistence that is more scalable than extDB, and iniDB, and that is easier to maintain and update due to its schemaless nature. + +The fork maintains a main branch called *Development_main*, which closely follows the development of the the parent (official) A3Wasteland repository. The *Development_main* should not deviate feature-wise from the official A3Wasteland development. + +The only changes that are allowed to go into the *Development_main* branch are those that are persistence related. + +The fork also maintains a branch called *Development_main_addons*. This branch is where we put those features that are not accepted (or not being implemented) into the official A3Wasteland repository (for whatever reasons). Some examples of these features are: + + * Private Storage + * Private Parking + * Extra vehicle actions (with locking/unlocking) + * ATMs + * Improved admin camera + * Water-edge glitch improvement + * Mine-saving + * Improved spawn experience + + +####Bug reports#### + + +If you think you have found a bug in this fork of the A3Wasteland mission, first make sure that you test against [the official A3Wasteland vanilla mission](https://github.com/A3Wasteland/ArmA3_Wasteland.Altis) - If the issue exists over there, then please create the issue over there instead. Unless the issues are related to persistence, or to an addon, it's very likely that the issue exists as well in the vanilla mission. + +Also, make sure to search our [issues list](https://github.com/micovery/ArmA3_Wasteland.Altis/issues) on GitHub in case a similar issue has already been opened. + +It is very helpful if you can prepare a reproduction of the bug. In other words, provide a small test case (or series of steps) which we can do in order to consistently reproduce the bug. It makes it easier to find the problem and to fix it. Do not simply say "XYZ is not working", please explain how exactly is it not working (what is the expectation vs what is actually happening), and under what circumstances. + +Provide as much information as you can. The easier it is for us to recreate your problem, the faster it is likely to be fixed. + +####Addons and feature requests#### + +If you find yourself wishing for an addon or feature that doesn't exist in this fork of A3Wasteland, you are probably not alone. There are bound to be others out there with similar needs. Many of the addons and features in the "Development_main_addons" branch today have been added because admins and/or users saw the the need. +Open an issue on our [issues list](https://github.com/micovery/ArmA3_Wasteland.Altis/issues) on GitHub which describes the feature you would like to see, why you need it, and how it should work. + +####Contributing code and documentation changes#### + +If you have a bugfix or new feature that you would like to contribute to this fork of A3Wasteland, please find or open an issue about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there are particular issues that you should know about before implementing the change. + +We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is important to find the best approach before writing too much code. + +See more details below for the process of contributing code to this fork of A3Wasteland. + +#### Fork and clone the repository #### + +You will need to fork this repository and clone it to your local machine. See +[github help page](https://help.github.com/articles/fork-a-repo) for help. + +**Repository:** [https://github.com/micovery/ArmA3_Wasteland.Altis](https://github.com/micovery/ArmA3_Wasteland.Altisb) + +#### Submitting your changes #### + +Once your changes and tests are ready to submit for review: + +1. Test your changes + + Load up the mission with your changes, and make sure that your feature actually works as expected, and that it does not negatively impact other areas. + +2. Sign the Contributor License Agreement + + Please make sure you have signed our [Contributor License Agreement](https://www.clahub.com/agreements/micovery/ArmA3_Wasteland.Altis). We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once. + +3. Rebase your changes + + Update your local repository with the most recent code from the main A3Wasteland (sock-rpc-stats) repository, and rebase your branch on top of the latest "Development_main" branch. We prefer your changes to be squashed into a single commit. + +4. Submit a pull request + + Push your local changes to your forked copy of the repository and [submit a pull request](https://help.github.com/articles/using-pull-requests). In the pull request, describe what your changes do and mention the number of the issue where discussion has taken place, eg "Closes #123". + +Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into A3Wasteland (sock-rpc-stats). + + +#### Follow these coding guidelines #### + +* SQF indent is 2 spaces (no tabs) +* No unnecessary aligning of code to make it "Look nice". For example + +```SQF + _foo = "............."; + _fooBar = "............."; + _fooBarWidgets = "............."; + +``` + +* Use if statements, instead of switch statements. Do not do stuff like this: +``` + switch (_foo) : { + case (): { + + } + case (): { + + } + default: { + + } + } +``` + +Instead, use the following format for if/else-if/else + +```SQF + + if () then { + + } + else { if () then { + + } + else { + + }}; +``` + + +* Avoid unnecessary nesting where possible. This is a subtle one. Sometimes you end with code that looks like this: + +```SQF + { + if () then { + if () then { + //actual logic here + } + } + } + } forEach _someArray; +``` + +This is unnecessary, and makes the code hard to maintain and understand. Instead do this: + +```SQF + {if (true) then { + + if (!) exitWith {}; + if (!) exitWith {}; + if (!) exitWith {}; + + //actual logic here + + }} forEach _someArray; +``` + +The whole point of this is to try to keep the code as flat as possible, and thus improve readability and maintenance, and reduce chance of subtle bugs. + +* Use functions and modularize as much as possible. +* Do not try to cram giant expressions into IF statements (create new functions if needed) +* Use underscore "_" instead of camel-casing for variable names, and function names. +* Always be coding on the defensive, do not assume that all the parameters passed into a function will always be initialized +* Use the utility macros from the macro.h file to help you out with type-checks, and processing of function arguments +* Line width is 140 characters +* Follow the Google [JavaScript style guidelines](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml) +* Do not re-format existing code. If there is legacy code form the A3Wasteland vanilla mission, do not reformat it. Follow the existing style instead. +* Wherever possible avoid making changes to the A3Wasteland vanilla files. +* Always define local variables before using them (use the "def", or "init" macros). +* Do not bulk-up local variable definitions all in one place. +* Try to define the local variable as close to the place where it's first used. +* Familiarize yourself with the "ARGV", and "ARGVX" macros for processing function parameters, and use them. +* Use the "init", and "def" macros instead of the "private" keyword diff --git a/README.md b/README.md index e895328aa..7553a8bbd 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,61 @@ -*Wasteland.Altis* by Team Wasteland! -=================== +###Wasteland.Altis (Sock-RPC-Stats fork) ### -ArmA 3 Wasteland is a harsh survival sandbox mission where 2 teams and independent players fight for survival. +This is a fork of the Wasteland mission with persistence support using the [sock-rpc-stats Node.js module](https://www.npmjs.org/package/sock-rpc-stats), and the [sock.dll / sock.so](https://bitbucket.org/micovery/sock.dll) Arma 3 extension. +The main mission itself is maintained by "Team Wasteland". -The mission is not ready yet, so for now it's just a placeholder :) +### PBOs ### +If you are looking for the prebuilt PBO files head over to the [Release Files](https://github.com/micovery/ArmA3_Wasteland.Altis/releases/). -*Team Wasteland* collaborators: +###Demo video tutorial (dedicated server)### + + +[![Demo Video](http://img.youtube.com/vi/-NIziTcKwok/0.jpg)](http://www.youtube.com/watch?v=-NIziTcKwok) + +### Prerequisites ### + * Download and install [Node.js](http://nodejs.org/download/) + * Install Arma 3 dedicated server by following [these instructions](https://community.bistudio.com/wiki/Arma_3_Dedicated_Server) from the BIS Wiki + + +###Linux Setup Instructions (dedicated server)### + +0. Install the stats server packages using npm +
npm install -g sock-rpc-stats
+0. Start the Stats server (example below using file system storage) +
sock-rpc-stats --url=file://./stats --repl
+0. Open a new terminal, and switch to the Arma 3 server directory +
cd ~/steamcmd/arma3
+0. Download and unzip the Wasteland saving pack +
wget https://github.com/micovery/ArmA3_Wasteland.Altis/releases/download/v0.0.1/A3W_Saving_Pack-sock_v0.0.1.zip
+
unzip A3W_Saving_Pack-sock_v0.0.1.zip
+0. Download misison file, and put it in the mpmissions directory +
wget https://github.com/micovery/ArmA3_Wasteland.Altis/releases/download/v0.0.1/ArmA3_Wasteland_v0.9h-sock_v0.0.1.Altis.pbo
+
mv ArmA3_Wasteland_v0.9h-sock_v0.0.1.Altis.pbo mpmissions/
+0. Modify your server config file to reference the Wasteland mission +
+  //excerpt from server.cfg
+  class Missions {
+    class Test {
+      template="ArmA3_Wasteland_v0.9h-sock_v0.0.1.Altis";
+      difficulty="regular";
+    };
+  };
+
+0. Start the Arma 3 server +
./arma3server -sock_host=127.0.0.1 -sock_port=1337 -profiles=server -config=server/server.cfg -cfg=server/arma3.cfg -port=2302
+ + +###Help### + + +For defects related to the mission please visit their [forums](http://forums.a3wasteland.com/), or submit issues directly to their [github repository](https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/issues) + +For defects related to persistence, use the [issue tracker](https://github.com/micovery/ArmA3_Wasteland.Altis/issues) in this repository. + + + +### *Team Wasteland* ### GoT - JoSchaap TPG - AgentRev @@ -15,3 +63,6 @@ The mission is not ready yet, so for now it's just a placeholder :) KoS - His_Shadow KoS - Bewilderbeest 404 - Del1te + + + diff --git a/addons/Explosives-To-Vehicle/EtV.sqf b/addons/Explosives-To-Vehicle/EtV.sqf new file mode 100644 index 000000000..ec7d31e3d --- /dev/null +++ b/addons/Explosives-To-Vehicle/EtV.sqf @@ -0,0 +1,108 @@ +/* + Stealthstick's "Explosive-To-Vehicle" Script + -Allows players to attach their explosive charges to any vehicle. +*/ + +EtV_ChargeCheck = +{ + _charge = _this select 0; + _unit = _this select 1; + _hasIt = _charge in (magazines _unit); + _nearVehs = nearestObjects [_unit,["Plane","Ship","LandVehicle","Helicopter_Base_F"],5]; + _return = (_hasIt && count _nearVehs > 0 && alive _unit); + _return +}; + +EtV_TouchOff = +{ + _array = _this select 3; + _unit = _array select 0; + _explosives = _unit getVariable ["charges",[]]; + { + if(alive _x) then + { + "HelicopterExploSmall" createVehicle (position _x); + deleteVehicle _x; + }; + } forEach _explosives; + _unit setVariable ["charges",[]]; +}; + +EtV_UnitCheck = +{ + private "_return"; + _unit = _this select 0; + _explosives = _unit getVariable ["charges",[]]; + if(count _explosives > 0) then + { + _return = true; + } + else + { + _return = false; + }; + + _return +}; + +EtV_AttachCharge = +{ + _array = _this select 3; + _charge = _array select 0; + _unit = _array select 1; + private "_class"; + + _unit removeMagazine _charge; + _unit playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; + + switch _charge do + { + case "DemoCharge_Remote_Mag": + { + _class = "DemoCharge_Remote_Ammo"; + }; + }; + + _nearVehicle = (nearestObjects [_unit,["Plane","Ship","LandVehicle","Helicopter_Base_F"],5]) select 0; + _explosive = _class createVehicle [0,0,0]; + _explosive attachTo [_unit,[0,1,0],"Lefthand"]; + _random0 = random 180; + _random1 = random 180; + [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; + [_explosive,_nearVehicle,_unit,_random0,_random1] spawn + { + _explosive = _this select 0; + _nearVehicle = _this select 1; + _unit = _this select 2; + _random0 = _this select 3; + _random1 = _this select 4; + + sleep 1.5; + _explosive attachTo [_nearVehicle]; + [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; + _unit setVariable ["charges",(_unit getVariable ["charges",[]]) + [_explosive]]; + }; +}; + +EtV_ClosestExplosive = +{ + _unit = _this select 0; + _charges = _unit getVariable ["charges",[]]; + _newArray = []; + {_newArray = _newArray + [player distance _x];} forEach _charges; + _closest = _newArray call BIS_fnc_lowestNum; + _selection = _newArray find _closest; + _charge = _charges select _selection; + _charge +}; + +//[unit] spawn EtV_Actions; +EtV_Actions = +{ + private ["_unit"]; + _unit = _this select 0; + _unit addAction ["" +"Attach Explosive Charge", EtV_AttachCharge, ["DemoCharge_Remote_Mag",_unit], 1, true, true, "","['DemoCharge_Remote_Mag',_target] call EtV_ChargeCheck"]; + _unit addAction ["" +"Touch off bomb(s)", EtV_TouchOff, [_unit], 1, true, true, "","[_target] call EtV_UnitCheck"]; +}; +//======================= +EtVInitialized = true; \ No newline at end of file diff --git a/addons/Explosives-To-Vehicle/init.sqf b/addons/Explosives-To-Vehicle/init.sqf new file mode 100644 index 000000000..8f45085f6 --- /dev/null +++ b/addons/Explosives-To-Vehicle/init.sqf @@ -0,0 +1,4 @@ +waitUntil {time > 0}; +execVM "addons\Explosives-To-Vehicle\EtV.sqf"; +waitUntil {!isNil "EtVInitialized"}; +[player] call EtV_Actions; \ No newline at end of file diff --git a/addons/JTS_PM/Functions.sqf b/addons/JTS_PM/Functions.sqf new file mode 100644 index 000000000..2a951053d --- /dev/null +++ b/addons/JTS_PM/Functions.sqf @@ -0,0 +1,214 @@ +//ALL FUNCTIONS MADE BY JTS + +waitUntil {!isNull player}; // Do not remove that + + +// EDITABLE VARIABLES (BEGIN) + +JTS_MSG_STR = "Messenger"; // Text, which will be displayed in action menu +JTS_ALLOW_PM = 0; // if 0 - receiving of personal messages on mission start is allowed. If 1 - receiving of personal messages on mission start is prohibited +JTS_SIDES = 0; // if 0 - list for player will be filled with all players, no matter on which side they are. If 1 - list for player will be filled only with players on the same side +JTS_MSG_COLOR = "#980000"; // Color of the text in action menu. The colors you can find here: http://www.w3schools.com/html/html_colors.asp + +// EDITABLE VARIABLES (END) + +player setVariable ["JTS_PM_STAT",JTS_ALLOW_PM,true]; + +JTS_DLPM = 0; +JTS_SUBJECT = 0; +JTS_PM_ARRAY = []; + +if (JTS_SIDES > 0) then {JTS_ALLOWED_SIDES = {(side _x == side player)}} else {JTS_ALLOWED_SIDES = true}; + +JTS_FNC_PM = +{ + private "_Find"; + + JTS_PM_UNP = playAbleUnits; + JTS_DLPM = 1; + + lbClear 00002; + lbClear 00003; + lbClear 00005; + + ctrlEnable [00002, false]; + ctrlEnable [00003, false]; + ctrlEnable [00005, false]; + ctrlEnable [00008, false]; + ctrlEnable [00009, false]; + ctrlEnable [00010, false]; + ctrlEnable [00011, false]; + + for "_i" from 0 to (count JTS_PM_ARRAY) do + { + lbAdd [00002, (JTS_PM_ARRAY select _i) select 0]; + lbSetData [00002, (lbSize 00002) - 1, (JTS_PM_ARRAY select _i) select 1]; + }; + + _Find = 0; + { + if (!isNull _x) then + { + if (alive _x && isPlayer _x && JTS_ALLOWED_SIDES) then + { + + lbAdd [00003, name _x]; + lbSetValue [00003, (lbSize 00003) - 1, _Find]; + }; _Find = _Find + 1; + }; + } forEach JTS_PM_UNP; + + lbsetcursel [00002, (lbSize 00002)]; + lbsetcursel [00003, 0]; + + ctrlEnable [00002, true]; + ctrlEnable [00003, true]; + ctrlEnable [00005, true]; + ctrlEnable [00009, true]; + ctrlEnable [00010, true]; + ctrlEnable [00011, true]; + + ctrlsettext [00007, Format ["Inbox: %1", lbSize 00002]]; + + JTS_DLPM = 0; +}; + +JTS_FNC_SENT = +{ + _Title = _this select 0; + _PM = _this select 1; + + JTS_PM_ARRAY set [count JTS_PM_ARRAY, [_Title, _PM]]; + hint parsetext "

You've Got a Text Message!"; + + if (alive player && dialog && JTS_DLPM < 1) then + { + {[] spawn _x} foreach [JTS_FNC_PM,JTS_FNC_PM_ENABLED,JTS_FNC_STATUS] + } + + else + { + closedialog 0 + }; +}; + +JTS_FNC_SEND = +{ + private ["_Size","_Title","_Message","_PM","_Receiver","_Validating","_Verify"]; + + _Size = count (toArray (ctrltext 00006)); + _Title = ctrltext 00006; + _Message = ctrltext 00004; + _PM = Format ["From: %1\n\n%2", name player, ctrlText 00004]; + _Receiver = JTS_PM_UNP select (lbValue [00003, lbCursel 00003]); + _Verify = 0; + + if (_Size > 15 || lbSize 00003 < 1) then + { + ctrlsettext [00007, "Error sending PM"]; + {ctrlsettext [_x, ""]} foreach [00004, 00006]; + } + + else + { + if (!(_Receiver call JTS_FNC_VALID)) then + { + ctrlsettext [00007, "Player doesn't respond"]; + {ctrlsettext [_x, ""]} foreach [00004,00006]; + } + + else + { + if (count (toArray _Title) < 2) then + { + ctrlsettext [00007, "Title is too small"]; + } + + else + { + if (_Receiver getVariable "JTS_PM_STAT" > 0) then + { + ctrlsettext [00007, "Player does not receive PM's"]; + } + + else + { + _Validating = toArray _Title; + + for "_i" from 0 to count _Validating do + { + if (_Validating select _i == 32) then + { + _Verify = _Verify + 1 + } + }; + + if (_Verify == count _Validating) then + { + _Title = Format ["No subject [%1] [%2]", name player, JTS_SUBJECT]; + JTS_SUBJECT = JTS_SUBJECT + 1; + }; + + ctrlsettext [00007, Format ["PM sent to %1", name _Receiver]]; + [[_Title, _PM],"JTS_FNC_SENT",_Receiver,false] spawn BIS_fnc_MP; + {ctrlsettext [_x, ""]} foreach [00004, 00006]; + }; + }; + }; + }; [] spawn {JTS_DLPM = 1;ctrlEnable [00009, false];ctrlEnable [00011, false];sleep 3;ctrlEnable [00009, true];ctrlEnable [00011, true];JTS_DLPM = 0;if (alive player && dialog) then {{[] spawn _x} foreach [JTS_FNC_PM,JTS_FNC_PM_ENABLED,JTS_FNC_STATUS]}} +}; + +JTS_FNC_PM_ENABLED = +{ + {lbAdd [00005, _x]} foreach ["Enabled","Disabled"]; + {lbSetValue [00005, (lbSize 00005) - 1, _x]} foreach [(lbSize 00005) - 1]; + lbsetcursel [00005, player getVariable "JTS_PM_STAT"]; +}; + +JTS_FNC_STATUS = +{ + while {alive player && dialog} do + { + _sz = count (toArray (ctrltext 00006)); + ctrlsettext [00008, Format ["%1/15", _sz]]; + sleep 0.1; + }; +}; + + +JTS_FNC_VALID = +{ + if (isNull _this ||!alive player) then + { + false + } + + else + { + if (!alive _this || _this == player || !isPlayer _this || !alive player) then + { + false + } + + else + { + true + } + } +}; + +JTS_FNC_PM_DELETE = +{ + if (lbSize 00002 < 1) then + { + ctrlsettext [00007, "Your inbox is empty"]; + } + + else + { + _Data = lbData [00002, lbCursel 00002]; + _Subject = lbText [00002, lbCursel 00002]; + JTS_PM_ARRAY = JTS_PM_ARRAY - [[_Subject,_Data]]; + {[] spawn _x} foreach [JTS_FNC_PM,JTS_FNC_PM_ENABLED,JTS_FNC_STATUS] + }; +}; diff --git a/addons/JTS_PM/Icons/Message.paa b/addons/JTS_PM/Icons/Message.paa new file mode 100644 index 000000000..3c33157a7 Binary files /dev/null and b/addons/JTS_PM/Icons/Message.paa differ diff --git a/addons/JTS_PM/JTS_PM.sqf b/addons/JTS_PM/JTS_PM.sqf new file mode 100644 index 000000000..7f0eff5f4 --- /dev/null +++ b/addons/JTS_PM/JTS_PM.sqf @@ -0,0 +1,6 @@ +if (!alive player) exitWith {closedialog 0}; +if (JTS_DLPM > 0) exitWith {closedialog 0;hint "Please, wait..."}; + +createDialog "JTS_PM"; + +{[] spawn _x} foreach [JTS_FNC_PM,JTS_FNC_PM_ENABLED,JTS_FNC_STATUS]; \ No newline at end of file diff --git a/addons/JTS_PM/PM_Compact.hpp b/addons/JTS_PM/PM_Compact.hpp new file mode 100644 index 000000000..1dd94c966 --- /dev/null +++ b/addons/JTS_PM/PM_Compact.hpp @@ -0,0 +1,367 @@ +#define JTS_CT_STATIC_PM 0 +#define JTS_CT_EDIT_PM 2 +#define JTS_CT_COMBO_PM 4 + +#define JTS_ST_LEFT_PM 0x00 +#define JTS_ST_SINGLE_PM 0 +#define JTS_ST_MULTI_PM 16 +//#define ST_WITH_RECT 160 +#define JTS_ST_NO_RECT_PM 0x200 + +#define JTS_FontM_PM "PuristaMedium" + +class JTS_GUI +{ + type = 0; + idc = -1; + style = 128; + colorText[] = {1,1,1,1}; + font = JTS_FontM_PM; + sizeEx = 0.04; + shadow = 0; + + colorbackground[] = + { + "(profilenamespace getvariable ['GUI_BCG_RGB_R',0])", + "(profilenamespace getvariable ['GUI_BCG_RGB_G',1])", + "(profilenamespace getvariable ['GUI_BCG_RGB_B',1])", + "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])" + }; +}; + +class JTS_RscButton +{ + idc = -1; + type = 16; + style = "0x02 + 0xC0"; + default = 0; + shadow = 0; + font = JTS_FontM_PM; + + animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; + + colorBackground[] = {0,0,0,0.8}; + colorBackgroundFocused[] = {1,1,1,1}; + colorBackground2[] = {0.75,0.75,0.75,1}; + color[] = {1,1,1,1}; + colorFocused[] = {0,0,0,1}; + color2[] = {0,0,0,1}; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.25}; + period = 1.2; + periodFocus = 1.2; + periodOver = 1.2; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + + soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; + + w = 0.095 * SafeZoneW; + h = 0.03 * SafeZoneH; + + class TextPos + { + left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)"; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0; + }; + + class Attributes + { + font = "PuristaLight"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + + class ShortcutPos + { + left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005"; + top = 0.005; + w = 0.0225; + h = 0.03; + }; + + class HitZone + { + left = 0; + top = 0; + right = 0; + bottom = 0; + }; +}; + +class JTS_RscEdit +{ + access = 0; + type = 2; + + colorBackground[] = {0,0,0,1}; + colorText[] = {0.95,0.95,0.95,1}; + colorDisabled[] = {0.95,0.95,0.95,1}; + + colorSelection[] = + { + "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])", + "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])", + "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", + 1 + }; + + autocomplete = ""; + text = ""; + size = 0.2; + style = "0x00 + 0x40"; + font = "PuristaMedium"; + shadow = 2; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + canModify = 1; + + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; +}; + +class JTS_PMText +{ + type = JTS_CT_STATIC_PM; + style = JTS_ST_LEFT_PM; + colorText[] = {1,1,1,1}; + colorBackground[] = {0, 0, 0, 0}; + font = "PuristaBold"; + sizeEx = 0.04; +}; + +class JTS_PMlite: JTS_PMText +{ + font = "PuristaLight"; + sizeEx = 0.035; +}; + +class JTS_RscCombo +{ + style = "0x10 + 0x200"; + access = ReadAndWrite; + type = JTS_CT_COMBO_PM; + shadow = 0; + maxHistoryDelay = 1; + wholeHeight = 0.44 * SafeZoneH; + font = JTS_FontM_PM; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + + colorSelect[] = {0,0,0,1}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0,0,0,1}; + colorScrollbar[] = {1,0,0,1}; + colorSelectBackground[] = {1,1,1,0.7}; + colorActive[] = {1,0,0,1}; + colorDisabled[] = {1,1,1,0.25}; + + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + + soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1}; + soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1}; + soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1}; + + arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; + arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; + + class ComboScrollBar + { + color[] = {1,1,1,1}; + autoScrollEnabled = 1; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; +}; + +class JTS_PM +{ + idd = -1; + movingEnable = false; + controlsBackground[] = {JTS_METRO,JTS_LINE}; + + class JTS_METRO: JTS_PMText + { + idc = -1; + moving = 1; + colorBackground[] = {0, 0, 0, 0.75}; + text = ""; + x = 0.2 * SafeZoneW + SafeZoneX; + y = 0.2 * SafeZoneH + SafeZoneY; + w = 0.3 * SafeZoneW; + h = 0.6 * SafeZoneH; + }; + + class JTS_LINE: JTS_GUI + { + idc = -1; + moving = 1; + text = "Messenger"; + x = 0.2 * SafeZoneW + SafeZoneX; + y = 0.168 * SafeZoneH + SafeZoneY; + w = 0.3 * SafeZoneW; + h = 0.03 * SafeZoneH; + }; + + controls[] = {JTS_DESCTEXT,JTS_INBOX,JTS_SEND,JTS_EDIT,JTS_STAT,JTS_EDIT_TITLE,JTS_INFOTEXT,JTS_TYPING,JTS_TXT1,JTS_TXT2,BUT1,BUT2,BUT3}; + + + class JTS_DESCTEXT: JTS_PMlite + { + idc = 00001; + style = JTS_ST_SINGLE_PM + JTS_ST_MULTI_PM + JTS_ST_NO_RECT_PM; + linespacing = 1; + shadow = 1; + text = ""; + x = 0.2 * SafeZoneW + SafeZoneX; + y = 0.3 * SafeZoneH + SafeZoneY; + w = 0.3 * SafeZoneW; + h = 0.3 * SafeZoneH; + }; + + class JTS_INBOX: JTS_RscCombo + { + idc = 00002; + onLBSelChanged = "ctrlsettext [00001, lbData [00002, lbCursel 00002]]"; + x = 0.21 * SafeZoneW + SafeZoneX; + y = 0.25 * SafeZoneH + SafeZoneY; + w = 0.18 * SafeZoneW; + h = 0.03 * SafeZoneH; + + }; + + class JTS_SEND: JTS_RscCombo + { + idc = 00003; + wholeHeight = 0.2 * SafeZoneH; + x = 0.395 * SafeZoneW + SafeZoneX; + y = 0.61 * SafeZoneH + SafeZoneY; + w = 0.095 * SafeZoneW; + h = 0.03 * SafeZoneH; + + }; + + class JTS_EDIT: JTS_RscEdit + { + idc = 00004; + text = ""; + toolTip = "Enter your message here"; + x = 0.21 * SafeZoneW + SafeZoneX; + y = 0.75 * SafeZoneH + SafeZoneY; + w = 0.28 * SafeZoneW; + h = 0.04 * SafeZoneH; + }; + + class JTS_STAT: JTS_RscCombo + { + idc = 00005; + onLBSelChanged = "player setVariable ['JTS_PM_STAT',lbValue [00005, lbCursel 00005], true]"; + toolTip = "Enable or disable the receiving of personal messages"; + wholeHeight = 0.2 * SafeZoneH; + x = 0.395 * SafeZoneW + SafeZoneX; + y = 0.25 * SafeZoneH + SafeZoneY; + w = 0.095 * SafeZoneW; + h = 0.03 * SafeZoneH; + + }; + + class JTS_EDIT_TITLE: JTS_RscEdit + { + idc = 00006; + text = ""; + toolTip = "Enter the title of the message here. Maximum length of the title is 15 characters"; + x = 0.21 * SafeZoneW + SafeZoneX; + y = 0.7 * SafeZoneH + SafeZoneY; + w = 0.19 * SafeZoneW; + h = 0.04 * SafeZoneH; + }; + + class JTS_INFOTEXT: JTS_PMlite + { + idc = 00007; + text = ""; + colorText[] = {0,1,0,1}; + x = 0.21 * SafeZoneW + SafeZoneX; + y = 0.65 * SafeZoneH + SafeZoneY; + w = 0.28 * SafeZoneW; + h = 0.032 * SafeZoneH; + }; + + class JTS_TYPING: JTS_RscEdit + { + idc = 00008; + text = ""; + x = 0.4 * SafeZoneW + SafeZoneX; + y = 0.7 * SafeZoneH + SafeZoneY; + w = 0.09 * SafeZoneW; + h = 0.04 * SafeZoneH; + }; + + class BUT1: JTS_RscButton + { + idc = 00009; + text = "SEND"; + action = "[] spawn JTS_FNC_SEND"; + x = 0.2 * SafeZoneW + SafeZoneX; + y = 0.805 * SafeZoneH + SafeZoneY; + }; + + class BUT2: JTS_RscButton + { + idc = 00010; + text = "CLOSE"; + action = "Closedialog 0"; + x = 0.405 * SafeZoneW + SafeZoneX; + y = 0.805 * SafeZoneH + SafeZoneY; + }; + + class BUT3: JTS_RscButton + { + idc = 00011; + text = "REMOVE"; + action = "[] spawn JTS_FNC_PM_DELETE"; + x = 0.3025 * SafeZoneW + SafeZoneX; + y = 0.805 * SafeZoneH + SafeZoneY; + }; + + class JTS_TXT1: JTS_PMText + { + idc = -1; + text = "Inbox:"; + x = 0.21 * SafeZoneW + SafeZoneX; + y = 0.21 * SafeZoneH + SafeZoneY; + w = 0.25 * SafeZoneW; + h = 0.032 * SafeZoneH; + }; + + class JTS_TXT2: JTS_PMText + { + idc = -1; + text = "Send to:"; + x = 0.21 * SafeZoneW + SafeZoneX; + y = 0.606 * SafeZoneH + SafeZoneY; + w = 0.195 * SafeZoneW; + h = 0.032 * SafeZoneH; + }; +}; \ No newline at end of file diff --git a/addons/JumpMF/detect_key_input.sqf b/addons/JumpMF/detect_key_input.sqf index 8ddba4969..36291ec9e 100644 --- a/addons/JumpMF/detect_key_input.sqf +++ b/addons/JumpMF/detect_key_input.sqf @@ -38,18 +38,36 @@ if (_pressedKey in actionKeys "GetOver") then [player, "AovrPercMrunSrasWrflDf"] call switchMoveGlobal; - waitUntil + horde_jumpmf_var_vel2 = _prevVel select 2; + + ["A3W_horde_jumpmf_vel", "onEachFrame", { - player setFatigue (_fatigue + 0.05 + (_load / 5000)); + horde_jumpmf_var_vel1 = (velocity player) select 2; + + // Ignore very high downward accelerations caused by step transitions, otherwise it kills the player + if (horde_jumpmf_var_vel1 - horde_jumpmf_var_vel2 < -7) then + { + horde_jumpmf_var_vel1 = horde_jumpmf_var_vel2; + }; + player setVelocity [ - (_prevVel select 0) * HORDE_JUMPMF_SLOWING_MULTIPLIER, - (_prevVel select 1) * HORDE_JUMPMF_SLOWING_MULTIPLIER, - ((velocity player) select 2) min 1 + (_this select 0) * HORDE_JUMPMF_SLOWING_MULTIPLIER, + (_this select 1) * HORDE_JUMPMF_SLOWING_MULTIPLIER, + horde_jumpmf_var_vel1 min 1 ]; + + horde_jumpmf_var_vel2 = (velocity player) select 2; + }, _prevVel] call BIS_fnc_addStackedEventHandler; + + waitUntil + { + player setFatigue (_fatigue + 0.05 + (_load / 5000)); (animationState player != "AovrPercMrunSrasWrflDf") }; + ["A3W_horde_jumpmf_vel", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; + [player, _prevMove] call switchMoveGlobal; player setVelocity [ diff --git a/addons/Lootspawner/LSlootLists.sqf b/addons/Lootspawner/LSlootLists.sqf index 5456e91b0..3612a3c69 100644 --- a/addons/Lootspawner/LSlootLists.sqf +++ b/addons/Lootspawner/LSlootLists.sqf @@ -110,8 +110,8 @@ lootMagazine_list = [ "100Rnd_65x39_caseless_mag", "100Rnd_65x39_caseless_mag_Tracer", - "150Rnd_762x51_Box", - "150Rnd_762x51_Box_Tracer", + "150Rnd_762x54_Box", + "150Rnd_762x54_Box_Tracer", //"16Rnd_9x21_Mag", "1Rnd_HE_Grenade_shell", "1Rnd_Smoke_Grenade_shell", diff --git a/addons/Lootspawner/fn_LSgetBuildingstospawnLoot.sqf b/addons/Lootspawner/fn_LSgetBuildingstospawnLoot.sqf index 9b433d535..5bbc500af 100644 --- a/addons/Lootspawner/fn_LSgetBuildingstospawnLoot.sqf +++ b/addons/Lootspawner/fn_LSgetBuildingstospawnLoot.sqf @@ -127,7 +127,9 @@ _begintime = diag_tickTime; { _loot = ((lootworldObject_list select _lootClass) select 1) call BIS_fnc_selectRandom; - if (_loot == "Land_Can_V3_F" && {["A3W_unlimitedStamina"] call isConfigOn}) exitWith { + if (_loot == "Land_Can_V3_F" && {["A3W_unlimitedStamina"] call isConfigOn} || + {(_loot == "Land_BakedBeans_F" || _loot == "Land_BottlePlastic_V2_F") && !(["A3W_survivalSystem"] call isConfigOn)}) exitWith + { _lootholder = objNull; }; diff --git a/addons/R3F_ARTY_AND_LOG/R3F_LOG/config.sqf b/addons/R3F_ARTY_AND_LOG/R3F_LOG/config.sqf index 9f11ba0a5..eb5a696f3 100644 --- a/addons/R3F_ARTY_AND_LOG/R3F_LOG/config.sqf +++ b/addons/R3F_ARTY_AND_LOG/R3F_LOG/config.sqf @@ -11,12 +11,38 @@ R3F_LOG_CFG_remorqueurs = "MRAP_01_base_F", "MRAP_02_base_F", "MRAP_03_base_F", + "Boat_Armed_01_base_F" +]; + +/** + * List of class names of (ground or air) vehicles which can tow heavy towables objects. + */ +R3F_LOG_CFG_remorqueursH = +[ "Truck_01_base_F", "Truck_02_base_F", "Truck_03_base_F", "Wheeled_APC_F", - "Tank_F", - "Boat_Armed_01_base_F" + "Tank_F" +]; + +/** + * List of class names of (ground or air) vehicles which can tow all towables objects. + */ +R3F_LOG_CFG_remorqueursALL = +[ + "SUV_01_base_F", + "Offroad_01_base_F", + "Van_01_base_F", + "MRAP_01_base_F", + "MRAP_02_base_F", + "MRAP_03_base_F", + "Boat_Armed_01_base_F", + "Truck_01_base_F", + "Truck_02_base_F", + "Truck_03_base_F", + "Wheeled_APC_F", + "Tank_F" ]; /** @@ -31,14 +57,87 @@ R3F_LOG_CFG_objets_remorquables = "MRAP_01_base_F", "MRAP_02_base_F", "MRAP_03_base_F", + "UAV_02_base_F", + "UGV_01_base_F", + "SDV_01_base_F", + "Boat_Civil_01_base_F", + "Boat_Armed_01_base_F", + "O_Heli_Light_02_unarmed_F", + "I_Heli_light_03_unarmed_F", + "B_Heli_Transport_01_F", + "B_Heli_Transport_01_camo_F", + "O_Heli_Light_02_F", + "O_Heli_Light_02_v2_F", + "I_Heli_light_03_F", + "B_Heli_Attack_01_F", + "O_Heli_Attack_02_F", + "O_Heli_Attack_02_black_F", + "B_Heli_Light_01_F", + "B_Heli_Light_01_armed_F", + "C_Heli_Light_01_civil_F" +]; + +/** + * List of class names of heavy towables objects. + */ +R3F_LOG_CFG_objets_remorquablesH = +[ + "Hatchback_01_base_F", + "SUV_01_base_F", + "Offroad_01_base_F", + "Van_01_base_F", + "MRAP_01_base_F", + "MRAP_02_base_F", + "MRAP_03_base_F", + "Truck_01_base_F", + "Truck_02_base_F", + "Truck_03_base_F", + "Wheeled_APC_F", + "Tank_F", "UGV_01_base_F", "SDV_01_base_F", "Boat_Civil_01_base_F", "Boat_Armed_01_base_F", - "Helicopter_Base_F", + "O_Heli_Light_02_unarmed_F", + "I_Heli_light_03_unarmed_F", + "B_Heli_Transport_01_F", + "B_Heli_Transport_01_camo_F", + "O_Heli_Light_02_F", + "O_Heli_Light_02_v2_F", + "I_Heli_light_03_F", + "B_Heli_Attack_01_F", + "O_Heli_Attack_02_F", + "O_Heli_Attack_02_black_F", + "B_Heli_Light_01_F", + "B_Heli_Light_01_armed_F", + "C_Heli_Light_01_civil_F", + "I_Heli_Transport_02_F", + "Heli_Transport_04_base_F", + "B_Heli_Transport_03_unarmed_F", + "B_Heli_Transport_03_F", "Plane" ]; +/** + * List of class names of heavy. + */ +R3F_LOG_CFG_objets_remorquablesALL = +[ + "Truck_01_base_F", + "Truck_02_base_F", + "Truck_03_base_F", + "Wheeled_APC_F", + "Tank_F", + "I_Heli_Transport_02_F", + "Heli_Transport_04_base_F", + "B_Heli_Transport_03_unarmed_F", + "B_Heli_Transport_03_F", + "I_Plane_Fighter_03_AA_F", + "I_Plane_Fighter_03_CAS_F", + "B_Plane_CAS_01_F", + "O_Plane_CAS_02_F" +]; + /****** LIFT WITH VEHICLE ******/ /** @@ -46,7 +145,27 @@ R3F_LOG_CFG_objets_remorquables = */ R3F_LOG_CFG_heliporteurs = [ - "Helicopter_Base_F" + "O_Heli_Light_02_unarmed_F", + "I_Heli_light_03_unarmed_F", + "B_Heli_Transport_01_F", + "B_Heli_Transport_01_camo_F", + "O_Heli_Light_02_F", + "O_Heli_Light_02_v2_F", + "I_Heli_light_03_F", + "B_Heli_Attack_01_F", + "O_Heli_Attack_02_F", + "O_Heli_Attack_02_black_F" +]; + +/** + * List of class names of air vehicles which can lift heavy liftables objects. + */ +R3F_LOG_CFG_heliporteursH = +[ + "I_Heli_Transport_02_F", + "Heli_Transport_04_base_F", + "B_Heli_Transport_03_unarmed_F", + "B_Heli_Transport_03_F" ]; /** @@ -61,12 +180,32 @@ R3F_LOG_CFG_objets_heliportables = "MRAP_01_base_F", "MRAP_02_base_F", "MRAP_03_base_F", - "UGV_01_base_F", "SDV_01_base_F", "Boat_Civil_01_base_F", "Boat_Armed_01_base_F" ]; +/** + * List of class names of heavy liftables objects. + */ +R3F_LOG_CFG_objets_heliportablesH = +[ + "Hatchback_01_base_F", + "SUV_01_base_F", + "Offroad_01_base_F", + "Van_01_base_F", + "MRAP_01_base_F", + "MRAP_02_base_F", + "MRAP_03_base_F", + "Truck_01_base_F", + "Truck_02_base_F", + "Truck_03_base_F", + "Wheeled_APC_F", + "Tank_F", + "SDV_01_base_F", + "Boat_Civil_01_base_F", + "Boat_Armed_01_base_F" +]; /****** LOAD IN VEHICLE / CHARGER DANS LE VEHICULE ******/ @@ -95,11 +234,13 @@ R3F_LOG_CFG_transporteurs = ["Boat_Armed_01_base_F", 20], ["Heli_Light_01_base_F", 10], ["Heli_Light_02_base_F", 20], - ["I_Heli_light_03_base_F", 20], + ["I_Heli_light_03_unarmed_F", 20], + ["I_Heli_light_03_F", 20], ["Heli_Transport_01_base_F", 25], - ["Heli_Transport_02_base_F", 30], - ["B_Heli_Transport_03_base_F", 30], - ["Heli_Transport_04_base_F", 30], + ["Heli_Transport_02_base_F", 100], + ["B_Heli_Transport_03_unarmed_F", 100], + ["B_Heli_Transport_03_F", 100], + ["Heli_Transport_04_base_F", 100], ["Heli_Attack_01_base_F", 10], ["Heli_Attack_02_base_F", 20] ]; @@ -107,8 +248,6 @@ R3F_LOG_CFG_transporteurs = R3F_LOG_CFG_objets_transportables = [ - ["Static_Designator_01_base_F", 2], - ["Static_Designator_02_base_F", 2], ["StaticWeapon", 5], ["Box_NATO_AmmoVeh_F", 10], ["B_supplyCrate_F", 5], @@ -217,5 +356,7 @@ R3F_LOG_CFG_objets_deplacables = "Land_Shoot_House_Wall_F", "Land_Stone_8m_F", "Land_ToiletBox_F", - "Land_BarrelWater_F" + "Land_BarrelWater_F", + "Land_HandyCam_F", + "Land_SatellitePhone_F" ]; diff --git a/addons/R3F_ARTY_AND_LOG/R3F_LOG/heliporteur/heliporter.sqf b/addons/R3F_ARTY_AND_LOG/R3F_LOG/heliporteur/heliporter.sqf index 1820f28b8..5ad026f59 100644 --- a/addons/R3F_ARTY_AND_LOG/R3F_LOG/heliporteur/heliporter.sqf +++ b/addons/R3F_ARTY_AND_LOG/R3F_LOG/heliporteur/heliporter.sqf @@ -21,7 +21,7 @@ else private ["_heliporteur", "_objet"]; _heliporteur = _this select 0; - _objet = nearestObjects [_heliporteur, R3F_LOG_CFG_objets_heliportables, 20]; + _objet = nearestObjects [_heliporteur, R3F_LOG_CFG_objets_heliportablesH, 20]; // Parce que l'héliporteur peut être un objet héliportable _objet = _objet - [_heliporteur]; @@ -107,4 +107,4 @@ else }; R3F_LOG_mutex_local_verrou = false; -}; +}; \ No newline at end of file diff --git a/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_deplacable/objectLockStateMachine.sqf b/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_deplacable/objectLockStateMachine.sqf index 98b8709ff..4ceae9818 100644 --- a/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_deplacable/objectLockStateMachine.sqf +++ b/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_deplacable/objectLockStateMachine.sqf @@ -41,6 +41,7 @@ switch (_lockState) do case (vehicle player != player): { _text = "Action failed! You can't do this in a vehicle" }; case (!isNull (_object getVariable ["R3F_LOG_est_transporte_par", objNull])): { _text = "Action failed! Somebody moved the object" }; case (_object getVariable ["objectLocked", false]): { _text = "Somebody else locked it before you" }; + case (count (nearestObjects [player, ["Land_Cashdesk_F"], 50]) > 0): { _text = "You are not allowed to lock objects within 50m of shops"}; default { _failed = false; @@ -57,9 +58,12 @@ switch (_lockState) do { _object setVariable ["objectLocked", true, true]; _object setVariable ["ownerUID", getPlayerUID player, true]; + _object setVariable ["ownerN", name player, true]; - pvar_manualObjectSave = netId _object; - publicVariableServer "pvar_manualObjectSave"; + //tell the server that this object was locked + trackObject = _object; + publicVariableServer "trackObject"; + ["Object locked!", 5] call mf_notify_client; }; @@ -141,8 +145,10 @@ switch (_lockState) do _object setVariable ["baseSaving_hoursAlive", nil, true]; _object setVariable ["baseSaving_spawningTime", nil, true]; - pvar_manualObjectSave = netId _object; - publicVariableServer "pvar_manualObjectSave"; + //tell the server that this object was unlocked + untrackObject = _object; + publicVariableServer "untrackObject"; + ["Object unlocked!", 5] call mf_notify_client; }; diff --git a/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_init.sqf b/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_init.sqf index 5507e3f52..84cf69d17 100644 --- a/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_init.sqf +++ b/addons/R3F_ARTY_AND_LOG/R3F_LOG/objet_init.sqf @@ -57,7 +57,7 @@ _objet addEventHandler ["GetIn", if ({_objet isKindOf _x} count R3F_LOG_CFG_objets_deplacables > 0) then { _objet addAction [(" " + STR_R3F_LOG_action_deplacer_objet + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\objet_deplacable\deplacer.sqf", nil, 5, false, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_deplacer_objet_valide && !(_target getVariable ['objectLocked', false])"]; - _objet addAction [(" " + STR_LOCK_OBJECT + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\objet_deplacable\objectLockStateMachine.sqf", _doLock, -5, false, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_deplacer_objet_valide && Object_canLock && (!(_target isKindOf 'AllVehicles') || {_target isKindOf 'StaticWeapon'})"]; + _objet addAction [(" " + STR_LOCK_OBJECT + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\objet_deplacable\objectLockStateMachine.sqf", _doLock, -5, false, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_deplacer_objet_valide && Object_canLock && !(_target isKindOf 'AllVehicles')"]; _objet addAction [(" " + STR_UNLOCK_OBJECT + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\objet_deplacable\objectLockStateMachine.sqf", _doUnlock, -5, false, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_deplacer_objet_valide && !Object_canLock"]; }; @@ -69,7 +69,19 @@ if ({_objet isKindOf _x} count R3F_LOG_CFG_objets_remorquables > 0) then }; _objet addAction [(" " + STR_R3F_LOG_action_selectionner_objet_remorque + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\remorqueur\selectionner_objet.sqf", nil, 5, false, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_selectionner_objet_remorque_valide && Object_canLock"]; + + _objet addAction [(" " + STR_R3F_LOG_action_detacher + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\remorqueur\detacher.sqf", nil, 6, true, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_detacher_valide"]; +}; +if ({_objet isKindOf _x} count R3F_LOG_CFG_objets_remorquablesALL > 0) then +{ + if ({_objet isKindOf _x} count R3F_LOG_CFG_objets_deplacables > 0) then + { + _objet addAction [(" " + STR_R3F_LOG_action_remorquer_deplace + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\remorqueur\remorquer_deplace.sqf", nil, 6, true, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_remorquer_deplace_valide"]; + }; + + _objet addAction [(" " + STR_R3F_LOG_action_selectionner_objet_remorque + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\remorqueur\selectionner_objet.sqf", nil, 5, false, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_selectionner_objet_remorque_valide && Object_canLock"]; + _objet addAction [(" " + STR_R3F_LOG_action_detacher + ""), "addons\R3F_ARTY_AND_LOG\R3F_LOG\remorqueur\detacher.sqf", nil, 6, true, true, "", "R3F_LOG_objet_addAction == _target && R3F_LOG_action_detacher_valide"]; }; diff --git a/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/detacher.sqf b/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/detacher.sqf index f995355f4..1060ed8e6 100644 --- a/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/detacher.sqf +++ b/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/detacher.sqf @@ -24,7 +24,7 @@ else _remorqueur = _objet getVariable "R3F_LOG_est_transporte_par"; // Ne pas permettre de décrocher un objet s'il est porté héliporté - if ({_remorqueur isKindOf _x} count R3F_LOG_CFG_remorqueurs > 0) then + if ({_remorqueur isKindOf _x} count R3F_LOG_CFG_remorqueursALL > 0) then { player switchMove "AinvPknlMstpSlayWrflDnon_medic"; diff --git a/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/remorquer_deplace.sqf b/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/remorquer_deplace.sqf index 102489342..3326e9ac1 100644 --- a/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/remorquer_deplace.sqf +++ b/addons/R3F_ARTY_AND_LOG/R3F_LOG/remorqueur/remorquer_deplace.sqf @@ -20,7 +20,7 @@ else _objet = R3F_LOG_joueur_deplace_objet; - _remorqueur = nearestObjects [_objet, R3F_LOG_CFG_remorqueurs, 22]; + _remorqueur = nearestObjects [_objet, R3F_LOG_CFG_remorqueursALL, 22]; // Parce que le remorqueur peut être un objet remorquable _remorqueur = _remorqueur - [_objet]; diff --git a/addons/R3F_ARTY_AND_LOG/R3F_LOG/surveiller_conditions_actions_menu.sqf b/addons/R3F_ARTY_AND_LOG/R3F_LOG/surveiller_conditions_actions_menu.sqf index e4abf109f..74383fae0 100644 --- a/addons/R3F_ARTY_AND_LOG/R3F_LOG/surveiller_conditions_actions_menu.sqf +++ b/addons/R3F_ARTY_AND_LOG/R3F_LOG/surveiller_conditions_actions_menu.sqf @@ -52,6 +52,49 @@ while {true} do {!(_objet_pointe getVariable "R3F_LOG_disabled")}; }; + if ({_objet_pointe isKindOf _x} count R3F_LOG_CFG_objets_remorquablesH > 0) then + { + // Condition action selectionner_objet_remorque + R3F_LOG_action_selectionner_objet_remorque_valide = + alive _objet_pointe && + isNull R3F_LOG_joueur_deplace_objet && + {isNull driver _objet_pointe || + {!isPlayer driver _objet_pointe && // allow UAV towing + {getText (configFile >> "CfgVehicles" >> typeOf driver _objet_pointe >> "simulation") == "UAVPilot"}}} && + {isNull (_objet_pointe getVariable "R3F_LOG_est_transporte_par")} && + {!alive (_objet_pointe getVariable "R3F_LOG_est_deplace_par")} && + {!(_objet_pointe getVariable "R3F_LOG_disabled")}; + // Condition action detacher + R3F_LOG_action_detacher_valide = + isNull R3F_LOG_joueur_deplace_objet && + {!isNull (_objet_pointe getVariable "R3F_LOG_est_transporte_par")} && + {!(_objet_pointe getVariable "R3F_LOG_disabled")}; + // S'il est déplaçable + if ({_objet_pointe isKindOf _x} count R3F_LOG_CFG_objets_deplacables > 0) then + { + // Condition action remorquer_deplace + R3F_LOG_action_remorquer_deplace_valide = + alive R3F_LOG_joueur_deplace_objet && + {R3F_LOG_joueur_deplace_objet == _objet_pointe} && + {isNull driver _objet_pointe || + {!isPlayer driver _objet_pointe && // allow UAV towing + {getText (configFile >> "CfgVehicles" >> typeOf driver _objet_pointe >> "simulation") == "UAVPilot"}}} && + {{ + alive _x && + _x != _objet_pointe && + {isNull (_x getVariable "R3F_LOG_remorque")} && + {vectorMagnitude velocity _x < 6} && + {(getPos _x) select 2 < 2} && + {!(_x getVariable "R3F_LOG_disabled")} + } count nearestObjects [_objet_pointe, R3F_LOG_CFG_remorqueursALL, 18] > 0} && + {!(_objet_pointe getVariable "R3F_LOG_disabled")}; + if ({_objet_pointe isKindOf (_x select 0)} count R3F_LOG_CFG_objets_transportables > 0) then + { + // Disable towing on loadable objects + R3F_LOG_action_selectionner_objet_remorque_valide = false; + }; + }; + }; // Si l'objet est un objet remorquable if ({_objet_pointe isKindOf _x} count R3F_LOG_CFG_objets_remorquables > 0) then { @@ -89,7 +132,7 @@ while {true} do {vectorMagnitude velocity _x < 6} && {(getPos _x) select 2 < 2} && {!(_x getVariable "R3F_LOG_disabled")} - } count nearestObjects [_objet_pointe, R3F_LOG_CFG_remorqueurs, 18] > 0} && + } count nearestObjects [_objet_pointe, R3F_LOG_CFG_remorqueursALL, 18] > 0} && {!(_objet_pointe getVariable "R3F_LOG_disabled")}; if ({_objet_pointe isKindOf (_x select 0)} count R3F_LOG_CFG_objets_transportables > 0) then @@ -128,6 +171,32 @@ while {true} do {!alive (_objet_pointe getVariable "R3F_LOG_est_deplace_par")} && {!(_objet_pointe getVariable "R3F_LOG_disabled")}; }; + if ({_objet_pointe isKindOf _x} count R3F_LOG_CFG_remorqueursH > 0) then + { + // Condition action remorquer_deplace + R3F_LOG_action_remorquer_deplace_valide = + alive _objet_pointe && + alive R3F_LOG_joueur_deplace_objet && + {!(R3F_LOG_joueur_deplace_objet getVariable "R3F_LOG_disabled")} && + {{R3F_LOG_joueur_deplace_objet isKindOf _x} count R3F_LOG_CFG_objets_remorquablesH > 0} && + {isNull (_objet_pointe getVariable "R3F_LOG_remorque")} && + {vectorMagnitude velocity _objet_pointe < 6} && + {(getPos _objet_pointe) select 2 < 2} && + {!(_objet_pointe getVariable "R3F_LOG_disabled")} && + {{_objet_pointe isKindOf (_x select 0)} count R3F_LOG_CFG_objets_transportables == 0}; + // Condition action remorquer_selection + R3F_LOG_action_remorquer_selection_valide = + alive _objet_pointe && + isNull R3F_LOG_joueur_deplace_objet && + !isNull R3F_LOG_objet_selectionne && + {R3F_LOG_objet_selectionne != _objet_pointe} && + {!(R3F_LOG_objet_selectionne getVariable "R3F_LOG_disabled")} && + {{R3F_LOG_objet_selectionne isKindOf _x} count R3F_LOG_CFG_objets_remorquablesH > 0} && + {isNull (_objet_pointe getVariable "R3F_LOG_remorque")} && + {vectorMagnitude velocity _objet_pointe < 6} && + {(getPos _objet_pointe) select 2 < 2} && + {!(_objet_pointe getVariable "R3F_LOG_disabled")}; + }; // Si l'objet est un véhicule remorqueur if ({_objet_pointe isKindOf _x} count R3F_LOG_CFG_remorqueurs > 0) then @@ -198,6 +267,28 @@ while {true} do call _resetConditions; }; + if ({(vehicle player) isKindOf _x} count R3F_LOG_CFG_heliporteursH > 0) then + { + R3F_LOG_objet_addAction = vehicle player; + // On est dans le véhicule, on affiche pas les options de transporteur et remorqueur + call _resetConditions; + // Condition action heliporter + R3F_LOG_action_heliporter_valide = + driver R3F_LOG_objet_addAction == player && + {{_x != R3F_LOG_objet_addAction && {!(_x getVariable "R3F_LOG_disabled")}} count nearestObjects [R3F_LOG_objet_addAction, R3F_LOG_CFG_objets_heliportablesH, 15] > 0} && + {isNull (R3F_LOG_objet_addAction getVariable "R3F_LOG_heliporte")} && + {vectorMagnitude velocity R3F_LOG_objet_addAction < 6} && + {(getPos R3F_LOG_objet_addAction) select 2 > 1} && + {!(R3F_LOG_objet_addAction getVariable "R3F_LOG_disabled")}; + // Condition action heliport_larguer + R3F_LOG_action_heliport_larguer_valide = + driver R3F_LOG_objet_addAction == player && + {!isNull (R3F_LOG_objet_addAction getVariable "R3F_LOG_heliporte")} && + //{vectorMagnitude velocity R3F_LOG_objet_addAction < 15} && + //{(getPos R3F_LOG_objet_addAction) select 2 < 40} && + {!(R3F_LOG_objet_addAction getVariable "R3F_LOG_disabled")} && + {(getPosATL (R3F_LOG_objet_addAction getVariable "R3F_LOG_heliporte") select 2) >= 0}; + }; // Pour l'héliportation, l'objet n'est plus pointé, mais on est dedans // Si le joueur est dans un héliporteur if ({(vehicle player) isKindOf _x} count R3F_LOG_CFG_heliporteurs > 0) then diff --git a/addons/R3F_ARTY_AND_LOG/surveiller_nouveaux_objets.sqf b/addons/R3F_ARTY_AND_LOG/surveiller_nouveaux_objets.sqf index 1bd538bf0..99e387e94 100644 --- a/addons/R3F_ARTY_AND_LOG/surveiller_nouveaux_objets.sqf +++ b/addons/R3F_ARTY_AND_LOG/surveiller_nouveaux_objets.sqf @@ -19,7 +19,7 @@ private ["_liste_objets_depl_heli_remorq_transp", "_liste_vehicules_connus", "_l #ifdef R3F_LOG_enable // Union des tableaux de types d'objets servant dans un isKindOf -_liste_objets_depl_heli_remorq_transp = R3F_LOG_CFG_objets_deplacables + R3F_LOG_CFG_objets_heliportables + R3F_LOG_CFG_objets_remorquables + R3F_LOG_classes_objets_transportables; +_liste_objets_depl_heli_remorq_transp = R3F_LOG_CFG_objets_deplacables + R3F_LOG_CFG_objets_heliportables + R3F_LOG_CFG_objets_heliportablesH + R3F_LOG_CFG_objets_remorquables + R3F_LOG_CFG_objets_remorquablesH + R3F_LOG_classes_objets_transportables; #endif // Contiendra la liste des véhicules (et objets) déjà initialisés @@ -57,6 +57,11 @@ while {true} do [_objet] spawn R3F_LOG_FNCT_heliporteur_init; }; + // If vehicle can airlift heavy + if ({_objet isKindOf _x} count R3F_LOG_CFG_heliporteursH > 0) then + { + [_objet] spawn R3F_LOG_FNCT_heliporteur_init; + }; // If vehicle can transport contents if ({_objet isKindOf _x} count R3F_LOG_classes_transporteurs > 0) then { @@ -69,6 +74,11 @@ while {true} do [_objet] spawn R3F_LOG_FNCT_remorqueur_init; }; + // If vehicle can tow heavy + if ({_objet isKindOf _x} count R3F_LOG_CFG_remorqueursH > 0) then + { + [_objet] spawn R3F_LOG_FNCT_remorqueur_init; + }; _objet setVariable ["R3F_LOG_init_done", true]; if (!local _objet && !simulationEnabled _objet) then { _objet enableSimulation true }; #endif diff --git a/addons/UAV_Control/functions.sqf b/addons/UAV_Control/functions.sqf index 2cb38ac0d..f5d8a9900 100644 --- a/addons/UAV_Control/functions.sqf +++ b/addons/UAV_Control/functions.sqf @@ -11,7 +11,7 @@ while {true} do waitUntil {sleep 0.1; _uav = getConnectedUAV player; !isNull _uav}; // ignore quadcopters and remote designators - if ({_uav isKindOf _x} count ["UAV_01_base_F", "StaticWeapon"] == 0) then + if ({_uav isKindOf _x} count ["StaticWeapon"] == 0) then { _ownerUID = _uav getVariable ["ownerUID", ""]; diff --git a/addons/beacondetector/beacondetector.sqf b/addons/beacondetector/beacondetector.sqf new file mode 100644 index 000000000..a0a3c9302 --- /dev/null +++ b/addons/beacondetector/beacondetector.sqf @@ -0,0 +1,76 @@ +// @file Version: 1.0 +// @file Name: beacondetector.sqf +// @file Author: wiking.at +// Allows tracking of spawn beacons + +// Check if script is already active +if (BeaconScanInProgress) exitWith +{ + ["You are already performing another beacon scan.", 5] call mf_notify_client; +}; + +_beaconsnear = nearestObjects [player, ["Land_Sleeping_bag_folded_F"], 100]; + +if ((count _beaconsnear) > 0 ) then + { + + playsound "beep9"; ["Spawn beacon found - tracking started.", 5] call mf_notify_client; + BeaconScanInProgress = true; + Beaconscanstop = false; + + _distance = 0; //init distance + + while {_distance < 100} do + { + _beaconsnear = nearestObjects [player, ["Land_Sleeping_bag_folded_F"], 100]; + + if (Beaconscanstop) exitwith + { + playsound "beep9"; + ["Spawn beacon scan interrupted.", 5] call mf_notify_client; + BeaconScanInProgress = false; + }; + + if (count _beaconsnear == 0) exitwith + { + playsound "beep9"; + ["No spawn beacon in detector range.", 5] call mf_notify_client; + BeaconScanInProgress = false; + }; + + _nearestbeacon = _beaconsnear select 0; + _distance = player distance _nearestbeacon; + _dir = getdir (vehicle player); + _degree = ((getpos _nearestbeacon select 0) - (getpos player select 0)) atan2 ((getpos _nearestbeacon select 1) - (getpos player select 1)); + if (_degree < 0) then { _degree = _degree + 360}; + _difference = _degree - _dir; + if (_difference > 180) then { _difference = _difference - 360}; + if (_difference < -180) then { _difference = _difference + 360}; + _adjusteddiff = (abs _difference); + _beepfreq = ((_adjusteddiff / 50) + 0.25); + + + + switch (true) do + { + case (_distance < 6) : {playsound "beep6";}; + case (_distance < 10) : {playsound "beep5";}; + case (_distance < 20) : {playsound "beep4";}; + case (_distance < 30) : {playsound "beep3";}; + case (_distance < 50) : {playsound "beep2";}; + case (_distance < 100) : {playsound "beep";}; + default { + //default case should not happen + playsound "beep9"; + ["There was a malfunction of your beacon detector.", 5] call mf_notify_client; + }; + }; + sleep _beepfreq; + + }; + } +else +{ +playsound "beep9"; +["No Spawn beacon in detector range.", 5] call mf_notify_client; +}; \ No newline at end of file diff --git a/addons/beacondetector/sound/beep.wav b/addons/beacondetector/sound/beep.wav new file mode 100644 index 000000000..9ad31d676 Binary files /dev/null and b/addons/beacondetector/sound/beep.wav differ diff --git a/addons/boomerang/config.sqf b/addons/boomerang/config.sqf new file mode 100644 index 000000000..b8289f41f --- /dev/null +++ b/addons/boomerang/config.sqf @@ -0,0 +1,23 @@ +boomerang_max_inventory_terminals = 1; //maximum number of Boomerang terminals that player can carry in inventory +boomerang_max_inventory_stations = 1; //maximum number of Boomerang stations that player can carry in inventory + +boomerang_allow_vehicle_deploy = true; //whether or not to allow deploying boomerang on vehicles +boomerang_allow_ground_deploy = true; //whether or not to allow deploying boomerang on the ground +boomerang_min_distance = 150; //minimum distance from the base station for terminals to work +boomerang_vehicle_class_list = ["All"]; //list of vehicle classes where boomerang can be deployed + + +boomerand_hud_scale = 1; //scale for how big to show the boomerang device +boomerang_hud_x = safezoneX + (safeZoneW / 8); // X screen coordinate for the boomerang device +boomerang_hud_y = safezoneY; //Y screen coordinate for the boomerang device + +//Terminal +MF_ITEMS_BOOMERANG_TERMINAL = "boomerang_terminal"; +MF_ITEMS_BOOMERANG_TERMINAL_TYPE = "Land_FMradio_F"; +MF_ITEMS_BOOMERANG_TERMINAL_ICON = "addons\boomerang\icons\terminal.paa"; + +//Station +MF_ITEMS_BOOMERANG_STATION = "boomerang_station"; +MF_ITEMS_BOOMERANG_STATION_TYPE = "Land_SatellitePhone_F"; +MF_ITEMS_BOOMERANG_STATION_ICON = "addons\boomerang\icons\antenna.paa"; + diff --git a/addons/boomerang/functions.sqf b/addons/boomerang/functions.sqf new file mode 100644 index 000000000..a3b04dbc6 --- /dev/null +++ b/addons/boomerang/functions.sqf @@ -0,0 +1,621 @@ +if (!isNil "boomerang_functions_defined") exitWith {}; + +#include "macro.h" +#include "hud_constants.h" + +diag_log format["Loading boomerang functions ..."]; + +call compile preprocessFileLineNumbers "addons\boomerang\config.sqf"; + + + +boomerang_hud_remove = { + 11 cuttext ["","plain"]; + boomerang_hud_active = nil; +}; + +boomerang_led_set_state = { + ARGVX3(0,_index,0); + ARGVX3(1,_state,false); + + if (_index < 1 || {_index > 12}) exitWith {}; + + def(_display); + def(_idc); + def(_led); + + _display = uiNamespace getVariable "boomerang_hud"; + _idc = boomerang_hud_led_idc_base + _index; + _led = _display displayCtrl _idc; + _led ctrlShow _state; +}; + +boomerang_lcd_set = { + ARGVX3(0,_text,""); + + def(_display); + _display = uiNamespace getVariable "boomerang_hud"; + + def(_boomerang_lcd); + _boomerang_lcd = _display displayCtrl boomerang_hud_lcd_idc; + + _boomerang_lcd ctrlSetText _text; + _boomerang_lcd ctrlCommit 0; +}; + + +//0 - voice +//1 - beep +//2 - muted +boomerang_sound_mode = 0; + + +boomerang_led_sound = { _this spawn { + ARGVX3(0,_index,0); + + if (boomerang_sound_mode == 2) exitWith {}; + + if (boomerang_sound_mode == 0) exitWith { + playSound "contact_voice"; + uiSleep 1; + playSound ("at_" + str(_index)); + uiSleep 1; + }; + + if (boomerang_sound_mode == 1) exitWith { + playSound "contact_beep"; + uiSleep 2; + }; +}}; + +boomerang_cycle_sound_mode = { + boomerang_sound_mode = (boomerang_sound_mode + 1) % 3; + + def(_mode); + if (boomerang_sound_mode == 0) then { + _mode = "Voice reports"; + } + else { if (boomerang_sound_mode == 1) then { + _mode = "Beep sounds"; + } + else { if (boomerang_sound_mode == 2) then { + _mode = "Sound muted"; + };};}; + + def(_text); + _text = _mode; + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_TERMINAL_ICON, "Sound mode"] + "

" + _text; + hintSilent parseText _text; +}; + + +boomerang_alert_at = { + disableSerialization; + ARGVX3(0,_direction,0); + ARGVX3(1,_dist,0); + ARGVX4(2,_voice,false,true); + + [(" " +str(round(_dist)) + " M")] call boomerang_lcd_set; + + if (_voice) then { + [_direction] call boomerang_led_sound; + }; + + [_direction, true] call boomerang_led_set_state; + uiSleep 2; + [_direction, false] call boomerang_led_set_state; + [""] call boomerang_lcd_set; +}; + +//pre-computed set of relative coordinates +boomerang_led_coord_map = [ + [0.03,-0.07,0], //1 o'clock + [0.0519615,-0.042,0], //2 o'clock + [0.06,0,0], //3 o'oclock + [0.0519615,0.042,0], //4 o'oclock + [0.03,0.07,0], //5 o'oclock + [0,0.083,0], //6 o'clock + [-0.03,0.07,0], //7 o'clock + [-0.0519615,0.042,0], //8 o'clock + [-0.06,0,0], //9 o'clock + [-0.0519615,-0.042,0], //10 o'clock + [-0.03,-0.07,0], //11 o'clock + [0,-0.083,0] //12 o'clock +]; + +boomerang_led_setup = { + disableSerialization; + ARGVX3(0,_index,0); + if (_index < 1 || {_index > 12}) exitWith {}; + + def(_display); + def(_idc); + def(_led); + + _display = uiNamespace getVariable "boomerang_hud"; + _idc = boomerang_hud_led_idc_base + _index; + _led = _display displayCtrl _idc; + + private["_x","_y", "_w", "_h"]; + _w = 0.025 * boomerand_hud_scale; + _h = 0.025 * boomerand_hud_scale; + _x = boomerang_hud_x + _w * 8.6; + _y = boomerang_hud_y + _h * 13.78; + + def(_vec); + _vec = boomerang_led_coord_map select (_index -1); + _vec = [(_vec select 0) * boomerand_hud_scale, (_vec select 1) * boomerand_hud_scale, 0]; + + _led ctrlSetPosition [(_x + (_vec select 0)),(_y + (_vec select 1)),_w,_h]; + _led ctrlSetText "addons\boomerang\images\boomerang_led.paa"; + _led ctrlShow false; + _led ctrlCommit 0; +}; + + +boomerang_is_terminal_nearby = { + ARGVX4(0,_player,objNull,false); + ARGVX4(1,_distance,0,false); + + def(_vehicles); + _vehicles = (nearestObjects [getPos _player, ["Helicopter", "Plane", "Ship_F", "Car", "Motorcycle", "Tank", MF_ITEMS_BOOMERANG_STATION_TYPE], _distance]); + init(_result,false); + { + if (_x getVariable ["has_boomerang", false]) exitWith { + _result = true; + }; + } forEach _vehicles; + + (_result) +}; + + +boomerand_test_leds = { + disableSerialization; + { + for "_i" from 1 to 12 do { + [_i, _x] call boomerang_led_set_state; + if ((_i % 2) == 0) then { playSound "contact_beep";}; + uiSleep 0.01; + }; + } forEach [true, false]; +}; + + +boomerang_hud_setup = { + disableSerialization; + 11 cutRsc ["boomerang_hud","PLAIN",1e+011,false]; + + def(_display); + _display = uiNamespace getVariable "boomerang_hud"; + + def(_boomerang_background); + def(_boomerang_lcd); + _boomerang_background = _display displayCtrl boomerang_hud_background_idc; + _boomerang_lcd = _display displayCtrl boomerang_hud_lcd_idc; + + + private["_x","_y", "_w", "_h"]; + _w = 0.6 * boomerand_hud_scale; + _h = 0.6 * boomerand_hud_scale; + _x = boomerang_hud_x; + _y = boomerang_hud_y; + _boomerang_background ctrlSetPosition [_x,_y,_w,_h]; + _boomerang_background ctrlSetText "addons\boomerang\images\boomerang.paa"; + _boomerang_background ctrlCommit 0; + + private["_lx","_ly","_lw","_lh"]; + _lw = _w/3.25; + _lh = _h/10.4; + _lx = _x + (_w /10) * 2.26 ; + _ly = _y + (_h /10) * 2.83; + + _boomerang_lcd ctrlSetPosition [_lx,_ly,_lw,_lh]; + _boomerang_lcd ctrlSetBackgroundColor [0,0,0,0.3]; + _boomerang_lcd ctrlSetFontHeight 0.045 * boomerand_hud_scale; + _boomerang_lcd ctrlSetFont "PuristaBold"; + _boomerang_lcd ctrlSetTextColor [0,0,0,0.67]; + _boomerang_lcd ctrlSetText ""; + _boomerang_lcd ctrlCommit 0; + + for "_i" from 1 to 12 do { + [_i] call boomerang_led_setup; + }; + + //for shits and giggles + [] spawn boomerand_test_leds; + + boomerang_hud_active = true; + + + [] spawn { + init(_player,player); + [_player] call boomerang_remove_firedNear; + [_player] call boomerang_add_firedNear; + [] call boomerang_setup_hud_keyUp; + + + + def(_vehicle_has_station); + def(_player_has_terminal); + def(_terminal_nearby); + init(_notification,0); + + _notify_no_terminal = { + _text = "No portable termial."; + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_TERMINAL_ICON, "disconnected"] + "

" + _text; + hintSilent parseText _text; + }; + + _notify_no_station = { + _text = "No stations nearby."; + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_STATION_ICON, "disconnected"] + "

" + _text; + hintSilent parseText _text; + }; + + //hintSilent ""; //clear any hints + + waitUntil { + sleep 3; + if (not(alive player)) exitWith {true}; //player died, close the hud + if (isNil "boomerang_hud_active") exitWith {true}; //something else closed the hud, bail out + + _vehicle_has_station = ((vehicle player) getVariable ["has_boomerang", false]); + if (_vehicle_has_station) exitWith {false}; //vehicle has boomerang, leave the hud open + + _player_has_terminal = (MF_ITEMS_BOOMERANG_TERMINAL call mf_inventory_count > 0); + if (not(_player_has_terminal)) exitWith {call _notify_no_terminal; true}; //player dropped the terminal, close the hud + + _terminal_nearby = [player, boomerang_min_distance] call boomerang_is_terminal_nearby; + + if (not(_terminal_nearby)) exitWith {call _notify_no_station; true}; //there are no nearby temrinals, close the hug + + false + }; + + [] call boomerang_remove_hud_keyUp; + [] call boomerang_hud_remove; + [_player] call boomerang_remove_firedNear; + }; + +}; + +vector_angle2 = { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_v2,[]); + def(_local); + _local = _obj worldToModel _v2; + (_local select 0) atan2 ( _local select 1); +}; + +boomerang_get_clock_pos = { + ARGVX3(0,_unit,objNull); + ARGVX3(1,_firer,objNull); + + def(_angle); + _angle = [_unit, getPos _firer] call vector_angle2; + _angle = ((_angle) + 360) % 360; + + def(_clock_pos); + _clock_pos = round((_angle / 360) * 12); + _clock_pos = if (_clock_pos == 0) then {12} else {_clock_pos}; + + (_clock_pos) +}; + + +boomerang_fired_near_handler = { + if (isNil "boomerang_hud_active") exitWith {}; + ARGVX3(0,_unit,objNull); + ARGVX3(1,_firer,objNull); + ARGVX3(2,_distance,0); + ARGVX3(3,_weapon,""); + ARGVX3(4,_muzzle,""); + ARGVX3(5,_mode,""); + ARGVX3(6,_ammo,""); + + if (_unit == _firer) exitWith {}; + _unit = (vehicle _unit); + + def(_clock_pos); + _clock_pos = [_unit, _firer] call boomerang_get_clock_pos; + + + init(_exit,false); + if (!(isNil "boomerang_last_event_pos" || {isNil "boomerang_last_event_time"})) then { + if (boomerang_last_event_pos == _clock_pos && (diag_tickTime - boomerang_last_event_time) < 3) then { + _exit = true; + }; + }; + + if (_exit) exitWith {}; + + boomerang_last_event_pos = _clock_pos; + boomerang_last_event_time = diag_tickTime; + + init(_dist,(_unit distance _firer)); + if (!isNil "boomerang_alert_script_handle" && {not(scriptDone boomerang_alert_script_handle)}) exitWith { + //don't play the sound, but at least show the LED + [_clock_pos, _dist, false] spawn boomerang_alert_at; + }; + + boomerang_alert_script_handle = [_clock_pos, _dist, true] spawn boomerang_alert_at; + +}; + +boomerang_vehicle_notify = { + ARGVX4(0,_player,objNull,false); + ARGVX4(1,_vehicle,objNull,false); + + if (not(_vehicle getVariable ["has_boomerang", false])) exitWith {false}; + + _text = "This vehicle has a boomerang system installed. Press Control+B to activate it."; + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_STATION_ICON, "available"] + "

" + _text; + hintSilent parseText _text; + + [] call boomerang_setup_vehicle_keyUp; + [_vehicle] call boomerang_remove_firedNear; + [_vehicle] call boomerang_add_firedNear; + true +}; + + +boomerang_vehicle_watch = { + def(_notified): + def(_vehicle); + + waitUntil { + sleep 2; + //wait until the player enters a vehicle, and is notified + waitUntil { + sleep 2; + if ((vehicle player) == (player)) exitWith {false}; + if ([player, (vehicle player)] call boomerang_vehicle_notify) exitWith {true}; + false + }; + _vehicle = (vehicle player); + //wait until the player exits the vehicle + waitUntil {sleep 2; ((vehicle player) != _vehicle)}; + [] call boomerang_remove_vehicle_keyUp; + [_vehicle] call boomerang_remove_firedNear; + hintSilent ""; + }; +}; + +boomerang_add_firedNear = { + ARGVX3(0,_vehicle,objNull); + def(_id); + _id = _vehicle addEventHandler ["FiredNear", {_this call boomerang_fired_near_handler}]; + _vehicle setVariable ["FiredNear_ID", _id]; +}; + +boomerang_remove_firedNear = { + //diag_log format["%1 call boomerang_remove_firedNear", _this]; + ARGVX3(0,_vehicle,objNull); + def(_id); + _id = _vehicle getVariable "FiredNear_ID"; + if (isNil "_id") exitWith {}; + _vehicle removeEventHandler ["FiredNear", _id]; +}; + + + +boomerang_toggle_hud = { + _this spawn { + if (isNil "boomerang_hud_active") exitWith { + [] call boomerang_hud_remove; + def(_text); + _text = ""; + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_TERMINAL_ICON, "connecting ..."] + "

" + _text; + hintSilent parseText _text; + [] call boomerang_hud_setup; + sleep 4; + if (not(isNil "boomerang_hud_active")) then { + _text = ( + "Cycle mode: Shift + M
" + + "Exit system: Ctrl + E" + ); + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_STATION_ICON, "connected"] + "

" + _text + ""; + hintSilent parseText _text; + }; + }; + + [] call boomerang_hud_remove; + }; + false +}; + + +#define MUTEX_UNLOCK mutexScriptInProgress = false; doCancelAction = false + + +boomerang_ground_deploy = { + + if (not(boomerang_allow_ground_deploy)) exitWith { + ["Deploying the boomerang on the ground is not allowed.", "Boomerang Vehicle Deploy", true] call BIS_fnc_guiMessage; + }; + + ARGVX3(0,_player,objNull); + ARGVX3(1,_item_type,""); + + def(_msg); + _msg = "You are about to deploy the Boomerang Base Station. Players nearby will need to use a Boomerang Terminal. Do you want to proceed?"; + if (not([_msg, "Boomerang Ground Deploy", true, true] call BIS_fnc_guiMessage)) exitWith {false}; + + //this is needed in order for the mf_inventory_drop call to work (since it's nested inside USE) + MUTEX_UNLOCK ; + + private["_device"]; + _device = _item_type call mf_inventory_drop; + + if (!isOBJECT(_device)) exitWith {false}; + + _device setVariable ["is_boomerang", true, true]; + _device setVariable ["boomerang_owner_type", "player"]; + _device setVariable ["boomerang_owner_value", getPlayerUID _player]; + _device setVariable ["has_boomerang", true, true]; + + + true +}; + +boomerang_vehcle_deploy = { + + if (not(boomerang_allow_vehicle_deploy)) exitWith { + ["The Boomerang base station cannot be deployed inside vehicles.", "Boomerang Vehicle Deploy", true] call BIS_fnc_guiMessage; + }; + + ARGVX3(0,_vehicle,objNull); + ARGVX3(1,_player,objNull); + player groupChat format["%1", boomerang_vehicle_class_list]; + if (isARRAY(boomerang_vehicle_class_list) && ({_vehicle isKindOf _x} count boomerang_vehicle_class_list) == 0) exitWith { + ["The Boomerang base station cannot be deployed in this kind of vehicle", "Boomerang Vehicle Deploy", true] call BIS_fnc_guiMessage; + }; + + def(_msg); + _msg = "You are about to deploy the Boomerang Base Station in this vehicle. Once installed, it cannot be removed. Do you want to proceed?"; + if (not([_msg, "Boomerang Vehicle Deploy", true,true] call BIS_fnc_guiMessage)) exitWith {false}; + + _vehicle setVariable ["has_boomerang", true, true]; + _vehicle setVariable ["boomerang_owner_type", "player"]; + _vehicle setVariable ["boomerang_owner_value", getPlayerUID _player]; + + [_id, 1] call mf_inventory_remove; + + + true +}; + +boomerang_station_use = { + private["_item_type"]; + _item_type = _this; + + init(_vehicle, vehicle player); + init(_player,player); + + if (_vehicle != _player) exitWith { + [_vehicle,_player] call boomerang_vehcle_deploy; + false + }; + + [_player, _item_type] call boomerang_ground_deploy; + + false +}; + + +boomerang_vehicle_keyUpHandler = { + init(_vehicle,vehicle player); + if (_vehicle == player) exitWith {}; + if (!(_vehicle getVariable ["has_boomerang", false])) exitWith {}; + + ARGVX2(0,_this); + ARGV2(0,_display); + ARGV2(1,_key); + ARGV2(2,_shift); + ARGV2(3,_control); + ARGV2(4,_alt); + + + if (_control && {_key == DIK_B}) then { + [] call boomerang_toggle_hud; + }; + true +}; + +boomerang_remove_vehicle_keyUp = { + disableSerialization; + _display = findDisplay 46; + if (not(undefined(boomerang_vehicle_keyUpHandler_id))) then { + _display displayRemoveEventHandler ["keyUp",boomerang_vehicle_keyUpHandler_id]; + boomerang_vehicle_keyUpHandler_id = nil; + }; +}; + +boomerang_setup_vehicle_keyUp = { + init(_data,_this); + + disableSerialization; + _display = findDisplay 46; + if (undefined(boomerang_vehicle_keyUpHandler_id) ) then { + boomerang_vehicle_keyUpHandler_id = _display displayAddEventHandler ["keyUp",format["[_this,%1] call boomerang_vehicle_keyUpHandler",_data]]; + }; +}; + + + +boomerang_toggle_hud = { + _this spawn { + if (isNil "boomerang_hud_active") exitWith { + [] call boomerang_hud_remove; + def(_text); + _text = ""; + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_TERMINAL_ICON, "connecting ..."] + "

" + _text; + hintSilent parseText _text; + [] call boomerang_hud_setup; + sleep 5; + if (not(isNil "boomerang_hud_active")) then { + _text = ( + "Cycle mode: Shift + M
" + + "Exit system: Ctrl + E" + ); + _text = format["Boomerang

(%2)", MF_ITEMS_BOOMERANG_STATION_ICON, "connected"] + "

" + _text + ""; + hintSilent parseText _text; + }; + }; + + [] call boomerang_hud_remove; + }; + false +}; + + +boomerang_hud_keyUpHandler = { + //player groupChat format["%1", _this]; + if (isNil "boomerang_hud_active") exitWith {}; + ARGVX2(0,_this); + ARGV2(0,_display); + ARGV2(1,_key); + ARGV2(2,_shift); + ARGV2(3,_control); + ARGV2(4,_alt); + + if (_shift && {_key == DIK_M}) exitWith { + [] call boomerang_cycle_sound_mode; + true + }; + + if (_control && {_key == DIK_E}) then { + [] call boomerang_hud_remove; + true + }; + + false +}; + +boomerang_remove_hud_keyUp = { + disableSerialization; + _display = findDisplay 46; + if (not(undefined(boomerang_hud_keyUpHandler_id))) then { + _display displayRemoveEventHandler ["keyDown",boomerang_hud_keyUpHandler_id]; + boomerang_hud_keyUpHandler_id = nil; + }; +}; + +boomerang_setup_hud_keyUp = { + init(_data,_this); + + disableSerialization; + _display = findDisplay 46; + if (undefined(boomerang_hud_keyUpHandler_id) ) then { + boomerang_hud_keyUpHandler_id = _display displayAddEventHandler ["keyDown",format["[_this,%1] call boomerang_hud_keyUpHandler",_data]]; + }; +}; + + + +[] spawn boomerang_vehicle_watch; + +boomerang_functions_defined = true; + +diag_log format["Loading boomerang functions complete"]; \ No newline at end of file diff --git a/addons/boomerang/hud.hpp b/addons/boomerang/hud.hpp new file mode 100644 index 000000000..c55ae8e99 --- /dev/null +++ b/addons/boomerang/hud.hpp @@ -0,0 +1,56 @@ +#include "hud_constants.h" + +class boomerang_hud { + idd = boomerang_hud_idd; + movingEnable = 1; + enableSimulation = 0; + enableDisplay = 0; + fadein = 0; + duration = 1e+011; + fadeout = 0; + name = "boomerang_hud"; + onLoad = "uiNamespace setVariable ['boomerang_hud',_this select 0]"; + objects[] = {}; + controls[] = { + boomerang_hud_background, + boomerang_hud_1_led, + boomerang_hud_2_led, + boomerang_hud_3_led, + boomerang_hud_4_led, + boomerang_hud_5_led, + boomerang_hud_6_led, + boomerang_hud_7_led, + boomerang_hud_8_led, + boomerang_hud_9_led, + boomerang_hud_10_led, + boomerang_hud_11_led, + boomerang_hud_12_led, + boomerang_hud_lcd + }; + + LED(1); + LED(2); + LED(3); + LED(4); + LED(5); + LED(6); + LED(7); + LED(8); + LED(9); + LED(10); + LED(11); + LED(12); + + class boomerang_hud_background: gui_RscPictureKeepAspect { + idc = boomerang_hud_background_idc; + x = -10; y = -10; + w = 0.1; h = 0.1; + }; + + class boomerang_hud_lcd: gui_RscText { + idc = boomerang_hud_lcd_idc; + x = -10; y = -10; + w = 0.1; h = 0.1; + text = ""; + }; +}; \ No newline at end of file diff --git a/addons/boomerang/hud_constants.h b/addons/boomerang/hud_constants.h new file mode 100644 index 000000000..da4787404 --- /dev/null +++ b/addons/boomerang/hud_constants.h @@ -0,0 +1,41 @@ +#define boomerang_hud_idd 3000 +#define boomerang_hud_led_idc_base 3000 +//3001 - 3012 are for LEDs +#define boomerang_hud_background_idc 3013 +#define boomerang_hud_lcd_idc 3014 + +#define LED_IDC(x) (boomerang_hud_led_idc_base + x) + +#define LED(index) \ + class boomerang_hud_##index##_led: gui_RscPictureKeepAspect { \ + idc = LED_IDC(index); \ + x = -10; y = -10; \ + w = 0.1; h = 0.1; \ + } + +#define DIK_A 0x1E +#define DIK_B 0x30 +#define DIK_C 0x2E +#define DIK_D 0x20 +#define DIK_E 0x12 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_I 0x17 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_M 0x32 +#define DIK_N 0x31 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_Q 0x10 +#define DIK_R 0x13 +#define DIK_S 0x1F +#define DIK_T 0x14 +#define DIK_U 0x16 +#define DIK_V 0x2F +#define DIK_W 0x11 +#define DIK_X 0x2D +#define DIK_Y 0x15 +#define DIK_Z 0x2C \ No newline at end of file diff --git a/addons/boomerang/icons/antenna.paa b/addons/boomerang/icons/antenna.paa new file mode 100644 index 000000000..49bd4f1bc Binary files /dev/null and b/addons/boomerang/icons/antenna.paa differ diff --git a/addons/boomerang/icons/terminal.paa b/addons/boomerang/icons/terminal.paa new file mode 100644 index 000000000..bf459ad6c Binary files /dev/null and b/addons/boomerang/icons/terminal.paa differ diff --git a/addons/boomerang/images/boomerang.paa b/addons/boomerang/images/boomerang.paa new file mode 100644 index 000000000..500dcab82 Binary files /dev/null and b/addons/boomerang/images/boomerang.paa differ diff --git a/addons/boomerang/images/boomerang_led.paa b/addons/boomerang/images/boomerang_led.paa new file mode 100644 index 000000000..22c6c374b Binary files /dev/null and b/addons/boomerang/images/boomerang_led.paa differ diff --git a/addons/boomerang/macro.h b/addons/boomerang/macro.h new file mode 100644 index 000000000..83e60c22b --- /dev/null +++ b/addons/boomerang/macro.h @@ -0,0 +1,166 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + +#define isSCRIPT(x) \ +(not(isNil {x}) && {typeName x == typeName scriptNull}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} + +#define IMPORT_FINALIZER if (isNil "finalize") then { \ + finalizer = { \ + if (isNil "_this" || {typeName _this != typeName {}}) exitWith {}; \ + \ + private["_str_data"]; \ + _str_data = toArray str(_this); \ + \ + private["_space"]; \ + _space = (toArray " ") select 0;\ + _str_data set [0, _space]; \ + _str_data set [((count _str_data)-1), _space]; \ + \ + (compileFinal (toString _str_data)) \ + }; \ + finalizer = finalizer call finalizer; \ +}; \ No newline at end of file diff --git a/addons/boomerang/sound_constants.h b/addons/boomerang/sound_constants.h new file mode 100644 index 000000000..1526a93ef --- /dev/null +++ b/addons/boomerang/sound_constants.h @@ -0,0 +1,8 @@ +#define SOUND(name,path) \ + class name { \ + name = #name; \ + sound[] = {#path, 1, 1}; \ + titles[] = {}; \ + } + +#define PATH(name) addons\boomerang\sounds\##name## diff --git a/addons/boomerang/sounds.hpp b/addons/boomerang/sounds.hpp new file mode 100644 index 000000000..24de1d302 --- /dev/null +++ b/addons/boomerang/sounds.hpp @@ -0,0 +1,17 @@ +#include "sound_constants.h" +SOUND(contact_voice,PATH(contact.ogg)); +SOUND(contact_beep,PATH(beep.ogg)); +SOUND(at_1,PATH(1.ogg)); +SOUND(at_2,PATH(2.ogg)); +SOUND(at_3,PATH(3.ogg)); +SOUND(at_4,PATH(4.ogg)); +SOUND(at_5,PATH(5.ogg)); +SOUND(at_6,PATH(6.ogg)); +SOUND(at_7,PATH(7.ogg)); +SOUND(at_8,PATH(8.ogg)); +SOUND(at_9,PATH(9.ogg)); +SOUND(at_10,PATH(10.ogg)); +SOUND(at_11,PATH(11.ogg)); +SOUND(at_12,PATH(12.ogg)); + + diff --git a/addons/boomerang/sounds/1.ogg b/addons/boomerang/sounds/1.ogg new file mode 100644 index 000000000..63636d493 Binary files /dev/null and b/addons/boomerang/sounds/1.ogg differ diff --git a/addons/boomerang/sounds/10.ogg b/addons/boomerang/sounds/10.ogg new file mode 100644 index 000000000..f97773519 Binary files /dev/null and b/addons/boomerang/sounds/10.ogg differ diff --git a/addons/boomerang/sounds/11.ogg b/addons/boomerang/sounds/11.ogg new file mode 100644 index 000000000..d2b5944ad Binary files /dev/null and b/addons/boomerang/sounds/11.ogg differ diff --git a/addons/boomerang/sounds/12.ogg b/addons/boomerang/sounds/12.ogg new file mode 100644 index 000000000..874c52002 Binary files /dev/null and b/addons/boomerang/sounds/12.ogg differ diff --git a/addons/boomerang/sounds/2.ogg b/addons/boomerang/sounds/2.ogg new file mode 100644 index 000000000..df29466b5 Binary files /dev/null and b/addons/boomerang/sounds/2.ogg differ diff --git a/addons/boomerang/sounds/3.ogg b/addons/boomerang/sounds/3.ogg new file mode 100644 index 000000000..c8425df08 Binary files /dev/null and b/addons/boomerang/sounds/3.ogg differ diff --git a/addons/boomerang/sounds/4.ogg b/addons/boomerang/sounds/4.ogg new file mode 100644 index 000000000..3ba61ebd4 Binary files /dev/null and b/addons/boomerang/sounds/4.ogg differ diff --git a/addons/boomerang/sounds/5.ogg b/addons/boomerang/sounds/5.ogg new file mode 100644 index 000000000..19d9562dd Binary files /dev/null and b/addons/boomerang/sounds/5.ogg differ diff --git a/addons/boomerang/sounds/6.ogg b/addons/boomerang/sounds/6.ogg new file mode 100644 index 000000000..7b58edd2b Binary files /dev/null and b/addons/boomerang/sounds/6.ogg differ diff --git a/addons/boomerang/sounds/7.ogg b/addons/boomerang/sounds/7.ogg new file mode 100644 index 000000000..3309fa677 Binary files /dev/null and b/addons/boomerang/sounds/7.ogg differ diff --git a/addons/boomerang/sounds/8.ogg b/addons/boomerang/sounds/8.ogg new file mode 100644 index 000000000..4fb3153e5 Binary files /dev/null and b/addons/boomerang/sounds/8.ogg differ diff --git a/addons/boomerang/sounds/9.ogg b/addons/boomerang/sounds/9.ogg new file mode 100644 index 000000000..d24e14cf3 Binary files /dev/null and b/addons/boomerang/sounds/9.ogg differ diff --git a/addons/boomerang/sounds/beep.ogg b/addons/boomerang/sounds/beep.ogg new file mode 100644 index 000000000..9798d8abf Binary files /dev/null and b/addons/boomerang/sounds/beep.ogg differ diff --git a/addons/boomerang/sounds/contact.ogg b/addons/boomerang/sounds/contact.ogg new file mode 100644 index 000000000..c7060e120 Binary files /dev/null and b/addons/boomerang/sounds/contact.ogg differ diff --git a/addons/camera/functions.sqf b/addons/camera/functions.sqf index 6a889d67c..34432e0b6 100644 --- a/addons/camera/functions.sqf +++ b/addons/camera/functions.sqf @@ -603,7 +603,7 @@ camera_update_nightvision = { false SetCamUseTi 0; }; case 1: { - camera_unit commandChat format["Setting camera NV "]; + camera_unit commandChat format["Setting camera NV"]; camUseNVG true; false SetCamUseTi 0; }; @@ -628,22 +628,22 @@ camera_update_nightvision = { true SetCamUseTi 3; }; case 6: { - camera_unit commandChat format["Setting camera light-orange-hot "]; + camera_unit commandChat format["Setting camera light-orange-hot"]; camUseNVG false; true SetCamUseTi 4; }; case 7: { - camera_unit commandChat format["Setting camera dark-orange-hot "]; + camera_unit commandChat format["Setting camera dark-orange-hot"]; camUseNVG false; true SetCamUseTi 5; }; case 8: { - camera_unit commandChat format["Setting camera orange body-heat "]; + camera_unit commandChat format["Setting camera orange body-heat"]; camUseNVG false; true SetCamUseTi 6; }; case 9: { - camera_unit commandChat format["Setting camera colored body-heat "]; + camera_unit commandChat format["Setting camera colored body-heat"]; camUseNVG false; true SetCamUseTi 7; }; diff --git a/addons/cctv/cctv_functions.sqf b/addons/cctv/cctv_functions.sqf new file mode 100644 index 000000000..8389f7f71 --- /dev/null +++ b/addons/cctv/cctv_functions.sqf @@ -0,0 +1,341 @@ +#include "constants.h" +#include "macro.h" +#include "dikcodes.h" + +if (not(undefined(cctv_functions_defined))) exitWith {}; +diag_log format["Loading camera functions ..."]; + + +cctv_camera_data_get = { + ARGVX3(0,_index,0); + ARGVX3(1,_cameras,[]); + if (_index < 0 || _index > (count(_cameras) -1)) exitWith {[]}; + + (_cameras select _index) +}; + + +cctv_camera_view_last = objNull; +cctv_camera_view_index = -1; +cctv_camera_view_next = { + //player groupChat format["cctv_camera_view_next %1",_this]; + ARGV2(0,_player); + ARGV2(1,_cameras); + + if (typeName _player != "OBJECT") exitWith {}; + + private["_camera_index"]; + _camera_index = cctv_camera_view_index + 1; + + + private["_source"]; + _source = [_camera_index,_cameras] call cctv_camera_data_get; + if (!isOBJECT(_source) || {isNull _source}) exitWith {}; + + private["_camera_name", "_camera_owner_type"]; + _camera_name = _source getVariable ["camera_name", nil]; + if (!isSTRING(_camera_name) || {_camera_name == ""}) exitWith {}; + + _camera_owner_type = _source getVariable ["camera_owner_type", nil]; + if (!isSTRING(_camera_owner_type) || {_camera_owner_type == ""}) exitWith {}; + + + if (not(isNull cctv_camera_view_last)) then { + cctv_camera_view_last cameraeffect ["terminate","back"]; + camDestroy cctv_camera_view_last; + }; + + private["_rendertarget"]; + _rendertarget = "cctv_render0"; + + //create the camera,and point it forward + private["_camera"]; + _camera = "camera" camCreate position cameraon; + _camera attachTo [_source,[0,-0.5,1]]; + _camera camPrepareTarget (_source modelToWorld [0,-5,1]); + _camera camPrepareFov 0.7; + _camera camPrepareFocus [-1,-1]; + _camera camCommitPrepared 0; + _camera cameraeffect ["internal","back",_rendertarget]; + + cctv_camera_view_last = _camera; + + //update the screen with the camera view + + private["_screen"]; + _screen = call laptop_flat_menu_screen_control; + if (not(sunOrMoon > 0)) then { + _rendertarget setPiPEffect [1]; + }; + _screen ctrlsettext format ["#(argb,512,512,1)r2t(%1,1.0)",_rendertarget]; + _screen ctrlsettextcolor [1,1,1,1]; + _screen ctrlcommit 0; + + //set the camera name on the screen + [format["%1: %2", (toUpper _camera_owner_type), _camera_name]] call laptop_flat_menu_update_text_tl; + + //update the next cell index + if (_camera_index >= (count(_cameras) -1)) then { + _camera_index = -1; + }; + cctv_camera_view_index = _camera_index; + //player groupChat format["cctv_camera_view_index = %1",cctv_camera_view_index]; +}; + + + +cctv_security_laptop_event_handler = { + //player groupChat format["cctv_security_laptop_event_handler %1",_this]; + ARGV2(0,_event); + ARGV2(1,_this); + ARGV2(0,_player); + ARGV2(1,_cameras); + + private["_event_type"]; + _event_type = _event select laptop_flat_event_type; + switch _event_type do { + case LAPTOP_EVENT_ON: { + [_player,_cameras] call cctv_camera_view_next; + }; + case LAPTOP_EVENT_KEY: { + private["_key"]; + _key = _event select laptop_flat_envent_data; + switch _key do { + case DIK_SPACE: { + [_player,_cameras] call cctv_camera_view_next; + }; + }; + }; + case LAPTOP_EVENT_BUTTON: { + private["_button"]; + _button = _event select laptop_flat_envent_data; + switch _button do { + case LAPTOP_EVENT_BUTTON_MOUSE_PAD: { + [_player,_cameras] call cctv_camera_view_next; + }; + }; + }; + }; +}; + + +cctv_cameras = OR(cctv_cameras,[]); + +cctv_get_group_uids = { + ARGVX4(0,_player,objNull,[]); + + private["_group_uids"]; + _group_uids = [getPlayerUID _player]; + {if (true) then { + private["_member"]; + _member = _x; + if (!isOBJECT(_member) || {isNull _member}) exitWith {}; + + private["_member_uid"]; + _member_uid = getPlayerUID _member; + if (!isSTRING(_member_uid) || {_member_uid == ""}) exitWith {}; + + _group_uids pushBack _member_uid; + };} forEach (units (group _player)); + + (_group_uids) +}; + +cctv_get_accessible_cameras = { + ARGVX3(0,_player,objNull); + if (!isARRAY(cctv_cameras) || {count(cctv_cameras) == 0}) then {[]}; + + private["_uid", "_side", "_group_uids"]; + _uid = getPlayerUID _player; + _side = str(side _player); + _group_uids = [_player] call cctv_get_group_uids; + + //make a list with the UIDs for the group members + + + //player groupChat format["_uid = %1, _side = %2, _group_uids = %3", _uid, _side, _group_uids]; + + //get the list of cameras that are accessible to this player + private["_cameras"]; + _cameras = []; + {if (true) then { + private["_camera"]; + _camera = _x; + if (!isOBJECT(_camera) || {isNull _camera}) exitWith {}; + + private["_distance"]; + _distance = _player distance _camera; + if (cctv_max_distance > 0 && {_distance > cctv_max_distance}) exitWith {}; + + private["_owner_type"]; + _owner_type = _camera getVariable ["camera_owner_type", nil]; + if (!isSTRING(_owner_type)) exitWith {}; + + private["_owner_value"]; + _owner_value = _camera getVariable ["camera_owner_value", nil]; + if (!isSTRING(_owner_value) || {_owner_value == ""}) exitWith {}; + + //player groupChat format["_owner_type = %1, _owner_value = %2", _owner_type, _owner_value]; + + if (!((_owner_type == "player" && {_owner_value == _uid}) ||{ + (_owner_type == "side" && {_owner_value == _side}) ||{ + (_owner_type == "group" && {_owner_value in _group_uids})}})) exitWith {}; + + _cameras pushBack _camera; + };} forEach cctv_cameras; + + (_cameras) +}; + +cctv_security_laptop_menu = { + ARGV2(0,_player); + + if (typeName _player != "OBJECT") exitWith {}; + + private["_cameras"]; + _cameras = [_player] call cctv_get_accessible_cameras; + //player groupChat format["_cameras = %1", _cameras]; + + if (count(_cameras) == 0) exitWith { + player groupChat format["There are no cameras currently accessible."]; + }; + + private["_handler"]; + _handler = [[_player, _cameras],"cctv_security_laptop_event_handler"]; + [_handler,_handler,_handler] call laptop_flat_menu_setup; + player groupChat format["Use space-bar on laptop to cycle between cameras."]; +}; + + +#define MUTEX_UNLOCK mutexScriptInProgress = false; doCancelAction = false + +cctv_get_cameras_by_type = { + ARGVX4(0,_player,objNull,[]); + ARGVX4(1,_type,"",[]); + + private["_uid", "_side", "_group_uids"]; + _uid = getPlayerUID _player; + _side = str(side _player); + _group_uids = [_player] call cctv_get_group_uids; + + cctv_cameras = OR(cctv_cameras,[]); + + private["_result"]; + _result = []; + {if (true) then { + private["_camera"]; + _camera = _x; + if (!isOBJECT(_camera) || {isNull _camera}) exitWith {}; + + private["_ctype", "_cvalue"]; + _ctype = _camera getVariable "camera_owner_type"; + _cvalue = _camera getVariable "camera_owner_value"; + if (!isSTRING(_ctype) || {_ctype == ""}) exitWith {}; + if (!isSTRING(_cvalue) || {_cvalue == ""}) exitWith {}; + if (_type != _ctype) exitWith {}; + + if ((_type == "group" && {_cvalue in _group_uids}) || { + (_type == "side" && {_cvalue == _side}) || { + (_type == "player" && {_cvalue == _uid})}}) exitWith { + _result pushBack _camera; + }; + };} forEach cctv_cameras; + + (_result) +}; + +cctv_enforce_limits = { + ARGVX3(0,_player,objNull); + ARGVX3(1,_owner_type,""); + + cctv_cameras = OR(cctv_cameras,[]); + + private["_old_cameras", "_count"]; + _old_cameras = [_player,_owner_type] call cctv_get_cameras_by_type; + _count = count(_old_cameras); + + if(!((_owner_type == "player" && {_count >= cctv_max_deployed_player_cameras}) || { + (_owner_type == "group" && {_count >= cctv_max_deployed_group_cameras}) || { + (_owner_type == "side" && {_count >= cctv_max_deployed_side_cameras})}})) exitWith {}; + + + if (_owner_type == "player") then { + player groupChat format["You already have %1 personal CCTV camera(s) deployed.", _count]; + } + else { + player groupChat format["There are already %1 %2 CCTV camera(s) deployed.", _count, toUpper _owner_type]; + }; + + private["_camera_to_delete"]; + _camera_to_delete = _old_cameras select 0; + player groupChat format["Camera ""%1"" was deleted.", (_camera_to_delete getVariable "camera_name")]; + deleteVehicle _camera_to_delete; + cctv_cameras = cctv_cameras - [objNull]; +}; + + +cctv_camera_use = { + //this is needed in order for the mf_inventory_drop call to work (since it's nested inside USE) + MUTEX_UNLOCK ; + + private["_item_type"]; + _item_type = _this; + + private["_player", "_uid"]; + _player = player; + _uid = getPlayerUID _player; + + private["_closesttown", "_town_name", "_town_pos"]; + _closesttown = (nearestLocations [_player,["NameCityCapital","NameCity","NameVillage"],10000]) select 0; + _town_name = text _closesttown; + _town_pos = position _closesttown; + + + private["_cctv_id", "_cctv_name", "_rand"]; + _rand = ceil(random 10000); + _camera_name = format["%1 (%2)", _town_name, _rand]; + + cctv_menu_result = nil; + [_player, _camera_name] call cctv_menu_dialog; + waitUntil {!dialog || {!isNil "cctv_menu_result"}}; + + if (isNil "cctv_menu_result") exitWith {false}; + + //player groupChat format["cctv_menu_result = %1", cctv_menu_result]; + + private["_access_control"]; + _camera_name = cctv_menu_result select cctv_menu_result_camera_name; + _access_control = cctv_menu_result select cctv_menu_result_ac; + + private["_owner_type"]; + _owner_type = _access_control select cctv_menu_result_ac_type; + _owner_value = _access_control select cctv_menu_result_ac_value; + + private["_camera"]; + _camera = _item_type call mf_inventory_drop; + + if (isNil "_camera" || {typeName _camera != typeName objNull || {isNull _camera}}) exitWith {false}; + + _camera setVariable ["a3w_cctv_camera", true, true]; + _camera setVariable ["camera_name", _camera_name, true]; + _camera setVariable ["camera_owner_type", _owner_type, true]; + _camera setVariable ["camera_owner_value", _owner_value, true]; + _camera setVariable ["R3F_LOG_disabled", false, true]; // Added for locking and saving. + + [_player, _owner_type] call cctv_enforce_limits; + cctv_cameras pushBack _camera; + publicVariable "cctv_cameras"; + + false +}; + +cctv_base_use = { + [player] call cctv_security_laptop_menu; + false +}; + + + +cctv_functions_defined = true; + +diag_log format["Loading camera functions complete"]; \ No newline at end of file diff --git a/addons/cctv/cctv_menu.hpp b/addons/cctv/cctv_menu.hpp new file mode 100644 index 000000000..5e0e1ed37 --- /dev/null +++ b/addons/cctv/cctv_menu.hpp @@ -0,0 +1,94 @@ +#include "constants.h" + +class cctv_menu { + idd = bank_dialog_idd; + movingEnable = true; + controlsBackground[] = { + cctv_menu_background + }; + + name = "CCTV_MENU"; + onUnload = ""; + onLoad="uiNamespace setVariable ['CCTV_MENU',_this select 0]"; + + objects[] = {}; + controls[] = { + cctv_menu_header, + cctv_menu_camera_name_label, + cctv_menu_camera_name_field, + cctv_menu_access_control_label, + cctv_menu_access_control_field, + cctv_menu_button_ok, + cctv_menu_button_cancel + }; + + class cctv_menu_header : gui_RscMenuTitle { + idc = cctv_menu_header_idc; + moving = 1; + x = 0.30-10; y = 0.10-10; + w = 0.39; h = 0.63; + text = "Bank Menu"; + }; + + class cctv_menu_background: gui_Rscbackground { + idc = cctv_menu_background_idc; + moving = 1; + x = 0.30-10; y = 0.10-10; + w = 0.39; h = 0.63; + }; + + //Camera name + class cctv_menu_camera_name_label : gui_RscText { + idc = cctv_menu_camera_name_label_idc; + x = 0.32-10; y = 0.47-10; + w = 0.13; h = 0.04; + text = ""; + }; + + class cctv_menu_camera_name_field: gui_RscEdit { + idc = cctv_menu_camera_name_field_idc; + x = 0.49-10; y = 0.47-10; + w = 0.18; h = 0.04; + colorBackground[] = FIELD_BACKGROUND; + text = "0"; + }; + + + //Access Type + class cctv_menu_access_control_label : gui_RscText { + idc = cctv_menu_access_control_label_idc; + x = 0.32-10; y = 0.47-10; + w = 0.13; h = 0.04; + text = ""; + }; + + class cctv_menu_access_control_field : gui_RscCombo { + idc = cctv_menu_access_control_field_idc; + x = 0.32-10; y = 0.14-10; + w = 0.35; h = 0.30; + onLBSelChanged = ""; + }; + + //Buttons + class cctv_menu_button_ok : gui_RscMenuButton { + idc = cctv_menu_button_ok_idc; + x = 0.32-10; y = 0.62-10; + w = 0.35; h = 0.04; + colorBackgroundDisabled[] = DISABLED_BUTTON_BACKGROUND; + colorDisabled[] = DISABLED_BUTTON_TEXT; + font = "PuristaBold"; + text = ""; + }; + + + class cctv_menu_button_cancel : gui_RscMenuButton { + idc = cctv_menu_button_cancel_idc; + x = 0.75-10; y = 0.67-10; + w = 0.35; h = 0.04; + colorBackgroundDisabled[] = DISABLED_BUTTON_BACKGROUND; + colorDisabled[] = DISABLED_BUTTON_TEXT; + font = "PuristaBold"; + text = "Close"; + action = "closeDialog 0;"; + }; +}; \ No newline at end of file diff --git a/addons/cctv/cctv_menu_functions.sqf b/addons/cctv/cctv_menu_functions.sqf new file mode 100644 index 000000000..c20bdba95 --- /dev/null +++ b/addons/cctv/cctv_menu_functions.sqf @@ -0,0 +1,324 @@ +#include "constants.h" +#include "macro.h" +#include "defines.h" + +if (not(undefined(cctv_menu_functions_defined))) exitWith {}; + +diag_log format["Loading camera menu functions ..."]; + +cctv_menu_result_camera_name = 0; +cctv_menu_result_ac = 1; +cctv_menu_result_ac_type = 0; +cctv_menu_result_ac_value = 1; + +strlen = { + private["_text"]; + _text = _this select 0; + if (undefined(_text)) exitWith {0}; + if (typeName _text != "STRING") exitWith {null}; + (count (toArray _text)) +}; + +substr = { + private["_string", "_start", "_length"]; + _string = _this select 0; + _start = _this select 1; + _length = _this select 2; + + if (undefined(_string)) exitWith {""}; + if (undefined(_start)) exitWith {""}; + + if (typeName _string != "STRING") exitWith {""}; + if (typeName _start != "SCALAR") exitWith {""}; + + + private["_string_data", "_string_out_data"]; + _string_data = toArray _string; + _string_out_data = []; + + if (undefined(_length)) then { + _length = count(_string_data) - _start; + }; + + private["_i", "_count"]; + _i = _start; + _count = 0; + while {(_i < (count _string_data)) && (_count < _length)} do { + _string_out_data set [_count, (_string_data select _i)]; + _count = _count + 1; + _i = _i + 1; + }; + + (toString _string_out_data) +}; + + +cctv_menu_dialog = { _this spawn { + disableSerialization; + + ARGVX3(0,_player,objNull); + ARGVX3(1,_camera_name,""); + + if (not(createDialog "cctv_menu")) exitWith { + player groupChat format["ERROR: Could not create CCTV menu dialog"]; + }; + + private["_list"]; + _list = [_camera_name] call cctv_menu_setup; + + private["_my_index"]; + _my_index = 0; + + {if(true)then { + private["_data", "_title", "_value"]; + _data = _x; + _title = _data select 0; + _value = _data select 1; + + private["_index"]; + _index = _list lbAdd _title; + + lbSetData [(ctrlIDC _list),_index,_value]; + lbSetValue [(ctrlIDC _list),_index,_value]; + };} forEach + [ + [format["Player (%1)", (name _player)], str(["player", getPlayerUID _player])], + [format["Group (%1)", str(group _player)], str(["group", getPlayerUID _player])], + [format["Team (%1)", str(side _player)], str(["side", str(side _player)])] + ]; + + _list lbSetCurSel 0; + + //Ok button + buttonSetAction [ + cctv_menu_button_ok_idc, + ( + ' cctv_menu_result = nil; ' + + ' private["_access_control", "_name"];' + + ' _name = ctrlText cctv_menu_camera_name_field_idc;' + + ' _access_control = call compile (lbData [cctv_menu_access_control_field_idc,lbCurSel cctv_menu_access_control_field_idc]);' + + ' if ([_name] call cctv_camera_name_valid) then {' + + ' cctv_menu_result = [_name,_access_control];' + + ' closedialog 0;' + + ' };' + )]; + +};}; + +cctv_camera_name_valid = { + ARGV3(0,_name,""); + + + if (isNil "_name") exitWith { + player groupChat format["The specified camera name is not valid", _min_length]; + false + }; + + def(_len); + _len = [_name] call strlen; + + def(_min_length); + _min_length = 5; + if (_len < _min_length) exitWith { + player groupChat format["The camera name must be at least %1 characters(s) long", _min_length]; + false + }; + + def(_max_length); + _max_length = 30; + if (_len > 30) exitWith { + player groupChat format["The camera name length %1 exceeds the maximum of %2 characters(s)", _len, _max_length]; + false + }; + + private["_other_camera"]; + _other_camera = [_name] call cctv_get_camera_by_name; + + if (!(isNil "_other_camera")) exitWith { + player groupChat format["The camera name %1, is already in use", _name]; + false + }; + + true +}; + +cctv_get_camera_by_name = { + ARGVX3(0,_name, ""); + + if (isNil "cctv_cameras") exitWith {}; + + private["_result"]; + + {if (true) then { + private["_camera"]; + _camera = _x; + if (!isOBJECT(_camera) || {isNull _camera}) exitWith {}; + + private["_cname"]; + _cname = _camera getVariable "camera_name"; + if (!isSTRING(_cname) || {_cname == ""}) exitWith {}; + + if (_cname == _name) exitWith { + _result = _camera; + }; + }; + + if (!isNil "_result") exitWith {}; + } forEach cctv_cameras; + + (OR(_result,nil)) + +}; + +cctv_menu_combo_focus = { + ARGVX3(0,_control,controlNull); + _control ctrlSetBackgroundColor [0.1,0.1,0.1,1]; +}; + +cctv_menu_combo_blur = { + ARGVX3(0,_control,controlNull); + _control ctrlSetBackgroundColor [1,1,1,0.08]; +}; + +cctv_menu_setup = { + disableSerialization; + ARGVX3(0,_camera_name,""); + + private["_display"]; + _display = uiNamespace getVariable "CCTV_MENU"; + + _cctv_menu_header = _display displayCtrl cctv_menu_header_idc; + _cctv_menu_background = _display displayCtrl cctv_menu_background_idc; + _cctv_menu_camera_name_label = _display displayCtrl cctv_menu_camera_name_label_idc; + _cctv_menu_camera_name_field = _display displayCtrl cctv_menu_camera_name_field_idc; + _cctv_menu_access_control_label = _display displayCtrl cctv_menu_access_control_label_idc; + _cctv_menu_access_control_field = _display displayCtrl cctv_menu_access_control_field_idc; + _cctv_menu_button_ok = _display displayCtrl cctv_menu_button_ok_idc; + _cctv_menu_button_cancel = _display displayCtrl cctv_menu_button_cancel_idc; + + + _cctv_menu_access_control_field ctrlAddEventHandler ["SetFocus","(_this) call cctv_menu_combo_focus"]; + _cctv_menu_access_control_field ctrlAddEventHandler ["KillFocus","(_this) call cctv_menu_combo_blur"]; + + private["_x","_y","_ysep","_sep","_cctv_title","_w","_h"]; + _x = 0.14; + _y = 0.14; + _w = 0.40; + _h = 0.30; + _ysep = 0.006; + _sep = 0.01; + _cctv_title = "CAMERA MENU"; + + private["_button_font_height","_font_family"]; + _button_font_height = MENU_TITLE_FONT_HEIGHT; + _font_family = "PuristaMedium"; + + //cctv header + private["_chx","_chy","_chw","_bhh"]; + _chx = _x; + _chy = _y; + _chw = _w; + _chh = 0.045; + + _cctv_menu_header ctrlSetPosition [_chx,_chy,_chw,_chh]; + _cctv_menu_header ctrlSetFontHeight _button_font_height; + _cctv_menu_header ctrlSetText _cctv_title; + _cctv_menu_header ctrlSetFont _font_family; + _cctv_menu_header ctrlCommit 0; + + //cctv close button + private["_ccx","_ccy","_ccw","_cch"]; + _ccw = 0.14; + _cch = _chh; + _ccx = _chx + _chw - _ccw; + _ccy = _chy + _h - _cch; + + _cctv_menu_button_cancel ctrlSetText "Cancel"; + _cctv_menu_button_cancel ctrlSetPosition [_ccx,_ccy,_ccw,_cch]; + buttonSetAction [(ctrlIDC _cctv_menu_button_cancel),"closeDialog 0"]; + _cctv_menu_button_cancel ctrlCommit 0; + + //cctv ok button + private["_cox","_coy" ,"_cow","_coh"]; + _cow = 0.11 ; + _coh = _cch; + _cox = _ccx - _cow - _ysep *2; + _coy = _ccy; + + + _cctv_menu_button_ok ctrlSetText "Ok"; + _cctv_menu_button_ok ctrlSetPosition [_cox,_coy,_cow,_coh]; + _cctv_menu_button_ok ctrlCommit 0; + + //cctv background + private["_cbx","_cby","_cbw","_cbh"]; + _cbx = _chx; + _cby = _chy + _chh + _ysep; + _cbw = _w; + _cbh = (_ccy ) - (_chy ) - _cch - _ysep - _ysep; + + _cctv_menu_background ctrlSetPosition [_cbx,_cby,_cbw,_cbh]; + _cctv_menu_background ctrlSetBackgroundColor [0,0,0,0.65]; + _cctv_menu_background ctrlCommit 0; + + + //cctv camera name label + private["_cnlx","_cnly","_cnlw","_cnlh"]; + _cnlx = _cbx + _sep * 2; + _cnly = _cby + _sep * 2; + _cnlw = (_cbw - _sep *6) / 2 - (_sep * 3); + _cnlh = 0.04; + + _cctv_menu_camera_name_label ctrlSetText "Camera name: "; + _cctv_menu_camera_name_label ctrlSetPosition [_cnlx,_cnly,_cnlw,_cnlh]; + _cctv_menu_camera_name_label ctrlSetFontHeight _button_font_height - 0.003; + _cctv_menu_camera_name_label ctrlCommit 0; + + + //cctv camera name field + private["_cnfx","_cnfy","_cnfw","_cnfh"]; + _cnfx = _cnlx + _cnlw + _sep * 2 ; + _cnfy = _cnly; + _cnfw = _cnlw + (_sep * 5); + _cnfh = _cnlh; + + _cctv_menu_camera_name_field ctrlSetText _camera_name; + _cctv_menu_camera_name_field ctrlSetFontHeight _button_font_height - 0.003;; + _cctv_menu_camera_name_field ctrlSetFont _font_family; + _cctv_menu_camera_name_field ctrlSetPosition [_cnfx,_cnfy,_cnfw,_cnfh]; + _cctv_menu_camera_name_field ctrlSetBackgroundColor [1,1,1,0.08]; + _cctv_menu_camera_name_field ctrlCommit 0; + + + //cctv access control label + private["_calx","_caly","_calw","_calh"]; + _calx = _cnlx; + _caly = _cnly + _cnlh + _ysep * 2; + _calw = _cnlw; + _calh = _cnlh; + + _cctv_menu_access_control_label ctrlSetText "Accessible by: "; + _cctv_menu_access_control_label ctrlSetPosition [_calx,_caly,_calw,_calh]; + _cctv_menu_access_control_label ctrlSetFontHeight _button_font_height - 0.003; + _cctv_menu_access_control_label ctrlCommit 0; + + //cctv access control field + private["_cafx","_cafy","_cafw","_cafh"]; + _cafx = _calx + _calw + _sep * 2 ; + _cafy = _caly; + _cafw = _calw + (_sep * 5); + _cafh = _calh; + + _cctv_menu_access_control_field ctrlSetFontHeight _button_font_height - 0.003;; + _cctv_menu_access_control_field ctrlSetFont _font_family; + _cctv_menu_access_control_field ctrlSetPosition [_cafx,_cafy,_cafw,_cafh]; + _cctv_menu_access_control_field ctrlSetBackgroundColor [1,1,1,0.08]; + _cctv_menu_access_control_field ctrlCommit 0; + + + _cctv_menu_access_control_field +}; + +cctv_menu_functions_defined = true; + +diag_log format["Loading camera menu functions complete"]; \ No newline at end of file diff --git a/addons/cctv/config.sqf b/addons/cctv/config.sqf new file mode 100644 index 000000000..4f3782379 --- /dev/null +++ b/addons/cctv/config.sqf @@ -0,0 +1,6 @@ +cctv_max_distance = -1; // -1 unlimited +cctv_max_inventory_cameras = 2; //maximum number of cameras that player can carry in his inventory +cctv_max_inventory_base_stations = 1; //maximum number of base stations that player can carry in his inventory +cctv_max_deployed_player_cameras = 3; //maximum number of personal cameras that a player can have deployed +cctv_max_deployed_group_cameras = 2; //maximum number of group cameras that could be deployed in a group +cctv_max_deployed_side_cameras = 10; //maxmumum number of team cameras that could be deployed in a team (WEST, EAST, INDEPENDENT) diff --git a/addons/cctv/constants.h b/addons/cctv/constants.h new file mode 100644 index 000000000..e10ec10c6 --- /dev/null +++ b/addons/cctv/constants.h @@ -0,0 +1,61 @@ +#define FIELD_BACKGROUND {1,1,1,0.1} +#define DISABLED_BUTTON_BACKGROUND {1,0,0,0.4} +#define DISABLED_BUTTON_TEXT {1,1,1,1} + + + + + +#define GUI_BCG_RGB {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"} + + +#define BOX_BACKGROUND {1,1,1,0.1} +#define DISABLED_BUTTON_BACKGROUND {1,0,0,0.4} +#define DISABLED_BUTTON_TEXT {1,1,1,1} + + + + +#define MENU_TITLE_FONT_HEIGHT (((((safezoneW / safezoneH) min 1.2) / 1.2) / 32) * 1) + + + + +#define cctv_menu_idd 3000 +#define cctv_menu_header_idc 3001 +#define cctv_menu_background_idc 3002 +#define cctv_menu_pay_button_idc 3004 +#define cctv_menu_close_button_idc 3005 +#define cctv_menu_bail_label_idc 3006 +#define cctv_menu_bail_field_idc 3007 + + + + +#define laptop_flat_menu_dialog_idd 10000 +#define laptop_flat_menu_background_idc 10001 +#define laptop_flat_menu_screen_idc 10002 +#define laptop_flat_menu_button_mouse_idc 10003 +#define laptop_flat_menu_button_space_idc 10004 +#define laptop_flat_menu_screen_text_tl_idc 10005 + +#define LAPTOP_EVENT_ON 0 +#define LAPTOP_EVENT_OFF 1 +#define LAPTOP_EVENT_KEY 2 +#define LAPTOP_EVENT_BUTTON 3 +#define LAPTOP_EVENT_BUTTON_MOUSE_PAD 0 +#define LAPTOP_EVENT_BUTTON_MOUSE_LEFT 1 +#define LAPTOP_EVENT_BUTTON_MOUSE_RIGHT 2 + + + +#define cctv_menu_dialog_idd 300 +#define cctv_menu_header_idc 301 +#define cctv_menu_background_idc 302 +#define cctv_menu_camera_name_label_idc 303 +#define cctv_menu_camera_name_field_idc 304 +#define cctv_menu_access_control_label_idc 309 +#define cctv_menu_access_control_field_idc 310 +#define cctv_menu_button_ok_idc 311 +#define cctv_menu_button_cancel_idc 313 + diff --git a/addons/cctv/defines.h b/addons/cctv/defines.h new file mode 100644 index 000000000..4f85ce549 --- /dev/null +++ b/addons/cctv/defines.h @@ -0,0 +1 @@ +#define strM(x) ([x, ","] call format_integer) diff --git a/addons/cctv/dikcodes.h b/addons/cctv/dikcodes.h new file mode 100644 index 000000000..18d691fc0 --- /dev/null +++ b/addons/cctv/dikcodes.h @@ -0,0 +1,341 @@ +/* F1 ... F15 */ +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_F11 0x57 +#define DIK_F12 0x58 +#define DIK_F13 0x64 +#define DIK_F14 0x65 +#define DIK_F15 0x66 + +/* 0..9 */ +#define DIK_0 0x0B +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_NUMPAD0 0x52 +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 + +/* alpha */ +#define DIK_A 0x1E +#define DIK_B 0x30 +#define DIK_C 0x2E +#define DIK_D 0x20 +#define DIK_E 0x12 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_I 0x17 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_M 0x32 +#define DIK_N 0x31 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_Q 0x10 +#define DIK_R 0x13 +#define DIK_S 0x1F +#define DIK_T 0x14 +#define DIK_U 0x16 +#define DIK_V 0x2F +#define DIK_W 0x11 +#define DIK_X 0x2D +#define DIK_Y 0x15 +#define DIK_Z 0x2C + +/* Controls */ +#define DIK_ESCAPE 0x01 +#define DIK_TAB 0x0F +#define DIK_LSHIFT 0x2A +#define DIK_RSHIFT 0x36 +#define DIK_LCONTROL 0x1D +#define DIK_RCONTROL 0x9D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_BACKSPACE DIK_BACK +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_LALT DIK_LMENU +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A /* capslock */ +#define DIK_CAPSLOCK DIK_CAPITAL +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define Graphics +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_BACKSLASH 0x2B +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_NUMPADSTAR DIK_MULTIPLY +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ + +/* KataKana */ +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* / ? on Portugese (Brazilian) keyboards */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Portugese (Brazilian) keyboards */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NUMPADCOMMA 0xB3 /* ,on numeric keypad (NEC PC98) */ + +/* Alternate names for keys originally not used on US keyboards. */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ +#define Apps +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_SYSRQ 0xB7 +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* ArrowKeypad */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ +#define other +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ + +/* Numeric sort */ +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* / ? on Portugese (Brazilian) keyboards */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Portugese (Brazilian) keyboards */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_NUMPADCOMMA 0xB3 /* ,on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* Alternate names for keys,to facilitate transition from DOS. */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/* Alternate names for keys originally not used on US keyboards. */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ \ No newline at end of file diff --git a/addons/cctv/functions.sqf b/addons/cctv/functions.sqf new file mode 100644 index 000000000..b7f338f88 --- /dev/null +++ b/addons/cctv/functions.sqf @@ -0,0 +1,7 @@ +[] execVM "addons\cctv\config.sqf"; + +{ + private["_h"]; + _h = [] execVM format["addons\cctv\%1_functions.sqf", _x]; + waitUntil {scriptDone _h}; +} forEach ["laptop_flat_menu", "cctv_menu", "cctv"] diff --git a/addons/cctv/icons/camcorder.paa b/addons/cctv/icons/camcorder.paa new file mode 100644 index 000000000..42be8e9b2 Binary files /dev/null and b/addons/cctv/icons/camcorder.paa differ diff --git a/addons/cctv/icons/laptop.paa b/addons/cctv/icons/laptop.paa new file mode 100644 index 000000000..dfd2dbe64 Binary files /dev/null and b/addons/cctv/icons/laptop.paa differ diff --git a/addons/cctv/images/laptop_flat.paa b/addons/cctv/images/laptop_flat.paa new file mode 100644 index 000000000..e8189e278 Binary files /dev/null and b/addons/cctv/images/laptop_flat.paa differ diff --git a/addons/cctv/laptop_flat_menu.hpp b/addons/cctv/laptop_flat_menu.hpp new file mode 100644 index 000000000..735c338a2 --- /dev/null +++ b/addons/cctv/laptop_flat_menu.hpp @@ -0,0 +1,58 @@ +#include "constants.h" + +class laptop_flat_menu { + idd = laptop_flat_menu_dialog_idd; + movingEnable = true; + controlsBackground[] = {laptop_flat_menu_background}; + objects[] = { }; + + name = "LAPTOP_FLAT_MENU"; + onUnload = ""; + onLoad="uiNamespace setVariable ['LAPTOP_FLAT_MENU',_this select 0]"; + + controls[] = { + laptop_flat_menu_background, + laptop_flat_menu_screen, + laptop_flat_menu_screen_text_tl, + laptop_flat_menu_button_mouse, + laptop_flat_menu_button_space + }; + + class laptop_flat_menu_screen_text_tl : gui_RscText { + idc = laptop_flat_menu_screen_text_tl_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + style = ST_LEFT; + text = "Sample Text"; + }; + + class laptop_flat_menu_background : gui_RscPictureKeepAspect { + idc = laptop_flat_menu_background_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + moving = 1; + }; + + class laptop_flat_menu_screen : gui_RscPicture { + idc = laptop_flat_menu_screen_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + moving = 1; + }; + + class laptop_flat_menu_button_mouse : gui_RscMenuButton { + idc = laptop_flat_menu_button_mouse_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + font = "PuristaBold"; + text = ""; + }; + + class laptop_flat_menu_button_space : gui_RscMenuButton { + idc = laptop_flat_menu_button_space_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + font = "PuristaBold"; + text = ""; + }; +}; \ No newline at end of file diff --git a/addons/cctv/laptop_flat_menu_functions.sqf b/addons/cctv/laptop_flat_menu_functions.sqf new file mode 100644 index 000000000..d2b2d477f --- /dev/null +++ b/addons/cctv/laptop_flat_menu_functions.sqf @@ -0,0 +1,170 @@ +#include "constants.h" +#include "macro.h" +#include "dikcodes.h" + +if (not(undefined(laptop_flat_menu_functions))) exitWith {}; + +diag_log format["Loading laptop flat menu functions ..."]; + +laptop_flat_event_type = 0; +laptop_flat_envent_data = 1; + +laptop_flat_key_event_cb = []; +laptop_flat_on_event_cb = []; +laptop_flat_off_event_cb = []; + +laptop_flat_data_cb_args = 0; +laptop_flat_data_cb_name = 1; + +laptop_flat_activate_key = { + //player groupChat format["laptop_flat_activate_key %1",_this]; + disableSerialization; + ARGV2(0,_type); + ARGV2(1,_value); + [[_type,_value],laptop_flat_key_event_cb] call laptop_flat_invoke_event_callback; +}; + + +laptop_flat_invoke_event_callback = { + disableSerialization; + ARGV2(0,_event); + ARGV2(1,_callback) + + if (isNil "_callback" || {typeName _callback != "ARRAY" || {count(_callback) < 2}}) exitWith {}; + + private["_args","_name"]; + _args = _callback select laptop_flat_data_cb_args; + _name = _callback select laptop_flat_data_cb_name; + + if (typeName "_name" != "STRING") exitWith {}; + + private["_method"]; + _method = missionNamespace getVariable [_name,{}]; + [_event,_args] call _method; +}; + +laptop_flat_menu_screen_control = { + private["_display"]; + _display = (uiNamespace getVariable 'LAPTOP_FLAT_MENU'); + (_display displayCtrl laptop_flat_menu_screen_idc) +}; + + + +laptop_flat_menu_update_text_tl = { + disableSerialization; + ARGV2(0,_text); + private["_display"]; + _display = (uiNamespace getVariable 'LAPTOP_FLAT_MENU'); + + _laptop_flat_menu_screen_text_tl = _display displayCtrl laptop_flat_menu_screen_text_tl_idc; + _laptop_flat_menu_screen_text_tl ctrlSetText _text; + _laptop_flat_menu_screen_text_tl ctrlCommit 0; +}; + +laptop_flat_menu_setup = {_this spawn { + disableSerialization; + ARGV2(0,_key_event_cb); + ARGV2(1,_on_event_cb); + ARGV2(2,_off_event_cb); + + laptop_flat_key_event_cb = _key_event_cb; + laptop_flat_on_event_cb = _on_event_cb; + laptop_flat_off_event_cb = _off_event_cb; + + if (!(createDialog "laptop_flat_menu")) exitWith { + player groupChat format["ERROR: Could not create lock panel menu dialog"]; + }; + + private["_display"]; + _display = (uiNamespace getVariable 'LAPTOP_FLAT_MENU'); + + _laptop_flat_menu_background = _display displayCtrl laptop_flat_menu_background_idc; + _laptop_flat_menu_screen = _display displayCtrl laptop_flat_menu_screen_idc; + _laptop_flat_menu_button_mouse = _display displayCtrl laptop_flat_menu_button_mouse_idc; + _laptop_flat_menu_button_space = _display displayCtrl laptop_flat_menu_button_space_idc; + _laptop_flat_menu_screen_text_tl = _display displayCtrl laptop_flat_menu_screen_text_tl_idc; + + + + private["_x","_y","_w","_h"]; + _w = 1; + _h = 1; + _x = 0.5 - (_w /2); + _y = 0.5 - (_h /2); + + _laptop_flat_menu_background ctrlSetPosition [_x,_y,_w,_h]; + _laptop_flat_menu_background ctrlSetText "addons\cctv\images\laptop_flat.paa"; + _laptop_flat_menu_background ctrlCommit 0; + + + private["_bspx","_bspy","_bspw","_bsph"]; + _bspw = _w * 0.126; + _bsph = _h * 0.025; + _bspx = _x + _bspw * 2.85; + _bspy = _y + _bsph * 30.2; + + + _laptop_flat_menu_button_space ctrlSetText ""; + _laptop_flat_menu_button_space ctrlSetPosition [_bspx,_bspy,_bspw,_bsph]; + _laptop_flat_menu_button_space ctrlSetBackgroundColor [0,0,0,0]; + _laptop_flat_menu_button_space ctrlCommit 0; + //_laptop_flat_menu_button_space ctrlEnable false; + buttonSetAction [(ctrlIDC _laptop_flat_menu_button_space),'[LAPTOP_EVENT_KEY,DIK_SPACE] call laptop_flat_activate_key;']; + + + private["_bxsep","_bysep"]; + _bxsep = _bsph; + _bysep = _bsph; + + private["_bmsx","_bmsy","_bmsw","_bmsh"]; + _bmsw = _bspw; + _bmsh = _bsph * 4; + _bmsx = _bspx + _bxsep * 0.5; + _bmsy = _bspy + _bysep * 2.5; + + _laptop_flat_menu_button_mouse ctrlSetText ""; + _laptop_flat_menu_button_mouse ctrlSetPosition [_bmsx,_bmsy,_bmsw,_bmsh]; + _laptop_flat_menu_button_mouse ctrlSetBackgroundColor [0,0,0,0]; + _laptop_flat_menu_button_mouse ctrlCommit 0; + //_laptop_flat_menu_button_mouse ctrlEnable false; + buttonSetAction [(ctrlIDC _laptop_flat_menu_button_mouse),'[LAPTOP_EVENT_BUTTON,LAPTOP_EVENT_BUTTON_MOUSE_PAD] call laptop_flat_activate_key;']; + + + private["_lsx","_lsy","_lsw","_lsh"]; + _lsw = _bspw * 4.1; + _lsh = _bsph * 15.7; + _lsx = _bspx - _bspw * 0.97; + _lsy = _bspy - _bsph * 27.9; + + + _laptop_flat_menu_screen ctrlSetPosition [_lsx,_lsy,_lsw,_lsh]; + //_laptop_flat_menu_screen ctrlSetTextColor [0,0,0,0.15]; + _laptop_flat_menu_screen ctrlSetText "#(argb,8,8,3)color(1,0,0,1)"; + _laptop_flat_menu_screen ctrlCommit 0; + + + private["_lstx","_lsty","_lstw","_lsth"]; + _lstw = _bspw * 3.5; + _lsth = _bsph * 1.5; + _lstx = _bspx - _bspw * 0.97; + _lsty = _bspy - _bsph * 27.9; + + _laptop_flat_menu_screen_text_tl ctrlSetPosition [_lstx,_lsty,_lstw,_lsth]; + _laptop_flat_menu_screen_text_tl ctrlSetBackgroundColor [0,0,0,0.6]; + _laptop_flat_menu_screen_text_tl ctrlSetFontHeight 0.03; + _laptop_flat_menu_screen_text_tl ctrlSetFont "PuristaMedium"; + _laptop_flat_menu_screen_text_tl ctrlSetTextColor [1,1,1,1]; + _laptop_flat_menu_screen_text_tl ctrlSetText ""; + _laptop_flat_menu_screen_text_tl ctrlCommit 0; + + + [[LAPTOP_EVENT_ON],laptop_flat_on_event_cb] call laptop_flat_invoke_event_callback; + waitUntil {not(ctrlShown _laptop_flat_menu_background)}; + [[LAPTOP_EVENT_OFF],laptop_flat_off_event_cb] call laptop_flat_invoke_event_callback; +};}; + + +laptop_flat_menu_functions = true; + +diag_log format["Loading laptop flat menu functions complete"]; \ No newline at end of file diff --git a/addons/cctv/macro.h b/addons/cctv/macro.h new file mode 100644 index 000000000..7cdedd47a --- /dev/null +++ b/addons/cctv/macro.h @@ -0,0 +1,142 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} \ No newline at end of file diff --git a/addons/cctv/ui.hpp b/addons/cctv/ui.hpp new file mode 100644 index 000000000..437ca58e2 --- /dev/null +++ b/addons/cctv/ui.hpp @@ -0,0 +1,489 @@ +#define FontM "PuristaMedium" +#define FontHTML "PuristaMedium" +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 +#define CT_STRUCTURED_TEXT 13 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_SHORTCUT_BUTTON 16 +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 +#define CT_ANIMATED_TEXTURE 45 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT_CONTAINER 82 +#define CT_OBJECT_CONT_ANIM 83 +#define CT_LINEBREAK 98 +#define CT_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define CT_LISTNBOX 102 + +#define ST_LEFT 0 +#define ST_RIGHT 1 +#define ST_CENTER 2 +#define ST_MULTI 16 +#define ST_PICTURE 48 +#define ST_FRAME 64 +#define ST_SHADOW 256 +#define ST_NO_RECT 512 + + +// Respawn Dialog additions + +#define FontM_R "PuristaMedium" +#define FontHTML_R "PuristaMedium" +#define Dlg_ROWS 36 +#define Dlg_COLS 90 +#define Dlg_CONTROLHGT ((100/Dlg_ROWS)/100) +#define Dlg_COLWIDTH ((100/Dlg_COLS)/100) +#define Dlg_TEXTHGT_MOD 0.8 +#define Dlg_ROWSPACING_MOD 1.3 +#define Dlg_ROWHGT (Dlg_CONTROLHGT*Dlg_ROWSPACING_MOD) +#define Dlg_TEXTHGT (Dlg_CONTROLHGT*Dlg_TEXTHGT_MOD) +#define Dlg_ICONWIDTH (Dlg_CONTROLHGT*4/5) +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0c +#define ST_TYPE 0xF0 +#define ST_SINGLE 0 +#define ST_TITLE_BAR 32 +#define ST_PICTURE 48 +#define ST_FRAME 64 +#define ST_BACKGROUND 80 +#define ST_GROUP_BOX 96 +#define ST_GROUP_BOX2 112 +#define ST_HUD_BACKGROUND 128 +#define ST_TILE_PICTURE 144 +#define ST_WITH_RECT 160 +#define ST_LINE 176 +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 +#define ST_KEEP_ASPECT_RATIO 0x800 +#define ST_TITLE ST_TITLE_BAR + ST_CENTER +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 +#define SL_TEXTURES 0x10 +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 + + + +class cctv_ui_RscText { + type = CT_STATIC; + idc = -1; + style = ST_LEFT; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.02; + text = ""; +}; + +class cctv_ui_RscBgRahmen { + type = CT_STATIC; + idc = -1; + style = ST_FRAME; + colorBackground[] = {1.0,1.0,1.0,0.75}; + colorText[] = {1,1,1,1}; + font = FontM; + SizeEX = 0.025; + text = ""; +}; + +class cctv_ui_RscBackground { + colorBackground[] = {0,0,0,0.75}; + text = ""; + type = CT_STATIC; + idc = -1; + style = ST_LEFT; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.04; +}; + +class cctv_ui_RscPicture { + type = CT_STATIC; + idc = -1; + style = ST_PICTURE; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.02; + text = ""; +}; + +class cctv_ui_RscPictureKeepAspect: cctv_ui_RscPicture { + style = "0x30 + 0x800"; +}; + +class cctv_ui_RscBackgroundPicture { + type = CT_STATIC; + idc = -1; + style = ST_PICTURE; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.02; + text = "dbg.pac"; +}; + +class cctv_ui_RscButton { + type = CT_BUTTON; + idc = -1; + style = ST_CENTER; + colorText[] = {1,1,1,1}; + font = FontHTML; + sizeEx = 0.025; + soundPush[] = {"",0.2,1}; + soundClick[] = {"",0.2,1}; + soundEscape[] = {"",0.2,1}; + default = false; + text = ""; + action = ""; + colorActive[] = {0,0,0,0}; + colorDisabled[] = {0,0,0,0.1}; + colorBackground[] = {0.8,0.8,0.8,0.3}; + colorBackgroundActive[] = {0.7,0.7,0.7,1}; + colorBackgroundDisabled[] = {1,1,1,0.5}; + colorFocused[] = {0.84,1,0.55,1}; + colorShadow[] = {0,0,0,0.1}; + colorBorder[] = {1,1,1,0.1}; + offsetX = 0; + offsetY = 0; + offsetPressedX = 0; + offsetPressedY = 0; + borderSize = 0; + soundEnter[] = {"",0.15,1}; +}; + +class cctv_ui_RscMenuButton { + type = CT_SHORTCUT_BUTTON; + style = "0x02 + 0xC0"; + default = 0; + shadow = 0; + x = 0; + y = 0; + w = 0.095589; + h = 0.039216; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,1)"; + animTextureDisabled = "#(argb,8,8,3)color(1,0,0,0.8)"; + animTextureOver = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,1)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,1)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,1)"; + textureNoShortcut = ""; + + colorBackground[] = {1,1,1,0.8}; + colorBackground2[] = {1,1,1,0.5}; + color[] = {1,1,1,1}; + color2[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,0,0,0.8}; + + colorFocused[] = {1,1,1,1}; + colorBackgroundFocused[] = {0,0,0,0}; + + period = 1.2; + periodFocus = 1.2; + periodOver = 1.2; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + + class HitZone + { + left = 0.0; + top = 0.0; + right = 0.0; + bottom = 0.0; + }; + + class TextPos + { + left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)"; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + class Attributes + { + font = "PuristaLight"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class ShortcutPos + { + left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005"; + top = 0.005; + w = 0.0225; + h = 0.03; + }; + soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; +}; + +class cctv_ui_RscMenuTitle { + type = CT_STATIC; + idc = -1; + style = ST_CENTER; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + colorText[] = {1,1,1,1}; + font = "PuristaMedium"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + shadow = 1; + colorShadow[] = {0,0,0,0.5}; + linespacing = 1; +}; + + +class cctv_ui_RscDummy : cctv_ui_RscButton { + x = -1.0; + y = -1.0; + idc = -1; + w = 0.01; + h = 0.01; + default = true; +}; + +class cctv_ui_RscEdit { + idc = -1; + type = CT_EDIT; + style = ST_LEFT; + font = FontHTML; + sizeEx = 0.02; + colorText[] = {1,1,1,1}; + colorSelection[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorDisabled[] = {1,0,0,0.3}; + autocomplete = false; + text = ""; +}; + +class cctv_ui_RscEditMulti : cctv_ui_RscEdit { + style = ST_MULTI; + sizeEx = 0.03; + lineSpacing = 1; + colorDisabled[] = {1,1,1,1}; +}; + +class cctv_ui_RscLB_C { + style = ST_LEFT; + idc = -1; + colorSelect[] = {0,0,0,1.0}; + colorSelectBackground[] = {0.7,0.7,0.7,1}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.8,0.8,0.8,0.3}; + colorScrollbar[] = {Dlg_Color_White,1}; + colorDisabled[] = {1,0,0,0.3}; + font = FontHTML; + sizeEx = 0.025; + rowHeight = 0.04; + period = 1.200000; + maxHistoryDelay = 1.000000; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + + class ScrollBar {}; +}; + +class cctv_ui_RscListBox { + type = CT_LISTBOX; + style = ST_MULTI; + lineSpacing = 1; + shadow = 0; + //colorSelect[] = {0,0,0,1}; + colorSelect[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0,0,0,0.15}; + colorSelectBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + colorScrollbar[] = {Dlg_Color_White,1}; + arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; + arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; + wholeHeight = 0; + color[] = {1,1,1,1}; + colorActive[] = {1,0,0,1}; + colorDisabled[] = {1,0,0,0.3}; + font = "PuristaMedium"; + sizeEx = 0.030; + rowHeight = 0.04; + + + soundEnter[] = {"\A3\ui_f\data\sound\onover",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundClick[] = {"\A3\ui_f\data\sound\onclick",0.07,1}; + soundEscape[] = {"\A3\ui_f\data\sound\onescape",0.09,1}; + soundSelect[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundExpand[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundCollapse[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + maxHistoryDelay = 1; + + class ScrollBar { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; +}; + + + +class cctv_ui_RscListNBox : cctv_ui_RscListBox { + type = CT_LISTNBOX; + colorSelect[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0,0,0,0.15}; + colorSelectBackground[] = {0,0,0,0}; + drawSideArrows = 0; + toolTip = ""; + idcLeft = 20010; + idcRight = 20011; +}; + + +class cctv_ui_RscCombo { + type = CT_COMBO; + style = ST_MULTI; + lineSpacing = 1; + shadow = 0; + sizeEx = 0.030; + rowHeight = 0.04; + + //colorSelect[] = {0,0,0,1.0}; + colorSelect[] = {1,1,1,1.0}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.8,0.8,0.8,0.3}; +// colorSelectBackground[] = {0.7,0.7,0.7,1}; + colorSelectBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + colorScrollbar[] = {Dlg_Color_White,1}; + arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; + arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; + wholeHeight = 0.45; + color[] = {1,1,1,1}; + colorActive[] = {1,0,0,1}; + colorDisabled[] = {1,0,0,0.3}; + font = "PuristaMedium"; + + + soundEnter[] = {"\A3\ui_f\data\sound\onover",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundClick[] = {"\A3\ui_f\data\sound\onclick",0.07,1}; + soundEscape[] = {"\A3\ui_f\data\sound\onescape",0.09,1}; + soundSelect[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundExpand[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundCollapse[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + maxHistoryDelay = 1; + + class ScrollBar + { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + thumb = "\a3\ui_f\data\gui\cfg\Scrollbar\thumb_ca.paa"; + arrowEmpty = "\a3\ui_f\data\gui\cfg\Scrollbar\arrowempty_ca.paa"; + arrowFull = "\a3\ui_f\data\gui\cfg\Scrollbar\arrowfull_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + + class ComboScrollBar + { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; +}; + +/* +class RscCombo: RscLB_C { + type = CT_COMBO; + wholeHeight = 0.3; + soundSelect[] = {"",0.15,1}; + soundExpand[] = {"",0.15,1}; + soundCollapse[] = {"",0.15,1}; + arrowEmpty = ""; + arrowFull = ""; +}; +*/ + +class cctv_ui_RscSliderH { + idc = -1; + access = ReadandWrite; + type = CT_SLIDER; + sizeEx = 0.025; + style = 1024; + + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.2}; + arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; + thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa"; +}; + +class cctv_ui_RscSliderV { + access = ReadandWrite; + type = CT_SLIDER; + idc = -1; + sizeEx = 0.025; + style = 0; + color[] = {0.2,0.2,0.2,1}; + colorActive[] = {1,1,1,1}; +}; + +class cctv_ui_RscCheckBox { + idc = -1; + type = CT_CHECKBOXES; + style = ST_CENTER; + + colorText[] = {1,1,1,1}; + color[] = {0,1,0,1}; + colorTextSelect[] = {0,0.8,0,1}; + colorSelectedBg[] = {1,1,1,0}; + colorSelect[] = {0,0,0,1}; + colorTextDisable[] = {0.4,0.4,0.4,1}; + colorDisable[] = {0.4,0.4,0.4,1}; + font = "PuristaMedium"; + SizeEX=0.025; + rows = 1; + columns = 1; + strings[] = {""}; +}; \ No newline at end of file diff --git a/addons/disableEnvironment/disableEnvironment.sqf b/addons/disableEnvironment/disableEnvironment.sqf new file mode 100644 index 000000000..71602ead2 --- /dev/null +++ b/addons/disableEnvironment/disableEnvironment.sqf @@ -0,0 +1,18 @@ +// @file Name: disableEnvinronment.sqf +// @file Author: CRE4MPIE + + +waitUntil {time > 0}; +if (soundVolume > 0.99) then + { + + 0.5 fadeSound 0.98; + enableEnvironment false; + ["Environment effects Disabled.", 5] call mf_notify_client; + } + else + { + 0.5 fadeSound 1; + enableEnvironment true; + ["Environment effects Enabled.", 5] call mf_notify_client; + }; diff --git a/addons/far_revive/FAR_Player_Unconscious.sqf b/addons/far_revive/FAR_Player_Unconscious.sqf index fedc38cf8..560adc454 100644 --- a/addons/far_revive/FAR_Player_Unconscious.sqf +++ b/addons/far_revive/FAR_Player_Unconscious.sqf @@ -26,6 +26,11 @@ _unit spawn _draggedBy = DRAGGED_BY(_unit); _anim = animationState _unit; + if (isWeaponDeployed _unit || isWeaponRested _unit) then + { + _unit playMove ""; + }; + if ((getPos _unit select 2 < 0.5 && vectorMagnitude velocity _unit < 5) || {alive _draggedBy && !UNCONSCIOUS(_draggedBy)}) then { // Anim is stuck due to stance change in progress during injury diff --git a/addons/far_revive/FAR_handleAction.sqf b/addons/far_revive/FAR_handleAction.sqf index 8e5ca9580..a4d0dfb82 100644 --- a/addons/far_revive/FAR_handleAction.sqf +++ b/addons/far_revive/FAR_handleAction.sqf @@ -36,4 +36,9 @@ switch (toLower _action) do { [] spawn FAR_Release; }; + + case "action_kill": + { + [cursorTarget] spawn FAR_Kill; + }; }; diff --git a/addons/far_revive/FAR_revive_funcs.sqf b/addons/far_revive/FAR_revive_funcs.sqf index 83395dc87..5c709d4e3 100644 --- a/addons/far_revive/FAR_revive_funcs.sqf +++ b/addons/far_revive/FAR_revive_funcs.sqf @@ -15,7 +15,8 @@ FAR_Player_Actions = [ ["" + "Revive" + "", "addons\FAR_revive\FAR_handleAction.sqf", ["action_revive"], 100, true, true, "", FAR_Check_Revive], ["" + "Stabilize" + "", "addons\FAR_revive\FAR_handleAction.sqf", ["action_stabilize"], 99, true, true, "", FAR_Check_Stabilize], - ["" + "Drag" + "", "addons\FAR_revive\FAR_handleAction.sqf", ["action_drag"], 98, true, true, "", FAR_Check_Dragging] + ["" + "Drag" + "", "addons\FAR_revive\FAR_handleAction.sqf", ["action_drag"], 98, true, true, "", FAR_Check_Dragging], + ["" + "Kill" + "", "addons\FAR_revive\FAR_handleAction.sqf", ["action_kill"], 97, true, true, "", FAR_Check_Dragging] ]; }; } @@ -283,6 +284,20 @@ FAR_Check_Revive = } call mf_compile; +//////////////////////////////////////////////// +// Kill Player Action +//////////////////////////////////////////////// +FAR_Kill = +{ + call FAR_Check_Dragging; + _target = cursorTarget; + if ((_target isKindOf "Man") && { _target call A3W_fnc_isUnconscious}) then { + _target allowDamage true; + _target setDamage 1; + }; +} +call mf_compile; + //////////////////////////////////////////////// // Show Nearby Friendly Medics //////////////////////////////////////////////// diff --git a/addons/fpsFix/vehicleManagerHC.sqf b/addons/fpsFix/vehicleManagerHC.sqf index ee7865a29..c4e993c88 100644 --- a/addons/fpsFix/vehicleManagerHC.sqf +++ b/addons/fpsFix/vehicleManagerHC.sqf @@ -106,7 +106,7 @@ while {true} do { _startTime = diag_tickTime; _entities = entities "All"; - A3W_allPlayers = call allPlayers; + A3W_allPlayers = call fn_allPlayers; _loopQty = [A3W_vehicleManagerHC, _entities, MAIN_LOOP_INTERVAL, _oldCount, _totalTime, _loopQty, true] call fn_loopSpread; diff --git a/addons/gui/gui.hpp b/addons/gui/gui.hpp new file mode 100644 index 000000000..a6572f45a --- /dev/null +++ b/addons/gui/gui.hpp @@ -0,0 +1,512 @@ +#define FontM "PuristaMedium" +#define FontHTML "PuristaMedium" +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 +#define CT_STRUCTURED_TEXT 13 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_SHORTCUT_BUTTON 16 +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 +#define CT_ANIMATED_TEXTURE 45 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT_CONTAINER 82 +#define CT_OBJECT_CONT_ANIM 83 +#define CT_LINEBREAK 98 +#define CT_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define CT_LISTNBOX 102 + +#define ST_LEFT 0 +#define ST_RIGHT 1 +#define ST_CENTER 2 +#define ST_MULTI 16 +#define ST_PICTURE 48 +#define ST_FRAME 64 +#define ST_SHADOW 256 +#define ST_NO_RECT 512 + + +// Respawn Dialog additions + +#define FontM_R "PuristaMedium" +#define FontHTML_R "PuristaMedium" +#define Dlg_ROWS 36 +#define Dlg_COLS 90 +#define Dlg_CONTROLHGT ((100/Dlg_ROWS)/100) +#define Dlg_COLWIDTH ((100/Dlg_COLS)/100) +#define Dlg_TEXTHGT_MOD 0.8 +#define Dlg_ROWSPACING_MOD 1.3 +#define Dlg_ROWHGT (Dlg_CONTROLHGT*Dlg_ROWSPACING_MOD) +#define Dlg_TEXTHGT (Dlg_CONTROLHGT*Dlg_TEXTHGT_MOD) +#define Dlg_ICONWIDTH (Dlg_CONTROLHGT*4/5) +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0c +#define ST_TYPE 0xF0 +#define ST_SINGLE 0 +#define ST_TITLE_BAR 32 +#define ST_PICTURE 48 +#define ST_FRAME 64 +#define ST_BACKGROUND 80 +#define ST_GROUP_BOX 96 +#define ST_GROUP_BOX2 112 +#define ST_HUD_BACKGROUND 128 +#define ST_TILE_PICTURE 144 +#define ST_WITH_RECT 160 +#define ST_LINE 176 +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 +#define ST_KEEP_ASPECT_RATIO 0x800 +#define ST_TITLE ST_TITLE_BAR + ST_CENTER +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 +#define SL_TEXTURES 0x10 +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 + + + +class gui_RscText { + type = CT_STATIC; + idc = -1; + style = ST_LEFT; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.02; + text = ""; +}; + +class gui_RscBgRahmen { + type = CT_STATIC; + idc = -1; + style = ST_FRAME; + colorBackground[] = {1.0,1.0,1.0,0.75}; + colorText[] = {1,1,1,1}; + font = FontM; + SizeEX = 0.025; + text = ""; +}; + +class gui_RscBackground { + colorBackground[] = {0,0,0,0.75}; + text = ""; + type = CT_STATIC; + idc = -1; + style = ST_LEFT; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.04; +}; + +class gui_RscPicture { + type = CT_STATIC; + idc = -1; + style = ST_PICTURE; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.02; + text = ""; +}; + +class gui_RscPictureKeepAspect: gui_RscPicture { + style = "0x30 + 0x800"; +}; + +class gui_RscBackgroundPicture { + type = CT_STATIC; + idc = -1; + style = ST_PICTURE; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = FontM; + sizeEx = 0.02; + text = "dbg.pac"; +}; + +class gui_RscButton { + type = CT_BUTTON; + idc = -1; + style = ST_CENTER; + colorText[] = {1,1,1,1}; + font = FontHTML; + sizeEx = 0.025; + soundPush[] = {"",0.2,1}; + soundClick[] = {"",0.2,1}; + soundEscape[] = {"",0.2,1}; + default = false; + text = ""; + action = ""; + colorActive[] = {0,0,0,0}; + colorDisabled[] = {0,0,0,0.1}; + colorBackground[] = {0.8,0.8,0.8,0.3}; + colorBackgroundActive[] = {0.7,0.7,0.7,1}; + colorBackgroundDisabled[] = {1,1,1,0.5}; + colorFocused[] = {0.84,1,0.55,1}; + colorShadow[] = {0,0,0,0.1}; + colorBorder[] = {1,1,1,0.1}; + offsetX = 0; + offsetY = 0; + offsetPressedX = 0; + offsetPressedY = 0; + borderSize = 0; + soundEnter[] = {"",0.15,1}; +}; + +class gui_RscMenuButton { + type = CT_SHORTCUT_BUTTON; + style = "0x02 + 0xC0"; + default = 0; + shadow = 0; + x = 0; + y = 0; + w = 0.095589; + h = 0.039216; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,1)"; + animTextureDisabled = "#(argb,8,8,3)color(1,0,0,0.8)"; + animTextureOver = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,1)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,1)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,1)"; + textureNoShortcut = ""; + + colorBackground[] = {1,1,1,0.8}; + colorBackground2[] = {1,1,1,0.5}; + color[] = {1,1,1,1}; + color2[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,0,0,0.8}; + + colorFocused[] = {1,1,1,1}; + colorBackgroundFocused[] = {0,0,0,0}; + + period = 1.2; + periodFocus = 1.2; + periodOver = 1.2; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + + class HitZone + { + left = 0.0; + top = 0.0; + right = 0.0; + bottom = 0.0; + }; + + class TextPos + { + left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)"; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + class Attributes + { + font = "PuristaLight"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class ShortcutPos + { + left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005"; + top = 0.005; + w = 0.0225; + h = 0.03; + }; + soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; +}; + +class gui_RscMenuTitle { + type = CT_STATIC; + idc = -1; + style = ST_CENTER; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + colorText[] = {1,1,1,1}; + font = "PuristaMedium"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + shadow = 1; + colorShadow[] = {0,0,0,0.5}; + linespacing = 1; +}; + + +class gui_RscDummy : gui_RscButton { + x = -1.0; + y = -1.0; + idc = -1; + w = 0.01; + h = 0.01; + default = true; +}; + +class gui_RscEdit { + idc = -1; + type = CT_EDIT; + style = ST_LEFT; + font = FontHTML; + sizeEx = 0.02; + colorText[] = {1,1,1,1}; + colorSelection[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorDisabled[] = {1,0,0,0.3}; + autocomplete = false; + text = ""; +}; + +class gui_RscEditMulti : gui_RscEdit { + style = ST_MULTI; + sizeEx = 0.03; + lineSpacing = 1; + colorDisabled[] = {1,1,1,1}; +}; + +class gui_RscLB_C { + style = ST_LEFT; + idc = -1; + colorSelect[] = {0,0,0,1.0}; + colorSelectBackground[] = {0.7,0.7,0.7,1}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.8,0.8,0.8,0.3}; + colorScrollbar[] = {Dlg_Color_White,1}; + colorDisabled[] = {1,0,0,0.3}; + font = FontHTML; + sizeEx = 0.025; + rowHeight = 0.04; + period = 1.200000; + maxHistoryDelay = 1.000000; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + + class ScrollBar {}; +}; + +class gui_RscListBox { + type = CT_LISTBOX; + style = ST_MULTI; + lineSpacing = 1; + shadow = 0; + + + colorText[] = {1,1,1,1}; + colorBackground[] = {0,0,0,0.15}; + + colorSelect[] = {1,1,1,1}; + colorSelectBackground[] = {1,1,1,0.2}; + + colorSelect2[] = {1,1,1,0.7}; + colorSelectBackground2[] = {1,1,1,0.4}; + + colorScrollbar[] = {Dlg_Color_White,1}; + arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; + arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; + wholeHeight = 0; + color[] = {1,1,1,1}; + colorActive[] = {1,0,0,1}; + colorDisabled[] = {1,0,0,0.3}; + font = "PuristaMedium"; + sizeEx = 0.030; + rowHeight = 0.04; + + + soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1}; + soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1}; + soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1}; + + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + maxHistoryDelay = 1; + + colorShadow[] = {0,0,0,0.5}; + + + period = 1.2; + colorPicture[] = {1,1,1,1}; + colorPictureSelected[] = {1,1,1,1}; + colorPictureDisabled[] = {1,1,1,1}; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + + class ScrollBar { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + + class ListScrollBar: ScrollBar { + color[] = {1,1,1,1}; + autoScrollEnabled = 1; + }; + +}; + + + +class gui_RscListNBox : gui_RscListBox { + type = CT_LISTNBOX; + colorSelect[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0,0,0,0.15}; + colorSelectBackground[] = {0,0,0,0}; + drawSideArrows = 0; + toolTip = ""; + idcLeft = 20010; + idcRight = 20011; +}; + + +class gui_RscCombo { + type = CT_COMBO; + style = ST_MULTI; + lineSpacing = 1; + shadow = 0; + sizeEx = 0.030; + rowHeight = 0.04; + + //colorSelect[] = {0,0,0,1.0}; + colorSelect[] = {1,1,1,1.0}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.8,0.8,0.8,0.3}; +// colorSelectBackground[] = {0.7,0.7,0.7,1}; + colorSelectBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + colorScrollbar[] = {Dlg_Color_White,1}; + arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; + arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; + wholeHeight = 0.45; + color[] = {1,1,1,1}; + colorActive[] = {1,0,0,1}; + colorDisabled[] = {1,0,0,0.3}; + font = "PuristaMedium"; + + + soundEnter[] = {"\A3\ui_f\data\sound\onover",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundClick[] = {"\A3\ui_f\data\sound\onclick",0.07,1}; + soundEscape[] = {"\A3\ui_f\data\sound\onescape",0.09,1}; + soundSelect[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundExpand[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + soundCollapse[] = {"\A3\ui_f\data\sound\new1",0.0,0}; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + maxHistoryDelay = 1; + + class ScrollBar + { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + thumb = "\a3\ui_f\data\gui\cfg\Scrollbar\thumb_ca.paa"; + arrowEmpty = "\a3\ui_f\data\gui\cfg\Scrollbar\arrowempty_ca.paa"; + arrowFull = "\a3\ui_f\data\gui\cfg\Scrollbar\arrowfull_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + + class ComboScrollBar + { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; +}; + +/* +class RscCombo: RscLB_C { + type = CT_COMBO; + wholeHeight = 0.3; + soundSelect[] = {"",0.15,1}; + soundExpand[] = {"",0.15,1}; + soundCollapse[] = {"",0.15,1}; + arrowEmpty = ""; + arrowFull = ""; +}; +*/ + +class gui_RscSliderH { + idc = -1; + access = ReadandWrite; + type = CT_SLIDER; + sizeEx = 0.025; + style = 1024; + + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.2}; + arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; + thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa"; +}; + +class gui_RscSliderV { + access = ReadandWrite; + type = CT_SLIDER; + idc = -1; + sizeEx = 0.025; + style = 0; + color[] = {0.2,0.2,0.2,1}; + colorActive[] = {1,1,1,1}; +}; + +class gui_RscCheckBox { + idc = -1; + type = CT_CHECKBOXES; + style = ST_CENTER; + + colorText[] = {1,1,1,1}; + color[] = {0,1,0,1}; + colorTextSelect[] = {0,0.8,0,1}; + colorSelectedBg[] = {1,1,1,0}; + colorSelect[] = {0,0,0,1}; + colorTextDisable[] = {0.4,0.4,0.4,1}; + colorDisable[] = {0.4,0.4,0.4,1}; + font = "PuristaMedium"; + SizeEX=0.025; + rows = 1; + columns = 1; + strings[] = {""}; +}; \ No newline at end of file diff --git a/addons/gui/macro.h b/addons/gui/macro.h new file mode 100644 index 000000000..992461961 --- /dev/null +++ b/addons/gui/macro.h @@ -0,0 +1,146 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} diff --git a/addons/infiSTAR/infiSTAR_AdminMenu.hpp b/addons/infiSTAR/infiSTAR_AdminMenu.hpp new file mode 100644 index 000000000..2bb690cfb --- /dev/null +++ b/addons/infiSTAR/infiSTAR_AdminMenu.hpp @@ -0,0 +1,744 @@ +/* + File: infiSTAR_AdminMenu.hpp + Author: GRIMandinfiSTAR + Contact: bruno.marcetic@gmail.com or infiSTAR23@gmail.com // www.infiSTAR.de + Antihack & AdminTools - ChristianLorenzen - www.infiSTAR.de-License: (CC) + #1281 +*/ +class RscTextInfi +{ +access=0; +idc=-1; +type=0; +style=0x00; +linespacing=1; +colorBackground[]={0,0,0,0}; +colorText[]={0.84,0.07,0,1}; +shadow=1; +font="PuristaBold"; +sizeex=0.0400; +fixedWidth=0; +}; + +class RscButtonInfi +{ +access=0; +idc=-1; +type=1; +text=""; +action=""; +colorText[]={1,1,1,0.9}; +colorDisabled[]={0.6,0.1,0.3,0}; +colorBackground[]={0,0,0,0.8}; +colorBackgroundDisabled[]={0,0.0,0}; +colorBackgroundActive[]={0.15,0.35,0.55,0.7}; +colorFocused[]={0.58,0.05,0,0.7}; +colorShadow[]={0.023529,0,0.0313725,1}; +colorBorder[]={0.023529,0,0.0313725,1}; +soundEnter[]={"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; +soundPush[]={"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; +soundClick[]={"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; +soundEscape[]={"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; +style=2; +shadow=0; +font="PuristaMedium"; +sizeEx=0.02921; +offsetX=0.003; +offsetY=0.003; +offsetPressedX=0.002; +offsetPressedY=0.002; +borderSize=0; +}; + + +class RscListBoxInfi +{ +access=0; +type=5; +style=0; +font="PuristaLight"; +sizeEx=0.03; +rowHeight=0; +colorText[]={1,1,1,1}; +colorScrollbar[]={1,1,1,1}; +colorSelect[]={0,0,0,1}; +colorSelect2[]={1,0.5,0,1}; +colorSelectBackground[]={0.6,0.6,0.6,1}; +colorSelectBackground2[]={0.2,0.2,0.2,1}; +colorBackground[]={0,0,0,0.6}; +maxHistoryDelay=1.0; +soundSelect[]={"",0.1,1}; +period=1; +autoScrollSpeed=-1; +autoScrollDelay=5; +autoScrollRewind=0; +arrowEmpty="#(argb,8,8,3)color(1,1,1,1)"; +arrowFull="#(argb,8,8,3)color(1,1,1,1)"; +shadow=0; +colorDisabled[]={1,1,1,0.25}; +border=false; +borderSize=0; + +class ScrollBar +{ +arrowEmpty="#(argb,8,8,3)color(1,1,1,1)"; +arrowFull="#(argb,8,8,3)color(1,1,1,1)"; +border="#(argb,8,8,3)color(1,1,1,1)"; +color[]={1,1,1,0.6}; +colorActive[]={1,1,1,1}; +colorDisabled[]={1,1,1,0.3}; +thumb="#(argb,8,8,3)color(1,1,1,1)"; +}; +class ListScrollBar:ScrollBar +{ +color[]={1,1,1,0.6}; +colorActive[]={1,1,1,1}; +colorDisabled[]={1,1,1,0.3}; +thumb="#(argb,8,8,3)color(1,1,1,1)"; +arrowEmpty="#(argb,8,8,3)color(1,1,1,1)"; +arrowFull="#(argb,8,8,3)color(1,1,1,1)"; +border="#(argb,8,8,3)color(1,1,1,1)"; +shadow=0; +}; +}; +class RscEditInfi +{ +access=0; +type=2; +style=0x00+64; +colorBackground[]={0,0,0,0}; +colorText[]={1,1,1,1}; +colorSelection[]={1,1,1,0.25}; +colorDisabled[]={1,1,1,0}; +font="PuristaBold"; +sizeEx=0.04; +autocomplete=""; +text=""; +size=0.2; +shadow=0; +}; +class RscMapControlInfi +{ +access=0; +idc=11; +type=101; +style=0x30; + +colorOutside[]={0,0,0,1}; +colorRailWay[]={0.8,0.2,0,1}; +colorTracks[]={0.84,0.76,0.65,0.15}; +colorRoads[]={0.7,0.7,0.7,1}; +colorMainRoads[]={0.9,0.5,0.3,1}; +colorTracksFill[]={0.84,0.76,0.65,1}; +colorRoadsFill[]={1,1,1,1}; +colorMainRoadsFill[]={1,0.6,0.4,1}; +colorGrid[]={0.1,0.1,0.1,0.6}; +colorGridMap[]={0.1,0.1,0.1,0.6}; +colorBackground[]={1.00,1.00,1.00,1.00}; +colorText[]={0.00,0.00,0.00,1.00}; +colorSea[]={0.56,0.80,0.98,0.50}; +colorForest[]={0.60,0.80,0.20,0.50}; +colorRocks[]={0.50,0.50,0.50,0.50}; +colorCountlines[]={0.65,0.45,0.27,0.50}; +colorMainCountlines[]={0.65,0.45,0.27,1.00}; +colorCountlinesWater[]={0.00,0.53,1.00,0.50}; +colorMainCountlinesWater[]={0.00,0.53,1.00,1.00}; +colorForestBorder[]={0.40,0.80,0.00,1.00}; +colorRocksBorder[]={0.50,0.50,0.50,1.00}; +colorPowerLines[]={0.00,0.00,0.00,1.00}; +colorNames[]={0.00,0.00,0.00,1.00}; +colorInactive[]={1.00,1.00,1.00,0.50}; +colorLevels[]={0.00,0.00,0.00,1.00}; +maxSatelliteAlpha=0.85; +alphaFadeStartScale=0.35; +alphaFadeEndScale=0.4; + + +font="TahomaB"; +sizeEx=0.040000; +moveOnEdges=0; + +fontLabel="TahomaB"; +sizeExLabel=0.02; +fontGrid="TahomaB"; +sizeExGrid=0.02; +fontUnits="TahomaB"; +sizeExUnits=0.02; +fontNames="TahomaB"; +sizeExNames=0.02; +fontInfo="TahomaB"; +sizeExInfo=0.02; +fontLevel="TahomaB"; +sizeExLevel=0.02; + +ptsPerSquareSea=6; +ptsPerSquareTxt=8; +ptsPerSquareCLn=8; +ptsPerSquareExp=8; +ptsPerSquareCost=8; +ptsPerSquareFor="4.0f"; +ptsPerSquareForEdge="10.0f"; +ptsPerSquareRoad=2; +ptsPerSquareObj=10; +scaleMin=0.001; +scaleMax=1; + +text="#(argb,8,8,3)color(1,1,1,1)"; +showCountourInterval=2; +scaleDefault=0.1; +onMouseButtonClick=""; +onMouseButtonDblClick=""; + +class ActiveMarker{ +color[]={0.30,0.10,0.90,1.00}; +size=50; +}; +class Bunker{ +icon="\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=14; +importance="1.5*14*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class Bush{ +icon="\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; +color[]={0.55,0.64,0.43,1.00}; +size=14; +importance="0.2*14*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class BusStop{ +icon="\A3\ui_f\data\map\mapcontrol\busstop_ca.paa"; +color[]={0.00,0.00,1.00,1.00}; +size=10; +importance="1*10*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class Command{ +icon="#(argb,8,8,3)color(1,1,1,1)"; +color[]={0.00,0.00,0.00,1.00}; +size=18; +importance=1.00; +coefMin=1.00; +coefMax=1.00; +}; +class CustomMark +{ +color[]={0,0,0,1}; +icon="\A3\ui_f\data\map\mapcontrol\custommark_ca.paa"; +size=24; +importance=1; +coefMin=1; +coefMax=1; +}; +class Cross{ +icon="\A3\ui_f\data\map\mapcontrol\Cross_CA.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=16; +importance="0.7*16*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class Fortress{ +icon="\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=16; +importance="2*16*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class Fuelstation{ +icon="\A3\ui_f\data\map\mapcontrol\fuelstation_ca.paa"; +color[]={1.00,0.35,0.35,1.00}; +size=16; +importance="2*16*0.05"; +coefMin=0.75; +coefMax=4.00; +}; +class Fountain{ +icon="\A3\ui_f\data\map\mapcontrol\fountain_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=12; +importance="1*12*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class Hospital{ +icon="\A3\ui_f\data\map\mapcontrol\hospital_ca.paa"; +color[]={0.78,0.00,0.05,1.00}; +size=16; +importance="2*16*0.05"; +coefMin=0.50; +coefMax=4; +}; +class Chapel{ +icon="\A3\ui_f\data\map\mapcontrol\chapel_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=16; +importance="1*16*0.05"; +coefMin=0.90; +coefMax=4.00; +}; +class Church{ +icon="\A3\ui_f\data\map\mapcontrol\church_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=16; +importance="2*16*0.05"; +coefMin=0.90; +coefMax=4.00; +}; +class Lighthouse{ +icon="\A3\ui_f\data\map\mapcontrol\lighthouse_ca.paa"; +color[]={0.78,0.00,0.05,1.00}; +size=20; +importance="3*16*0.05"; +coefMin=0.90; +coefMax=4.00; +}; +class Quay{ +icon="\A3\ui_f\data\map\mapcontrol\quay_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=16; +importance="2*16*0.05"; +coefMin=0.50; +coefMax=4.00; +}; +class Rock{ +icon="\A3\ui_f\data\map\mapcontrol\rock_ca.paa"; +color[]={0.35,0.35,0.35,1.00}; +size=12; +importance="0.5*12*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class Ruin{ +icon="\A3\ui_f\data\map\mapcontrol\ruin_ca.paa"; +color[]={0.78,0.00,0.05,1.00}; +size=16; +importance="1.2*16*0.05"; +coefMin=1.00; +coefMax=4.00; +}; +class Stack{ +icon="\A3\ui_f\data\map\mapcontrol\stack_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=20; +importance="2*16*0.05"; +coefMin=0.90; +coefMax=4.00; +}; +class Tree{ +icon="\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; +color[]={0.55,0.64,0.43,1.00}; +size=12; +importance="0.9*16*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class SmallTree{ +icon="\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; +color[]={0.55,0.64,0.43,1.00}; +size=12; +importance="0.6*12*0.05"; +coefMin=0.25; +coefMax=4.00; +}; +class Tourism{ +icon="\A3\ui_f\data\map\mapcontrol\tourism_ca.paa"; +color[]={0.78,0.00,0.05,1.00}; +size=16; +importance="1*16*0.05"; +coefMin=0.70; +coefMax=4.00; +}; +class Transmitter{ +icon="\A3\ui_f\data\map\mapcontrol\transmitter_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=20; +importance="2*16*0.05"; +coefMin=0.90; +coefMax=4.00; +}; +class ViewTower{ +icon="\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=16; +importance="2.5*16*0.05"; +coefMin=0.50; +coefMax=4.00; +}; +class Watertower{ +icon="\A3\ui_f\data\map\mapcontrol\watertower_ca.paa"; +color[]={0.00,0.35,0.70,1.00}; +size=32; +importance="1.2*16*0.05"; +coefMin=0.90; +coefMax=4.00; +}; +class Waypoint{ +icon="\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa"; +color[]={0.00,0.00,0.00,1.00}; +size=24; +importance=1.00; +coefMin=1.00; +coefMax=1.00; +}; +class WaypointCompleted{ +icon="\A3\ui_f\data\map\mapcontrol\waypointCompleted_ca.paa"; +color[]={0.00,0.00,0.00,1.00}; +size=24; +importance=1.00; +coefMin=1.00; +coefMax=1.00; +}; +class Task +{ +colorCreated[]={1,1,1,1}; +colorCanceled[]={0.7,0.7,0.7,1}; +colorDone[]={0.7,1,0.3,1}; +colorFailed[]={1,0.3,0.2,1}; +color[]={"(profilenamespace getVariable['IGUI_TEXT_RGB_R',0])","(profilenamespace getVariable['IGUI_TEXT_RGB_G',1])","(profilenamespace getVariable['IGUI_TEXT_RGB_B',1])","(profilenamespace getVariable['IGUI_TEXT_RGB_A',0.8])"}; +icon="\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa"; +iconCreated="\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa"; +iconCanceled="\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa"; +iconDone="\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa"; +iconFailed="\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa"; +size=27; +importance=1; +coefMin=1; +coefMax=1; +}; +class Power +{ +icon="\A3\ui_f\data\map\mapcontrol\power_CA.paa"; +size=24; +importance=1; +coefMin=0.85; +coefMax=1; +color[]={1,1,1,1}; +}; +class Powersolar +{ +icon="\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa"; +size=24; +importance=1; +coefMin=0.85; +coefMax=1; +color[]={1,1,1,1}; +}; +class Powerwave +{ +icon="\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa"; +size=24; +importance=1; +coefMin=0.85; +coefMax=1; +color[]={1,1,1,1}; +}; +class Powerwind +{ +icon="\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa"; +size=24; +importance=1; +coefMin=0.85; +coefMax=1; +color[]={1,1,1,1}; +}; +class Shipwreck +{ +icon="\A3\ui_f\data\map\mapcontrol\shipwreck_CA.paa"; +size=24; +importance=1; +coefMin=0.85; +coefMax=1; +color[]={1,1,1,1}; +}; +}; + + +class infiSTAR_AdminMenu{ +idd=-1338; +movingenable=false; +enablesimulation=true; +controls[]= +{ +infiSTAR_TXT_1000, +infiSTAR_BTN_10, +infiSTAR_BTN_11, +infiSTAR_LIST_1500, +infiSTAR_LIST_1501, +infiSTAR_BTN_20, +infiSTAR_BTN_21, +infiSTAR_BTN_23, +infiSTAR_BTN_24, +infiSTAR_BTN_25, +infiSTAR_MAP, +infiSTAR_EDIT_100, +infiSTAR_BTN_26, +infiSTAR_BTN_27, +infiSTAR_BTN_28, +infiSTAR_BTN_29, +infiSTAR_BTN_30, +infiSTAR_BTN_31, +infiSTAR_BTN_32, +infiSTAR_BTN_33, +infiSTAR_BTN_34, +infiSTAR_BTN_35, +infiSTAR_BTN_36, +infiSTAR_BTN_37, +infiSTAR_BTN_38 +}; +class infiSTAR_TXT_1000:RscTextInfi +{ +idc=2; + +text="infiSTAR.de"; +x=-4.16885e-005*safezoneW+safezoneX; +y=-5.99921e-005*safezoneH+safezoneY; +w=1*safezoneW; +h=0.0341667*safezoneH; +colorText[]={1,1,1,0.9}; +colorBackground[]={0.56,0.04,0.04,1}; +}; +class infiSTAR_BTN_10:RscButtonInfi +{ +idc=10; + +text="Range"; +x=0.01875*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0625001*safezoneW; +h=0.02*safezoneH; +}; +class infiSTAR_BTN_11:RscButtonInfi +{ +idc=11; + +text="Alphabet"; +x=0.104687*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0625001*safezoneW; +h=0.02*safezoneH; +}; +class infiSTAR_LIST_1500:RscListBoxInfi +{ +idc=1500; + +x=0*safezoneW+safezoneX; +y=0.0616667*safezoneH+safezoneY; +w=0.189063*safezoneW; +h=0.938334*safezoneH; +}; +class infiSTAR_LIST_1501:RscListBoxInfi +{ +idc=1501; + +x=0.189021*safezoneW+safezoneX; +y=0.0616663*safezoneH+safezoneY; +w=0.344271*safezoneW; +h=0.946*safezoneH; +}; +class infiSTAR_BTN_20:RscButtonInfi +{ +idc=20; +default="true"; + +text="MainMenu"; +x=0.202083*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0625001*safezoneW; +h=0.02*safezoneH; +}; +class infiSTAR_BTN_21:RscButtonInfi +{ +idc=21; + +text="SpawnMenu"; +x=0.288021*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0625001*safezoneW; +h=0.02*safezoneH; +}; +class infiSTAR_BTN_23:RscButtonInfi +{ +idc=23; + +text="AHLog"; +x=0.373958*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0625001*safezoneW; +h=0.02*safezoneH; +}; +class infiSTAR_BTN_24:RscButtonInfi +{ +idc=24; + +text="AdminLog"; +x=0.459896*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0625001*safezoneW; +h=0.02*safezoneH; +}; +class infiSTAR_BTN_25:RscButtonInfi +{ +idc=25; + +text="MapOn/Off"; +x=0.763542*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0625001*safezoneW; +h=0.02*safezoneH; +}; +class infiSTAR_MAP:RscMapControlInfi +{ +idc=7; + +x=0.533333*safezoneW+safezoneX; +y=0.0616667*safezoneH+safezoneY; +w=0.467709*safezoneW; +h=0.700666*safezoneH; +}; +class infiSTAR_EDIT_100:RscEditInfi +{ +idc=100; + +text="Search"; +x=0.196354*safezoneW+safezoneX; +y=0.126*safezoneH+safezoneY; +w=0.326563*safezoneW; +h=0.044*safezoneH; +}; +class infiSTAR_BTN_26:RscButtonInfi +{ +idc=26; + +text="Weapon"; +x=0.207813*safezoneW+safezoneX; +y=0.17*safezoneH+safezoneY; +w=0.0458333*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_27:RscButtonInfi +{ +idc=27; + +text="Magazine"; +x=0.259375*safezoneW+safezoneX; +y=0.17*safezoneH+safezoneY; +w=0.0458333*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_28:RscButtonInfi +{ +idc=28; + +text="Backpack"; +x=0.310938*safezoneW+safezoneX; +y=0.17*safezoneH+safezoneY; +w=0.0458333*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_29:RscButtonInfi +{ +idc=29; + +text="Vest"; +x=0.3625*safezoneW+safezoneX; +y=0.17*safezoneH+safezoneY; +w=0.0458333*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_30:RscButtonInfi +{ +idc=30; + +text="Uniform"; +x=0.414063*safezoneW+safezoneX; +y=0.17*safezoneH+safezoneY; +w=0.0458333*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_31:RscButtonInfi +{ +idc=31; + +text="Tools"; +x=0.465625*safezoneW+safezoneX; +y=0.17*safezoneH+safezoneY; +w=0.0458333*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_32:RscButtonInfi +{ +idc=32; + +text="SpawnMAP"; +x=0.545833*safezoneW+safezoneX; +y=0.786*safezoneH+safezoneY; +w=0.06875*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_33:RscButtonInfi +{ +idc=33; + +text="CameraMAP"; +x=0.620313*safezoneW+safezoneX; +y=0.786*safezoneH+safezoneY; +w=0.06875*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_34:RscButtonInfi +{ +idc=34; + +text="TargetMAP"; +x=0.694792*safezoneW+safezoneX; +y=0.786*safezoneH+safezoneY; +w=0.06875*safezoneW; +h=0.022*safezoneH; +}; +class infiSTAR_BTN_35:RscButtonInfi +{ +idc=35; + +text="Map/PiPFocus"; +x=0.665625*safezoneW+safezoneX; +y=0.038*safezoneH+safezoneY; +w=0.0802083*safezoneW; +h=0.0203333*safezoneH; +}; +class infiSTAR_BTN_36:RscButtonInfi +{ +idc=36; + +text="Items"; +x=0.219271*safezoneW+safezoneX; +y=0.082*safezoneH+safezoneY; +w=0.0916667*safezoneW; +h=0.033*safezoneH; +}; +class infiSTAR_BTN_37:RscButtonInfi +{ +idc=37; + +text="Vehicles"; +x=0.316667*safezoneW+safezoneX; +y=0.082*safezoneH+safezoneY; +w=0.0916667*safezoneW; +h=0.033*safezoneH; +}; +class infiSTAR_BTN_38:RscButtonInfi +{ +idc=38; + +text="Misc"; +x=0.414063*safezoneW+safezoneX; +y=0.082*safezoneH+safezoneY; +w=0.0916667*safezoneW; +h=0.033*safezoneH; +}; +}; \ No newline at end of file diff --git a/addons/lsd_nvg/RscTitles.hpp b/addons/lsd_nvg/RscTitles.hpp new file mode 100644 index 000000000..242691783 --- /dev/null +++ b/addons/lsd_nvg/RscTitles.hpp @@ -0,0 +1,54 @@ +// @file Name: RscTitles.hpp +// @file Author: xx-LSD-xx, AgentRev + +class lsd_Rsc_nvHint +{ + idd = -1; + onLoad = "uiNamespace setVariable ['lsd_Rsc_nvHint', _this select 0]"; + movingEnable = 0; + fadeIn = 0; + fadeOut = 0.500000; + duration = 1; + + class Controls + { + class lsd_Rsc_nvHint_Label + { + idc = -1; + type = 0; + style = 2; + x = 0; + y = "(safeZoneH * 0.750) + safeZoneY + 0.005"; + w = 1; + h = 0.033000; + colorBackground[] = {0, 0, 0, 0}; + colorText[] = {1, 1, 1, 1}; + font = "TahomaB"; + sizeEx = 0.024000; + text = "NV Intensity:"; + shadow = 2; + }; + + class lsd_Rsc_nvHint_Text + { + idc = 1; + type = 13; + style = 2; + x = 0; + y = "(safeZoneH * 0.750) + safeZoneY + 0.033"; + w = 1; + h = 0.040000; + colorBackground[] = {0, 0, 0, 0}; + colorText[] = {1, 1, 1, 1}; + font = "PuristaMedium"; + size = 0.039210; + text = ""; + shadow = 2; + lineSpacing = 1; + + class Attributes { + align = "center"; + }; + }; + }; +}; diff --git a/addons/lsd_nvg/init.sqf b/addons/lsd_nvg/init.sqf new file mode 100644 index 000000000..4f716e307 --- /dev/null +++ b/addons/lsd_nvg/init.sqf @@ -0,0 +1,133 @@ +// @file Name: init.sqf +// @file Author: xx-LSD-xx + +#define MAIN_DISPLAY (findDisplay 46) +#define PAGE_UP 201 +#define PAGE_DOWN 209 +#define MIN_SENSITIVITY 1 +#define MAX_SENSITIVITY 20 +#define INCREMENT 1 + +if (!hasInterface) exitWith {}; + +lsd_nvOn = false; +lsd_nvSensitivity = 20; +lsd_nvSensitivityBar = +[ + "Dummy", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "|||||||||||||||||||", + "Auto" +]; + +// wait until in game before adding the keyEH +waitUntil {!isNull MAIN_DISPLAY}; + +MAIN_DISPLAY displayAddEventHandler ["KeyDown", +{ + private ["_ctrlID", "_dikCode", "_shift", "_ctrl", "_alt", "_handled"]; + + _ctrlID = _this select 0; + _dikCode = _this select 1; + _shift = _this select 2; + _ctrl = _this select 3; + _alt = _this select 4; + _handled = false; + + // if there's a dialog or map up, or there is no nv, just quit + // shift is required now + if ( dialog || visibleMap || !lsd_nvOn || !_shift) exitWith { false }; + + switch (_dikCode) do + { + case PAGE_UP: + { + if (lsd_nvSensitivity < MAX_SENSITIVITY) then + { + lsd_nvSensitivity = lsd_nvSensitivity + INCREMENT; + _handled = true; + }; + }; + case PAGE_DOWN: + { + if (lsd_nvSensitivity > MIN_SENSITIVITY) then + { + lsd_nvSensitivity = lsd_nvSensitivity - INCREMENT; + _handled = true; + }; + }; + }; + + if (_handled) then + { + if (lsd_nvSensitivity >= MAX_SENSITIVITY) then // go to auto mode + { + setAperture -1; + } + else // manual mode + { + setAperture (lsd_nvSensitivity / 2); + }; + + playSound "FD_Timer_F"; + + ("lsd_Rsc_nvHint" call BIS_fnc_rscLayer) cutRsc ["LSD_Rsc_nvHint","PLAIN"]; + ((uiNamespace getVariable "LSD_Rsc_nvHint") displayCtrl 1) ctrlSetStructuredText parseText(lsd_nvSensitivityBar select lsd_nvSensitivity); + }; + + _handled +}]; + +0 spawn +{ + waitUntil + { + if !(isNull player) then + { + if (currentVisionMode player == 1) then + { + if (!lsd_nvOn) then + { + if (lsd_nvSensitivity >= MAX_SENSITIVITY) then // go to auto mode + { + setAperture -1; + } + else // manual mode + { + setAperture (lsd_nvSensitivity / 2); + }; + + lsd_nvOn = true; + }; + } + else + { + if (lsd_nvOn) then + { + setAperture -1; + lsd_nvOn = false + }; + }; + }; + + sleep 0.1; + false + }; +}; diff --git a/addons/outlw_magrepack/Configs/MagRepack_Dialog_About.hpp b/addons/outlw_magrepack/Configs/MagRepack_Dialog_About.hpp new file mode 100644 index 000000000..d43222f2c --- /dev/null +++ b/addons/outlw_magrepack/Configs/MagRepack_Dialog_About.hpp @@ -0,0 +1,129 @@ + +class MagRepack_Dialog_About +{ + idd = -1; + onLoad = "uiNamespace setVariable ['outlw_MR_Dialog_About', (_this select 0)]"; + + class Controls + { + class A_BG_Main: outlw_MR_IGUIBack + { + idc = 2200; + x = 10 * GUI_GRID_W + GUI_GRID_X; + y = 10.5 * GUI_GRID_H + GUI_GRID_Y; + w = 20 * GUI_GRID_W; + h = 4 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class A_MainTitle: outlw_MR_RscText + { + idc = 1000; + text = "Mag Repack: About"; + x = 10 * GUI_GRID_W + GUI_GRID_X; + y = 9.375 * GUI_GRID_H + GUI_GRID_Y; + w = 20 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + }; + class A_ButtonCancel: outlw_MR_RscButtonMenu + { + idc = 2400; + text = "Mmkay"; + action = "closeDialog 0"; + x = 22.5 * GUI_GRID_W + GUI_GRID_X; + y = 14.625 * GUI_GRID_H + GUI_GRID_Y; + w = 7.5 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + default = false; + + class Attributes + { + align = "right"; + }; + }; + class A_BG_MiddleBottom: outlw_MR_IGUIBack + { + idc = 2405; + x = 17.625 * GUI_GRID_W + GUI_GRID_X; + y = 14.625 * GUI_GRID_H + GUI_GRID_Y; + w = 4.7225 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class A_BG_LeftBottom: outlw_MR_IGUIBack + { + idc = 2401; + x = 10 * GUI_GRID_W + GUI_GRID_X; + y = 14.625 * GUI_GRID_H + GUI_GRID_Y; + w = 7.5 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorBackground[] = {0,0,0,0.75}; + }; + class A_Author: outlw_MR_RscText + { + idc = 1002; + text = "Author: Outlawled"; + x = 10.5 * GUI_GRID_W + GUI_GRID_X; + y = 10.75 * GUI_GRID_H + GUI_GRID_Y; + w = 19 * GUI_GRID_W; + h = 0.8 * GUI_GRID_H; + + sizeEx = 0.8 * GUI_GRID_H; + }; + class A_Version: outlw_MR_RscText + { + idc = 1001; + text = "Version:"; + x = 10.5 * GUI_GRID_W + GUI_GRID_X; + y = 11.55 * GUI_GRID_H + GUI_GRID_Y; + w = 19 * GUI_GRID_W; + h = 0.8 * GUI_GRID_H; + + sizeEx = 0.8 * GUI_GRID_H; + }; + class A_Date: outlw_MR_RscText + { + idc = 1003; + text = "Updated:"; + x = 10.5 * GUI_GRID_W + GUI_GRID_X; + y = 12.35 * GUI_GRID_H + GUI_GRID_Y; + w = 19 * GUI_GRID_W; + h = 0.8 * GUI_GRID_H; + + sizeEx = 0.8 * GUI_GRID_H; + }; + class A_ForumLink: outlw_MR_RscText + { + idc = 1004; + text = "BI Forum URL:"; + x = 10.5 * GUI_GRID_W + GUI_GRID_X; + y = 13.15 * GUI_GRID_H + GUI_GRID_Y; + w = 10 * GUI_GRID_W; + h = 0.8 * GUI_GRID_H; + sizeEx = 0.8 * GUI_GRID_H; + }; + class A_ButtonCopy: outlw_MR_RscButtonMenu + { + idc = 1005; + text = "Copy"; + action = "copyToClipboard 'http://forums.bistudio.com/showthread.php?151402-Mag-Repack';"; + x = 16.25 * GUI_GRID_W + GUI_GRID_X; + y = 13.25 * GUI_GRID_H + GUI_GRID_Y; + w = 4 * GUI_GRID_W; + h = 0.8 * GUI_GRID_H; + + tooltip = "http://forums.bistudio.com/showthread.php?151402-Mag-Repack"; + + default = true; + + class Attributes + { + align = "center"; + size = "0.75"; + valign = "middle"; + }; + }; + }; +}; diff --git a/addons/outlw_magrepack/Configs/MagRepack_Dialog_Keybindings.hpp b/addons/outlw_magrepack/Configs/MagRepack_Dialog_Keybindings.hpp new file mode 100644 index 000000000..88de39420 --- /dev/null +++ b/addons/outlw_magrepack/Configs/MagRepack_Dialog_Keybindings.hpp @@ -0,0 +1,289 @@ + +class MagRepack_Dialog_Keybindings +{ + idd = -1; + onLoad = "uiNamespace setVariable ['outlw_MR_Dialog_Keybindings', (_this select 0)]"; + onUnload = "outlw_MR_keybindingMenuActive = false;"; + onKeyDown = "_this call outlw_KB_keyDown;"; + onKeyUp = "_this call outlw_KB_keyUp;"; + + class Controls + { + class KB_BG_Main: outlw_MR_IGUIBack + { + idc = 2200; + + x = 10 * GUI_GRID_W + GUI_GRID_X; + y = 10.5 * GUI_GRID_H + GUI_GRID_Y; + w = 20 * GUI_GRID_W; + h = 4 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class KB_MainTitle: outlw_MR_RscText + { + idc = 1000; + text = "Mag Repack: Keybindings"; + + x = 10 * GUI_GRID_W + GUI_GRID_X; + y = 9.375 * GUI_GRID_H + GUI_GRID_Y; + w = 20 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; + }; + class KB_ButtonCancel: outlw_MR_RscButtonMenu + { + idc = 2400; + text = "Cancel"; + action = "closeDialog 0"; + + x = 22.5 * GUI_GRID_W + GUI_GRID_X; + y = 14.625 * GUI_GRID_H + GUI_GRID_Y; + w = 7.5 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + default = false; + + class Attributes + { + align = "right"; + }; + }; + class KB_BG_MiddleBottom: outlw_MR_IGUIBack + { + idc = 2405; + + x = 17.625 * GUI_GRID_W + GUI_GRID_X; + y = 14.625 * GUI_GRID_H + GUI_GRID_Y; + w = 4.7225 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class KB_ButtonApply: outlw_MR_RscButtonMenu + { + idc = 2401; + text = "Apply"; + action = "[[outlw_KB_cShift, outlw_KB_cCtrl, outlw_KB_cAlt, outlw_KB_cKey]] call outlw_MR_applyKeybinding;"; + + x = 10 * GUI_GRID_W + GUI_GRID_X; + y = 14.625 * GUI_GRID_H + GUI_GRID_Y; + w = 7.5 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + default = false; + }; + class KB_BG_Keybinding: outlw_MR_IGUIBack + { + idc = 2498; + + x = 20.125 * GUI_GRID_W + GUI_GRID_X; + y = 11.375 * GUI_GRID_H + GUI_GRID_Y; + w = 9 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorBackground[] = {1,1,1,0.25}; + }; + class KB_Keybinding: outlw_MR_RscStructuredText + { + idc = 2499; + text = ""; + + x = 20.125 * GUI_GRID_W + GUI_GRID_X; + y = 11.375 * GUI_GRID_H + GUI_GRID_Y; + w = 9 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorBackground[] = {0,0,0,0}; + + class Attributes + { + align = "center"; + valign = "middle"; + size = 0.8; + }; + }; + class KB_BG_Shift: outlw_MR_IGUIBack + { + idc = 2500; + + x = 20.125 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 2.875 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorBackground[] = {0,0,0,0.8}; + }; + class KB_BG_Ctrl: outlw_MR_IGUIBack + { + idc = 2501; + + x = 23.1875 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 2.75 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorBackground[] = {0,0,0,0.8}; + }; + class KB_BG_Alt: outlw_MR_IGUIBack + { + idc = 2502; + + x = 26.1875 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 2.875 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorBackground[] = {0,0,0,0.8}; + }; + class KB_ButtonShift: outlw_MR_RscButtonMenu + { + idc = 2550; + text = "Shift"; + + action = "[0] call outlw_KB_modifierSwitch;"; + + x = 20.125 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 2.875 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorFocused[] = {1,1,1,0.5}; + colorBackgroundFocused[] = {0,0,0,0}; + colorBackground[] = {0,0,0,0}; + colorBackground2[] = {1,1,1,0.5}; + + textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureNormal = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0)"; + + class Attributes + { + align = "center"; + size = "0.875"; + }; + }; + class KB_ButtonCtrl: outlw_MR_RscButtonMenu + { + idc = 2551; + text = "Ctrl"; + + action = "[1] call outlw_KB_modifierSwitch;"; + + x = 23.1875 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 2.75 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorFocused[] = {1,1,1,0.5}; + colorBackgroundFocused[] = {0,0,0,0}; + colorBackground[] = {0,0,0,0}; + colorBackground2[] = {1,1,1,0.5}; + + textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureNormal = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0)"; + + class Attributes + { + align = "center"; + size = "0.875"; + }; + }; + class KB_ButtonAlt: outlw_MR_RscButtonMenu + { + idc = 2552; + text = "Alt"; + + action = "[2] call outlw_KB_modifierSwitch;"; + + x = 26.1875 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 2.875 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + colorFocused[] = {1,1,1,0.5}; + colorBackgroundFocused[] = {0,0,0,0}; + colorBackground[] = {0,0,0,0}; + colorBackground2[] = {1,1,1,0.5}; + + textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureNormal = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0)"; + + class Attributes + { + align = "center"; + size = "0.875"; + }; + }; + class KB_BG_KeyDescription: outlw_MR_RscPicture + { + idc = 2570; + text = "addons\outlw_magrepack\Images\MR_TargetGradient.paa"; + + x = 10.875 * GUI_GRID_W + GUI_GRID_X; + y = 11.375 * GUI_GRID_H + GUI_GRID_Y; + w = 9 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + }; + class KB_BG_ModDescription: outlw_MR_RscPicture + { + idc = 2571; + text = "addons\outlw_magrepack\Images\MR_TargetGradient.paa"; + + x = 10.875 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 9 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + }; + class KB_KeyDescription: outlw_MR_RscStructuredText + { + idc = 2572; + text = "Keybinding:"; + + x = 10.875 * GUI_GRID_W + GUI_GRID_X; + y = 11.375 * GUI_GRID_H + GUI_GRID_Y; + w = 9 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + class Attributes + { + align = "right"; + }; + }; + class KB_ModDescription: outlw_MR_RscStructuredText + { + idc = 2573; + text = "Modifiers:"; + + x = 10.875 * GUI_GRID_W + GUI_GRID_X; + y = 12.625 * GUI_GRID_H + GUI_GRID_Y; + w = 9 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + class Attributes + { + align = "right"; + }; + }; + }; +}; + + + + + + + + diff --git a/addons/outlw_magrepack/Configs/MagRepack_Dialog_Main.hpp b/addons/outlw_magrepack/Configs/MagRepack_Dialog_Main.hpp new file mode 100644 index 000000000..3181d6afb --- /dev/null +++ b/addons/outlw_magrepack/Configs/MagRepack_Dialog_Main.hpp @@ -0,0 +1,689 @@ + +class MagRepack_Dialog_Main +{ + idd = -1; + movingenable = false; + onLoad = "uiNamespace setVariable ['outlw_MR_Dialog_Main', (_this select 0)]"; + onUnload = "call outlw_MR_onDialogDestroy;"; + onMouseButtonUp = "call outlw_MR_onMouseButtonUp;"; + + class Controls + { + class MR_BG_ListBox: outlw_MR_IGUIBack + { + idc = 2200; + + x = 4.25 * GUI_GRID_W + GUI_GRID_X; + y = 2.5 * GUI_GRID_H + GUI_GRID_Y; + w = 14 * GUI_GRID_W; + h = 15.75 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class MR_BG_Main: outlw_MR_IGUIBack + { + idc = 2201; + + x = 18.5 * GUI_GRID_W + GUI_GRID_X; + y = 2 * GUI_GRID_H + GUI_GRID_Y; + w = 18 * GUI_GRID_W; + h = 14.5 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class MR_BG_LeftBorder: outlw_MR_IGUIBack + { + idc = 2955; + + x = 3.7 * GUI_GRID_W + GUI_GRID_X; + y = 2.75 * GUI_GRID_H + GUI_GRID_Y; + w = 0.25 * GUI_GRID_W; + h = 15.25 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class MR_BG_BottomBorder: outlw_MR_IGUIBack + { + idc = 2956; + + x = 8.5 * GUI_GRID_W + GUI_GRID_X; + y = 18.5 * GUI_GRID_H + GUI_GRID_Y; + w = 8.5 * GUI_GRID_W; + h = 0.25 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + /* + class MR_BG_Logo: outlw_MR_IGUIBack + { + idc = 2956; + + x = 4.25 * GUI_GRID_W + GUI_GRID_X; + y = 18.5 * GUI_GRID_H + GUI_GRID_Y; + w = 6.0404 * GUI_GRID_W; + h = 1.1633 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class MR_Logo: outlw_MR_RscPicture + { + idc = 1200; + + text = "addons\outlw_magrepack\Images\MR_logo.paa"; + x = 4.5 * GUI_GRID_W + GUI_GRID_X; + y = 17 * GUI_GRID_H + GUI_GRID_Y; + w = 5.5 * GUI_GRID_W; + h = 4.5 * GUI_GRID_H; + }; + */ + class MR_MainTitle: outlw_MR_RscStructuredText + { + idc = 1001; + + text = "Mag Repack"; + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 0.75 * GUI_GRID_H + GUI_GRID_Y; + w = 12.5 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {0,0,0,1}; + }; + class MR_MagListTitle: outlw_MR_RscStructuredText + { + idc = 1000; + + text = "All Magazines"; + x = 7.75 * GUI_GRID_W + GUI_GRID_X; + y = 1.25 * GUI_GRID_H + GUI_GRID_Y; + w = 10 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {0,0,0,1}; + + class Attributes + { + align = "right"; + }; + }; + class MR_SourceBox: outlw_MR_IGUIBack + { + idc = 2208; + + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 3.5 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 4 * GUI_GRID_H; + colorBackground[] = {1,1,1,0.1}; + }; + class MR_FG_Source: outlw_MR_RscPicture + { + idc = 2210; + text = "addons\outlw_magrepack\Images\MR_SourceGradient.paa"; + + x = 19.5 * GUI_GRID_W + GUI_GRID_X; + y = 4 * GUI_GRID_H + GUI_GRID_Y; + w = 16 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + }; + class MR_TargetBox: outlw_MR_IGUIBack + { + idc = 2214; + + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 8 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 4 * GUI_GRID_H; + colorBackground[] = {1,1,1,0.1}; + }; + class MR_FG_Target: outlw_MR_RscPicture + { + idc = 2211; + text = "addons\outlw_magrepack\Images\MR_TargetGradient.paa"; + + x = 19.5 * GUI_GRID_W + GUI_GRID_X; + y = 8.5 * GUI_GRID_H + GUI_GRID_Y; + w = 16 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + }; + class MR_BG_SourceText: outlw_MR_RscText + { + idc = 1005; + style = 1; + + text = ""; + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 3 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 0.5 * GUI_GRID_H; + colorBackground[] = {0,0,0,1}; + sizeEx = 0.8 * GUI_GRID_H; + }; + class MR_SourceText: outlw_MR_RscText + { + idc = 1002; + style = 0; + + text = " Source"; + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 2.8125 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 0.75 * GUI_GRID_H; + colorBackground[] = {0,0,0,0}; + sizeEx = 0.75 * GUI_GRID_H; + }; + class MR_BG_TargetText: outlw_MR_RscText + { + idc = 1003; + style = 1; + + text = ""; + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 12 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 0.5 * GUI_GRID_H; + colorBackground[] = {0,0,0,1}; + sizeEx = 0.8 * GUI_GRID_H; + }; + class MR_TargetText: outlw_MR_RscText + { + idc = 1004; + style = 1; + + text = "Target "; + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 11.8125 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 0.75 * GUI_GRID_H; + colorBackground[] = {0,0,0,0}; + sizeEx = 0.75 * GUI_GRID_H; + }; + class MR_SourcePic: outlw_MR_RscPicture + { + idc = 1201; + + text = ""; + x = 20 * GUI_GRID_W + GUI_GRID_X; + y = 4 * GUI_GRID_H + GUI_GRID_Y; + w = 3.5 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + }; + class MR_SourceInfo: outlw_MR_RscStructuredText + { + idc = 1100; + + x = 23 * GUI_GRID_W + GUI_GRID_X; + y = 4.25 * GUI_GRID_H + GUI_GRID_Y; + w = 12.5 * GUI_GRID_W; + h = 2.5 * GUI_GRID_H; + sizeEx = 0.65 * GUI_GRID_H; + }; + class MR_TargetPic: outlw_MR_RscPicture + { + idc = 1203; + + text = ""; + x = 31.5 * GUI_GRID_W + GUI_GRID_X; + y = 8.5 * GUI_GRID_H + GUI_GRID_Y; + w = 3.5 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + }; + class MR_TargetInfo: outlw_MR_RscStructuredText + { + idc = 1101; + + x = 19.5 * GUI_GRID_W + GUI_GRID_X; + y = 8.75 * GUI_GRID_H + GUI_GRID_Y; + w = 12.5 * GUI_GRID_W; + h = 2.5 * GUI_GRID_H; + sizeEx = 0.65 * GUI_GRID_H; + }; + class MR_SourceListBox: outlw_MR_RscListBox + { + idc = 1501; + canDrag = 1; + rowHeight = 3 * GUI_GRID_H; + onLBDrag = "[(((_this select 1) select 0) select 1), (((_this select 1) select 0) select 2), 'source'] call outlw_MR_onDrag;"; + onMouseButtonClick = "if ((_this select 1) == 1) then {call outlw_MR_clearSource;};"; + + x = 19.5 * GUI_GRID_W + GUI_GRID_X; + y = 4 * GUI_GRID_H + GUI_GRID_Y; + w = 16 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + sizeEx = 0.65 * GUI_GRID_H; + + colorText[] = {0,0,0,0}; + colorDisabled[] = {0,0,0,0}; + colorScrollbar[] = {0,0,0,0}; + colorSelect[] = {0,0,0,0}; + colorSelect2[] = {0,0,0,0}; + colorSelectBackground[] = {0,0,0,0}; + colorSelectBackground2[] = {0,0,0,0}; + colorBackground[] = {0,0,0,0}; + }; + class MR_TargetListBox: outlw_MR_RscListBox + { + idc = 1502; + canDrag = 1; + rowHeight = 3 * GUI_GRID_H; + onLBDrag = "[(((_this select 1) select 0) select 1), (((_this select 1) select 0) select 2), 'target'] call outlw_MR_onDrag;"; + onMouseButtonClick = "if ((_this select 1) == 1) then {call outlw_MR_clearTarget;};"; + + x = 19.5 * GUI_GRID_W + GUI_GRID_X; + y = 8.5 * GUI_GRID_H + GUI_GRID_Y; + w = 16 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + sizeEx = 0.65 * GUI_GRID_H; + + colorText[] = {0,0,0,0}; + colorDisabled[] = {0,0,0,0}; + colorScrollbar[] = {0,0,0,0}; + colorSelect[] = {0,0,0,0}; + colorSelect2[] = {0,0,0,0}; + colorSelectBackground[] = {0,0,0,0}; + colorSelectBackground2[] = {0,0,0,0}; + colorBackground[] = {0,0,0,0}; + }; + class MR_SourceArea: outlw_MR_IGUIBack + { + idc = 2215; + onLBDrop = "((_this select 4) select 0) call outlw_MR_addSource; true;"; + + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 3.5 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 4 * GUI_GRID_H; + colorBackground[] = {0,0,0,0}; + tooltipColorBox[] = {0,0,0,0}; + }; + class MR_TargetArea: outlw_MR_IGUIBack + { + idc = 2216; + onLBDrop = "((_this select 4) select 0) call outlw_MR_addTarget; true;"; + + x = 19 * GUI_GRID_W + GUI_GRID_X; + y = 8 * GUI_GRID_H + GUI_GRID_Y; + w = 17 * GUI_GRID_W; + h = 4 * GUI_GRID_H; + colorBackground[] = {0,0,0,0}; + tooltipColorBox[] = {0,0,0,0}; + }; + class MR_SourceConvertButton: outlw_MR_RscButtonMenu + { + idc = 1600; + text = ""; + action = "['Source'] call outlw_MR_convert;"; + + x = 33 * GUI_GRID_W + GUI_GRID_X; + y = 3.5 * GUI_GRID_H + GUI_GRID_Y; + w = 3 * GUI_GRID_W; + h = 0.5 * GUI_GRID_H; + + size = 0.5 * GUI_GRID_H; + + class Attributes + { + font = "PuristaMedium"; + align = "center"; + }; + + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0)"; + }; + class MR_TargetConvertButton: outlw_MR_RscButtonMenu + { + idc = 1601; + text = ""; + action = "['target'] call outlw_MR_convert;"; + + x = 33 * GUI_GRID_W + GUI_GRID_X; + y = 8 * GUI_GRID_H + GUI_GRID_Y; + w = 3 * GUI_GRID_W; + h = 0.5 * GUI_GRID_H; + + size = 0.5 * GUI_GRID_H; + + class Attributes + { + font = "PuristaMedium"; + align = "center"; + }; + + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0)"; + animTexturePressed = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0)"; + }; + class MR_BG_ComboBox: outlw_MR_IGUIBack + { + idc = 15000; + + x = 4.75 * GUI_GRID_W + GUI_GRID_X; + y = 3.8 * GUI_GRID_H + GUI_GRID_Y; + w = 13.5 * GUI_GRID_W; + h = 13.95 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.35}; + }; + class MR_MagListBox: outlw_MR_RscListBox + { + idc = 1500; + type = 102; + canDrag = 1; + columns[] = {0.12,-0.01,0.006,0.83}; + rowHeight = 1.45 * GUI_GRID_H; + drawSideArrows = 0; + idcLeft = -1; + idcRight = -1; + onLBDrag = "[(((_this select 1) select 0) select 1), (((_this select 1) select 0) select 2), 'list'] call outlw_MR_onDrag;"; + + x = 4.75 * GUI_GRID_W + GUI_GRID_X; + y = 4 * GUI_GRID_H + GUI_GRID_Y; + w = 13 * GUI_GRID_W; + h = 13.6 * GUI_GRID_H; + sizeEx = 0.7 * GUI_GRID_H; + }; + class MR_MagListBoxArea: outlw_MR_IGUIBack + { + idc = 2217; + onLBDrop = "call outlw_MR_moveToList; true;"; + + x = 4.75 * GUI_GRID_W + GUI_GRID_X; + y = 3.8 * GUI_GRID_H + GUI_GRID_Y; + w = 13.5 * GUI_GRID_W; + h = 13.95 * GUI_GRID_H; + colorBackground[] = {0,0,0,0}; + }; + class MR_MagListCombo: outlw_MR_RscCombo + { + idc = 22170; + onLBSelChanged = "outlw_MR_currentFilter = (_this select 0) lbData ((_this select 1) - 1); call outlw_MR_populateMagListBox;"; + + x = 4.75 * GUI_GRID_W + GUI_GRID_X; + y = 3 * GUI_GRID_H + GUI_GRID_Y; + w = 13.5 * GUI_GRID_W; + h = 0.8 * GUI_GRID_H; + + sizeEx = 0.75 * GUI_GRID_H; + }; + class MR_PB_SourceAmmo: outlw_MR_RscControlsGroup + { + idc = 2218; + x = 19.5 * GUI_GRID_W + GUI_GRID_X; + y = 4 * GUI_GRID_H + GUI_GRID_Y; + w = 0.5 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + + class Controls + { + class MR_SourceAmmo: outlw_MR_IGUIBack + { + idc = 22180; + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 3 * GUI_GRID_H + GUI_GRID_Y; + w = 0.5 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + colorBackground[] = {1,1,1,1}; + }; + }; + }; + class MR_PB_TargetAmmo: outlw_MR_RscControlsGroup + { + idc = 2219; + x = 35 * GUI_GRID_W + GUI_GRID_X; + y = 8.5 * GUI_GRID_H + GUI_GRID_Y; + w = 0.5 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + + class Controls + { + class MR_TargetAmmo: outlw_MR_IGUIBack + { + idc = 22190; + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 3 * GUI_GRID_H + GUI_GRID_Y; + w = 0.5 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + colorBackground[] = {1,1,1,1}; + }; + }; + }; + class MR_BG_RepackProgress: outlw_MR_IGUIBack + { + idc = 10005; + + x = 20.875 * GUI_GRID_W + GUI_GRID_X; + y = 13.875 * GUI_GRID_H + GUI_GRID_Y; + w = 13.3125 * GUI_GRID_W; + h = 1.25 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.9}; + }; + class MR_PB_Repack: outlw_MR_RscControlsGroup + { + idc = 10000; + + x = 21 * GUI_GRID_W + GUI_GRID_X; + y = 14 * GUI_GRID_H + GUI_GRID_Y; + w = 13 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + + class Controls + { + class MR_BG_RepackProgress: outlw_MR_IGUIBack + { + idc = 10001; + + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 0 * GUI_GRID_H + GUI_GRID_Y; + w = 13 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {1,1,1,0.2}; + }; + class MR_RepackProgress: outlw_MR_IGUIBack + { + idc = 10002; + + x = -13 * GUI_GRID_W + GUI_GRID_X; + y = 0 * GUI_GRID_H + GUI_GRID_Y; + w = 13 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + colorBackground[] = {1,1,1,0.275}; + }; + }; + }; + class MR_RepackingText: outlw_MR_RscText + { + idc = 1008; + text = ""; + x = 25 * GUI_GRID_W + GUI_GRID_X; + y = 14 * GUI_GRID_H + GUI_GRID_Y; + w = 5 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + }; + class MR_ButtonClose: outlw_MR_RscActiveText + { + idc = 2499; + style = 48; + text = "\A3\Ui_f\data\GUI\Rsc\RscDisplayArcadeMap\icon_exit_cross_ca.paa"; + tooltip = "Close"; + action = "closeDialog 0;"; + + x = 35.625 * GUI_GRID_W + GUI_GRID_X; + y = 2.125 * GUI_GRID_H + GUI_GRID_Y; + w = 0.76 * GUI_GRID_W; + h = 0.75 * GUI_GRID_H; + + default = false; + }; + class MR_ButtonOptions: outlw_MR_RscButtonMenu + { + idc = 2400; + + text = "Options"; + action = "call outlw_MR_optionsMenu;"; + x = 18.5 * GUI_GRID_W + GUI_GRID_X; + y = 16.75 * GUI_GRID_H + GUI_GRID_Y; + w = 6.5 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + }; + class MR_Options_Border_Top: outlw_MR_IGUIBack + { + idc = 8997; + + x = 36.75 * GUI_GRID_W + GUI_GRID_X; + y = 5.75 * GUI_GRID_H + GUI_GRID_Y; + w = 0.25 * GUI_GRID_W; + h = 3 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class MR_Options_Border_Bottom: outlw_MR_IGUIBack + { + idc = 8998; + + x = 36.75 * GUI_GRID_W + GUI_GRID_X; + y = 13.25 * GUI_GRID_H + GUI_GRID_Y; + w = 0.25 * GUI_GRID_W; + h = 1.5 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class MR_Options_Border: outlw_MR_IGUIBack + { + idc = 8999; + + x = 36.75 * GUI_GRID_W + GUI_GRID_X; + y = 8.75 * GUI_GRID_H + GUI_GRID_Y; + w = 0.25 * GUI_GRID_W; + h = 4.5 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.75}; + }; + class MR_Options_Group: outlw_MR_RscControlsGroup + { + idc = 9000; + + x = 36.5 * GUI_GRID_W + GUI_GRID_X; + y = 7.375 * GUI_GRID_H + GUI_GRID_Y; + w = 0 * GUI_GRID_W; + h = 6.125 * GUI_GRID_H; + + class Controls + { + class MR_BG_Options: outlw_MR_IGUIBack + { + idc = 9007; + + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 1.125 * GUI_GRID_H + GUI_GRID_Y; + w = 8 * GUI_GRID_W; + h = 3.875 * GUI_GRID_H; + colorBackground[] = {0,0,0,0.675}; + }; + class MR_OptionsTitle: outlw_MR_RscStructuredText + { + idc = 9001; + + text = "OPTIONS"; + x = 1.75 * GUI_GRID_W + GUI_GRID_X; + y = 0 * GUI_GRID_H + GUI_GRID_Y; + w = 6 * GUI_GRID_W; + h = 0.875 * GUI_GRID_H; + colorBackground[] = {0,0,0,1}; + + class Attributes + { + align = "right"; + size = "0.875"; + }; + }; + class MR_ButtonOption_Debug: outlw_MR_RscButtonMenu + { + idc = 9002; + text = "Debug Mode"; + action = "call outlw_MR_debugSwitch;"; + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 1.125 * GUI_GRID_H + GUI_GRID_Y; + w = 8 * GUI_GRID_W; + h = 0.875 * GUI_GRID_H; + + class Attributes + { + size = "0.875"; + }; + + default = false; + }; + class MR_ButtonOption_ShowFull: outlw_MR_RscButtonMenu + { + idc = 9004; + text = "Show Full"; + action = "call outlw_MR_showFullSwitch;"; + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 2.125 * GUI_GRID_H + GUI_GRID_Y; + w = 8 * GUI_GRID_W; + h = 0.875 * GUI_GRID_H; + + class Attributes + { + size = "0.875"; + }; + + default = false; + }; + class MR_ButtonOption_Keybindings: outlw_MR_RscButtonMenu + { + idc = 9003; + text = "Keybindings"; + action = "call outlw_MR_openKeybindings"; + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 3.125 * GUI_GRID_H + GUI_GRID_Y; + w = 8 * GUI_GRID_W; + h = 0.875 * GUI_GRID_H; + + class Attributes + { + size = "0.875"; + }; + + default = false; + }; + class MR_ButtonOption_About: outlw_MR_RscButtonMenu + { + idc = 9005; + text = "About"; + action = "call outlw_MR_openAbout"; + x = 0 * GUI_GRID_W + GUI_GRID_X; + y = 4.125 * GUI_GRID_H + GUI_GRID_Y; + w = 8 * GUI_GRID_W; + h = 0.875 * GUI_GRID_H; + + class Attributes + { + size = "0.875"; + }; + + default = false; + }; + class MR_ButtonOption_Hide: outlw_MR_RscButtonMenu + { + idc = 9006; + text = "Hide"; + action = "call outlw_MR_optionsMenu;"; + x = 4.5 * GUI_GRID_W + GUI_GRID_X; + y = 5.25 * GUI_GRID_H + GUI_GRID_Y; + w = 3.5 * GUI_GRID_W; + h = 0.875 * GUI_GRID_H; + + class Attributes + { + align = "right"; + size = "0.875"; + }; + + default = false; + }; + }; + }; + }; +}; + + + + + + + + diff --git a/addons/outlw_magrepack/Configs/defines.hpp b/addons/outlw_magrepack/Configs/defines.hpp new file mode 100644 index 000000000..cd59ee929 --- /dev/null +++ b/addons/outlw_magrepack/Configs/defines.hpp @@ -0,0 +1,421 @@ + +#define GUI_GRID_X (0) +#define GUI_GRID_Y (0) +#define GUI_GRID_W (0.025) +#define GUI_GRID_H (0.04) +#define GUI_GRID_WAbs (1) +#define GUI_GRID_HAbs (1) + +// Control types +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 +#define CT_STRUCTURED_TEXT 13 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_SHORTCUTBUTTON 16 +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 +#define CT_ANIMATED_TEXTURE 45 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT_CONTAINER 82 +#define CT_OBJECT_CONT_ANIM 83 +#define CT_LINEBREAK 98 +#define CT_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define CT_LISTNBOX 102 + +// Static styles +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0C + +#define ST_TYPE 0xF0 +#define ST_SINGLE 0x00 +#define ST_MULTI 0x10 +#define ST_TITLE_BAR 0x20 +#define ST_PICTURE 0x30 +#define ST_FRAME 0x40 +#define ST_BACKGROUND 0x50 +#define ST_GROUP_BOX 0x60 +#define ST_GROUP_BOX2 0x70 +#define ST_HUD_BACKGROUND 0x80 +#define ST_TILE_PICTURE 0x90 +#define ST_WITH_RECT 0xA0 +#define ST_LINE 0xB0 + +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 +#define ST_KEEP_ASPECT_RATIO 0x800 + +#define ST_TITLE ST_TITLE_BAR + ST_CENTER + +// Slider styles +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 + +#define SL_TEXTURES 0x10 + +// progress bar +#define ST_VERTICAL 0x01 +#define ST_HORIZONTAL 0 + +// Listbox styles +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 + +// Tree styles +#define TR_SHOWROOT 1 +#define TR_AUTOCOLLAPSE 2 + +// MessageBox styles +#define MB_BUTTON_OK 1 +#define MB_BUTTON_CANCEL 2 +#define MB_BUTTON_USER 4 + +class outlw_MR_RscText +{ + access = 0; + type = 0; + idc = -1; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + text = ""; + fixedWidth = 0; + x = 0; + y = 0; + h = 0.037; + w = 0.3; + style = 0; + shadow = 1; + colorShadow[] = {0,0,0,0.5}; + font = "PuristaMedium"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + linespacing = 1; +}; +class outlw_MR_RscStructuredText +{ + access = 0; + type = 13; + idc = -1; + style = 0; + colorText[] = {1,1,1,1}; + class Attributes + { + font = "PuristaMedium"; + color = "#ffffff"; + align = "left"; + shadow = 1; + }; + x = 0; + y = 0; + h = 0.035; + w = 0.1; + text = ""; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + shadow = 1; +}; +class outlw_MR_RscPicture +{ + access = 0; + type = 0; + idc = -1; + style = 48; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = "TahomaB"; + sizeEx = 0; + lineSpacing = 0; + text = ""; + fixedWidth = 0; + shadow = 0; + x = 0; + y = 0; + w = 0.2; + h = 0.15; +}; +class outlw_MR_RscListBox +{ + access = 0; + type = 5; + w = 0.4; + h = 0.4; + rowHeight = 0; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.25}; + colorScrollbar[] = {1,0,0,0}; + colorSelect[] = {0,0,0,1}; + colorSelect2[] = {0,0,0,1}; + colorSelectBackground[] = {0.95,0.95,0.95,1}; + colorSelectBackground2[] = {1,1,1,0.5}; + colorBackground[] = {0,0,0,0}; + soundSelect[] = + { + "\A3\ui_f\data\sound\RscListbox\soundSelect", + 0.09, + 1 + }; + arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; + arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; + class ListScrollBar + { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + style = 16; + font = "PuristaMedium"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + shadow = 0; + colorShadow[] = {0,0,0,0.5}; + color[] = {1,1,1,1}; + period = 1.2; + maxHistoryDelay = 1; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; +}; +class outlw_MR_RscActiveText +{ + access = 0; + type = 11; + color[] = {1,1,1,0.7}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.7}; + colorText[] = {1,1,1,0.7}; + soundClick[] = {"",0.1,1}; + soundEnter[] = {"",0.1,1}; + soundEscape[] = {"",0.1,1}; + soundPush[] = {"",0.1,1}; + font = "PuristaMedium"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; +}; +class outlw_MR_IGUIBack +{ + type = 0; + idc = 124; + style = 128; + text = ""; + colorText[] = {0,0,0,0}; + font = "PuristaMedium"; + sizeEx = 0; + shadow = 0; + x = 0.1; + y = 0.1; + w = 0.1; + h = 0.1; + colorbackground[] = + { + "(profilenamespace getvariable ['IGUI_BCG_RGB_R',0])", + "(profilenamespace getvariable ['IGUI_BCG_RGB_G',1])", + "(profilenamespace getvariable ['IGUI_BCG_RGB_B',1])", + "(profilenamespace getvariable ['IGUI_BCG_RGB_A',0.8])" + }; +}; +class outlw_MR_RscButtonMenu +{ + idc = -1; + type = 16; + style = "0x02 + 0xC0"; + default = 0; + shadow = 0; + x = 0; + y = 0; + w = 0.095589; + h = 0.039216; + textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; + animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,0.5)"; + animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.8)"; + class HitZone + { + left = 0; + top = 0; + right = 0; + bottom = 0; + }; + colorFocused[] = {1,1,1,0.5}; + colorBackgroundFocused[] = {0,0,0,0.8}; + colorBackground[] = {0,0,0,0.8}; + colorBackground2[] = {1,1,1,0.5}; + color[] = {1,1,1,1}; + color2[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.25}; + period = 1.2; + periodFocus = 1.2; + periodOver = 1.2; + font = "PuristaMedium"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + class TextPos + { + left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)"; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0; + }; + class Attributes + { + font = "PuristaLight"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class ShortcutPos + { + left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005"; + top = 0.005; + w = 0.0225; + h = 0.03; + }; + soundEnter[] = + { + "\A3\ui_f\data\sound\RscButtonMenu\soundEnter", + 0.09, + 1 + }; + soundPush[] = + { + "\A3\ui_f\data\sound\RscButtonMenu\soundPush", + 0.09, + 1 + }; + soundClick[] = + { + "\A3\ui_f\data\sound\RscButtonMenu\soundClick", + 0.09, + 1 + }; + soundEscape[] = + { + "\A3\ui_f\data\sound\RscButtonMenu\soundEscape", + 0.09, + 1 + }; +}; +class outlw_MR_RscControlsGroup +{ + class VScrollbar + { + color[] = {1,1,1,0}; + width = 0; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + shadow = 0; + }; + class HScrollbar + { + color[] = {1,1,1,0}; + height = 0; + shadow = 0; + }; + class ScrollBar + { + color[] = {1,1,1,0}; + colorActive[] = {1,1,1,0}; + colorDisabled[] = {1,1,1,0}; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + type = 15; + idc = -1; + x = 0; + y = 0; + w = 1; + h = 1; + shadow = 0; + style = 16; +}; +class outlw_MR_RscCombo +{ + access = 0; + type = 4; + colorSelect[] = {0,0,0,1}; + colorText[] = {1,1,1,1}; + colorBackground[] = {0,0,0,1}; + colorScrollbar[] = {1,0,0,1}; + soundSelect[] = + { + "\A3\ui_f\data\sound\RscCombo\soundSelect", + 0.1, + 1 + }; + soundExpand[] = + { + "\A3\ui_f\data\sound\RscCombo\soundExpand", + 0.1, + 1 + }; + soundCollapse[] = + { + "\A3\ui_f\data\sound\RscCombo\soundCollapse", + 0.1, + 1 + }; + maxHistoryDelay = 1; + class ComboScrollBar + { + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + }; + style = "0x10 + 0x200"; + x = 0; + y = 0; + w = 0.12; + h = 0.035; + shadow = 0; + colorSelectBackground[] = {1,1,1,0.7}; + arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; + arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; + wholeHeight = 0.45; + color[] = {1,1,1,1}; + colorActive[] = {1,0,0,1}; + colorDisabled[] = {1,1,1,0.25}; + font = "PuristaMedium"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; +}; + + + + diff --git a/addons/outlw_magrepack/Images/MR_SourceGradient.paa b/addons/outlw_magrepack/Images/MR_SourceGradient.paa new file mode 100644 index 000000000..b88c73d80 Binary files /dev/null and b/addons/outlw_magrepack/Images/MR_SourceGradient.paa differ diff --git a/addons/outlw_magrepack/Images/MR_TargetGradient.paa b/addons/outlw_magrepack/Images/MR_TargetGradient.paa new file mode 100644 index 000000000..e54b377a9 Binary files /dev/null and b/addons/outlw_magrepack/Images/MR_TargetGradient.paa differ diff --git a/addons/outlw_magrepack/Images/MR_logo.paa b/addons/outlw_magrepack/Images/MR_logo.paa new file mode 100644 index 000000000..12e004a3d Binary files /dev/null and b/addons/outlw_magrepack/Images/MR_logo.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/0.paa b/addons/outlw_magrepack/Images/bulletCount/0.paa new file mode 100644 index 000000000..9921be0da Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/0.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/1.paa b/addons/outlw_magrepack/Images/bulletCount/1.paa new file mode 100644 index 000000000..fb1af049d Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/1.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/10.paa b/addons/outlw_magrepack/Images/bulletCount/10.paa new file mode 100644 index 000000000..15ab7391f Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/10.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/11.paa b/addons/outlw_magrepack/Images/bulletCount/11.paa new file mode 100644 index 000000000..9d6625c15 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/11.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/12.paa b/addons/outlw_magrepack/Images/bulletCount/12.paa new file mode 100644 index 000000000..d9d63adca Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/12.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/13.paa b/addons/outlw_magrepack/Images/bulletCount/13.paa new file mode 100644 index 000000000..9bfed869b Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/13.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/14.paa b/addons/outlw_magrepack/Images/bulletCount/14.paa new file mode 100644 index 000000000..d6b48328c Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/14.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/15.paa b/addons/outlw_magrepack/Images/bulletCount/15.paa new file mode 100644 index 000000000..46d9f1ed1 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/15.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/16.paa b/addons/outlw_magrepack/Images/bulletCount/16.paa new file mode 100644 index 000000000..658e2c3e1 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/16.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/17.paa b/addons/outlw_magrepack/Images/bulletCount/17.paa new file mode 100644 index 000000000..d32399923 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/17.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/18.paa b/addons/outlw_magrepack/Images/bulletCount/18.paa new file mode 100644 index 000000000..7ebdf61b5 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/18.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/19.paa b/addons/outlw_magrepack/Images/bulletCount/19.paa new file mode 100644 index 000000000..901b9879d Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/19.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/2.paa b/addons/outlw_magrepack/Images/bulletCount/2.paa new file mode 100644 index 000000000..aa4a8a861 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/2.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/20.paa b/addons/outlw_magrepack/Images/bulletCount/20.paa new file mode 100644 index 000000000..8e34da025 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/20.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/21.paa b/addons/outlw_magrepack/Images/bulletCount/21.paa new file mode 100644 index 000000000..2f174e27d Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/21.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/22.paa b/addons/outlw_magrepack/Images/bulletCount/22.paa new file mode 100644 index 000000000..bfeabfdbe Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/22.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/23.paa b/addons/outlw_magrepack/Images/bulletCount/23.paa new file mode 100644 index 000000000..f1cf4bf9f Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/23.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/24.paa b/addons/outlw_magrepack/Images/bulletCount/24.paa new file mode 100644 index 000000000..0f2087990 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/24.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/25.paa b/addons/outlw_magrepack/Images/bulletCount/25.paa new file mode 100644 index 000000000..1d71842e0 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/25.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/26.paa b/addons/outlw_magrepack/Images/bulletCount/26.paa new file mode 100644 index 000000000..c2565c3cc Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/26.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/27.paa b/addons/outlw_magrepack/Images/bulletCount/27.paa new file mode 100644 index 000000000..81808a2fd Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/27.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/28.paa b/addons/outlw_magrepack/Images/bulletCount/28.paa new file mode 100644 index 000000000..8a43ee95f Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/28.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/29.paa b/addons/outlw_magrepack/Images/bulletCount/29.paa new file mode 100644 index 000000000..407ca6b1b Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/29.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/3.paa b/addons/outlw_magrepack/Images/bulletCount/3.paa new file mode 100644 index 000000000..a6b938d85 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/3.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/30.paa b/addons/outlw_magrepack/Images/bulletCount/30.paa new file mode 100644 index 000000000..5bb632add Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/30.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/4.paa b/addons/outlw_magrepack/Images/bulletCount/4.paa new file mode 100644 index 000000000..bc8c21b5f Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/4.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/5.paa b/addons/outlw_magrepack/Images/bulletCount/5.paa new file mode 100644 index 000000000..1a5ba5fc0 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/5.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/6.paa b/addons/outlw_magrepack/Images/bulletCount/6.paa new file mode 100644 index 000000000..6dc5a37c4 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/6.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/7.paa b/addons/outlw_magrepack/Images/bulletCount/7.paa new file mode 100644 index 000000000..43f9e6035 Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/7.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/8.paa b/addons/outlw_magrepack/Images/bulletCount/8.paa new file mode 100644 index 000000000..02cb2849e Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/8.paa differ diff --git a/addons/outlw_magrepack/Images/bulletCount/9.paa b/addons/outlw_magrepack/Images/bulletCount/9.paa new file mode 100644 index 000000000..0599d01cc Binary files /dev/null and b/addons/outlw_magrepack/Images/bulletCount/9.paa differ diff --git a/addons/outlw_magrepack/MagRepack_init.sqf b/addons/outlw_magrepack/MagRepack_init.sqf new file mode 100644 index 000000000..7909942fa --- /dev/null +++ b/addons/outlw_magrepack/MagRepack_init.sqf @@ -0,0 +1,59 @@ + +/* + |---- + -Author: Outlawled + -Created: 7 March 2013 + -Updated: 5 December 2014 + -Version: 3.1.1 (Addon) + -Description: - Allows the player to repack the ammo in his magazines. + - Default keybinding to open the Mag Repack dialog is "Ctrl+R", this can be customized via the options menu in the Mag Repack dialog. + - Pressing "Shift+Ctrl+Alt+Backspace" will reset the keybinding to the default setting (in case the player forgets what he changed his keybinding to). + - The player may choose a magazine from a list of all of his magazines to be the "Source" magazine and then he may choose a magazine + from a list of all of his magazines of the same ammo type as the Source magazine to be the "Target" magazine (or vice versa). As soon + as the Source and Target are both defined, bullets from the Source magazine will automatically start repacking into the Target magazine. + |---- +*/ + +outlw_MR_bulletTime = 0.8; // Seconds per individual bullet. +outlw_MR_beltTime = 4; // Seconds per belt magazine. + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +disableSerialization; + +outlw_MR_version = "3.1.1"; +outlw_MR_date = "5 December 2014"; + +outlw_MR_defaultKeybinding = [false, true, false, 19]; + +outlw_MR_canCreateDialog = true; +outlw_MR_keybindingMenuActive = false; +outlw_MR_debugMode = profileNamespace getVariable ["outlw_MR_debugMode_profile", false]; +outlw_MR_doHideFull = profileNamespace getVariable ["outlw_MR_doHideFull_profile", false]; +outlw_MR_keyList = profileNamespace getVariable ["outlw_MR_keyList_profile", outlw_MR_defaultKeybinding]; + +if (typeName(outlw_MR_keyList select 0) != "BOOL") then +{ + profileNamespace setVariable ["outlw_MR_keyList_profile", outlw_MR_defaultKeybinding]; + outlw_MR_keyList =+ outlw_MR_defaultKeybinding; +}; + +outlw_MR_shift = outlw_MR_keyList select 0; +outlw_MR_ctrl = outlw_MR_keyList select 1; +outlw_MR_alt = outlw_MR_keyList select 2; +outlw_MR_keybinding = outlw_MR_keyList select 3; + +[] execVM "addons\outlw_magrepack\Scripts\MagRepack_Main.sqf"; +[] execVM "addons\outlw_magrepack\Scripts\MagRepack_Keybindings.sqf"; +[] execVM "addons\outlw_magrepack\Scripts\MagRepack_Misc.sqf"; + +waitUntil {!(isNil "outlw_MR_getIDCs")}; + +outlw_MR_listIDCs = [(missionConfigFile >> "MR_Dialog" >> "Controls")] call outlw_MR_getIDCs; + +waitUntil {!(isNull (findDisplay 46))}; + +(findDisplay 46) displayAddEventHandler ["KeyDown", "_this call outlw_MR_keyDown;"]; + +systemChat "Mag Repack Initialized"; +systemChat ("Keybinding: " + (call outlw_MR_keyListToString)); diff --git a/addons/outlw_magrepack/Scripts/MagRepack_Keybindings.sqf b/addons/outlw_magrepack/Scripts/MagRepack_Keybindings.sqf new file mode 100644 index 000000000..0c6247ded --- /dev/null +++ b/addons/outlw_magrepack/Scripts/MagRepack_Keybindings.sqf @@ -0,0 +1,139 @@ + +outlw_MR_openKeybindings = +{ + createDialog "MagRepack_Dialog_Keybindings"; + outlw_MR_keybindingMenuActive = true; + + outlw_KB_cShift = outlw_MR_shift; + outlw_KB_cCtrl = outlw_MR_ctrl; + outlw_KB_cAlt = outlw_MR_alt; + outlw_KB_cKey = outlw_MR_keybinding; + + call outlw_KB_updateKeyText; + + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2401) ctrlEnable false; + + if (outlw_KB_cShift) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2500) ctrlSetBackgroundColor [1, 1, 1, 0.25]; + }; + + if (outlw_KB_cCtrl) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2501) ctrlSetBackgroundColor [1, 1, 1, 0.25]; + }; + + if (outlw_KB_cAlt) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2502) ctrlSetBackgroundColor [1, 1, 1, 0.25]; + }; +}; + +outlw_MR_applyKeybinding = +{ + private ["_systemString"]; + + outlw_MR_keyList =+ (_this select 0); + profileNamespace setVariable ["outlw_MR_keyList_profile", outlw_MR_keyList]; + + outlw_MR_shift = outlw_MR_keyList select 0; + outlw_MR_ctrl = outlw_MR_keyList select 1; + outlw_MR_alt = outlw_MR_keyList select 2; + outlw_MR_keybinding = outlw_MR_keyList select 3; + + if (count _this > 1 && {_this select 1}) then + { + _systemString = "Mag Repack keybinding has been reset to "; + } + else + { + _systemString = "Mag Repack keybinding has been updated to "; + closeDialog 0; + }; + + systemChat (_systemString + (call outlw_MR_keyListToString)); +}; + +outlw_KB_keyDown = +{ + if ((_this select 1) != 1) then + { + outlw_KB_cKey = _this select 1; + call outlw_KB_updateKeyText; + call outlw_KB_enableApply; + + true; + }; +}; + +outlw_KB_enableApply = +{ + if !([outlw_MR_keyList, [outlw_KB_cShift, outlw_KB_cCtrl, outlw_KB_cAlt, outlw_KB_cKey]] call BIS_fnc_areEqual) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2401) ctrlEnable true; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2401) ctrlEnable false; + }; +}; + +outlw_KB_updateKeyText = +{ + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2499) ctrlSetText (keyName outlw_KB_cKey); +}; + +outlw_KB_modifierSwitch = +{ + _mod = _this select 0; + + if (_mod == 0) then + { + if (!outlw_KB_cShift) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2500) ctrlSetBackgroundColor [1, 1, 1, 0.25]; + outlw_KB_cShift = true; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2500) ctrlSetBackgroundColor [0, 0, 0, 0.8]; + outlw_KB_cShift = false; + }; + } + else + { + if (_mod == 1) then + { + if (!outlw_KB_cCtrl) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2501) ctrlSetBackgroundColor [1, 1, 1, 0.25]; + outlw_KB_cCtrl = true; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2501) ctrlSetBackgroundColor [0, 0, 0, 0.8]; + outlw_KB_cCtrl = false; + }; + } + else + { + if (_mod == 2) then + { + if (!outlw_KB_cAlt) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2502) ctrlSetBackgroundColor [1, 1, 1, 0.25]; + outlw_KB_cAlt = true; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Keybindings") displayCtrl 2502) ctrlSetBackgroundColor [0, 0, 0, 0.8]; + outlw_KB_cAlt = false; + }; + }; + }; + }; + + call outlw_KB_updateKeyText; + call outlw_KB_enableApply; +}; + diff --git a/addons/outlw_magrepack/Scripts/MagRepack_Main.sqf b/addons/outlw_magrepack/Scripts/MagRepack_Main.sqf new file mode 100644 index 000000000..05d9c4932 --- /dev/null +++ b/addons/outlw_magrepack/Scripts/MagRepack_Main.sqf @@ -0,0 +1,969 @@ + +outlw_MR_createDialog = +{ + private ["_stance", "_raised", "_weapon"]; + + outlw_MR_sourceType = ""; + outlw_MR_sourceCount = 0; + outlw_MR_sourceCap = 0; + + outlw_MR_targetType = ""; + outlw_MR_targetCount = 0; + outlw_MR_targetCap = 0; + + outlw_MR_listDragging = false; + outlw_MR_sourceDragging = false; + outlw_MR_targetDragging = false; + + outlw_MR_doAddToMagazines = true; + outlw_MR_canCreateDialog = false; + + outlw_MR_dragType = ""; + outlw_MR_dragCount = 0; + outlw_MR_dragCap = 0; + + outlw_MR_currentFilter = ""; + outlw_MR_isRepacking = false; + outlw_MR_optionsOpen = false; + + createDialog "MagRepack_Dialog_Main"; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1001) ctrlSetText ("Mag Repack [" + outlw_MR_version + "]"); + + outlw_MR_blur = ppEffectCreate ["DynamicBlur", 401]; + outlw_MR_blur ppEffectEnable true; + outlw_MR_blur ppEffectAdjust [1.5]; + outlw_MR_blur ppEffectCommit 0; + + if (vehicle player == player) then + { + _stance = "Pknl"; + _raised = "Sras"; + _weapon = "Wpst"; + + if (stance player == "PRONE") then + { + _stance = "Ppne"; + }; + + switch (currentWeapon player) do + { + case (""): {_raised = "Snon"; _weapon = "Wnon";}; + case (primaryWeapon player): {_weapon = "Wrfl";}; + case (secondaryWeapon player): {_weapon = "Wlnr";}; + }; + + player playMove ("Ainv" + _stance + "Mstp" + _raised + _weapon + "Dnon"); + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 22170) lbAdd "All Ammo Types"; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 22170) lbSetData [0, ""]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 22170) lbSetCurSel 0; + + call outlw_MR_populateMagListBox; + call outlw_MR_populateMagComboBox; + + [true] call outlw_MR_sourceEnabled; + [true] call outlw_MR_targetEnabled; + + if (outlw_MR_debugMode) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9002) ctrlSetStructuredText parseText "Debug Mode: On"; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9002) ctrlSetStructuredText parseText "Debug Mode: Off"; + }; + + if (outlw_MR_doHideFull) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9004) ctrlSetStructuredText parseText "Show Full: Off"; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9004) ctrlSetStructuredText parseText "Show Full: On"; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9003) ctrlSetStructuredText parseText "Keybindings"; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9005) ctrlSetStructuredText parseText "About"; + + outlw_MR_startingInfo = call outlw_MR_debugInfo; + + [] spawn + { + private ["_a", "_b"]; + + _a = magazinesAmmo player; + + while {!(IsNull (uiNamespace getVariable "outlw_MR_Dialog_Main"))} do + { + sleep 0.05; + + _b = magazinesAmmo player; + + if !([_a, _b] call BIS_fnc_areEqual) then + { + call outlw_MR_populateMagListBox; + _a =+ _b; + }; + + if !(alive player) then + { + closeDialog 0; + }; + }; + }; +}; + +outlw_MR_populateMagComboBox = +{ + private ["_this", "_magTypes", "_ammoTypes", "_n", "_a"]; + + _magTypes = (call outlw_MR_magInfo) select 0; + _ammoTypes = []; + _a = 0; + + for "_n" from 0 to ((count _magTypes) - 1) do + { + if !((getText(configFile >> "cfgMagazines" >> (_magTypes select _n) >> "ammo")) in _ammoTypes) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 22170) lbAdd ([([(getText(configFile >> "cfgMagazines" >> (_magTypes select _n) >> "ammo"))] call outlw_MR_ammoDisplayName), 25] call outlw_MR_shortString); + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 22170) lbSetData [_a, (getText(configFile >> "cfgMagazines" >> (_magTypes select _n) >> "ammo"))]; + _ammoTypes set [count _ammoTypes, (getText(configFile >> "cfgMagazines" >> (_magTypes select _n) >> "ammo"))]; + + _a = _a + 1; + }; + }; +}; + +outlw_MR_populateMagListBox = +{ + private ["_this", "_args", "_magListTitle", "_magTypes", "_magAmmoCounts", "_magAmmoCaps", "_magCounts", "_bgrndPos", "_n", "_a"]; + + _args = call outlw_MR_magInfo; + _magListTitle = "All Magazines"; + + if (outlw_MR_sourceType != "" || {outlw_MR_targetType != ""} || {outlw_MR_currentFilter != ""}) then + { + _args = (_args) call outlw_MR_filter; + _magListTitle = "Compatible Mags"; + }; + + lnbClear ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500); + + _args = (_args) call outlw_MR_uniqueMags; + + if (outlw_MR_doHideFull) then + { + _args = (_args) call outlw_MR_hideFull; + _magListTitle = "Non-Full Magazines"; + + if (outlw_MR_sourceType != "" || {outlw_MR_targetType != ""} || {outlw_MR_currentFilter != ""}) then + { + _magListTitle = "Compatible, Non-Full"; + }; + }; + + _magTypes = _args select 0; + _magAmmoCounts = _args select 1; + _magAmmoCaps = _args select 2; + _magCounts = _args select 3; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1000) ctrlSetStructuredText parseText _magListTitle; + + _bgrndPos = ctrlPosition ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500); + + if (count _magTypes > 9) then + { + ["outlw_MR_Dialog_Main", 1500, [(_bgrndPos select 0), (_bgrndPos select 1), 0.3375, (_bgrndPos select 3)], 0] call outlw_MR_ctrlSetPos; + ["outlw_MR_Dialog_Main", 2217, [(_bgrndPos select 0), (_bgrndPos select 1), 0.321, (_bgrndPos select 3) + 0.003], 0] call outlw_MR_ctrlSetPos; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lnbDeleteColumn 3; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lnbAddColumn 0.83; + } + else + { + ["outlw_MR_Dialog_Main", 1500, [(_bgrndPos select 0), (_bgrndPos select 1), 0.325, (_bgrndPos select 3)], 0] call outlw_MR_ctrlSetPos; + ["outlw_MR_Dialog_Main", 2217, [(_bgrndPos select 0), (_bgrndPos select 1), 0.325, (_bgrndPos select 3) + 0.003], 0] call outlw_MR_ctrlSetPos; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lnbDeleteColumn 3; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lnbAddColumn 0.89; + + }; + + _a = 0; + + for "_n" from 0 to ((count _magTypes) - 1) do + { + _magCountStr = str(_magCounts select _n); + + if (_magCounts select _n < 10) then + { + _magCountStr = " " + _magCountStr; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lnbAddRow [([(getText(configFile >> "cfgMagazines" >> _magTypes select _n >> "DisplayName")), 25] call outlw_MR_shortString), "", "", _magCountStr]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lnbSetPicture [[_n, 1], format ["addons\outlw_magrepack\Images\bulletCount\%1.paa", round((_magAmmoCounts select _n)/(_magAmmoCaps select _n)*30)]]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lnbSetPicture [[_n, 2], (getText(configFile >> "cfgMagazines" >> _magTypes select _n >> "picture"))]; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lbSetValue [_n*4, _magAmmoCounts select _n]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1500) lbSetData [_n*4, _magTypes select _n]; + }; +}; + +outlw_MR_filter = +{ + private ["_this", "_magTypes", "_magAmmoCounts", "_magAmmoCaps", "_ammoType", "_returnTypes", "_returnCounts", "_returnCaps"]; + + _magTypes = _this select 0; + _magAmmoCounts = _this select 1; + _magAmmoCaps = _this select 2; + + _ammoType = (getText(configFile >> "cfgMagazines" >> outlw_MR_sourceType >> "ammo")); + + if (_ammoType == "") then + { + _ammoType = (getText(configFile >> "cfgMagazines" >> outlw_MR_targetType >> "ammo")); + }; + + if (_ammoType == "") then + { + _ammoType = outlw_MR_currentFilter; + }; + + _returnTypes = []; + _returnCounts = []; + _returnCaps = []; + + for "_n" from 0 to ((count _magTypes) - 1) do + { + if ((getText (configFile >> "cfgMagazines" >> _magTypes select _n >> "ammo")) == _ammoType) then + { + _returnTypes set [count _returnTypes, _magTypes select _n]; + _returnCounts set [count _returnCounts, _magAmmoCounts select _n]; + _returnCaps set [count _returnCaps, _magAmmoCaps select _n]; + }; + }; + + [_returnTypes, _returnCounts, _returnCaps]; +}; + +outlw_MR_hideFull = +{ + private ["_this", "_magTypes", "_magAmmoCounts", "_magAmmoCaps", "_magCounts", "_returnMagTypes", "_returnAmmoCaps", "_returnAmmoCaps", "_returnMagCounts", "_n", "_a"]; + + _magTypes = _this select 0; + _magAmmoCounts = _this select 1; + _magAmmoCaps = _this select 2; + _magCounts = _this select 3; + + _returnMagTypes = []; + _returnMagAmmoCounts = []; + _returnMagAmmoCaps = []; + _returnMagCounts = []; + + _a = 0; + + for "_n" from 0 to ((count _magTypes) - 1) do + { + if ((_magAmmoCounts select _n) != (_magAmmoCaps select _n)) then + { + _returnMagTypes set [_a, _magTypes select _n]; + _returnMagAmmoCounts set [_a, _magAmmoCounts select _n]; + _returnMagAmmoCaps set [_a, _magAmmoCaps select _n]; + _returnMagCounts set [_a, _magCounts select _n]; + + _a = _a + 1; + }; + }; + + [_returnMagTypes, _returnMagAmmoCounts, _returnMagAmmoCaps, _returnMagCounts]; +}; + +outlw_MR_repack = +{ + private ["_sourceCap", "_targetCap", "_refreshRate", "_refreshCount", "_magCode", "_keepRepacking", "_sleepTime", "_n"]; + + outlw_MR_isRepacking = true; + + _refreshRate = outlw_MR_bulletTime; + _refreshCount = 1; + + _magCode = + { + outlw_MR_sourceCount = outlw_MR_sourceCount - 1; + outlw_MR_targetCount = outlw_MR_targetCount + 1; + }; + + if ([outlw_MR_sourceType] call outlw_MR_isBeltMagazine && {[outlw_MR_targetType] call outlw_MR_isBeltMagazine}) then + { + _refreshRate = outlw_MR_beltTime; + _magCode = + { + outlw_MR_sourceCount = outlw_MR_sourceCount - (outlw_MR_targetCap - outlw_MR_targetCount); + outlw_MR_targetCount = outlw_MR_targetCount + (outlw_MR_targetCap - outlw_MR_targetCount) + outlw_MR_sourceCount; + if (outlw_MR_targetCount > outlw_MR_targetCap) then {outlw_MR_targetCount = outlw_MR_targetCap}; + if (outlw_MR_sourceCount < 0) then {outlw_MR_sourceCount = 0}; + }; + } + else + { + if (outlw_MR_sourceCount >= (outlw_MR_targetCap - outlw_MR_targetCount)) then + { + _refreshCount = (outlw_MR_targetCap - outlw_MR_targetCount); + } + else + { + _refreshCount = outlw_MR_sourceCount; + }; + }; + + [] spawn outlw_MR_repackingText; + + ["outlw_MR_Dialog_Main", 10002, [0,0], (_refreshCount * _refreshRate)] call outlw_MR_ctrlSetPos; + + _keepRepacking = {outlw_MR_sourceType != "" && outlw_MR_targetType != "" && outlw_MR_sourceCount > 0 && outlw_MR_targetCount < outlw_MR_targetCap}; + _sleepTime = (time + (_refreshRate)); + + while {time < _sleepTime && call _keepRepacking} do + { + sleep 0.05; + }; + + while _keepRepacking do + { + call _magCode; + + ["outlw_MR_Dialog_Main", 22180, [0,((0.12/outlw_MR_sourceCap) * (outlw_MR_sourceCap - outlw_MR_sourceCount))], 0] call outlw_MR_ctrlSetPos; + ["outlw_MR_Dialog_Main", 22190, [0,((0.12/outlw_MR_targetCap) * (outlw_MR_targetCap - outlw_MR_targetCount))], 0] call outlw_MR_ctrlSetPos; + + _sleepTime = (time + (_refreshRate)); + + while {time < _sleepTime && call _keepRepacking} do + { + sleep 0.05; + }; + }; + + if (outlw_MR_sourceCount <= 0) then + { + call outlw_MR_clearSource; + }; + + if (outlw_MR_targetCount == outlw_MR_targetCap) then + { + call outlw_MR_clearTarget; + }; + + outlw_MR_isRepacking = false; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1008) ctrlSetText ""; + + ["outlw_MR_Dialog_Main", 10002, [-0.325,0], 0] call outlw_MR_ctrlSetPos; +}; + +outlw_MR_repackingText = +{ + private ["_repacking"]; + + _repacking = "Repacking..."; + + while {outlw_MR_isRepacking} do + { + _repacking = _repacking + "."; + + if (_repacking == "Repacking....") then + { + _repacking = "Repacking"; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1008) ctrlSetText _repacking; + + sleep 1; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1008) ctrlSetText ""; +}; + +outlw_MR_debugInfo = +{ + private ["_magsAmmo", "_totalMagCount", "_totalAmmo", "_typeCountAmmo", "_magType", "_magAmmo", "_index", "_inArray", "_n", "_a"]; + + _magsAmmo = magazinesAmmo player; + _totalMagCount = 0; + _totalAmmo = 0; + _typeCountAmmo = []; + + for "_n" from 0 to ((count _magsAmmo) - 1) do + { + _magType = ((_magsAmmo select _n) select 0); + _magAmmo = ((_magsAmmo select _n) select 1); + + if (getNumber(configFile >> "CfgMagazines" >> _magType >> "count") > 1 || {[_magType] call outlw_MR_isConvertable}) then + { + _index = 0; + _inArray = false; + + for [{_a = 0}, {_a < count _typeCountAmmo && !_inArray}, {_a = _a + 1}] do + { + if (_magType == ((_typeCountAmmo select _a) select 0)) then + { + _inArray = true; + _index = _a; + }; + }; + + if (_inArray) then + { + (_typeCountAmmo select _index) set [1, ((_typeCountAmmo select _index) select 1) + 1]; + (_typeCountAmmo select _index) set [2, ((_typeCountAmmo select _index) select 2) + _magAmmo]; + } + else + { + _typeCountAmmo set [(count _typeCountAmmo), [_magType, 1, _magAmmo]]; + }; + + _totalMagCount = _totalMagCount + 1; + _totalAmmo = _totalAmmo + _magAmmo; + }; + }; + + [[_totalMagCount, _totalAmmo], _typeCountAmmo]; +}; + +outlw_MR_block = +{ + private ["_doBlockSource", "_doBlockTarget"]; + + _doBlockSource = true; + _doBlockTarget = true; + + switch (true) do + { + case (outlw_MR_sourceType != ""): {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetToolTip "Source is already defined!";}; + case (outlw_MR_dragCount == 0): {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetToolTip "Source cannot be empty!";}; + case (outlw_MR_dragCap < 100 && (outlw_MR_targetType != "" && outlw_MR_targetCap >= 100)): + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetToolTip "The Target requires a belt, not individual bullets!"; + }; + default {_doBlockSource = false;}; + }; + + if (_doBlockSource) then + { + if (outlw_MR_sourceDragging) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetBackgroundColor [1,1,1,0.3]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetToolTip ""; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetBackgroundColor [1,0,0,0.3]; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlEnable false; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetBackgroundColor [1,1,1,0.3]; + }; + + switch (true) do + { + case (outlw_MR_targetType != ""): {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetToolTip "Target is already defined!";}; + case (outlw_MR_dragCount == outlw_MR_dragCap && outlw_MR_dragCap != 1): {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetToolTip "Target magazine cannot be full!";}; + case (outlw_MR_dragCap >= 100 && (outlw_MR_sourceType != "" && outlw_MR_sourceCap < 100)): + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetToolTip "This magazine requires belts, not individual bullets!"; + }; + default {_doBlockTarget = false;}; + }; + + if (_doBlockTarget) then + { + if (outlw_MR_targetDragging) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetBackgroundColor [1,1,1,0.3]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetToolTip ""; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetBackgroundColor [1,0,0,0.3]; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlEnable false; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetBackgroundColor [1,1,1,0.3]; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2217) ctrlSetBackgroundColor [1,1,1,0.3]; +}; + +outlw_MR_onDrag = +{ + private ["_this", "_magInfo"]; + + outlw_MR_listDragging = false; + outlw_MR_sourceDragging = false; + outlw_MR_targetDragging = false; + + outlw_MR_dragType = _this select 1; + outlw_MR_dragCount = _this select 0; + outlw_MR_dragCap = getNumber(configFile >> "CfgMagazines" >> outlw_MR_dragType >> "count"); + + switch (_this select 2) do + { + case "source": {outlw_MR_dragCount = outlw_MR_sourceCount; outlw_MR_dragCap = outlw_MR_sourceCap; outlw_MR_sourceDragging = true; ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2217) ctrlEnable true;}; + case "target": {outlw_MR_dragCount = outlw_MR_targetCount; outlw_MR_dragCap = outlw_MR_targetCap; outlw_MR_targetDragging = true; ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2217) ctrlEnable true;}; + default {outlw_MR_listDragging = true;}; + }; + + call outlw_MR_block; +}; + +outlw_MR_onMouseButtonUp = +{ + outlw_MR_dragType = ""; + outlw_MR_dragCount = 0; + outlw_MR_dragCap = 0; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetBackgroundColor [1,0,0,0]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetToolTip ""; + + if (outlw_MR_sourceType == "") then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlEnable true; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetBackgroundColor [1,0,0,0]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetToolTip ""; + + if (outlw_MR_targetType == "") then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlEnable true; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2217) ctrlSetBackgroundColor [0,0,0,0]; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2217) ctrlEnable false; +}; + +outlw_MR_sourceEnabled = +{ + private ["_this"]; + + if (_this select 0) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlEnable true; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1600) ctrlEnable false; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1600) ctrlSetText ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1600) ctrlSetTooltip ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1201) ctrlSetText ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1100) ctrlSetStructuredText parseText ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlSetToolTip ""; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2215) ctrlEnable false; + + if ([outlw_MR_sourceType] call outlw_MR_isConvertable) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1600) ctrlSetText "Convert"; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1600) ctrlSetTooltip (getText(configFile >> "CfgMagazines" >> ([outlw_MR_sourceType] call outlw_MR_getConversion) >> "DisplayName")); + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1600) ctrlEnable true; + }; + }; + + if (outlw_MR_dragType != "") then + { + call outlw_MR_block; + }; +}; + +outlw_MR_targetEnabled = +{ + private ["_this"]; + + if (_this select 0) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlEnable true; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1601) ctrlEnable false; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1601) ctrlSetText ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1601) ctrlSetTooltip ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1203) ctrlSetText ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1101) ctrlSetStructuredText parseText ""; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlSetToolTip ""; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 2216) ctrlEnable false; + + if ([outlw_MR_targetType] call outlw_MR_isConvertable) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1601) ctrlSetText "Convert"; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1601) ctrlSetTooltip (getText(configFile >> "CfgMagazines" >> ([outlw_MR_targetType] call outlw_MR_getConversion) >> "DisplayName")); + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1601) ctrlEnable true; + }; + }; + + if (outlw_MR_dragType != "") then + { + call outlw_MR_block; + }; +}; + +outlw_MR_addSource = +{ + private ["_this", "_doExit", "_magInfo"]; + + _doExit = false; + + if (outlw_MR_listDragging) then + { + if ([_this select 2, _this select 1] call outlw_MR_magVerified) then + { + outlw_MR_sourceType = _this select 2; + outlw_MR_sourceCount = _this select 1; + outlw_MR_sourceCap = getNumber(configFile >> "CfgMagazines" >> outlw_MR_sourceType >> "count"); + + [outlw_MR_sourceType, outlw_MR_sourceCount] call outlw_MR_removeMag; + call outlw_MR_populateMagListBox; + } + else + { + _doExit = true; + }; + } + else + { + outlw_MR_sourceType = outlw_MR_targetType; + outlw_MR_sourceCount = outlw_MR_targetCount; + outlw_MR_sourceCap = outlw_MR_targetCap; + + outlw_MR_doAddToMagazines = false; + + call outlw_MR_clearTarget; + }; + + if (_doExit) exitWith {}; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1501) lbAdd (getText (configFile >> "cfgMagazines" >> outlw_MR_sourceType >> "DisplayName")); + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1201) ctrlSetText (getText (configFile >> "cfgMagazines" >> outlw_MR_sourceType >> "picture")); + + ["outlw_MR_Dialog_Main", 22180, [0,((0.12/outlw_MR_sourceCap) * (outlw_MR_sourceCap - outlw_MR_sourceCount))], 0] call outlw_MR_ctrlSetPos; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1100) ctrlSetStructuredText parseText format + [ + "%1
%2
", + (getText (configFile >> "cfgMagazines" >> outlw_MR_sourceType >> "DisplayName")), + (getText (configFile >> "cfgMagazines" >> outlw_MR_sourceType >> "descriptionshort")) + ]; + + [false] call outlw_MR_sourceEnabled; + + if (outlw_MR_targetType != "") then + { + [] spawn outlw_MR_repack; + }; +}; + +outlw_MR_clearSource = +{ + private ["_doPopulate"]; + + _doPopulate = false; + + if (outlw_MR_doAddToMagazines) then + { + if (outlw_MR_sourceCount > 0) then + { + player addMagazine [outlw_MR_sourceType, outlw_MR_sourceCount]; + _doPopulate = true; + }; + }; + + lnbClear ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1501); + + outlw_MR_sourceType = ""; + outlw_MR_sourceCount = 0; + + if (_doPopulate) then + { + call outlw_MR_populateMagListBox; + }; + + [true] call outlw_MR_sourceEnabled; + outlw_MR_doAddToMagazines = true; + + ["outlw_MR_Dialog_Main", 22180, [0,0.12], 0] call outlw_MR_ctrlSetPos; +}; + +outlw_MR_addTarget = +{ + private ["_this", "_doExit", "_magInfo"]; + + _doExit = false; + + if (outlw_MR_listDragging) then + { + if ([_this select 2, _this select 1] call outlw_MR_magVerified) then + { + outlw_MR_targetType = _this select 2; + outlw_MR_targetCount = _this select 1; + outlw_MR_targetCap = getNumber(configFile >> "CfgMagazines" >> outlw_MR_targetType >> "count"); + + [outlw_MR_targetType, outlw_MR_targetCount] call outlw_MR_removeMag; + call outlw_MR_populateMagListBox; + } + else + { + _doExit = true; + }; + } + else + { + outlw_MR_targetType = outlw_MR_sourceType; + outlw_MR_targetCount = outlw_MR_sourceCount; + outlw_MR_targetCap = outlw_MR_sourceCap; + + outlw_MR_doAddToMagazines = false; + + call outlw_MR_clearSource; + }; + + if (_doExit) exitWith {}; + + if (outlw_MR_targetCap == 1) then + { + if ([outlw_MR_targetType] call outlw_MR_isConvertable) then + { + outlw_MR_targetType = [outlw_MR_targetType] call outlw_MR_getConversion; + outlw_MR_targetCap = getNumber(configFile >> "CfgMagazines" >> outlw_MR_targetType >> "count"); + }; + }; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1502) lbAdd (getText (configFile >> "cfgMagazines" >> outlw_MR_targetType >> "DisplayName")); + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1203) ctrlSetText (getText (configFile >> "cfgMagazines" >> outlw_MR_targetType >> "picture")); + + ["outlw_MR_Dialog_Main", 22190, [0,((0.12/outlw_MR_targetCap) * (outlw_MR_targetCap - outlw_MR_targetCount))], 0] call outlw_MR_ctrlSetPos; + + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1101) ctrlSetStructuredText parseText format + [ + "%1
%2
", + (getText (configFile >> "cfgMagazines" >> outlw_MR_targetType >> "DisplayName")), + (getText (configFile >> "cfgMagazines" >> outlw_MR_targetType >> "descriptionshort")) + ]; + + [false] call outlw_MR_targetEnabled; + + if (outlw_MR_sourceType != "") then + { + [] spawn outlw_MR_repack; + }; +}; + +outlw_MR_clearTarget = +{ + if (outlw_MR_doAddToMagazines) then + { + player addMagazine [outlw_MR_targetType, outlw_MR_targetCount]; + }; + + lnbClear ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 1502); + + outlw_MR_targetType = ""; + outlw_MR_targetCount = 0; + + call outlw_MR_populateMagListBox; + + [true] call outlw_MR_targetEnabled; + outlw_MR_doAddToMagazines = true; + + ["outlw_MR_Dialog_Main", 22190, [0,0.12], 0] call outlw_MR_ctrlSetPos; +}; + +outlw_MR_moveToList = +{ + switch (true) do + { + case (outlw_MR_sourceDragging): {call outlw_MR_clearSource;}; + case (outlw_MR_targetDragging): {call outlw_MR_clearTarget;}; + }; +}; + +outlw_MR_optionsMenu = +{ + _posGroup = ctrlPosition ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9000); + _posBottom = ctrlPosition ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8998); + _posTop = ctrlPosition ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8997); + + if ([9006,9001,9000,8999,8998,8997] call outlw_MR_isAnimating) exitWith {}; + + if (outlw_MR_optionsOpen) then + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9006) ctrlSetPosition [0,0.21]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9001) ctrlSetPosition [0,0]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9000) ctrlSetPosition [(_posGroup select 0) - 0.00625, (_posGroup select 1), 0, (_posGroup select 3)]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8999) ctrlSetPosition [(_posGroup select 0), (_posGroup select 1) + 0.055]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8998) ctrlSetPosition [(_posBottom select 0), (_posBottom select 1) - 0.01]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8997) ctrlSetPosition [(_posTop select 0), (_posTop select 1) + 0.055]; + + outlw_MR_optionsOpen = false; + + [] spawn + { + {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl _x) ctrlCommit 0.15;} forEach [9006,9001,9000,8999]; + sleep 0.15; + {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl _x) ctrlCommit 0.1;} forEach [8998,8997]; + }; + } + else + { + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9006) ctrlSetPosition [0.1125,0.21]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9001) ctrlSetPosition [0.04375,0]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9000) ctrlSetPosition [(_posGroup select 0) + 0.00625, (_posGroup select 1), 0.2, (_posGroup select 3)]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8999) ctrlSetPosition [(_posGroup select 0) + 0.2125, (_posGroup select 1) + 0.055]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8998) ctrlSetPosition [(_posBottom select 0), (_posBottom select 1) + 0.01]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 8997) ctrlSetPosition [(_posTop select 0), (_posTop select 1) - 0.055]; + + outlw_MR_optionsOpen = true; + + [] spawn + { + {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl _x) ctrlCommit 0.1;} forEach [8998,8997]; + sleep 0.1; + {((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl _x) ctrlCommit 0.15;} forEach [9006,9001,9000,8999]; + }; + }; +}; + +outlw_MR_debugSwitch = +{ + if (outlw_MR_debugMode) then + { + outlw_MR_debugMode = false; + profileNamespace setVariable ["outlw_MR_debugMode_profile", false]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9002) ctrlSetStructuredText parseText "Debug Mode: Off"; + } + else + { + outlw_MR_debugMode = true; + profileNamespace setVariable ["outlw_MR_debugMode_profile", true]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9002) ctrlSetStructuredText parseText "Debug Mode: On"; + }; +}; + +outlw_MR_showFullSwitch = +{ + if (outlw_MR_doHideFull) then + { + outlw_MR_doHideFull = false; + profileNamespace setVariable ["outlw_MR_doHideFull_profile", false]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9004) ctrlSetStructuredText parseText "Show Full: On"; + } + else + { + outlw_MR_doHideFull = true; + profileNamespace setVariable ["outlw_MR_doHideFull_profile", true]; + ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl 9004) ctrlSetStructuredText parseText "Show Full: Off"; + }: + + call outlw_MR_populateMagListBox; +}; + +outlw_MR_onDialogDestroy = +{ + private ["_endingInfo", "_sTCA", "_eTCA", "_snTCA", "_enTCA", "_output", "_toAdd", "_dif", "_difStr", "_n", "_a"]; + + ppEffectDestroy outlw_MR_blur; + + if (outlw_MR_sourceType != "") then + { + call outlw_MR_clearSource; + }; + + if (outlw_MR_targetType != "") then + { + call outlw_MR_clearTarget; + }; + + if (outlw_MR_debugMode) then + { + _endingInfo = call outlw_MR_debugInfo; + + _sTCA = outlw_MR_startingInfo select 1; + _eTCA = _endingInfo select 1; + _output = ""; + + for "_n" from 0 to ((count _sTCA) - 1) do + { + _snTCA = _sTCA select _n; + _toAdd = ((getText (configFile >> "cfgMagazines" >> _snTCA select 0 >> "DisplayName")) + "
[" + str(_snTCA select 1) + "] >> [0]
Ammo: -" + str(_snTCA select 2) + ""); + + for "_a" from 0 to ((count _eTCA) - 1) do + { + _enTCA = _eTCA select _a; + + if ((_snTCA select 0) == (_enTCA select 0)) then + { + _toAdd = ((getText (configFile >> "cfgMagazines" >> _snTCA select 0 >> "DisplayName")) + "
[" + str(_snTCA select 1) + "] >> [" + str(_enTCA select 1) + "]
"); + + _dif = (_enTCA select 2) - (_snTCA select 2); + + switch (true) do + { + case (_dif > 0): {_toAdd = (_toAdd + "Ammo: +" + str(_dif) + "")}; + case (_dif < 0): {_toAdd = (_toAdd + "Ammo: " + str(_dif) + "")}; + default {_toAdd = (_toAdd + "Ammo: No Change")}; + }; + }; + }; + + _output = (_output + _toAdd + "

"); + }; + + for "_n" from 0 to ((count _eTCA) - 1) do + { + _enTCA = _eTCA select _n; + _toAdd = ((getText (configFile >> "cfgMagazines" >> _enTCA select 0 >> "DisplayName")) + "
[0] >> [" + str(_enTCA select 1) + "]
Ammo: +" + str(_enTCA select 2) + "

"); + + for "_a" from 0 to ((count _sTCA) - 1) do + { + _snTCA = _sTCA select _a; + + if ((_snTCA select 0) == (_enTCA select 0)) then + { + _toAdd = ""; + _a = count _sTCA; + }; + }; + + _output = (_output + _toAdd); + }; + + _dif = ((_endingInfo select 0) select 1) - ((outlw_MR_startingInfo select 0) select 1); + _difStr = ""; + + switch (true) do + { + case (_dif > 0): {_difStr = ("+" + str(_dif) + "")}; + case (_dif < 0): {_difStr = ("" + str(_dif) + "")}; + default {_difStr = "No Change"}; + }; + + hint parseText ("
Mag Repack Debug

All Mags
[" + str((outlw_MR_startingInfo select 0) select 0) + "] >> [" + str((_endingInfo select 0) select 0) + "]
Ammo: " + _difStr + "

" + _output + "
"); + }; + + [] spawn + { + sleep 0.5; + outlw_MR_canCreateDialog = true; + }; +}; + + + + diff --git a/addons/outlw_magrepack/Scripts/MagRepack_Misc.sqf b/addons/outlw_magrepack/Scripts/MagRepack_Misc.sqf new file mode 100644 index 000000000..f9c2caf5b --- /dev/null +++ b/addons/outlw_magrepack/Scripts/MagRepack_Misc.sqf @@ -0,0 +1,441 @@ + +outlw_MR_modifierCheck = +{ + _shift = _this select 2; + _ctrl = _this select 3; + _alt = _this select 4; + + if (outlw_MR_shift && {!_shift}) then + { + false; + } + else + { + if (outlw_MR_ctrl && {!_ctrl}) then + { + false; + } + else + { + if (outlw_MR_alt && {!_alt}) then + { + false; + } + else + { + true; + }; + }; + }; +}; + +outlw_MR_keyDown = +{ + if (!alive player || player getVariable ["playerSpawning", true] || player call A3W_fnc_isUnconscious) exitWith {false}; + + _key = _this select 1; + + if (_key == outlw_MR_keybinding && {_this call outlw_MR_modifierCheck}) then + { + if (outlw_MR_canCreateDialog) then + { + call outlw_MR_createDialog; + true; + } + else + { + if (!outlw_MR_keybindingMenuActive) then + { + closeDialog 0; + true; + }; + }; + } + else + { + if (_key == 14 && {_this select 2} && {_this select 3} && {_this select 4} && {outlw_MR_canCreateDialog}) then + { + [outlw_MR_defaultKeybinding, true] call outlw_MR_applyKeybinding; + true; + }; + }; +}; + +outlw_MR_getIDCs = +{ + private ["_this", "_config", "_ctrlCount", "_returnList", "_ctrl", "_n"]; + + _config = _this select 0; + _filter = {true}; + + if (count _this > 1) then + { + _filter = _this select 1; + }; + + _ctrlCount = count(_config); + _returnList = []; + + for "_n" from 0 to (_ctrlCount - 1) do + { + _ctrl = configName((_config) select _n); + + if (call _filter) then + { + _returnList = _returnList + [getNumber(_config >> _ctrl >> "idc")]; + }; + + if (isClass(_config >> _ctrl >> "Controls")) then + { + _returnList = _returnList + ([(_config >> _ctrl >> "Controls"), _filter] call outlw_MR_getIDCs); + }; + }; + + _returnList; +}; + +outlw_MR_isAnimating = +{ + private ["_listIDCs", "_ctrlCount", "_returnBool", "_idc", "_n"]; + + _listIDCs = outlw_MR_listIDCs; + + if ((count _this) > 0) then + { + _listIDCs = _this; + }; + + _ctrlCount = count _listIDCs; + _returnBool = false; + + for "_n" from 0 to (_ctrlCount - 1) do + { + _idc = _listIDCs select _n; + + if !(ctrlCommitted ((uiNamespace getVariable "outlw_MR_Dialog_Main") displayCtrl _idc)) then + { + _n = _ctrlCount; + _returnBool = true; + }; + }; + + _returnBool; +}; + +outlw_MR_ctrlSetPos = +{ + ((uiNamespace getVariable (_this select 0)) displayCtrl (_this select 1)) ctrlSetPosition (_this select 2); + ((uiNamespace getVariable (_this select 0)) displayCtrl (_this select 1)) ctrlCommit (_this select 3); +}; + +outlw_MR_shortString = +{ + private ["_this", "_inputString", "_limit", "_uniray", "_n"]; + + _inputString = _this select 0; + _limit = _this select 1; + _uniray = toArray(_inputString); + + if (count(_uniray) > _limit) then + { + for [{_n = (count(_uniray) - 1);}, {_n >= _limit}, {_n = _n - 1}] do + { + _uniray set [_n, -42]; + }; + + _uniray = _uniray - [-42]; + + (toString(_uniray) + "..."); + } + else + { + _inputString; + }; +}; + +outlw_MR_ammoDisplayName = +{ + private ["_this", "_uniray", "_n"]; + + _uniray = toArray(_this select 0); + + for "_n" from 0 to ((count _uniray) - 1) do + { + if (_n < 2) then + { + _uniray set [_n, -42]; + }; + + if ((_uniray select _n) == 95) then + { + _uniray set [_n, 32]; + }; + }; + + _uniray = _uniray - [-42]; + + toString(_uniray); +}; + +outlw_MR_magInfo = +{ + private ["_this", "_magsAmmo", "_magTypes", "_magAmmoCounts", "_magAmmoCaps", "_magType", "_n", "_a"]; + + _magsAmmo = magazinesAmmo player; + _magTypes = []; + _magAmmoCounts = []; + _magAmmoCaps = []; + _a = 0; + + for "_n" from 0 to ((count _magsAmmo) - 1) do + { + _magType = ((_magsAmmo select _n) select 0); + + if (getNumber(configFile >> "CfgMagazines" >> _magType >> "count") > 1 || {[_magType] call outlw_MR_isConvertable}) then + { + _magTypes set [_a, _magType]; + _magAmmoCounts set [_a, ((_magsAmmo select _n) select 1)]; + _magAmmoCaps set [_a, getNumber(configFile >> "CfgMagazines" >> _magType >> "count")]; + _a = _a + 1; + }; + }; + + [_magTypes, _magAmmoCounts, _magAmmoCaps]; +}; + +outlw_MR_removeMag = +{ + private ["_this", "_toRemove", "_ammoCount", "_magInfo", "_n"]; + + _toRemove = _this select 0; + _ammoCount = _this select 1; + _magInfo = call outlw_MR_magInfo; + + {player removeMagazine _x} forEach (_magInfo select 0); + + for "_n" from 0 to ((count (_magInfo select 0)) - 1) do + { + if (((_magInfo select 0) select _n) != _toRemove || {((_magInfo select 1) select _n) != _ammoCount}) then + { + player addMagazine [((_magInfo select 0) select _n), ((_magInfo select 1) select _n)]; + } + else + { + _toRemove = ""; + }; + }; +}; + +outlw_MR_magVerified = +{ + private ["_this", "_toVerify", "_ammoCount", "_magInfo", "_returnBool", "_n"]; + + _toVerify = _this select 0; + _ammoCount = _this select 1; + _magInfo = call outlw_MR_magInfo; + _returnBool = false; + + for "_n" from 0 to ((count (_magInfo select 0)) - 1) do + { + if (((_magInfo select 0) select _n) == _toVerify && {((_magInfo select 1) select _n) == _ammoCount}) then + { + _n = count (_magInfo select 0); + _returnBool = true; + }; + }; + + _returnBool; +}; + +outlw_MR_uniqueMags = +{ + private ["_this", "_magTypes", "_magAmmoCounts", "_magAmmoCaps", "_returnMagTypes", "_returnAmmoCaps", "_returnAmmoCaps", "_returnMagCounts", "_n", "_a", "_p"]; + + _magTypes = _this select 0; + _magAmmoCounts = _this select 1; + _magAmmoCaps = _this select 2; + + _returnMagTypes = []; + _returnAmmoCounts = []; + _returnAmmoCaps = []; + _returnMagCounts = []; + + _isUnique = true; + _a = 0; + _p = 0; + + for "_n" from 0 to ((count _magTypes) - 1) do + { + _isUnique = true; + + for [{_a = 0}, {(_a < count _returnMagTypes) && _isUnique}, {_a = _a + 1}] do + { + if ((_magTypes select _n) == (_returnMagTypes select _a) && {(_magAmmoCounts select _n) == (_returnAmmoCounts select _a)}) then + { + _isUnique = false; + } + }; + + if (_isUnique) then + { + _returnMagTypes set [_p, _magTypes select _n]; + _returnAmmoCounts set [_p, _magAmmoCounts select _n]; + _returnAmmoCaps set [_p, _magAmmoCaps select _n]; + _returnMagCounts set [_p, 1]; + + _p = _p + 1; + } + else + { + _returnMagCounts set [(_a - 1), ((_returnMagCounts select (_a - 1)) + 1)]; + }; + }; + + [_returnMagTypes, _returnAmmoCounts, _returnAmmoCaps, _returnMagCounts]; +}; + +outlw_MR_isBeltMagazine = +{ + private ["_magType", "_cap", "_nameSound", "_returnBool"]; + + _magType = _this select 0; + _cap = getNumber(configFile >> "CfgMagazines" >> _magType >> "count"); + _nameSound = getText(configFile >> "CfgMagazines" >> _magType >> "nameSound"); + + _returnBool = false; + + if (_nameSound == "mGun" || {(_nameSound != "magazine" && _cap >= 100)}) then + { + _returnBool = true; + }; + + _returnBool; +}; + +outlw_MR_isConvertable = +{ + (([_this select 0] call outlw_MR_getConversion) != ""); +}; + +outlw_MR_getConversion = +{ + private ["_magType", "_returnType", "_magTypeArray"]; + + _magType = _this select 0; + _returnType = ""; + + if (getNumber(configFile >> "CfgMagazines" >> _magType >> "count") == 3) then + { + _returnType = configName(inheritsFrom(configFile >> "CfgMagazines" >> _magType)); + } + else + { + _magTypeArray = toArray(_magType); + + if ((_magTypeArray select 0) == 49) then + { + _magTypeArray set [0, 51]; + _returnType = toString(_magTypeArray); + } + else + { + _returnType = ("3Rnd_" + _magType); + }; + }; + + if !(isClass(configFile >> "CfgMagazines" >> _returnType)) then + { + _returnType = ""; + }; + + _returnType; +}; + +outlw_MR_convert = +{ + private ["_this", "_magType", "_ammoCount", "_toAdd", "_n"]; + + _magType = outlw_MR_sourceType; + _ammoCount = outlw_MR_sourceCount; + + if ((_this select 0) == "Target") then + { + _magType = outlw_MR_targetType; + _ammoCount = outlw_MR_targetCount; + }; + + _toAdd = [_magType] call outlw_MR_getConversion; + outlw_MR_doAddToMagazines = false; + + for "_n" from 0 to (_ammoCount - 1) do + { + player addMagazine [_toAdd, 1]; + }; + + call outlw_MR_populateMagListBox; + + if ((_this select 0) == "Source") then + { + call outlw_MR_clearSource; + } + else + { + call outlw_MR_clearTarget; + }; +}; + +outlw_MR_keyListToString = +{ + private ["_shift", "_ctrl", "_alt", "_key", "_returnString", "_q"]; + + if (count _this == 4) then + { + _shift = (_this select 0); + _ctrl = (_this select 1); + _alt = (_this select 2); + _key = (_this select 3); + } + else + { + _shift = outlw_MR_shift; + _ctrl = outlw_MR_ctrl; + _alt = outlw_MR_alt; + _key = outlw_MR_keybinding; + }; + + _returnString = ""; + _q = '"'; + + if (_shift) then + { + _returnString = _returnString + "Shift+"; + }; + + if (_ctrl) then + { + _returnString = _returnString + "Ctrl+"; + }; + + if (_alt) then + { + _returnString = _returnString + "Alt+"; + }; + + _returnString = (_returnString + (keyName _key)); + + (_q + toString(toArray(_returnString) - [34]) + _q); +}; + +outlw_MR_openAbout = +{ + createDialog "MagRepack_Dialog_About"; + + ((uiNamespace getVariable "outlw_MR_Dialog_About") displayCtrl 1001) ctrlSetText ("Version: " + outlw_MR_version); + ((uiNamespace getVariable "outlw_MR_Dialog_About") displayCtrl 1003) ctrlSetText ("Updated: " + outlw_MR_date); + ((uiNamespace getVariable "outlw_MR_Dialog_About") displayCtrl 2400) ctrlSetStructuredText parseText "MMKAY"; +}; + + + + + diff --git a/addons/outlw_magrepack/config.hpp b/addons/outlw_magrepack/config.hpp new file mode 100644 index 000000000..4c23c7a1d --- /dev/null +++ b/addons/outlw_magrepack/config.hpp @@ -0,0 +1,4 @@ +#include "Configs\defines.hpp" +#include "Configs\MagRepack_Dialog_Main.hpp" +#include "Configs\MagRepack_Dialog_Keybindings.hpp" +#include "Configs\MagRepack_Dialog_About.hpp" diff --git a/addons/outlw_magrepack/readme.txt b/addons/outlw_magrepack/readme.txt new file mode 100644 index 000000000..f098e96dd --- /dev/null +++ b/addons/outlw_magrepack/readme.txt @@ -0,0 +1,105 @@ + +-------------- +| Mag Repack | +-------------- + + - Version: 3.1.1 + - Created: 7 March 2013 + - Updated: 5 December 2014 + +---------- +| Author | +---------- + + - Outlawled (outlawled@gmail.com) + +--------------- +| Description | +--------------- + + - Allows the player to repack the ammo in his magazines. + - Default keybinding to open the Mag Repack dialog is "Ctrl+R", this can be customized via the options menu in the Mag Repack dialog. + - Pressing "Alt+Shift+Ctrl+Backspace" will reset the keybinding to the default setting (in case the player forgets what he changed his keybinding to). + - The player may choose a magazine from a list of all of his magazines to be the "Source" magazine and then he may choose a magazine from a list of all of his magazines of the same ammo type as the Source magazine to be the "Target" magazine (or vice versa). As soon as the Source and Target are both defined, bullets from the Source magazine will automatically start repacking into the Target magazine. + +--------- +| Notes | +--------- + + - This mod requires CBA. + - Feel free to unpack the PBO and look through the code and change stuff, but please don't steal anything. That would not be tits. Just email me if you want to use any of my code in your own public release. + +---------------- +| Installation | +---------------- + + - Extract "@outlw_magRepack" folder to your ArmA 3 directory. + - "C:\Program Files (x86)\Steam\steamapps\common\Arma 3" for 64-bit Windows. + - "C:\Program Files\Steam\steamapps\common\Arma 3" for 32-bit Windows. + +------------- +| Changelog | +------------- + - 3.1.1 + - Fixed: RPT Error. + + - 3.1.0 + - Fixed: Error dialogs popping up about the scrollbars. + - Removed: Mag Repack logo from the bottom left of the main dialog. + - Overhauled keybinding system. It now allows just one key and any combination of Shift, Ctrl, and Alt modifiers. For example: "Ctrl+R", "Alt+J", "Shift+Ctrl+N", "Shift+Alt+Ctrl+Space", etc. + - Redesigned Keybinding dialog based on the new keybinding system. + - Magazine type (i.e. whether the magazine is a belt magazine or a regular magazine) is determined by the magazine's "nameSound" config entry instead of just being based on the magazine's capacity. + - Rewrote 40mm grenade conversion system so it no longer uses a predefined list. + + - 3.0.2 + - Fixed: Updated UI classnames to be unique so as to avoid possible conflicts. + - Fixed: An issue with the keybinding not being recognized if another key wasn't pressed between keybinding presses. + + - 3.0.1 + - New: Pressing the keybinding while the dialog is open will now close the dialog. + - Back-end optimizations. + - Adjusted size of the Mag Repack logo to be slightly smaller. + - Fixed: Now uses the keyName command to get the Strings associated with each keyboard key instead of having them hardcoded like an idiot. + - New: Can now change the bullet and belt repack times via outlw_MR_bulletTime and outlw_MR_beltTime variables (script version). + - All default repack times slightly increased. + - Fixed: Changed script version init file name to "MagRepack_init_sv.sqf" to avoid conflict when user has the addon version installed while playing on a server running the script version. + + - 3.0.0 + - Removed: Everything. + - New: Added a GUI. + - New: Players may now repack bullets from different types of magazines as long as both magazines use the same ammo. + - New: Players may now convert 1rnd 40mm magazines into 3rnd 40mm magazines and vice versa. + - New: Players may now change their keybinding. + - New: Optional debug info. + - Fixed: Added animations for prone, launchers, and no weapon. + + - 2.1.4 + - Reverted back to 2.1.2. + + - 2.1.3 + - Fixed: Now uses CBA's Extended Pre-Init EventHandlers instead of the Post-Init ones which were broken with the ArmA 3 Beta update. + + - 2.1.2 + - Fixed: Uses "hintSilent" instead of "hint" for most cases. + - Fixed: The sorting function is now a proper function available in the player's function library. + + - 2.1.1 + - Fixed: Now works with latest ArmA 3 Alpha Development Build + + - 2.1 + - Fixed: Changed a global variable to be less likely to cause mod incompatibility. + + - 2.0 + - New: Animation changed to 'Gear' animation. + - New: Magazine types are now repacked one by one. + - New: How long it takes to repack each magazine type depends on how many bullets of that magazine type need to be repacked. + - New: A magazine type can be skipped by pressing the 'Space' key. + - New: Repack can be exited by moving (if player is inside a vehicle, getting out will exit, pressing movement keys will do nothing). + - Fixed: Player can no longer repack magazines while in the driver, gunner, or commander seat of a vehicle. + - New: Informational hint after repacking now displays each individual magazine ammo count from before and after the repack. E.G. [15,16,12,5,3] >> [20,20,11] + - New: While repacking, a hint displays which magazine type is being repacked and the current ammo counts of each individual magazine of the current magazine type. + - Fixed: Vaulting and reloading are now disabled during repack. + + - 1.3 + - Initial release. + diff --git a/addons/parking/config.sqf b/addons/parking/config.sqf new file mode 100644 index 000000000..8b02bfc99 --- /dev/null +++ b/addons/parking/config.sqf @@ -0,0 +1,21 @@ + +//List of cities where private parking is available (empty or unset means all cities) +pp_cities_whitelist = ["Agios Konstantinos", "Ioannina", "Panagia", "Lakka", "Aggelochori", "Therisa", "Panochori", "Syrta"]; + +//whether or not to show map markers for private parking locations +pp_markers_enabled = true; + +//shape, type, color, size, text (for map markers, if enabled) +pp_markers_properties = ["ICON", "mil_dot", "ColorKhaki", [1.2,1.2], "Parking"]; + +//number of seconds to wait (after joining the sever) before a vehicle can be retrieved (0 = no wait) +pp_retrieve_wait = 300; + +//amount of money to charge player for retrieving a vehicle from parking (0 = no charge) +pp_retrieve_cost = 1500; + +//maximum number of vehicles that a player can park (0 = no limit) +pp_max_player_vehicles = 2; + +//List of class names for vehicles that are not allowed to be parked +pp_disallowed_vehicle_classes = []; diff --git a/addons/parking/constants.h b/addons/parking/constants.h new file mode 100644 index 000000000..42b43b9b8 --- /dev/null +++ b/addons/parking/constants.h @@ -0,0 +1,9 @@ +#define GUI_BCG_RGB {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"} +#define MENU_TITLE_FONT_HEIGHT (((((safezoneW / safezoneH) min 1.2) / 1.2) / 32) * 1) + +#define list_simple_menu_menu_dialog_idd 6001 +#define list_simple_menu_header_idc 6001 +#define list_simple_menu_background_idc 6002 +#define list_simple_menu_submit_button_idc 6003 +#define list_simple_menu_close_button_idc 6004 +#define list_simple_menu_list_idc 6005 diff --git a/addons/parking/functions.sqf b/addons/parking/functions.sqf new file mode 100644 index 000000000..692fef830 --- /dev/null +++ b/addons/parking/functions.sqf @@ -0,0 +1,5 @@ +call compile preprocessFileLineNumbers "addons\parking\config.sqf"; + +{ + call compile preprocessFileLineNumbers format["addons\parking\%1_functions.sqf", _x]; +} forEach ["misc", "list_simple_menu", "pp_interact", "pp_saving", "pp_actions"]; diff --git a/addons/parking/icons/parking.paa b/addons/parking/icons/parking.paa new file mode 100644 index 000000000..0353a026b Binary files /dev/null and b/addons/parking/icons/parking.paa differ diff --git a/addons/parking/list_simple_menu.hpp b/addons/parking/list_simple_menu.hpp new file mode 100644 index 000000000..6aa50726c --- /dev/null +++ b/addons/parking/list_simple_menu.hpp @@ -0,0 +1,66 @@ +#include "constants.h" + +class list_simple_menu { + idd = list_simple_menu_menu_dialog_idd; + movingEnable = true; + controlsBackground[] = {list_simple_menu_background}; + objects[] = { }; + + name = "LIST_SIMPLE_MENU"; + onUnload = ""; + onLoad="uiNamespace setVariable ['LIST_SIMPLE_MENU',_this select 0]"; + + controls[] = { + list_simple_menu_header, + list_simple_menu_select_button, + list_simple_menu_close_button, + list_simple_menu_list + }; + + class list_simple_menu_header : gui_RscMenuTitle { + idc = list_simple_menu_header_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + style = ST_CENTER; + font = "PuristaBold"; + SizeEX = 0.03; + colorBackground[] = GUI_BCG_RGB; + text = "list_simple"; + moving = 1; + }; + + class list_simple_menu_background : gui_RscBackground { + idc = list_simple_menu_background_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + moving = 1; + }; + + class list_simple_menu_select_button : gui_RscMenuButton { + idc = list_simple_menu_submit_button_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + font = "PuristaBold"; + SizeEX = 0.03; + text = "Select"; + }; + + class list_simple_menu_close_button : gui_RscMenuButton { + idc = list_simple_menu_close_button_idc; + x = -10; y = -10; + w = 0.05; h = 0.05; + font = "PuristaBold"; + SizeEX = 0.03; + text = "Close"; + action = "closedialog 0;"; + }; + + class list_simple_menu_list : gui_RscListBox { + idc = list_simple_menu_list_idc; + //x = -10; y = -10; + //w = 0.05; h = 0.50; + x = 0.15; y = 0.198; + w = 0.53; h = 0.334; + rowHeight = 0.065; + }; +}; \ No newline at end of file diff --git a/addons/parking/list_simple_menu_functions.sqf b/addons/parking/list_simple_menu_functions.sqf new file mode 100644 index 000000000..1a075e800 --- /dev/null +++ b/addons/parking/list_simple_menu_functions.sqf @@ -0,0 +1,131 @@ +if (!isNil "list_simple_menu_functions_defined") exitWith {}; +diag_log format["Loading list simple menu functions ... "]; + +#include "constants.h" +#include "macro.h" + + +list_simple_menu_header = 0; +list_simple_menu_list = 1; +list_simple_menu_submit = 2; +list_simple_menu_close = 3; + +list_simple_menu_label_data = { + private["_index"]; + _index = lbCurSel (list_simple_menu_list_idc); + if (_index < 0) exitWith {nil}; + + private["_data"]; + _data = (lbData [list_simple_menu_list_idc,_index]); + if (undefined(_data)) exitWith {nil}; + _data +}; + +list_simple_menu_setup = { + disableSerialization; + ARGVX3(0,_title,""); + ARGVX3(1,_x,0); + ARGVX3(2,_y,0); + ARGVX3(3,_w,0); + ARGVX3(4,_h,0); + + if (!(createDialog "list_simple_menu")) exitWith { + player groupChat format["ERROR: Could not create list simple menu dialog"]; + }; + + private["_display"]; + _display = (uiNamespace getVariable 'LIST_SIMPLE_MENU'); + + _list_simple_menu_header = _display displayCtrl list_simple_menu_header_idc; + _list_simple_menu_background = _display displayCtrl list_simple_menu_background_idc; + _list_simple_menu_select_button = _display displayCtrl list_simple_menu_submit_button_idc; + _list_simple_menu_close_button = _display displayCtrl list_simple_menu_close_button_idc; + _list_simple_menu_list = _display displayCtrl list_simple_menu_list_idc; + + private["_ysep","_sep","_header_title"]; + _ysep = 0.003; + _sep = 0.01; + _header_title = _title; + + private["_button_font_height","_font_family"]; + _button_font_height = MENU_TITLE_FONT_HEIGHT; + _font_family = "PuristaMedium"; + + //header + private["_lhx","_lhy","_lhw","_lhh"]; + _lhx = _x; + _lhy = _y; + _lhw = _w; + _lhh = 0.045; + + _list_simple_menu_header ctrlSetPosition [_lhx,_lhy,_lhw,_lhh]; + _list_simple_menu_header ctrlSetFontHeight _button_font_height; + _list_simple_menu_header ctrlSetFont _font_family; + _list_simple_menu_header ctrlSetText _header_title; + _list_simple_menu_header ctrlCommit 0; + + + //background + private["_lbx","_lby","_lbw","_lbh"]; + _lbx = _lhx; + _lby = _lhy + _lhh + _ysep; + _lbw = _w; + _lbh = _h - _lhh - _lhh - _ysep - _ysep; + + _list_simple_menu_background ctrlSetPosition [_lbx,_lby,_lbw,_lbh]; + _list_simple_menu_background ctrlSetBackgroundColor [0,0,0,0.65]; + _list_simple_menu_background ctrlCommit 0; + + //select button + private["_lsx","_lsy","_lsw","_lsh"]; + _lsw = 0.20; + _lsh = _lhh; + _lsx = _lhx; + _lsy = _lby + _lbh + _ysep; + + _list_simple_menu_select_button ctrlSetText "Submit"; + _list_simple_menu_select_button ctrlSetPosition [_lsx,_lsy,_lsw,_lsh]; + _list_simple_menu_select_button ctrlCommit 0; + + + //close button + private["_lcx","_lcy","_lcw","_lch"]; + _lcw = 0.14; + _lch = _lhh; + _lcx = _lhx + _lhw - _lcw; + _lcy = _lhy + _h - _lch; + + _list_simple_menu_close_button ctrlSetText "Close"; + _list_simple_menu_close_button ctrlSetPosition [_lcx,_lcy,_lcw,_lch]; + buttonSetAction [(ctrlIDC _list_simple_menu_close_button),"closeDialog 0"]; + _list_simple_menu_close_button ctrlCommit 0; + + //list + private["_llx","_lly","_llw","_llh"]; + _llx = _lbx + _sep ; + _lly = _lby + _sep; + _llw = _lhw - _sep * 2; + _llh = _lbh - _sep * 2; + + _list_simple_menu_list ctrlSetText ""; + _list_simple_menu_list ctrlSetPosition [_llx,_lly,_llw,_llh]; + _list_simple_menu_list ctrlSetFontHeight _button_font_height - 0.0015; + _list_simple_menu_list ctrlCommit 0; + + private["_controls"]; + + _controls = []; + _controls set [list_simple_menu_header,_list_simple_menu_header]; + _controls set [list_simple_menu_list,_list_simple_menu_list]; + _controls set [list_simple_menu_submit,_list_simple_menu_select_button]; + _controls set [list_simple_menu_close,_list_simple_menu_close_button]; + + _controls +}; + + + + +list_simple_menu_functions_defined = true; + +diag_log format["Loading list simple menu functions complete"]; \ No newline at end of file diff --git a/addons/parking/macro.h b/addons/parking/macro.h new file mode 100644 index 000000000..992461961 --- /dev/null +++ b/addons/parking/macro.h @@ -0,0 +1,146 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} diff --git a/addons/parking/misc_functions.sqf b/addons/parking/misc_functions.sqf new file mode 100644 index 000000000..6803a7a55 --- /dev/null +++ b/addons/parking/misc_functions.sqf @@ -0,0 +1,81 @@ +if (!isNil "parking_misc_functions_defined") exitWith {}; +diag_log format["Loading parking misc functions"]; + +#include "macro.h" + +generic_picture_path = { + ARGVX3(0,_id,""); + ([_id, "picture"] call generic_config_text) +}; + +generic_display_name = { + ARGVX3(0,_id,""); + ([_id, "displayName"] call generic_config_text) +}; + +generic_icon_path = { + ARGVX3(0,_id,""); + ([_id, "icon"] call generic_config_text) +}; + +generic_config_text = { + ARGVX3(0,_id,""); + ARGVX3(1,_field,""); + + if (_id == "" || {_field == ""}) exitWith {""}; + + if (isClass(configFile >> "CfgWeapons" >> _id)) exitWith { + (getText(configFile >> "CfgWeapons" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgVehicles" >> _id)) exitWith { + (getText(configFile >> "CfgVehicles" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgMagazines" >> _id)) exitWith { + (getText(configFile >> "CfgMagazines" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgAmmos" >> _id)) exitWith { + (getText(configFile >> "CfgAmmos" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgGlasses" >> _id)) exitWith { + (getText(configFile >> "CfgGlasses" >> _id >> _field)) + }; + + "" +}; + +format_integer = { + private["_value", "_nan", "_separator"]; + _nan = "NotANumber"; + _value = _this select 0; + _separator = _this select 1; + + if (undefined(_value)) exitWith {_nan}; + if (typeName _value != "SCALAR") exitWith {_nan}; + + if (_value == 0) exitWith {"0"}; + + private["_string_value", "_digits", "_remainder", "_sign"]; + _string_value = ""; + _digits = 0; + _sign = if (_value < 0) then {"-"} else {""}; + _value = abs(round(_value)); + while { _value >= 1 } do { + _digits = _digits + 1; + if ( _digits > 1 && ((_digits - 1) % 3) == 0) then { + _string_value = _separator + _string_value; + }; + _remainder = _value % 10; + _string_value = str(_remainder) + _string_value; + _value = floor(_value / 10); + }; + + _sign+_string_value +}; + + +diag_log format["Loading parking misc functions complete"]; +parking_misc_functions_defined = true; \ No newline at end of file diff --git a/addons/parking/pp_actions_functions.sqf b/addons/parking/pp_actions_functions.sqf new file mode 100644 index 000000000..e2a5e707d --- /dev/null +++ b/addons/parking/pp_actions_functions.sqf @@ -0,0 +1,433 @@ +//if (!isNil "parking_functions_defined") exitWith {}; +diag_log format["Loading parking functions ..."]; + +#include "macro.h" + +#define strM(x) ([x,","] call format_integer) + +pp_marker_create = { + ARGVX3(0,_name,""); + ARGVX3(1,_location,[]); + ARGVX3(2,_this,[]); + + ARGVX3(0,_shape,""); + ARGVX3(1,_type,""); + ARGVX3(2,_color,""); + ARGVX3(3,_size,[]); + ARGVX3(4,_text,""); + + private["_marker"]; + _marker = createMarker [_name,_location]; + + _marker setMarkerShapeLocal _shape; + _marker setMarkerTypeLocal _type; + _marker setMarkerColorLocal _color; + _marker setMarkerSizeLocal _size; + //_marker setMarkerTextLocal _text; + (_marker) +}; + +pp_get_all_cities = { + if (isARRAY(pp_all_cities)) exitWith {pp_get_all_cities}; + pp_get_all_cities = (nearestLocations [[0,0,0],["NameCityCapital","NameCity","NameVillage"],1000000]); + (pp_get_all_cities) +}; + +pp_markers_list = OR(pp_markers_list,[]); +pp_terminals_list = OR(pp_terminals_list,[]); + +{ + deleteVehicle _x; +} forEach pp_terminals_list; + +{ + deleteMarker _x; +} forEach pp_markers_list; + +pp_create_terminal = { + //Land_Laptop_unfolded_F + ARGVX3(0,_garage,objNull); + + def(_pos); + def(_terminal); + + _pos = _garage modelToWorld [-5,0.45,-1.485]; + _garage allowDamage false; + + _terminal = createVehicle ["Land_CampingTable_small_F", _pos, [], 0, ""]; + _terminal setPos _pos; + _terminal setVectorDirAndUp [([vectorDir _garage,90] call BIS_fnc_rotateVector2D), vectorUp _garage]; + _terminal attachTo [_garage, [0,0,0]]; + _terminal allowDamage false; + //_terminal enableSimulation false; + _terminal setVariable ["is_parking", true, true]; + _terminal setVariable ["R3F_LOG_disabled", true]; //don't allow players to move the table + _terminal attachTo [_terminal, [0,0,0]]; + detach _terminal; + + def(_laptop); + _laptop = createVehicle ["Land_Laptop_unfolded_F", _pos, [], 0, ""]; + _laptop setPos getPos _terminal; + _laptop attachTo [_terminal, [0,-0.1,0.55]]; + _laptop setVariable ["is_parking", true, true]; + _laptop setVariable ["R3F_LOG_disabled", true]; //don't allow players to move the laptop + + + pp_terminals_list pushBack _terminal; + pp_terminals_list pushBack _laptop; + + (_pos) +}; + +pp_create_terminals = { + def(_town); + def(_town_pos); + def(_town_name); + def(_garage); + def(_terminal); + def(_model); + def(_pos); + def(_name); + def(_marker); + init(_i,0); + + + {if (true) then { + _town = _x; + _town_name = text(_town); + _town_pos = position _town; + if (isARRAY(pp_cities_whitelist) && {count(pp_cities_whitelist) > 0 && {not(_town_name in pp_cities_whitelist)}}) exitWith {}; + + _garage = (nearestObjects [_town_pos, ["Land_i_Shed_Ind_F"], 300]) select 0; + if (!isOBJECT(_garage)) exitWith { + diag_log format["No garage in %1", _town_name]; + }; + + _name = format["parking_terminal_%1", _i]; + _i = _i + 1; + + _pos = [_garage] call pp_create_terminal; + + diag_log format["Creating parking terminal at: %1 (%2)", _town_name, _pos]; + + if (pp_markers_enabled) then { + _marker = [_name, _pos, pp_markers_properties] call pp_marker_create; + pp_markers_list pushBack _marker; + }; + + }} foreach (call pp_get_all_cities); +}; + +pp_get_near_vehicles = { + ARGVX4(0,_player,objNull,[]); + + def(_vehicles); + _vehicles = (nearestObjects [getPos _player, ["Helicopter", "Plane", "Ship_F", "Car", "Motorcycle", "Tank"], 50]); + + init(_filtered,[]); + def(_uid); + _uid = getPlayerUID player; + + def(_ownerUID); + def(_vehicle); + + {if (true) then { + _vehicle = _x; + if (not(isOBJECT(_vehicle) && {alive _vehicle})) exitWith {}; + + _ownerUID = _vehicle getVariable ["ownerUID", ""]; + if(!isSTRING(_ownerUID)) exitWith {}; + if (_ownerUID == "" || {_ownerUID == _uid}) exitWith { + _filtered pushBack _vehicle; + }; + + };} forEach _vehicles; + + (_filtered) +}; + + + +pp_join_time = diag_tickTime; //time when the player joined the server + +pp_get_wait_time = { + ARGVX4(0,_vehicle_id,"",0); + + if (not(isSCALAR(pp_retrieve_wait)) || {pp_retrieve_wait <= 0}) exitWith {0}; + + def(_cooldown_start_name); + _cooldown_start_name = format["%1_cooldown_start", _vehicle_id]; + + + def(_cooldown_start); + _cooldown_start = missionNamespace getVariable _cooldown_start_name; + + if (!isSCALAR(_cooldown_start)) then { + _cooldown_start = pp_join_time; + missionNamespace setVariable [_cooldown_start_name, _cooldown_start]; + }; + + def(_time_elapsed); + _time_elapsed = diag_tickTime - _cooldown_start; + + def(_time_remaining); + _time_remaining = pp_retrieve_wait - _time_elapsed; + + if (_time_remaining <= 0) then { + missionNamespace setVariable [_cooldown_start_name, nil]; + }; + + (_time_remaining) +}; + +pp_retrieve_transaction_ok = { + ARGVX4(0,_player,objNull,true); + ARGVX4(1,_cost,0,true); + ARGVX3(2,_class,"",true) + + def(_cmoney); + _cmoney = _player getVariable ["cmoney",0]; + if (_cost > _cmoney) exitWith { + _player groupChat format["%1, you do not have enough money to retrieve the %2", (name _player), ([_class] call generic_display_name)]; + false + }; + + _player setVariable ["cmoney", _cmoney - _cost, true]; + true +}; + +pp_retrieve_allowed = { + ARGVX4(0,_player,objNull, true); + ARGVX4(1,_vehicle_id,"",true); + ARGVX4(2,_class,"", true); + + //check if there is a cool-down period + def(_wait_time); + _wait_time = [_vehicle_id] call pp_get_wait_time; + if (isSCALAR(_wait_time) && {_wait_time > 0 }) exitWith { + _player groupChat format["%1, you have to wait %2 more sec(s) to retrieve the %3", (name _player), ceil(_wait_time), ([_class] call generic_display_name)]; + false + }; + + //check if thereis a price for retrieving the vehicle + if (isSCALAR(pp_retrieve_cost) && {pp_retrieve_cost > 0}) exitWith { + init(_cost,pp_retrieve_cost); + _msg = format["It's going to cost you $%1 to retrieve the %2. Do you want to proceed?", strM(_cost), ([_class] call generic_display_name)]; + + if (not([_msg, "Confirm", "Yes", "No"] call BIS_fnc_guiMessage)) exitWith {false}; + if (not([_player, _cost] call pp_retrieve_transaction_ok)) exitWith {false}; + + true + }; + + true +}; + +pp_park_allowed = { + ARGVX4(0,_player,objNull, true); + ARGVX4(1,_vehicle_id,"",true); + ARGVX4(2,_class,"", true); + + if (isARRAY(pp_disallowed_vehicle_classes) && {count(pp_disallowed_vehicle_classes) > 0 && { ({_class isKindOf _x} count pp_disallowed_vehicle_classes) > 0}}) exitWith { + _msg = format["This vehicle (%1) is not allowed to be parked.", ([_class] call generic_display_name)]; + [_msg, "Illegal Parking", "Ok", false] call BIS_fnc_guiMessage; + false + }; + + def(_parked_vehicles); + _parked_vehicles = _player getVariable ["parked_vehicles", []]; + init(_count,count(_parked_vehicles)); + + //check if the parking is full + if (isSCALAR(pp_max_player_vehicles) && {pp_max_player_vehicles > 0 && {_count >= pp_max_player_vehicles}}) exitWith { + _msg = format["You already have %1 vehicle(s) parked. There are no more parking spaces available.", _count]; + [_msg, "Full Parking", "Ok", false] call BIS_fnc_guiMessage; + false + }; + + true +}; + + + +pp_park_vehicle_action = { + init(_player,player); + + def(_vehicles); + _vehicles = [_player] call pp_get_near_vehicles; + + def(_vehicle_id); + _vehicle_id = ["Park Vehicle", _vehicles] call pp_interact_park_vehicle_wait; + + if (!isSTRING(_vehicle_id)) exitWith { + //_player groupChat format["%1, you did not select any vehicle to park", (name _player)]; + }; + + + _vehicle = objectFromNetId _vehicle_id; + if (!isOBJECT(_vehicle)) exitWith { + _player groupChat format["%1, the vehicle you selected to park could not be found", (name _player)]; + }; + + def(_class); + _class = typeOf _vehicle; + + if (not([_player, _vehicle_id, _class] call pp_park_allowed)) exitWith {}; + + + _player groupChat format["Please wait while we park your %1", ([typeOf _vehicle] call generic_display_name)]; + [_player, _vehicle] call pp_park_vehicle; +}; + +pp_retrieve_vehicle_action = { + init(_player,player); + + def(_parked_vehicles); + _parked_vehicles = _player getVariable "parked_vehicles"; + _parked_vehicles = if (isARRAY(_parked_vehicles)) then {_parked_vehicles} else {[]}; + + + def(_vehicle_id); + _vehicle_id = ["Retrieve Vehicle", _parked_vehicles] call pp_interact_park_vehicle_wait; + + + if (!isSTRING(_vehicle_id)) exitWith { + //_player groupChat format["%1, you did not select any vehicle to retreive", (name _player)]; + }; + + def(_vehicle_data); + _vehicle_data = [_parked_vehicles, _vehicle_id] call fn_getFromPairs; + + if (!isARRAY(_vehicle_data)) exitWith { + player groupChat format["ERROR: The selected vehicle (%1) was not found", _vehicle_id]; + }; + + def(_class); + _class = [_vehicle_data, "Class"] call fn_getFromPairs; + + if (not([_player, _vehicle_id, _class] call pp_retrieve_allowed)) exitWith {}; + + _player groupChat format["Please wait while we retrieve your %1", ([_class] call generic_display_name)]; + [player, _vehicle_id] call pp_retrieve_vehicle; +}; + + +pp_cameraDir = { + ([(positionCameraToWorld [0,0,0]), (positionCameraToWorld [0,0,1])] call BIS_fnc_vectorDiff) +}; + +pp_is_object_parking = { + ARGVX4(0,_obj,objNull,false); + (_obj getVariable ["is_parking", false]) +}; + +pp_is_player_near = { + private["_pos1", "_pos2"]; + _pos1 = (eyePos player); + _pos2 = ([_pos1, call pp_cameraDir] call BIS_fnc_vectorAdd); + + private["_objects"]; + _objects = lineIntersectsWith [_pos1,_pos2,objNull,objNull,true]; + if (isNil "_objects" || {typeName _objects != typeName []}) exitWith {false}; + + + private["_found"]; + _found = false; + { + if ([_x] call pp_is_object_parking) exitWith { + _found = true; + }; + } forEach _objects ; + + (_found) +}; + +pp_actions = OR(pp_actions,[]); + +pp_remove_actions = { + if (count pp_actions == 0) exitWith {}; + + { + private["_action_id"]; + _action_id = _x; + player removeAction _action_id; + } forEach pp_actions; + pp_actions = []; +}; + +pp_add_actions = { + if (count pp_actions > 0) exitWith {}; + private["_player"]; + _player = _this select 0; + + private["_action_id", "_text"]; + _action_id = _player addAction [" Park Vehicle", {call pp_park_vehicle_action}]; + pp_actions = pp_actions + [_action_id]; + + _action_id = _player addAction [" Retrieve Vehicle", {call pp_retrieve_vehicle_action}]; + pp_actions = pp_actions + [_action_id]; +}; + +pp_check_actions = { + private["_player"]; + _player = player; + private["_vehicle", "_in_vehicle"]; + _vehicle = (vehicle _player); + _in_vehicle = (_vehicle != _player); + + if (not(_in_vehicle || {not(alive _player) || {not(call pp_is_player_near)}})) exitWith { + [_player] call pp_add_actions; + }; + + [_player] call pp_remove_actions; +}; + +//this is a hack so that markers sync for JIP (Join in Progress) players +pp_sync_markers = { + { + _x setMarkerColor markerColor _x ; + } forEach allMapMarkers; +}; + + +pp_client_loop_stop = false; +pp_client_loop = { + if (not(isClient)) exitWith {}; + private ["_pp_client_loop_i"]; + _pp_client_loop_i = 0; + + while {_pp_client_loop_i < 5000 && not(pp_client_loop_stop)} do { + call pp_check_actions; + sleep 0.5; + _pp_client_loop_i = _pp_client_loop_i + 1; + }; + [] spawn pp_client_loop; +}; + + +pp_setup_terminals = { + if (not(isClient)) then { //FIXME: Need to change this to not(isClient) + diag_log format["Setting up parking terminals ... "]; + [] call pp_create_terminals; + pp_setup_terminals_complete = true; + publicVariable "pp_setup_terminals_complete"; + diag_log format["Setting up parking terminals complete"]; + + ["pp_sync_markers", "onPlayerConnected", { [] spawn pp_sync_markers}] call BIS_fnc_addStackedEventHandler; + }; + + if (isClient) then { + diag_log format["Waiting for parking terminals setup to complete ..."]; + waitUntil {not(isNil "pp_setup_terminals_complete")}; + diag_log format["Waiting for parking terminals setup to complete ... done"]; + }; +}; + +[] call pp_setup_terminals; +[] spawn pp_client_loop; + +parking_functions_defined = true; +diag_log format["Loading parking functions complete"]; + + + diff --git a/addons/parking/pp_interact_functions.sqf b/addons/parking/pp_interact_functions.sqf new file mode 100644 index 000000000..bbf43d315 --- /dev/null +++ b/addons/parking/pp_interact_functions.sqf @@ -0,0 +1,83 @@ +if (!isNil "parking_interact_functions") exitWith {}; +diag_log format["Loading parking interact functions ..."]; + +#include "constants.h" +#include "macro.h" + + +pp_interact_select_vehicle = { + ARGVX3(0,_vehicle_id,""); + if (_vehicle_id == "") exitWith {nil}; + + pp_interact_selected_vehicle = _vehicle_id; + closeDialog 0; + _vehicle_id +}; + +pp_interact_park_vehicle_wait = { + //player groupChat format["interact_select_vehicle_wait %1",_this]; + disableSerialization; + ARGVX3(0,_title,""); + ARGVX3(1,_vehicle_list,[]); + + pp_interact_selected_vehicle = nil; + + def(_controls); + def(_list); + def(_submit); + + _controls = [toUpper(_title),0.14,0.14,0.55,0.45] call list_simple_menu_setup; + if (!isARRAY(_controls)) exitWith { + player groupChat format["ERROR: Could not setup dialog for parking vehicles"]; + nil + }; + + _list = _controls select list_simple_menu_list; + _submit = _controls select list_simple_menu_submit; + + _submit ctrlSetText "Select"; + + buttonSetAction [(ctrlIDC _submit),'[([] call list_simple_menu_label_data)] call pp_interact_select_vehicle;']; + + _submit ctrlCommit 0; + + interact_selected_vehicle = nil; + + {if(true) then { + init(_vehicle_data,_x); + + def(_vehicle_id); + def(_class); + + if (isOBJECT(_vehicle_data) && {alive _vehicle_data}) then { + init(_vehicle,_vehicle_data); + _vehicle_id = netId _vehicle; + _class = typeOf _vehicle; + } + else { if (isARRAY(_vehicle_data)) then { + _vehicle_id = _vehicle_data select 0; + _vehicle_data = _vehicle_data select 1; + _class = [_vehicle_data, "Class"] call fn_getFromPairs; + };}; + + if (isNil "_class") exitWith {}; + + def(_picture); + def(_name); + _name = [_class] call generic_display_name; + _picture = [_class] call generic_picture_path; + + def(_index); + _index = _list lbAdd format["%1 (%2)",_name, _vehicle_id]; + _list lbSetData [_index, _vehicle_id]; + _list lbSetPicture [_index, _picture]; + };} forEach _vehicle_list; + + _list lbSetCurSel 0; + waitUntil {(not(isNil "pp_interact_selected_vehicle") || {not(ctrlShown _list)})}; + + OR(pp_interact_selected_vehicle,nil); +}; + +diag_log format["Loading parking interact functions complete"]; +parking_interact_functions_defined = true; \ No newline at end of file diff --git a/addons/parking/pp_saving_functions.sqf b/addons/parking/pp_saving_functions.sqf new file mode 100644 index 000000000..e614134b1 --- /dev/null +++ b/addons/parking/pp_saving_functions.sqf @@ -0,0 +1,191 @@ +if (!isNil "parking_saving_functions_defined") exitWith {}; +diag_log format["Loading parking saving functions ..."]; + +#include "macro.h" + +if (not(isClient)) then { + pp_notify = { + //diag_log format["%1 call pp_notify", _this]; + ARGVX3(0,_player,objNull); + ARGVX3(1,_msg,""); + ARGV3(2,_dialog,""); + + + pp_notify_request = [_msg,OR(_dialog,nil)]; + (owner _player) publicVariableClient "pp_notify_request"; + }; + + pp_mark_vehicle = { + //diag_log format["%1 call pp_create_mark_vehicle", _this]; + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + pp_mark_vehicle_request = [_vehicle]; + (owner _player) publicVariableClient "pp_mark_vehicle_request"; + }; + + pp_is_safe_position = { + ARGVX3(0,_player,objNull); + ARGVX3(1,_class,""); + ARGVX3(2,_position,[]); + + def(_classes); + _classes = ["Helicopter", "Plane", "Ship_F", "Car", "Motorcycle", "Tank"]; + + def(_size); + _size = sizeof _class; + + ((_position distance _player) < 30 && { + (count(nearestObjects [_position, _classes , _size]) == 0)}) + }; + + pp_park_vehicle_request_handler = { + ARGVX3(1,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + if (not(alive _vehicle)) exitWith {}; + + def(_uid); + _uid = getPlayerUID _player; + + diag_log format["Parking vehicle %1(%2) for player %3(%4)", typeOf _vehicle, netId _vehicle, (name _player), _uid]; + + def(_parked_vehicles); + _parked_vehicles = _player getVariable "parked_vehicles"; + _parked_vehicles = OR(_parked_vehicles,[]); + + def(_added); + _added = [_parked_vehicles, _vehicle, false] call v_addSaveVehicle; + if (isNil "_added") exitWith { + diag_log format["ERROR: Could not park vehicle %1(%2) for player %3(%4)", typeOf _vehicle, netId _vehicle, (name _player), _uid]; + [_player, format["The %1 needs to be saved before you can park it.", ([typeOf _vehicle] call generic_display_name)], "Parking Error"] call pp_notify; + }; + + def(_display_name); + _display_name = [typeOf _vehicle] call generic_display_name; + + deleteVehicle _vehicle; + + _player setVariable ["parked_vehicles", _parked_vehicles, true]; + [_player, format["%1, your %2 has been parked.", (name _player), _display_name]] call pp_notify; + }; + + pp_retrieve_vehicle_request_handler = { + ARGVX3(1,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle_id, ""); + + def(_uid); + _uid = getPlayerUID _player; + + diag_log format["Retrieving parked vehicle %1 for player %2(%3)", _vehicle_id, (name _player), _uid]; + + def(_parked_vehicles); + _parked_vehicles = _player getVariable "parked_vehicles"; + _parked_vehicles = OR(_parked_vehicles,[]); + + def(_vehicle_data); + _vehicle_data = [_parked_vehicles, _vehicle_id] call fn_getFromPairs; + + if (!isARRAY(_vehicle_data)) exitWith { + diag_log format["ERROR: Could not retrieve vehicle %1 for player %2(%3)", _vehicle_id, (name _player), _uid]; + [_player, format["Your vehicle (%2) could not be retrieved. Please report this error to A3Armory.com.", _vehicle_id], "Retrieval Error"] call pp_notify; + }; + + def(_position); + _position = [_vehicle_data, "Position"] call fn_getFromPairs; + + def(_class); + _class = [_vehicle_data, "Class"] call fn_getFromPairs; + + def(_create_array); + if (not([_player,_class,_position] call pp_is_safe_position)) then { + //we don't have an exact safe position, let the game figure one out + _create_array = [_class, getPos _player, [], 30, "NONE"]; + }; + + def(_vehicle); + _vehicle = [[_vehicle_id, _vehicle_data], true,OR(_create_array,nil)] call v_restoreVehicle; + + if (isNil "_vehicle") exitWith { + diag_log format["ERROR: Could not restore vehicle %1 for player %2(%3)", _vehicle_id, (name _player), _uid]; + [_player, format["Your vehicle (%1) could not be restored. Please report this error to A3Armory.com.", _vehicle_id], "Restoring Error"] call pp_notify; + }; + + [_parked_vehicles, _vehicle_id] call fn_removeFromPairs; + _player setVariable ["parked_vehicles", _parked_vehicles, true]; + + def(_display_name); + _display_name = [typeOf _vehicle] call generic_display_name; + [_player, format["%1, your %2 has been retrieved (marked on map)", (name _player), _display_name]] call pp_notify; + [_player, _vehicle] call pp_mark_vehicle; + }; + + "pp_park_vehicle_request" addPublicVariableEventHandler {_this call pp_park_vehicle_request_handler;}; + "pp_retrieve_vehicle_request" addPublicVariableEventHandler {_this call pp_retrieve_vehicle_request_handler;}; + +}; + +if (isClient) then { + pp_notify_request_handler = {_this spawn { + //diag_log format["%1 call pp_notify_request_handler", _this]; + ARGVX3(1,_this,[]); + ARGVX3(0,_msg,""); + ARGV3(1,_dialog,""); + + if (isSTRING(_dialog)) exitWith { + [_msg, _dialog, "OK", false] call BIS_fnc_guiMessage; + }; + + player groupChat _msg; + };}; + + "pp_notify_request" addPublicVariableEventHandler {_this call pp_notify_request_handler}; + + pp_mark_vehicle_request_handler = {_this spawn { + //diag_log format["%1 call pp_mark_vehicle_request_handler", _this]; + ARGVX3(1,_this,[]); + ARGVX3(0,_vehicle,objNull); + + sleep 3; //give enough time for the vehicle to be move to the correct location (before marking) + def(_class); + _class = typeOf _vehicle; + + def(_name); + _name = [_class] call generic_display_name; + + def(_pos); + _pos = getPos _vehicle; + + def(_marker); + _marker = format["pp_vehicle_marker_%1", ceil(random 1000)]; + _marker = createMarkerLocal [_marker, _pos]; + _marker setMarkerTypeLocal "waypoint"; + _marker setMarkerPosLocal _pos; + _marker setMarkerColorLocal "ColorBlue"; + //_marker setMarkerTextLocal _name; + + [_marker] spawn { + ARGVX3(0,_marker,""); + sleep 60; + deleteMarkerLocal _marker; + }; + };}; + + "pp_mark_vehicle_request" addPublicVariableEventHandler {_this call pp_mark_vehicle_request_handler}; + + pp_park_vehicle = { + pp_park_vehicle_request = _this; + publicVariableServer "pp_park_vehicle_request"; + }; + + pp_retrieve_vehicle = { + pp_retrieve_vehicle_request = _this; + publicVariableServer "pp_retrieve_vehicle_request"; + }; +}; + + +diag_log format["Loading parking saving functions complete"]; +parking_saving_functions_defined = true; \ No newline at end of file diff --git a/addons/proving_ground/CfgExplorer2/config.hpp b/addons/proving_ground/CfgExplorer2/config.hpp deleted file mode 100644 index 1b0e5279c..000000000 --- a/addons/proving_ground/CfgExplorer2/config.hpp +++ /dev/null @@ -1,382 +0,0 @@ -#define TitleBarH 0.07 * SafeZoneH -#define EXPL_VERSION Version 2.02 -#define EXPL_TITLE Config Explorer by HeliJunkie - -// Control types -#define CT_STATIC 0 -#define CT_BUTTON 1 -#define CT_EDIT 2 -#define CT_SLIDER 3 -#define CT_COMBO 4 -#define CT_LISTBOX 5 -#define CT_TOOLBOX 6 -#define CT_CHECKBOXES 7 -#define CT_PROGRESS 8 -#define CT_HTML 9 -#define CT_STATIC_SKEW 10 -#define CT_ACTIVETEXT 11 -#define CT_TREE 12 -#define CT_STRUCTURED_TEXT 13 -#define CT_CONTEXT_MENU 14 -#define CT_CONTROLS_GROUP 15 -#define CT_SHORTCUTBUTTON 16 -#define CT_XKEYDESC 40 -#define CT_XBUTTON 41 -#define CT_XLISTBOX 42 -#define CT_XSLIDER 43 -#define CT_XCOMBO 44 -#define CT_ANIMATED_TEXTURE 45 -#define CT_OBJECT 80 -#define CT_OBJECT_ZOOM 81 -#define CT_OBJECT_CONTAINER 82 -#define CT_OBJECT_CONT_ANIM 83 -#define CT_LINEBREAK 98 -#define CT_USER 99 -#define CT_MAP 100 -#define CT_MAP_MAIN 101 -#define CT_LISTNBOX 102 - -// Static styles -#define ST_POS 0x0F -#define ST_HPOS 0x03 -#define ST_VPOS 0x0C -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 -#define ST_DOWN 0x04 -#define ST_UP 0x08 -#define ST_VCENTER 0x0c - -#define ST_TYPE 0xF0 -#define ST_SINGLE 0 -#define ST_MULTI 16 -#define ST_TITLE_BAR 32 -#define ST_PICTURE 48 -#define ST_FRAME 64 -#define ST_BACKGROUND 80 -#define ST_GROUP_BOX 96 -#define ST_GROUP_BOX2 112 -#define ST_HUD_BACKGROUND 128 -#define ST_TILE_PICTURE 144 -#define ST_WITH_RECT 160 -#define ST_LINE 176 - -#define ST_SHADOW 0x100 -#define ST_NO_RECT 0x200 -#define ST_KEEP_ASPECT_RATIO 0x800 - -#define ST_TITLE ST_TITLE_BAR + ST_CENTER - -// Color defines -// #define CA_UI_HUD_Green {0.600,0.8392,0.4706,1.0} -// #define CA_IGUI_GreenDark {0.659,0.863,0.549,1} -// #define CA_IGUI_Green {0.6000,0.8392,0.4706,1.0} -// #define CA_IGUI_Green_Transparent {0.6000,0.8392,0.4706,0.75} -// #define CA_IGUI_Red {0.706,0.0745,0.0196,1} -// #define CA_IGUI_Orange {0.863,0.584,0.0,1} -// #define CA_IGUI_Blue {0.196,0.592,0.706, 1} -// #define CA_IGUI_Grey {0.606,0.606,0.606,1} -// #define CA_IGUI_Background {0.1882,0.2588,0.1490,0.76} -// #define CA_IGUI_DarkGreen {0.424,0.651,0.247, 1} -// #define Color_White {0.95, 0.95, 0.95, 1} -// #define Color_Black {0.023529, 0, 0.0313725, 1} -// #define Color_Gray {1, 1, 1, 0.5} -// #define Color_Orange {1, 0.537, 0, 1} - -// #define Color_OA_Text {0.8784, 0.8471, 0.651, 1} - - -// Text Size -#define TextSize_small SafeZoneH * 0.016 -#define TextSize_normal SafeZoneH * 0.018 -#define TextSize_big SafeZoneH * 0.022 -#define TextSize_title SafeZoneH * 0.040 - - - -// main dialog definiton -class HJ_ConfigExplorer - { - idd = 19000; - enableSimulation = 0; - movingEnable = 0; - //onLoad = "_this call c_proving_ground_HJ_fnc_InitDialog;"; - onUnLoad = "_this call c_proving_ground_HJ_fnc_EndDialog;"; - - controlsBackground[] = - { - BackGround, - TitleBar - }; - objects[] = { }; - controls[] = { - tCurrentPathText, - tCurrentPathValue, - tConfigText, - cConfigValue, - frmClasses, - lbClasses, - frmValues, - lbValues, - sbtnDumpClasses, - sbtnUp, - frmOrder, - lbOrder, - sbtnCopyClip, - eCode, - tVersion, - sbtnClose - }; - - // external class references - #include "defs_base_control.cpp" - - class RSC_HJ_ShortcutButton: RscIGUIShortcutButton - { - w = 0.1 * SafeZoneW; - h = 0.05 * SafeZoneW; - size = TextSize_normal; - sizeEx = TextSize_normal; - class TextPos: TextPos - { - top = ((0.05 * SafeZoneW) - TextSize_normal) / 4); - //top = 0.004; - }; - }; - - - - //**************************************** - //*** Background Controls - //**************************************** - - class BackGround:RscBackground - { - style = ST_HUD_BACKGROUND; - - x = SafeZoneX; - y = SafeZoneY; - w = SafeZoneW; - h = SafeZoneH; - - colorBackground[] = {0.05, 0.05, 0.05, 0.95}; - }; - - - class TitleBar:RscTitle - { - style = ST_TITLE; - x = SafeZoneX + 0.01; - y = SafeZoneY + 0.01; - w = SafeZoneW - 0.02; - h = TitleBarH - 0.01; - sizeEx = TextSize_title; - - text = EXPL_TITLE; - }; - - - //**************************************** - //*** Controls - //**************************************** - - class tCurrentPathText:RscText - { - idc = -1; - style = ST_FRAME; - x = ((0.01 * SafeZoneW) + SafeZoneX); - y = ((0.08 * SafeZoneH) + SafeZoneY); - w = (0.74 * SafeZoneW); - h = (2.5 * TextSize_normal); - sizeEx = TextSize_normal; - - text = "Current Config Path"; - // colorText[] = Color_OA_Text; - }; - - class tCurrentPathValue:RscText - { - idc = 101; - style = ST_LEFT; - x = ((0.01 * SafeZoneW) + SafeZoneX); - y = ((0.10 * SafeZoneH) + SafeZoneY); - w = (0.74 * SafeZoneW); - sizeEx = TextSize_normal; - - text = "Current Config Path"; - }; - - class tConfigText:RscText - { - idc = -1; - style = ST_RIGHT; - x = ((0.76 * SafeZoneW) + SafeZoneX); - y = ((0.10 * SafeZoneH) + SafeZoneY); - w = (0.08 * SafeZoneW); - sizeEx = TextSize_normal; - - text = "Config:"; - }; - - class cConfigValue:RscCombo - { - idc = 103; - x = ((0.85 * SafeZoneW) + SafeZoneX); - y = ((0.10 * SafeZoneH) + SafeZoneY); - w = (0.13 * SafeZoneW); - sizeEx = TextSize_normal; - onLBSelChanged = "_this call c_proving_ground_HJ_fnc_onConfigChange"; - }; - - class frmClasses:RscText - { - idc = -1; - type = CT_STATIC; - style = ST_FRAME; - x = ((0.01 * SafeZoneW) + SafeZoneX); - y = ((0.14 * SafeZoneH) + SafeZoneY); - w = (0.28 * SafeZoneW); - h = (0.47 * SafeZoneH); - sizeEx = TextSize_normal; - - text = "Classes"; - }; - - class lbClasses:RscIGUIListBox - { - idc = 110; - x = ((0.01 * SafeZoneW) + SafeZoneX); - y = ((0.14 * SafeZoneH) + SafeZoneY) + TextSize_normal; - w = (0.28 * SafeZoneW); - h = (0.46 * SafeZoneH) - (TextSize_normal / 2); - sizeEx = TextSize_normal; - - rowHeight = TextSize_normal; - - onLBDblClick = "_this call c_proving_ground_HJ_fnc_onDoubleClickClass;"; - }; - - class frmValues:RscText - { - idc = -1; - type = CT_STATIC; - style = ST_FRAME; - x = ((0.31 * SafeZoneW) + SafeZoneX); - y = ((0.14 * SafeZoneH) + SafeZoneY); - w = (0.68 * SafeZoneW); - h = (0.47 * SafeZoneH); - sizeEx = TextSize_normal; - - text = "Values"; - }; - - class lbValues:RscIGUIListBox - { - idc = 111; - x = ((0.31 * SafeZoneW) + SafeZoneX); - y = ((0.14 * SafeZoneH) + SafeZoneY) + TextSize_normal; - w = (0.68 * SafeZoneW); - h = (0.46 * SafeZoneH) - (TextSize_normal / 2); - sizeEx = TextSize_normal; - - rowHeight = TextSize_normal; - }; - - class sbtnDumpClasses:RSC_HJ_ShortcutButton - { - idc = 119; - x = ((0.09 * SafeZoneW) + SafeZoneX); - y = ((0.61 * SafeZoneH) + SafeZoneY); - - text = "dump"; - tooltip = "dump all classnames to edit box"; - - onButtonClick = "_this call c_proving_ground_HJ_fnc_onButtonClick_dump;"; - }; - - class sbtnUp:RSC_HJ_ShortcutButton - { - idc = 120; - x = ((0.19 * SafeZoneW) + SafeZoneX); - y = ((0.61 * SafeZoneH) + SafeZoneY); - - text = "up"; - tooltip = "move to parent class"; - - onButtonClick = "_this call c_proving_ground_HJ_fnc_onButtonClick_up;"; - }; - - class frmOrder:RscText - { - idc = -1; - type = CT_STATIC; - style = ST_FRAME; - x = ((0.01 * SafeZoneW) + SafeZoneX); - y = ((0.65 * SafeZoneH) + SafeZoneY); - w = (0.28 * SafeZoneW); - h = (0.25 * SafeZoneH); - text = "Parents"; - sizeEx = TextSize_normal; - // colorText[] = Color_OA_Text; - }; - - class lbOrder:RscIGUIListBox - { - idc = 112; - x = ((0.01 * SafeZoneW) + SafeZoneX); - y = ((0.65 * SafeZoneH) + SafeZoneY) + TextSize_normal; - w = (0.28 * SafeZoneW); - h = (0.25 * SafeZoneH) - TextSize_normal; - sizeEx = TextSize_normal; - - rowHeight = TextSize_normal; - }; - - class eCode:RscEdit - { - idc = 113; - style = ST_MULTI; - x = ((0.31 * SafeZoneW) + SafeZoneX); - y = ((0.65 * SafeZoneH) + SafeZoneY); - w = (0.68 * SafeZoneW); - h = (0.25 * SafeZoneH); - sizeEx = TextSize_small; - - font = "LucidaConsoleB"; - linespacing = 2; - autocomplete = "general"; - }; - - class sbtnCopyClip:RSC_HJ_ShortcutButton - { - x = ((0.31 * SafeZoneW) + SafeZoneX); - y = ((0.905 * SafeZoneH) + SafeZoneY); - - text = "-> Clipboard"; - tooltip = "copy all text to clipboard"; - - action = "copyToClipboard ctrlText 113;"; - }; - - class tVersion:RscText - { - style = ST_RIGHT; - x = ((0.70 * SafeZoneW) + SafeZoneX); - y = ((0.95 * SafeZoneH) + SafeZoneY); - w = (0.19 * SafeZoneW); - sizeEx = TextSize_small; - - text = EXPL_VERSION; - }; - - class sbtnClose:RSC_HJ_ShortcutButton - { - x = ((0.90 * SafeZoneW) + SafeZoneX); - y = ((0.95 * SafeZoneH) + SafeZoneY); - - text = "close"; - action = "closeDialog 0"; - - tooltip = "close explorer"; - }; -}; diff --git a/addons/proving_ground/CfgExplorer2/defs_base_control.cpp b/addons/proving_ground/CfgExplorer2/defs_base_control.cpp deleted file mode 100644 index c0a02a313..000000000 --- a/addons/proving_ground/CfgExplorer2/defs_base_control.cpp +++ /dev/null @@ -1,287 +0,0 @@ -class RscBackground { - type = 0; - IDC = -1; - style = 512; - x = 0; - y = 0; - w = 1; - h = 1; - text = ""; - ColorBackground[] = {0.48, 0.5, 0.35, 1}; - ColorText[] = {0.1, 0.1, 0.1, 1}; - font = "TahomaB"; - SizeEx = 1; -}; - -class RscCombo { - access = 0; - type = 4; - style = 0; - colorSelect[] = {0.023529, 0, 0.0313725, 1}; - colorText[] = {0.023529, 0, 0.0313725, 1}; - colorBackground[] = {0.95, 0.95, 0.95, 1}; - colorScrollbar[] = {0.023529, 0, 0.0313725, 1}; - soundSelect[] = {"", 0.1, 1}; - soundExpand[] = {"", 0.1, 1}; - soundCollapse[] = {"", 0.1, 1}; - maxHistoryDelay = 1; - x = 0; - y = 0; - w = 0.12; - h = 0.035; - colorSelectBackground[] = {0.543, 0.5742, 0.4102, 1}; - arrowEmpty = "\ca\ui\data\ui_arrow_combo_ca.paa"; - arrowFull = "\ca\ui\data\ui_arrow_combo_active_ca.paa"; - wholeHeight = 0.45; - color[] = {0, 0, 0, 0.6}; - colorActive[] = {0, 0, 0, 1}; - colorDisabled[] = {0, 0, 0, 0.3}; - font = "TahomaB"; - sizeEx = 0.03921; - class ComboScrollBar { - color[] = {1, 1, 1, 0.6}; - colorActive[] = {1, 1, 1, 1}; - colorDisabled[] = {1, 1, 1, 0.3}; - thumb = "\ca\ui\data\ui_scrollbar_thumb_ca.paa"; - arrowFull = "\ca\ui\data\ui_arrow_top_active_ca.paa"; - arrowEmpty = "\ca\ui\data\ui_arrow_top_ca.paa"; - border = "\ca\ui\data\ui_border_scroll_ca.paa"; - }; - -}; - -class RscEdit { - access = 0; - type = 2; - h = 0.04; - colorBackground[] = {0, 0, 0, 1}; - colorText[] = {0.95, 0.95, 0.95, 1}; - colorSelection[] = {0.543, 0.5742, 0.4102, 1}; - autocomplete = ""; - text = ""; - size = 0.2; - style = "0x00 + 0x40"; - font = "TahomaB"; - sizeEx = 0.03921; -}; - -class RscIGUIListBox { - color[] = {1, 1, 1, 1}; - colorText[] = {0.6, 0.8392, 0.4706, 1}; - colorScrollbar[] = {0.95, 0.95, 0.95, 1}; - colorSelect[] = {0.023529, 0, 0.0313725, 1}; - colorSelect2[] = {0.023529, 0, 0.0313725, 1}; - colorSelectBackground[] = {0.6, 0.8392, 0.4706, 1}; - colorSelectBackground2[] = {0.6, 0.8392, 0.4706, 1}; - period = 0; - colorBackground[] = {0, 0, 0, 1}; - sizeEx = 0.034; - - // Values from class: RscListBox // - - access = 0; - w = 0.4; - h = 0.4; - rowHeight = 0; - soundSelect[] = {"", 0.1, 1}; - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - type = 5; - style = 16; - font = "TahomaB"; - maxHistoryDelay = 1; - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - - class ListScrollBar { - color[] = {1, 1, 1, 0.6}; - colorActive[] = {1, 1, 1, 1}; - colorDisabled[] = {1, 1, 1, 0.3}; - thumb = "\ca\ui\data\igui_scrollbar_thumb_ca.paa"; - arrowFull = "\ca\ui\data\igui_arrow_top_active_ca.paa"; - arrowEmpty = "\ca\ui\data\igui_arrow_top_ca.paa"; - border = "\ca\ui\data\igui_border_scroll_ca.paa"; - }; -}; - -class RscStandardDisplay { - access = 0; - movingEnable = 1; - enableSimulation = 1; - enableDisplay = 1; -}; - -class RscText { - access = 0; - type = 0; - idc = -1; - colorBackground[] = {0, 0, 0, 0}; - colorText[] = {0.543, 0.5742, 0.4102, 1}; - text = ""; - x = 0; - y = 0; - h = 0.037; - w = 0.3; - style = 256; - font = "TahomaB"; - SizeEx = 0.03921; -}; - -class RscTitle : RscText { - style = 2; - x = 0.15; - y = 0.06; - w = 0.7; - - // Values from class: RscText // - - access = 0; - type = 0; - idc = -1; - colorBackground[] = {0, 0, 0, 0}; - colorText[] = {0.543, 0.5742, 0.4102, 1}; - text = ""; - h = 0.037; - font = "TahomaB"; - SizeEx = 0.03921; -}; - -class RscShortcutButton { - x = 0.1; - y = 0.1; - shortcuts[] = {}; - textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; - color[] = {0.543, 0.5742, 0.4102, 1}; - color2[] = {0.95, 0.95, 0.95, 1}; - colorFocused[] = {0.543, 0.5742, 0.4102, 1}; - colorDisabled[] = {1, 1, 1, 0.25}; - colorBackground[] = {1, 1, 1, 1}; - colorBackground2[] = {1, 1, 1, 0.4}; - colorBackgroundFocused[] = {1, 1, 1, 1}; - type = 16; - idc = -1; - style = 0; - default = 0; - w = 0.183825; - h = 0.104575; - periodFocus = 1.2; - periodOver = 0.8; - animTextureNormal = "\ca\ui\data\ui_button_normal_ca.paa"; - animTextureDisabled = "\ca\ui\data\ui_button_disabled_ca.paa"; - animTextureOver = "\ca\ui\data\ui_button_over_ca.paa"; - animTextureFocused = "\ca\ui\data\ui_button_focus_ca.paa"; - animTexturePressed = "\ca\ui\data\ui_button_down_ca.paa"; - animTextureDefault = "\ca\ui\data\ui_button_default_ca.paa"; - period = 0.4; - font = "TahomaB"; - size = 0.03921; - sizeEx = 0.03921; - text = ""; - soundEnter[] = {"", 0.09, 1}; - soundPush[] = {"", 0.09, 1}; - soundClick[] = {"\ca\ui\data\sound\new1", 0.07, 1}; - soundEscape[] = {"", 0.09, 1}; - action = ""; - - class Attributes { - font = "TahomaB"; - color = "#E5E5E5"; - align = "left"; - shadow = "true"; - }; - - class AttributesImage { - font = "TahomaB"; - color = "#E5E5E5"; - align = "left"; - }; - - class HitZone { - left = 0.004; - top = 0.029; - right = 0.004; - bottom = 0.029; - }; - - class ShortcutPos { - left = 0.0145; - top = 0.026; - w = 0.0392157; - h = 0.0522876; - }; - - class TextPos { - left = 0.025; - top = 0.034; - right = 0.005; - bottom = 0.005; - }; -}; - -class RscIGUIShortcutButton : RscShortcutButton { - w = 0.183825; - h = 0.0522876; - style = 2; - color[] = {1, 1, 1, 1}; - color2[] = {1, 1, 1, 0.85}; - colorBackground[] = {1, 1, 1, 1}; - colorbackground2[] = {1, 1, 1, 0.85}; - colorDisabled[] = {1, 1, 1, 0.4}; - animTextureNormal = "\ca\ui\data\igui_button_normal_ca.paa"; - animTextureDisabled = "\ca\ui\data\igui_button_disabled_ca.paa"; - animTextureOver = "\ca\ui\data\igui_button_over_ca.paa"; - animTextureFocused = "\ca\ui\data\igui_button_focus_ca.paa"; - animTexturePressed = "\ca\ui\data\igui_button_down_ca.paa"; - animTextureDefault = "\ca\ui\data\igui_button_normal_ca.paa"; - - // Values from class: RscShortcutButton // - - x = 0.1; - y = 0.1; - shortcuts[] = {}; - textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; - type = 16; - idc = -1; - default = 0; - periodFocus = 1.2; - periodOver = 0.8; - period = 0.4; - font = "TahomaB"; - size = 0.03921; - sizeEx = 0.03921; - text = ""; - soundEnter[] = {"", 0.09, 1}; - soundPush[] = {"", 0.09, 1}; - soundClick[] = {"\ca\ui\data\sound\new1", 0.07, 1}; - soundEscape[] = {"", 0.09, 1}; - action = ""; - - class Attributes { - font = "TahomaB"; - color = "#E5E5E5"; - align = "center"; - shadow = "true"; - }; - - class HitZone { - left = 0.002; - top = 0.003; - right = 0.002; - bottom = 0.016; - }; - - class ShortcutPos { - left = -0.006; - top = -0.007; - w = 0.0392157; - h = 0.0522876; - }; - - class TextPos { - left = 0.02; - top = 0; - right = 0.002; - bottom = 0.016; - }; -}; diff --git a/addons/proving_ground/CfgExplorer2/scripts/ArrayToString.sqf b/addons/proving_ground/CfgExplorer2/scripts/ArrayToString.sqf deleted file mode 100644 index acd773d3d..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/ArrayToString.sqf +++ /dev/null @@ -1,58 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private ["_configRoot", "_currentPath", "_ValuesArray", "_debug", "_OutString", "_TypeName", "_inArray", "_maxI", "_i"]; - -// *** -// *** get parameter -// *** -_inArray = _this select 0; -if ((TypeName _inArray) != "ARRAY") exitWith -{ - // "parameter error in ArrayToString.sqf" - diag_log text "#ArrayToString: Parameter Error in ArrayToString.sqf. Expected: Array."; -}; - -// *** -// *** define output parameter -// *** -_OutString = "{"; - -// *** -// *** building the string -// *** -_maxI = (count _inArray) - 1; - -for "_i" from 0 to (_maxI) do -{ - _TypeName = TypeName (_inArray select _i); - - switch (_TypeName) do - { - case "STRING": - { - _OutString = format["%1""%2""",_OutString,_inArray select _i]; - }; - - case "SCALAR": - { - _OutString = format["%1%2",_OutString,_inArray select _i]; - }; - - case "ARRAY": - { - _OutString = format["%1%2",_OutString,[_inArray select _i] call GFNC(ArrayToString)]; - }; - }; - // add a seperator "," if it is not the last item - If (_i != _maxI) then - { - _OutString = _OutString + ", "; - }; -}; - -_OutString = _OutString + "}"; - -// *** -// *** return the string -// *** -_OutString diff --git a/addons/proving_ground/CfgExplorer2/scripts/EndDialog.sqf b/addons/proving_ground/CfgExplorer2/scripts/EndDialog.sqf deleted file mode 100644 index b42a3118b..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/EndDialog.sqf +++ /dev/null @@ -1,8 +0,0 @@ -#include "macros.hpp" -GVAR(GameConfig) = nil; -GVAR(MissionConfig) = nil; -GVAR(CampaignConfig) = nil; - -CurrentRoot = nil; -CurrentConfig = nil; -ConfigPath = nil; diff --git a/addons/proving_ground/CfgExplorer2/scripts/FillClasses.sqf b/addons/proving_ground/CfgExplorer2/scripts/FillClasses.sqf deleted file mode 100644 index 00e6951f8..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/FillClasses.sqf +++ /dev/null @@ -1,44 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private ["_curConfig", "_preIndex", "_i", "_Entry", "_cfgName", "_index"]; - -// *** -// *** Get Parameter -// *** -_curConfig = _this select 0; -if ((typeName _curConfig) != "CONFIG") then -{ - diag_log "Parameter 1 is not of type CONFIG."; -}; - -// *** -// *** Check for second Parameter -// *** -if ((count _this) > 1) then -{ - _preIndex = _this select 1; -} -else -{ - _preIndex = 0; -}; - -// *** -// *** Get Classes and add them to class listbox -// *** -for "_i" from 0 to ((count _curConfig) - 1) do -{ - _Entry = (_curConfig) select _i; - _cfgName = configName _Entry; - - if (isClass _Entry) then - { - _index = lbAdd [110, format["%1",_cfgName]]; - }; -}; - -// *** -// *** Sort list box and preselect item -// *** -lbSort ((findDisplay 19000) displayCtrl 110); -lbSetCurSel [110, _preIndex]; diff --git a/addons/proving_ground/CfgExplorer2/scripts/FillValues.sqf b/addons/proving_ground/CfgExplorer2/scripts/FillValues.sqf deleted file mode 100644 index dd440772a..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/FillValues.sqf +++ /dev/null @@ -1,102 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private ["_curConfig", "_valueNames", "_parentLevel", "_Entry", "_EntryName", "_Code", "_confName", "_newLine", "_y", "_text", "_index", "_ArrayString"]; - -// *** -// *** Get Parameters -// *** -_curConfig = _this select 0; -_valueNames = _this select 1; -_parentLevel = _this select 2; - -if ((count _this) > 3) then -{ - _Code = _this select 3; -} -else -{ - _Code = ""; -}; - -// *** -// *** Get values from this config hive -// *** - -_confName = configName _curConfig; - -// *** -// *** add configName to parents box -// *** - -lbadd [112,format["%1 > %2",_parentLevel,_confName]]; - -_newLine = " -"; - -if (_parentLevel == 0) then -{ - // *** - // *** write the class header - // *** - - if (format["%1", inheritsFrom _curConfig] == "") then { - _Code = _Code + format["class %1 { %2",configName _curConfig,_newLine]; - } else - { - _Code = _Code + format["class %1 : %3 { %2",configName _curConfig,_newLine, configName (inheritsFrom _curConfig)]; - } - -} else -{ - // *** - // ***Following values are from an inherited class - // ***Add a comment to the code - - _Code = _Code + format["%1",_newLine]; - _Code = _Code + format[" // Values from class: %1 //%2",configName _curConfig,_newLine]; - _Code = _Code + format["%1",_newLine]; -}; - -for "_y" from 0 to ((count _curConfig) - 1) do { - _Entry = (_curConfig) select _y; - _EntryName = configName _Entry; - - if (not (isClass _Entry) && (not ((toUpper _EntryName) in _valueNames))) then { - if (isNumber _Entry) then { - _text = format["%1: %3 => %4",_parentLevel,_confName,_EntryName,getNumber _Entry]; - _index = lbAdd [111, _text]; - - _Code = _Code + format[" %1 = %2; %3",_EntryName, getNumber _Entry, _NewLine]; - }; - if (isText _Entry) then { - _text = format["%1: %3 => ""%4""",_parentLevel,_confName,_EntryName,gettext _Entry]; - _index = lbAdd [111, _text]; - - _Code = _Code + format[" %1 = ""%2""; %3",_EntryName, getText _Entry, _NewLine]; - }; - if (isArray _Entry) then { - _text = format["%1: %3 => %4",_parentLevel,_confName,_EntryName,getArray _Entry]; - _index = lbAdd [111, _text]; - _ArrayString = [getArray _Entry] call GFNC(ArrayToString); - - _Code = _Code + format[" %1[] = %2; %3",_EntryName, _ArrayString, _NewLine]; - }; - _valueNames = _valueNames + [toUpper _EntryName]; - }; -}; - -// *** -// *** Get values from next parent class -// *** -if isClass(inheritsFrom _curConfig) then -{ - _Code = [inheritsFrom _curConfig, _valueNames, (_parentLevel + 1), _Code ] call GFNC(FillValues); -}; -lbSort ((findDisplay 19000) displayCtrl 111); -if (_parentLevel == 0) then -{ - _Code = _Code + "}"; - ctrlSetText [113, _Code]; -}; - -_Code diff --git a/addons/proving_ground/CfgExplorer2/scripts/InitDialog.sqf b/addons/proving_ground/CfgExplorer2/scripts/InitDialog.sqf deleted file mode 100644 index 56526c6cc..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/InitDialog.sqf +++ /dev/null @@ -1,44 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private ["_display","_tmpIndex"]; - -// *** -// *** define some public variables -// *** - -GVAR(GameConfig) = 0; // configFile -GVAR(MissionConfig) = 1; // missionConfigFile -GVAR(CampaignConfig) = 2; // campaignConfigFile - -CurrentRoot = configFile; // Current Root Config -CurrentConfig = configFile; // Current Config Path -ConfigPath = []; // Paths below Config Root (String Array) - - -_display = findDisplay 19000; - -// *** -// *** Add UI Event handlers to Config Combo List -// *** Hint: Must be set before setting the init value to the ComboList (lbSetCurSel) !!! -// *** - -//(_display displayCtrl 103) ctrlSetEventHandler ["LBSelChanged", "_this call c_proving_ground_HJ_fnc_onConfigChange"]; -//(_display displayCtrl 110) ctrlSetEventHandler ["LBDblClick ", "_this spawn c_proving_ground_HJ_fnc_onDoubleClickClass"]; - -// *** -// *** Fill ComboList with the available Config Namespaces -// *** - -_tmpIndex = lbadd [103, "Game"]; -lbSetValue [103, _tmpIndex, GVAR(GameConfig)]; -_tmpIndex = lbadd [103, "Mission"]; -lbSetValue [103, _tmpIndex, GVAR(MissionConfig)]; -_tmpIndex = lbadd [103, "Campaign"]; -lbSetValue [103, _tmpIndex, GVAR(CampaignConfig)]; - -lbSetCurSel [103, 0]; - -// *** -// *** set inital focus to the class list box -// *** -ctrlSetFocus (_display displayCtrl 110); diff --git a/addons/proving_ground/CfgExplorer2/scripts/ShowConfig.sqf b/addons/proving_ground/CfgExplorer2/scripts/ShowConfig.sqf deleted file mode 100644 index ffb38a4a2..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/ShowConfig.sqf +++ /dev/null @@ -1,67 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private ["_configRoot", "_currentPath", "_ValuesArray", "_debug"]; - -// *** -// *** get parameter -// *** - -_configRoot = _this select 0; -_configPath = _this select 1; -_currentConfig = _configPath select (count(_configPath)-1); // returns last element - -// *** -// *** clear all List-/editboxes -// *** - -lbClear 110; //lbClasses -lbClear 113; //eCode - -// *** -// *** build and show config path -// *** - -if (count _configPath == 1) then -{ - ctrlSetText [101, "ROOT"]; -} else -{ - // TODO: Cutting off the Name - // _lenRootName = count (toArray ConfigRoot); - // _cfgNameArray = toarray (_configPath select ((count _configPath) -1)); - - ctrlSetText [101, format["%1",_configPath select ((count _configPath) -1)]]; -}; - -// *** -// *** Set state of "UP" button -// *** - -if (count _configPath == 1) then -{ - ctrlEnable [120, false]; -} -else -{ - ctrlEnable [120, true]; -}; - -// *** -// *** fill classes list box -// *** - -[_currentConfig, 0] call GFNC(FillClasses); - -// *** -// *** clear list boxes -// *** -lbClear 111; //lbValues -lbClear 112; //lbParents - -// *** -// *** Fill values list box and parents list box -// *** - -[_currentConfig, [], 0] call GFNC(FillValues); - - diff --git a/addons/proving_ground/CfgExplorer2/scripts/macros.hpp b/addons/proving_ground/CfgExplorer2/scripts/macros.hpp deleted file mode 100644 index e0c75b7d0..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/macros.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#define __autor_prefix c_ -#define __addon_prefix proving_ground_HJ_ -#define __quoted(str) #str -#define __concat2(var1,var2) ##var1####var2 -#define __concat3(var1,var2,var3) ##var1####var2####var3 -#define __concat4(var1,var2,var3,var4) ##var1####var2####var3####var4 -#define __preprocess compile preprocessFileLineNumbers -#define GVAR(a) __concat3(__autor_prefix,__addon_prefix,a) -#define GFNC(a) __concat4(__autor_prefix,__addon_prefix,fnc_,a) diff --git a/addons/proving_ground/CfgExplorer2/scripts/onButtonClick_dump.sqf b/addons/proving_ground/CfgExplorer2/scripts/onButtonClick_dump.sqf deleted file mode 100644 index 3cda95f71..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/onButtonClick_dump.sqf +++ /dev/null @@ -1,64 +0,0 @@ -#include "macros.hpp" -scriptname "onBC_dump.sqf"; -private ["_lbIDC", "_outputIDC", "_size", "_outText", "_crlf"]; -_curConfig = CurrentConfig; -hint format ["%1",[_curConfig]]; -_lbIDC = 110; -_outputIDC = 113; -_size = lbSize 110; -_outText = ""; -_tab = " "; -_crlf = " -"; - -_parseEnrty = { - _entry = _this select 0; - _needClass = _this select 1; - _return = []; - for "_i" from 0 to (count _entry)-1 do { - _subEntry = _entry select _i; - if ((isClass _subEntry)&&_needClass) then { - _return set [count _return,_subEntry]; - }; - if (!(isClass _subEntry)&&!_needClass) then { - _return set [count _return,_subEntry]; - }; - }; - _return -}; - -// -// clear output box -// -ctrlSetText [_outputIDC,""]; - -// -// iterate throu entries of list box -// -{ - // diag_log text format ["%1", lbtext [_lbIDC,_x]]; - _class = _x; - if ((str inheritsFrom _class)!="") then { - _outText = _outText + format["class %1 : %2 {",configName _class,configName inheritsFrom _class] + _crlf; - }else{ - _outText = _outText + format["class %1 {",configName _class] + _crlf; - }; - - - { - _Entry = _x; - _EntryName = configName _Entry; - _val = switch true do { - case (isNumber _Entry): {[_EntryName,getNumber _Entry]}; - case (isText _Entry): {[_EntryName,""""+getText _Entry+""""]}; - case (isArray _Entry): {[_EntryName+"[]",[getArray _Entry] call GFNC(ArrayToString)]}; - default {nil}; - }; - _text = _tab + format["%1 = %2;",_val select 0,_val select 1]; - _outText = _outText + _text + _crlf; - } forEach ([_class,false] call _parseEnrty); - - _outText = _outText + "};" + _crlf; -} forEach ([_curConfig,true] call _parseEnrty); -ctrlSetText [_outputIDC,_outText]; - diff --git a/addons/proving_ground/CfgExplorer2/scripts/onButtonClick_up.sqf b/addons/proving_ground/CfgExplorer2/scripts/onButtonClick_up.sqf deleted file mode 100644 index c6d46067c..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/onButtonClick_up.sqf +++ /dev/null @@ -1,79 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private ["_LastClassName", "_lbCount", "_i", "_notFound", "_text", "_debug"]; - -// *** -// *** set debug output (arma.rpt) -// *** -_debug = false; - -// *** -// *** Set Current Path to Parent Path -// *** - -if ((count ConfigPath) < 2) then -{ - diag_log "onButtonClickUp.sqf: ERROR: Not enough Values in Array ConfigPath!"; - if (true) exitWith {}; -}; - -CurrentConfig = ConfigPath select (count ConfigPath - 2); - -_LastClassName = toUpper (configName (ConfigPath select (count ConfigPath - 1))); - -if (_debug) then -{ - diag_log text "===== onButtonClickUp.sqf ====="; - diag_log text format["onButtonClickUp.sqf: ConfigPath : %1",ConfigPath]; - diag_log text format["onButtonClickUp.sqf: CurrentConfig : %1",CurrentConfig]; - diag_log text format["onButtonClickUp.sqf: _LastClassName: %1",_LastClassName]; -}; - -// *** -// *** Delete the last path from CofnigPath -// *** - -ConfigPath resize (count ConfigPath - 1); - -// *** -// *** Fill dialog controls -// *** -if (_debug) then -{ - diag_log format["onButtonClickUp.sqf: Parameters for hj_fn_showConfig: %1, %2",CurrentRoot, CurrentConfig]; -}; -[CurrentRoot, ConfigPath] call GFNC(showConfig); - -// *** -// *** Autoselect last selected class -// *** - -_notFound = true; -_lbCount = (lbsize 110) - 1; // count entrys in listbox - -if (_debug) then -{ - diag_log format["onButtonClickUP.sqf: Searching for Classname: %1", _LastClassName]; -}; - -for "_i" from 0 to _lbCount do -{ - _text = toUpper (lbtext[110, _i]); - - if (_text == _LastClassName) then - { - lbSetCurSel [110, _i]; - _notFound = false; - }; -}; - -// *** -// *** if no entry was found, select first one -// *** - -if (_notFound) then -{ - diag_log text format["onButtonClickUp.sqf: Anzahl Werte in ClassListBox: %1",_lbCount]; - diag_log text format["onButtonClickUp.sqf: Error, no ClassName found!"]; - lbSetCurSel [110, 0]; -}; diff --git a/addons/proving_ground/CfgExplorer2/scripts/onConfigChange.sqf b/addons/proving_ground/CfgExplorer2/scripts/onConfigChange.sqf deleted file mode 100644 index 59b041cd8..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/onConfigChange.sqf +++ /dev/null @@ -1,38 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private ["_currentCtrl", "_selectedIndex"]; - -_currentCtrl = _this select 0; // not really used -_selectedIndex = _this select 1; - -// *** -// *** Select the config namespace -// *** and set some global variables to inital values -// *** - -switch (_selectedIndex) do -{ - case 0: - { - CurrentRoot = configFile; - CurrentConfig = configFile; - ConfigPath = [configFile]; - }; - - case 1: - { - CurrentRoot = missionConfigFile; - CurrentConfig = missionConfigFile; - ConfigPath = [missionConfigFile]; - }; - - case 2: - { - CurrentRoot = campaignConfigFile; - CurrentConfig = campaignConfigFile; - ConfigPath = [campaignConfigFile]; - }; -}; -GVAR(IndexOrder) = []; - -[CurrentRoot,ConfigPath] call GFNC(showConfig); diff --git a/addons/proving_ground/CfgExplorer2/scripts/onDoubleClickClass.sqf b/addons/proving_ground/CfgExplorer2/scripts/onDoubleClickClass.sqf deleted file mode 100644 index ff8ca238f..000000000 --- a/addons/proving_ground/CfgExplorer2/scripts/onDoubleClickClass.sqf +++ /dev/null @@ -1,22 +0,0 @@ -#include "macros.hpp" -disableSerialization; -private["_control","_index","_selectedEntryName", "_Entry","_ConfName","_nix"]; - -// *** -// *** get parameter -// *** - -_control = _this select 0; -_index = _this select 1; - -_selectedEntryName = lbText [110,_index]; - -// *** -// *** get the new configObject -// *** -_Entry = (CurrentConfig >> _selectedEntryName); - -CurrentConfig = _Entry; -ConfigPath = ConfigPath + [_Entry]; - -[ConfigRoot, ConfigPath] call GFNC(showConfig); diff --git a/addons/proving_ground/PG_config.hpp b/addons/proving_ground/PG_config.hpp deleted file mode 100644 index 51c6d52d6..000000000 --- a/addons/proving_ground/PG_config.hpp +++ /dev/null @@ -1,1586 +0,0 @@ -#include "defs_ui.hpp" -#include "defs.hpp" - -class balca_debug_main -{ - idd = balca_debug_main_IDD; - name = "balca_debug_main"; - movingEnable = false; - - controlsBackground[] = {}; - objects[] = {}; - controls[] = { - balca_btn_control_group - }; -///////////// -#include "defs_base_control.hpp" -///////////// - - class balca_btn_control_group : balca_debug_control_group { - x = safezoneX_PG; - w = 1; - y = safezoneY_PG; - h = 1; - - class Controls { - //column 1 - class balca_cVeh_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = 0; - text = "Create vehicle"; - action = "if (isServer) then { closeDialog 0; createDialog ""balca_debug_veh_creator""; [0] call c_proving_ground_fnc_create_vehicle } else { closeDialog 0; createDialog ""balca_debug_veh_creator""; [0] call c_proving_ground_fnc_create_vehicle; ['You may get kicked if BattlEye is monitoring createVehicle.','WARNING'] spawn BIS_fnc_guiMessage }"; - }; - - class balca_cWeap_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = btn_height*1; - text = "Get weapon"; - action = "closeDialog 0;createDialog ""balca_debug_weap_creator"";[0,0] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_targets_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = btn_height*2; - text = "Targets"; - action = "closeDialog 0;if ((serverCommandAvailable '#kick')||isServer) then {createDialog ""balca_target_display"";[0] call c_proving_ground_fnc_target;[1] call c_proving_ground_fnc_target;}else{hint 'Target management not allowed for you'}"; - }; - - class balca_environment_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = btn_height*3; - text = "Environment"; - action = "closeDialog 0;createDialog ""balca_environment"";[0] call c_proving_ground_fnc_environment"; - }; - - class balca_stat_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = btn_height*4; - text = "Statistics"; - action = "closeDialog 0;createDialog ""balca_statistics"";[0] call c_proving_ground_fnc_statistics"; - }; - - class balca_realign_core_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = btn_height*6; - text = "Realign core"; - action = "closeDialog 0;_core = c_proving_ground_core;_dir = direction player;_pos = getPos player;_core setPos [(_pos select 0)+10*sin(_dir),(_pos select 1)+10*cos(_dir),0];_core setDir _dir;_marker = createMarkerLocal ['respawn_west',_pos];createMarkerLocal ['respawn_east',_pos];createMarkerLocal ['respawn_guerrila',_pos];createMarkerLocal ['respawn_civilian',_pos];closeDialog 0;"; - }; - - /*class balca_get_bot_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = btn_height*7; - text = "Get bot in team"; - action = "((group player) createUnit [typeOf player,getpos player,[],0.1,""FORM""]) setSkill 1"; - };*/ - - class balca_dVeh_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = btn_height*8; - text = "Delete vehicle"; - action = "deleteVehicle cursorTarget;"; - }; - - - //column 2 - class balca_ammo_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*0; - text = "Ammo"; - action = "[] call c_proving_ground_fnc_ammo"; - }; - - class balca_repair_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*1; - text = "Autoheal"; - action = "player setDamage 0; (vehicle player) setDamage 0;"; - }; - - class balca_booster_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*2; - text = "Booster"; - action = "[] spawn c_proving_ground_fnc_booster;closeDialog 0;"; - }; - - class balca_teleport_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*3; - text = "Teleport"; - action = "hint ""Click on map to teleport"";onMapSingleClick ""vehicle player setPos [_pos select 0,_pos select 1,0]; onMapSingleClick '';""; openMap true; closeDialog 0;"; - }; - - class balca_sattelite_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*4; - text = "Sattelite"; - action = "hint ""Click on map to aim sattelite"";onMapSingleClick ""[_pos] call c_proving_ground_fnc_sattelite;onMapSingleClick '';""; openMap true; closeDialog 0;"; - }; - - class balca_bulletcam_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*5; - text = "Bulletcam"; - action = """bulletcam"" call c_proving_ground_fnc_bulletcam;"; - }; - - class balca_marker_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*6; - text = "Hitmarker"; - action = """hitmarker"" call c_proving_ground_fnc_bulletcam;"; - }; - - /*class balca_status_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*7; - text = "Status display"; - action = "closeDialog 0;call c_proving_ground_fnc_status"; - };*/ - - class balca_console_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = btn_height*8; - text = "Console"; - action = "closeDialog 0;createDialog ""balca_debug_console"";[0] call c_proving_ground_fnc_exec_console; if (!isServer) then { ['Some commands can get you kicked by BattlEye.','WARNING'] spawn BIS_fnc_guiMessage }"; - }; - //column 3 - class balca_sound_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = btn_height*0; - text = "Sound player"; - action = "closeDialog 0;createDialog ""balca_sound_player"";[0] call c_proving_ground_fnc_sound;"; - }; - - class balca_display_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = btn_height*1; - text = "BalCa"; - action = "execVM ""\x\addons\balca\balca.sqf"";closeDialog 0;"; - }; - - class balca_reload_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = btn_height*2; - text = "Reloader"; - action = "closeDialog 0;(vehicle player) spawn c_proving_ground_reloader_fnc_act_open_dialog;"; - }; - - class balca_cfgexplorer_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = btn_height*3; - text = "cfgExplorer"; - action = "closeDialog 0;createDialog ""HJ_ConfigExplorer"";[] call c_proving_ground_HJ_fnc_InitDialog;"; - }; - - class balca_BIS_help_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = btn_height*4; - text = "BIS Functions Viewer"; - action = "closeDialog 0;[] call BIS_fnc_help"; - }; - - class balca_BIS_cfgviewer_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = btn_height*5; - text = "BIS Config Viewer"; - action = "closeDialog 0;[] call BIS_fnc_configviewer"; - }; - class balca_close_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = btn_height*8; - text = "Close"; - action = "closeDialog 0;"; - }; - }; - };//end btn control group -__onLoad - -}; - -class balca_debug_veh_creator -{ - idd = balca_debug_VC_IDD; - name = "balca_debug_veh_creator"; - movingEnable = false; - - controlsBackground[] = {balca_debug_background}; - objects[] = {}; - controls[] = { - balca_VC_vehlist, - balca_VC_vehicle_shortcut, - balca_VC_veh_info, - balca_VC_fill_static, - balca_VC_fill_car, - balca_VC_fill_truck, - balca_VC_fill_APC, - balca_VC_fill_tank, - balca_VC_fill_helicopter, - balca_VC_fill_plane, - balca_VC_fill_ship, - balca_VC_class_to_clipboard_btn, - balca_VC_info_to_clipboard_btn, - balca_VC_create_veh_core_btn, - balca_VC_create_veh_player_btn, - balca_VC_close_btn - }; -///////////////// - class balca_debug_background - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG-border_offsetX; w = column_weight*3 + border_offsetX*3; - y = safezoneY_PG-border_offsetY-btn_height*3; h = display_height+border_offsetY*2+btn_height*4; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaMedium"; - sizeEx = 0.032; - }; - - -///////////// -#include "defs_base_control.hpp" -///////////// - - class balca_VC_vehlist : balca_debug_list - { - idc = balca_VC_vehlist_IDC; - x = safezoneX_PG; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*4 - (safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[1] call c_proving_ground_fnc_create_vehicle"; - onLBDblClick = "[2] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_vehicle_shortcut : balca_debug_image - { - idc = balca_VC_vehicle_shortcut_IDC; - x = safezoneX_PG + column_weight; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = img_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_VC_veh_info : balca_debug_text - { - idc = balca_VC_veh_info_IDC; - type = CT_STRUCTURED_TEXT+ST_LEFT; - size = 0.023; - x = safezoneX_PG + column_weight*2; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*3-(safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_VC_fill_static : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*0; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Static"; - action = "[0,0] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_fill_car : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*0; w = btn_weight-column_div; - y = safezoneY_PG; - text = "Car"; - action = "[0,1] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_fill_truck : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*1; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Truck"; - action = "[0,2] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_fill_APC : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*1; w = btn_weight-column_div; - y = safezoneY_PG; - text = "APC"; - action = "[0,3] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_fill_tank : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*2; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Tank"; - action = "[0,4] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_fill_helicopter : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*2; w = btn_weight-column_div; - y = safezoneY_PG; - text = "Helicopter"; - action = "[0,5] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_fill_plane : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*3; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Plane"; - action = "[0,6] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_fill_ship : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*3; w = btn_weight-column_div; - y = safezoneY_PG; - text = "Ship"; - action = "[0,7] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_class_to_clipboard_btn : balca_debug_btn - { - x = safezoneX_PG; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom-btn_height; - text = "Class to clipboard"; - action = "[4] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_info_to_clipboard_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight*2; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom-btn_height; - text = "Info to clipboard"; - action = "[5] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_create_veh_core_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight; w = column_weight-column_div; - y = safezoneY_PG + offset_top*2+img_height; - text = "Create at core"; - action = "[2] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_create_veh_player_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight; w = column_weight-column_div; - y = safezoneY_PG + offset_top*2+img_height + btn_height; - text = "Create at player"; - action = "[3] call c_proving_ground_fnc_create_vehicle"; - }; - - class balca_VC_close_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight*2; w = btn_weight; - y = display_height-safezoneY_PG- offset_bottom; - text = "Back"; - action = "closeDialog 0; createDialog 'balca_debug_main'"; - }; -}; - -class balca_debug_weap_creator -{ - idd = balca_debug_WC_IDD; - name = "balca_debug_weap_creator"; - movingEnable = false; - - controlsBackground[] = {balca_debug_background}; - objects[] = {}; - controls[] = { - balca_WC_weaplist, - balca_WC_magazinelist, - balca_WC_weapon_shortcut, - balca_WC_weap_info, - balca_WC_magazine_info, - balca_WC_fill_rifles, - balca_WC_fill_scoped_rifles, - balca_WC_fill_heavy, - balca_WC_fill_launchers, - balca_WC_fill_pistols, - balca_WC_fill_grenades, - balca_WC_fill_binocular, - balca_WC_fill_items, - balca_WC_weap_to_clipboard_btn, - balca_WC_ammo_to_clipboard_btn, - balca_WC_create_weap_btn, - balca_WC_create_magazine_btn, - balca_WC_clear_magazines_btn, - balca_WC_close_btn - }; -///////////////// - class balca_debug_background - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG-border_offsetX; w = column_weight*3 + border_offsetX*3; - y = safezoneY_PG-border_offsetY-btn_height*3; h = display_height+border_offsetY*2+btn_height*4; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaMedium"; - sizeEx = 0.032; - }; - - -///////////// -#include "defs_base_control.hpp" -///////////// - - class balca_WC_weaplist : balca_debug_list - { - idc = balca_WC_weaplist_IDC; - x = safezoneX_PG; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*4 - (safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[1] call c_proving_ground_fnc_create_weapon;"; - onLBDblClick = "[2] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_magazinelist : balca_debug_list - { - idc = balca_WC_magazinelist_IDC; - x = safezoneX_PG + column_weight; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2 + img_height_wc; - h = display_height - offset_bottom*4 - img_height_wc-(safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[3] call c_proving_ground_fnc_create_weapon;"; - onLBDblClick = "[4] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_weapon_shortcut : balca_debug_image - { - idc = balca_WC_weapon_shortcut_IDC; - x = safezoneX_PG + column_weight; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = img_height_wc; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_WC_weap_info : balca_debug_text - { - idc = balca_WC_weap_info_IDC; - type = CT_STRUCTURED_TEXT+ST_LEFT; - size = 0.023; - x = safezoneX_PG + column_weight*2; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = img_height_wc; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_WC_magazine_info : balca_debug_text - { - idc = balca_WC_magazine_info_IDC; - type = CT_STRUCTURED_TEXT; - size = 0.023; - x = safezoneX_PG + column_weight*2; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2 + img_height_wc; - h = display_height - offset_bottom*4 - img_height_wc-(safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_WC_fill_rifles : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*0; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Rifles"; - action = "[0,0] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_fill_scoped_rifles : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*0; w = btn_weight-column_div; - y = safezoneY_PG; - text = "Scoped"; - action = "[0,1] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_fill_heavy : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*1; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Heavy"; - action = "[0,2] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_fill_launchers : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*1; w = btn_weight-column_div; - y = safezoneY_PG; - text = "Launchers "; - action = "[0,3] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_fill_pistols : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*2; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Pistols"; - action = "[0,4] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_fill_grenades : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*2; w = btn_weight-column_div; - y = safezoneY_PG; - text = "Grenades"; - action = "[0,5] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_fill_binocular : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*3; w = btn_weight-column_div; - y = safezoneY_PG - btn_height; - text = "Binoculars"; - action = "[0,6] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_fill_items : balca_debug_btn - { - x = safezoneX_PG + border_offsetX + btn_weight*3; w = btn_weight-column_div; - y = safezoneY_PG; - text = "Items"; - action = "[0,7] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_weap_to_clipboard_btn : balca_debug_btn - { - x = safezoneX_PG; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom-btn_height; - text = "Class to clipboard"; - action = "[5] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_ammo_to_clipboard_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom-btn_height; - text = "Ammo to clipboard"; - action = "[6] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_create_weap_btn : balca_debug_btn - { - x = safezoneX_PG; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom; - text = "Get weapon"; - action = "[2] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_create_magazine_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom; - text = "Get magazine"; - action = "[4] call c_proving_ground_fnc_create_weapon;"; - }; - - class balca_WC_clear_magazines_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight*2; w = column_weight-column_div; - y = display_height-safezoneY_PG-offset_bottom-btn_height; - text = "Clear magazines"; - action = "c_proving_ground_MAGS = [];{player removeMagazine _x} forEach (magazines player);"; - }; - - class balca_WC_close_btn : balca_debug_btn - { - x = safezoneX_PG+column_weight*2; w = btn_weight; - y = display_height-safezoneY_PG- offset_bottom; - text = "Close"; - action = "closeDialog 0;"; - }; -}; - -class balca_debug_console -{ - idd = balca_debug_console_IDD; - name = "balca_debug_console"; - movingEnable = false; - - controlsBackground[] = {balca_debug_background}; - objects[] = {}; - controls[] = { - balca_debug_console_edit, - balca_debug_console_result, - balca_debug_console_history, - balca_debug_console_control_group, - }; - - onKeyDown = "if((_this select 1) in [28,156]) then {[1] call c_proving_ground_fnc_exec_console;}; false"; -///////////////// - class balca_debug_background - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG-border_offsetX; w = column_weight*3 + border_offsetX*4; - y = safezoneY_PG-border_offsetY; h = display_height+border_offsetY*2; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaMedium"; - sizeEx = 0.032; - }; - - -///////////// -#include "defs_base_control.hpp" -///////////// - - class balca_debug_console_edit : balca_debug_edit - { - idc = balca_debug_console_edit_IDC; - x = safezoneX_PG; w = column_weight*3; - y = safezoneY_PG + offset_top*2; h = str_height*3; - text = "enter command here"; - }; - - class balca_debug_console_result : balca_debug_edit - { - idc = balca_debug_console_result_IDC; - x = safezoneX_PG; - w = column_weight*3; - y = safezoneY_PG + offset_top*2 + str_height*3; - h = str_height*2; - text = ""; - }; - - class balca_debug_console_history : balca_debug_list - { - idc = balca_debug_console_history_IDC; - x = safezoneX_PG; - w = column_weight*3; - y = safezoneY_PG + offset_top*2 + str_height*5; - h = display_height - offset_bottom*4 - str_height*5 - (safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[2] call c_proving_ground_fnc_exec_console;"; - onLBDblClick = "[3] call c_proving_ground_fnc_exec_console;"; - }; - - class balca_debug_console_control_group : balca_debug_control_group { - x = safezoneX_PG; - w = 1; - y = display_height-safezoneY_PG- offset_bottom-btn_height; - h = str_height*4; - class Controls { - class balca_debug_console_exec_btn : balca_debug_btn - { - x = 0; w = column_weight-column_div; - y = 0; - text = "Execute"; - action = "[1] call c_proving_ground_fnc_exec_console;"; - }; - - class balca_debug_console_exec_global_btn : balca_debug_btn - { - x = column_weight; w = column_weight-column_div; - y = 0; - text = "Exec global"; - action = "[4] call c_proving_ground_fnc_exec_console;"; - }; - - class balca_debug_console_exec_server_btn : balca_debug_btn - { - x = column_weight*2; w = column_weight-column_div; - y = 0; - text = "Exec on server"; - action = "[5] call c_proving_ground_fnc_exec_console;"; - }; - - class balca_debug_console_run_tracker_btn : balca_debug_btn - { - x = column_weight*0; w = column_weight-column_div; - y = btn_height; - text = "Run tracker"; - action = "[6] call c_proving_ground_fnc_exec_console;"; - }; - - class balca_debug_console_stop_tracker_btn : balca_debug_btn - { - x = column_weight*1; w = column_weight-column_div; - y = btn_height; - text = "Stop tracker"; - action = "[7] call c_proving_ground_fnc_exec_console;"; - }; - - class balca_debug_console_close_btn : balca_debug_btn - { - x = column_weight*2; w = btn_weight; - y = btn_height; - text = "Back"; - action = "closeDialog 0; createDialog 'balca_debug_main'"; - }; - }; - }; -}; - -class balca_target_display -{ - idd = balca_target_display_IDD; - name = "balca_target_display"; - movingEnable = false; - - controlsBackground[] = {balca_debug_background}; - objects[] = {}; - controls[] = { - balca_target_vehlist, - balca_target_vehicle_shortcut, - balca_target_veh_info, - balca_target_map, - balca_target_type_control_group, - balca_target_management_control_group, - balca_target_close_btn - }; -///////////////// - class balca_debug_background - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG-border_offsetX; w = column_weight*3 + border_offsetX*3; - y = safezoneY_PG-border_offsetY-btn_height*3; h = display_height+border_offsetY*2+btn_height*4; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaMedium"; - sizeEx = 0.032; - }; - - -///////////// -#include "defs_base_control.hpp" -///////////// - - onUnload = "[10] call c_proving_ground_fnc_target;"; - - class balca_target_vehlist : balca_debug_list - { - idc = balca_target_vehlist_IDC; - x = safezoneX_PG; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*4 - (safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[2] call c_proving_ground_fnc_target;"; - onLBDblClick = "[3] call c_proving_ground_fnc_target;"; - }; - - class balca_target_vehicle_shortcut : balca_debug_image - { - idc = balca_target_vehicle_shortcut_IDC; - x = safezoneX_PG + column_weight; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = img_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_target_veh_info : balca_debug_text - { - idc = balca_target_veh_info_IDC; - type = CT_STRUCTURED_TEXT+ST_LEFT; - size = 0.023; - x = safezoneX_PG + column_weight; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2 + img_height; - h = display_height - offset_bottom*3 - img_height-(safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_target_map : balca_debug_map - { - idc = balca_target_map_IDC; - x = safezoneX_PG; - w = column_weight*2 - column_div; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*4 - (safezoneY_PG + offset_top*2); - onMouseButtonDblClick = "[9,((_this select 0) ctrlMapScreenToWorld [_this select 2,_this select 3])] call c_proving_ground_fnc_target"; - }; - - class balca_target_type_control_group : balca_debug_control_group { - x = safezoneX_PG + border_offsetX + btn_weight*0; - w = 1; - y = safezoneY_PG - btn_height; - h = str_height*4; - - class Controls { - class balca_target_fill_man : balca_debug_btn - { - x = 0; w = btn_weight-column_div; - y = 0; - text = "Man"; - action = "[1,0] call c_proving_ground_fnc_target;"; - }; - - class balca_target_fill_car : balca_debug_btn - { - x = 0; w = btn_weight-column_div; - y = btn_height; - text = "Car"; - action = "[1,1] call c_proving_ground_fnc_target;"; - }; - - class balca_target_fill_truck : balca_debug_btn - { - x = btn_weight*1; w = btn_weight-column_div; - y = 0; - text = "Truck"; - action = "[1,2] call c_proving_ground_fnc_target;"; - }; - - class balca_target_fill_APC : balca_debug_btn - { - x = btn_weight*1; w = btn_weight-column_div; - y = btn_height; - text = "APC"; - action = "[1,3] call c_proving_ground_fnc_target;"; - }; - - class balca_target_fill_tank : balca_debug_btn - { - x = btn_weight*2; w = btn_weight-column_div; - y = 0; - text = "Tank"; - action = "[1,4] call c_proving_ground_fnc_target;"; - }; - - class balca_target_fill_helicopter : balca_debug_btn - { - x = btn_weight*2; w = btn_weight-column_div; - y = btn_height; - text = "Helicopter"; - action = "[1,5] call c_proving_ground_fnc_target;"; - }; - - class balca_target_fill_plane : balca_debug_btn - { - x = btn_weight*3; w = btn_weight-column_div; - y = 0; - text = "Plane"; - action = "[1,6] call c_proving_ground_fnc_target;"; - }; - - class balca_target_fill_ship : balca_debug_btn - { - x = btn_weight*3; w = btn_weight-column_div; - y = btn_height; - text = "Ship"; - action = "[1,7] call c_proving_ground_fnc_target;"; - }; - }; - };//end control group - - class balca_target_management_control_group : balca_debug_control_group { - x = safezoneX_PG+column_weight*2; - w = 1; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*4 - (safezoneY_PG + offset_top*2); - - class Controls { - class balca_target_mode_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = 0; - h = str_height; - text = "Mode"; - }; - - class balca_target_mode_combo : balca_debug_combo - { - idc = balca_target_mode_IDC; - x = 0; - w = column_weight-column_div*3; - y = btn_height; - onLBSelChanged = "c_proving_ground_target_mode = (_this select 1);[0,(_this select 1)] call c_proving_ground_fnc_target;"; - }; - - class balca_target_mode_land_static : balca_debug_control_group { - idc = balca_target_land_static_IDC; - x = 0; - w = 1; - y = btn_height*2; - h = btn_height*5; - class Controls { - class balca_target_distance_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*0; - h = str_height; - text = "Distance"; - }; - - class balca_target_direction_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*1; - h = str_height; - text = "Direction"; - }; - - class balca_target_speed_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*2; - h = str_height; - text = "Speed"; - }; - - class balca_target_distance : balca_debug_edit - { - idc = balca_target_distance_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*0; - h = str_height; - text = "--"; - }; - - class balca_target_direction : balca_debug_edit - { - idc = balca_target_direction_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*1; - h = str_height; - text = "--"; - }; - - class balca_target_speed : balca_debug_edit - { - idc = balca_target_speed_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*2; - h = str_height; - text = "--"; - }; - };//end contols - };//end balca_target_mode_static_land - - class balca_target_mode_land_random : balca_debug_control_group { - idc = balca_target_land_random_IDC; - x = 0; - w = 1; - y = btn_height*2; - h = btn_height*5; - class Controls { - class balca_target_distance_desc : balca_debug_text - { - x = 0; - w = 2*column_weight/3; - y = btn_height*0; - h = str_height; - text = "Distance +/-"; - }; - - class balca_target_direction_desc : balca_debug_text - { - x = 0; - w = 2*column_weight/3; - y = btn_height*1; - h = str_height; - text = "Direction +/-"; - }; - - class balca_target_speed_desc : balca_debug_text - { - x = 0; - w = column_weight/3-column_div; - y = btn_height*2; - h = str_height; - text = "Speed"; - }; - - class balca_target_rdistance : balca_debug_edit - { - idc = balca_target_rdistance_IDC; - x = column_weight/3; - w = column_weight/3-column_div*3; - y = btn_height*0; - h = str_height; - text = "--"; - }; - - class balca_target_distance_rand : balca_debug_edit - { - idc = balca_target_distance_rand_IDC; - x = 2*column_weight/3; - w = column_weight/3-column_div*3; - y = btn_height*0; - h = str_height; - text = "--"; - }; - - class balca_target_rdirection : balca_debug_edit - { - idc = balca_target_rdirection_IDC; - x = column_weight/3; - w = column_weight/3-column_div*3; - y = btn_height*1; - h = str_height; - text = "--"; - }; - - class balca_target_direction_rand : balca_debug_edit - { - idc = balca_target_direction_rand_IDC; - x = 2*column_weight/3; - w = column_weight/3-column_div*3; - y = btn_height*1; - h = str_height; - text = "--"; - }; - - class balca_target_speed_rand : balca_debug_edit - { - idc = balca_target_speed_rand_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div*3; - y = btn_height*2; - h = str_height; - text = "--"; - }; - };//end contols - };//end balca_target_mode_land_random - - class balca_target_mode_land_AI : balca_debug_control_group { - idc = balca_target_land_AI_IDC; - x = 0; - w = 1; - y = btn_height*2; - h = btn_height*5; - class Controls { - class balca_target_distance_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*0; - h = str_height; - text = "Distance"; - }; - - class balca_target_distance : balca_debug_edit - { - idc = balca_target_land_AI_dist_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*0; - h = str_height; - text = "--"; - }; - - class balca_target_show_map_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*1; - text = "Toggle map"; - action = "[7] call c_proving_ground_fnc_target;"; - }; -/* - class balca_target_adjust_way_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*2; - text = "Adjust waypoints"; - action = "[10] call c_proving_ground_fnc_target;"; - }; -*/ - class balca_target_clear_way_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*3; - text = "Clear waypoints"; - action = "[8] call c_proving_ground_fnc_target;"; - }; - - };//end contols - };//end balca_target_mode_land_AI - - class balca_target_mode_air_AI : balca_debug_control_group { - idc = balca_target_air_AI_IDC; - x = 0; - w = 1; - y = btn_height*2; - h = btn_height*5; - class Controls { - class balca_target_distance_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*0; - h = str_height; - text = "Distance"; - }; - - class balca_target_distance : balca_debug_edit - { - idc = balca_target_air_AI_dist_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*0; - h = str_height; - text = "--"; - }; - - - class balca_target_show_map_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*1; - text = "Toggle map"; - action = "[7] call c_proving_ground_fnc_target;"; - }; -/* - class balca_target_adjust_way_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*2; - text = "Adjust waypoints"; - action = "[10] call c_proving_ground_fnc_target;"; - }; -*/ - class balca_target_clear_way_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*3; - text = "Clear waypoints"; - action = "[8] call c_proving_ground_fnc_target;"; - }; - };//end contols - };//end balca_target_mode_air_AI - - class balca_target_apply_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*7; - text = "Apply"; - action = "[6] call c_proving_ground_fnc_target;"; - }; - - class balca_target_reset_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*8; - text = "Reset"; - action = "c_proving_ground_target_props = [100,0,(getDir c_proving_ground_core)+180]];[0] call c_proving_ground_fnc_target;[6] call c_proving_ground_fnc_target;"; - }; - - class balca_target_create_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*9; - text = "Add target"; - action = "[3] call c_proving_ground_fnc_target;"; - }; - - class balca_target_clear_btn : balca_debug_btn - { - x = 0; - w = column_weight-column_div; - y = btn_height*10; - text = "Clear targets"; - action = "[5] call c_proving_ground_fnc_target;"; - }; - }; - };//end management control group - - class balca_target_close_btn : balca_debug_btn - { - x = safezoneX_PG + btn_weight*3; w = btn_weight; - y = display_height-safezoneY_PG- offset_bottom; - text = "Close"; - action = "closeDialog 0;"; - }; -}; - -class balca_sound_player -{ - idd = balca_sound_player_IDD; - name = "balca_sound_player"; - movingEnable = false; - - controlsBackground[] = {balca_debug_background}; - objects[] = {}; - controls[] = { - balca_soundlist, - balca_clipboard_btn, - balca_close_btn - }; -///////////////// - class balca_debug_background - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG-border_offsetX; w = column_weight*3 + border_offsetX*3; - y = safezoneY_PG-border_offsetY; h = display_height+border_offsetY*2+btn_height*1; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaMedium"; - sizeEx = 0.032; - }; - - -///////////// -#include "defs_base_control.hpp" -///////////// - - class balca_soundlist : balca_debug_list - { - idc = balca_soundlist_IDC; - x = safezoneX_PG; - w = column_weight*3 - column_div; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*4 - (safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= ""; - onLBDblClick = "[1] call c_proving_ground_fnc_sound;"; - }; - - class balca_clipboard_btn : balca_debug_btn - { - x = safezoneX_PG; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom; - text = "to Clipboard"; - action = "[2] call c_proving_ground_fnc_sound;"; - }; - - class balca_close_btn : balca_debug_btn - { - x = safezoneX_PG + column_weight*2; w = btn_weight; - y = display_height-safezoneY_PG- offset_bottom; - text = "Close"; - action = "closeDialog 0;"; - }; -}; - -class balca_statistics -{ - idd = balca_stat_display_IDD; - name = "balca_statistics"; - movingEnable = false; - - controlsBackground[] = {balca_debug_background}; - objects[] = {}; - controls[] = { - balca_stat_text, - balca_reset_btn, - balca_clipboard_btn, - balca_close_btn - }; -///////////////// - class balca_debug_background - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG-border_offsetX; w = column_weight*3 + border_offsetX*3; - y = safezoneY_PG-border_offsetY; h = display_height+border_offsetY*2+btn_height*1; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaMedium"; - sizeEx = 0.032; - }; - - -///////////// -#include "defs_base_control.hpp" -///////////// - - class balca_stat_text : balca_debug_text - { - idc = balca_stat_text_IDC; - type = CT_STRUCTURED_TEXT+ST_LEFT; - size = 0.023; - x = safezoneX_PG; - w = column_weight - column_div; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*3 -(safezoneY_PG + offset_top*2); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; - - class balca_reset_btn : balca_debug_btn - { - x = safezoneX_PG; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom; - text = "Reset"; - action = "[1] call c_proving_ground_fnc_statistics;"; - }; - - class balca_clipboard_btn : balca_debug_btn - { - x = safezoneX_PG + column_weight; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom; - text = "to Clipboard"; - action = "[2] call c_proving_ground_fnc_statistics;"; - }; - - class balca_close_btn : balca_debug_btn - { - x = safezoneX_PG + column_weight*2; w = btn_weight; - y = display_height-safezoneY_PG- offset_bottom; - text = "Close"; - action = "closeDialog 0;"; - }; -}; - -class balca_environment -{ - idd = balca_environment_IDD; - name = "balca_environment"; - movingEnable = false; - - controlsBackground[] = {balca_debug_background}; - objects[] = {}; - controls[] = { - balca_env_control_group, - balca_apply_btn - }; -///////////////// - class balca_debug_background - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG-border_offsetX; w = column_weight*1 + border_offsetX*3; - y = safezoneY_PG-border_offsetY; h = display_height+border_offsetY*2+btn_height*1; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaMedium"; - sizeEx = 0.032; - }; - - -///////////// -#include "defs_base_control.hpp" -///////////// - - class balca_env_control_group : balca_debug_control_group { - x = safezoneX_PG+column_weight*0; - w = 1; - y = safezoneY_PG + offset_top*2; - h = display_height - offset_bottom*4 - (safezoneY_PG + offset_top*2); - - class Controls { - - class balca_env_VD_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*1; - h = str_height; - text = "Viewdistance"; - }; - - class balca_env_VD : balca_debug_edit - { - idc = balca_env_VD_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*1; - h = str_height; - text = "--"; - }; - - class balca_env_grass_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*2; - h = str_height; - text = "Grass"; - }; - - class balca_env_grass : balca_debug_edit - { - idc = balca_env_grass_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*2; - h = str_height; - text = "--"; - }; - - class balca_env_fog_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*3; - h = str_height; - text = "Fog"; - }; - - class balca_env_fog : balca_debug_edit - { - idc = balca_env_fog_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*3; - h = str_height; - text = "--"; - }; - - class balca_env_overcast_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*4; - h = str_height; - text = "Overcast"; - }; - - class balca_env_overcast : balca_debug_edit - { - idc = balca_env_overcast_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*4; - h = str_height; - text = "--"; - }; - - class balca_env_rain_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*5; - h = str_height; - text = "Rain"; - }; - - class balca_env_rain : balca_debug_edit - { - idc = balca_env_rain_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*5; - h = str_height; - text = "--"; - }; - - class balca_env_wind_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*6; - h = str_height; - text = "Wind speed"; - }; - - class balca_env_wind : balca_debug_edit - { - idc = balca_env_wind_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*6; - h = str_height; - text = "--"; - }; - - class balca_env_wind_dir_desc : balca_debug_text - { - x = 0; - w = column_weight/2-column_div; - y = btn_height*7; - h = str_height; - text = "Wind direction"; - }; - - class balca_env_wind_dir : balca_debug_edit - { - idc = balca_env_wind_dir_IDC; - x = column_weight*0.5; - w = column_weight/2-column_div; - y = btn_height*7; - h = str_height; - text = "--"; - }; - }; - }; - - class balca_apply_btn : balca_debug_btn - { - x = safezoneX_PG; w = column_weight-column_div; - y = display_height-safezoneY_PG- offset_bottom; - text = "Apply"; - action = "[1] call c_proving_ground_fnc_environment;"; - }; -}; - - -#include "CfgExplorer2\config.hpp" -#include "reloader\config.hpp" diff --git a/addons/proving_ground/PG_rsctitles.hpp b/addons/proving_ground/PG_rsctitles.hpp deleted file mode 100644 index ed1342ef8..000000000 --- a/addons/proving_ground/PG_rsctitles.hpp +++ /dev/null @@ -1,41 +0,0 @@ - class balca_debug_hint { - idd = balca_debug_hint_IDD; - onLoad = "with uiNameSpace do { balca_debug_hint = _this select 0 };"; - movingEnable = 0; - duration = 1; - fadeIn = "false"; - fadeOut = "false"; - controls[] = {"balca_hint_BG", "balca_hint_text", "balca_hint_text2"}; - - class balca_hint_BG { - idc = -1; - type = CT_STATIC; - font = "TahomaB"; - colorBackground[] = {0.1882, 0.2588, 0.149, 0.76}; - colorText[] = {0, 0, 0, 0}; - text = ""; - style = 128; - sizeEx = ( 16 / 408 ); - x = 0; - y = safezoneY_PG; - h = 0.08; - w = 0.38; - }; - - class balca_hint_text : balca_hint_BG { - idc = balca_hint_text_IDC; - style = ST_CENTER; - x = 0.01; - h = 0.033; - w = 0.37; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0.388, 0.545, 0.247, 0}; - font = "TahomaB"; - sizeEx = 0.03; - }; - - class balca_hint_text2 : balca_hint_text { - idc = balca_hint_text2_IDC; - y = safezoneY_PG + 0.033; - }; - }; diff --git a/addons/proving_ground/defs.hpp b/addons/proving_ground/defs.hpp deleted file mode 100644 index 10ec19bfd..000000000 --- a/addons/proving_ground/defs.hpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "macros.hpp" - -#define balca_debug_main_IDD 66461 -#define __idCounter(a) (balca_debug_main_IDD + a) -#define balca_debug_VC_IDD __idCounter(10) - -#define balca_VC_vehlist_IDC __idCounter(11) -#define balca_VC_vehicle_shortcut_IDC __idCounter(12) -#define balca_VC_veh_info_IDC __idCounter(13) - - -#define balca_debug_WC_IDD __idCounter(20) - -#define balca_WC_weaplist_IDC __idCounter(21) -#define balca_WC_magazinelist_IDC __idCounter(22) -#define balca_WC_weapon_shortcut_IDC __idCounter(23) -#define balca_WC_weap_info_IDC __idCounter(24) -#define balca_WC_magazine_info_IDC __idCounter(25) - -#define balca_debug_console_IDD __idCounter(30) - -#define balca_debug_console_edit_IDC __idCounter(31) -#define balca_debug_console_result_IDC __idCounter(32) -#define balca_debug_console_history_IDC __idCounter(33) - -#define balca_target_display_IDD __idCounter(40) - -#define balca_target_vehlist_IDC __idCounter(41) -#define balca_target_vehicle_shortcut_IDC __idCounter(42) -#define balca_target_veh_info_IDC __idCounter(43) -#define balca_target_mode_IDC __idCounter(44) -#define balca_target_land_static_IDC __idCounter(45) -#define balca_target_land_random_IDC __idCounter(46) -#define balca_target_land_AI_IDC __idCounter(47) -#define balca_target_air_AI_IDC __idCounter(48) - -#define balca_target_distance_IDC __idCounter(49) -#define balca_target_direction_IDC __idCounter(50) -#define balca_target_speed_IDC __idCounter(51) -#define balca_target_map_IDC __idCounter(52) - -#define balca_target_rdistance_IDC __idCounter(53) -#define balca_target_rdirection_IDC __idCounter(54) -#define balca_target_distance_rand_IDC __idCounter(55) -#define balca_target_direction_rand_IDC __idCounter(56) -#define balca_target_speed_rand_IDC __idCounter(57) -#define balca_target_land_AI_dist_IDC __idCounter(58) -#define balca_target_air_AI_dist_IDC __idCounter(59) - - -#define balca_sound_player_IDD __idCounter(70) -#define balca_soundlist_IDC __idCounter(71) - -#define balca_debug_hint_IDD __idCounter(80) - -#define balca_hint_text_IDC __idCounter(81) -#define balca_hint_text2_IDC __idCounter(82) - -#define balca_stat_display_IDD __idCounter(85) -#define balca_stat_text_IDC __idCounter(86) - -#define balca_environment_IDD __idCounter(87) -#define balca_env_VD_IDC __idCounter(88) -#define balca_env_grass_IDC __idCounter(89) -#define balca_env_fog_IDC __idCounter(90) -#define balca_env_overcast_IDC __idCounter(91) -#define balca_env_rain_IDC __idCounter(92) -#define balca_env_wind_IDC __idCounter(93) -#define balca_env_wind_dir_IDC __idCounter(94) - - diff --git a/addons/proving_ground/defs_base_control.hpp b/addons/proving_ground/defs_base_control.hpp deleted file mode 100644 index 95c48ac64..000000000 --- a/addons/proving_ground/defs_base_control.hpp +++ /dev/null @@ -1,612 +0,0 @@ - class balca_debug_control_group - { - idc = -1; - type = 15; - style = 0; - class VScrollbar - { - color[] = {1, 1, 1, 1}; - width = 0.021; - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - }; - - class HScrollbar - { - color[] = {1, 1, 1, 1}; - height = 0.028; - }; - - class ScrollBar - { - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - thumb = "#(argb,8,8,3)color(1,1,1,1)"; - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - border = "#(argb,8,8,3)color(1,1,1,1)"; - }; - x = 0; - w = 1; - y = 0; - h = 1; - }; - - class balca_debug_combo { - idc = -1; - type = 4; - style = 0; - - x = 0; - y = 0; - w = 0.12; - h = str_height; - - font = "PuristaBold"; - sizeEx = 0.03; - - rowHeight = 0.1; - wholeHeight = 0.4; - - class ComboScrollBar - { - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - thumb = "#(argb,8,8,3)color(1,1,1,1)"; - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - border = "#(argb,8,8,3)color(1,1,1,1)"; - }; - - colorSelect[] = {1, 1, 1, 1}; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0.543, 0.5742, 0.4102, 0.9}; - colorSelectBackground[] = {0.40, 0.43, 0.28, 0.9}; - colorScrollbar[] = {0.2, 0.2, 0.2, 1}; - - soundSelect[] = {"", 0.1, 1}; - soundExpand[] = {"", 0.1, 1}; - soundCollapse[] = {"", 0.1, 1}; - maxHistoryDelay = 1; - - arrowEmpty = ""; - arrowFull = ""; - color[] = {0.1, 0.1, 0.1, 1}; - colorActive[] = {0,0,0,1}; - colorDisabled[] = {0,0,0,0.3}; - }; - - class balca_debug_text - { - idc = -1; - type = CT_STATIC; - style = ST_LEFT; - x = 0.0; w = 0.3; - y = 0.0; h = 0.03; - sizeEx = 0.023; - colorBackground[] = {0.5, 0.5, 0.5, 0}; - colorText[] = {0.85, 0.85, 0.85, 1}; - font = "PuristaBold"; - text = ""; - }; - - class balca_debug_edit - { - type = CT_EDIT; - style = ST_LEFT+ST_MULTI; - idc = -1; - font = "PuristaMedium"; - sizeEx = 0.026; - htmlControl = true; - lineSpacing = 0.004; - x = 0.0; w = 0.3; - y = 0.0; h = 0.06; - colorText[] = {0.85, 0.85, 0.85, 1}; - colorSelection[] = {1, 1, 1, 1}; - colorDisabled[] = {0,0,0,0.3}; - autocomplete = "scripting"; - //text = ""; - }; - - class balca_debug_image - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE+ST_KEEP_ASPECT_RATIO; - x = 0.25; w = 0.1; - y = 0.1; h = 0.1; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "PuristaBold"; - sizeEx = 0.032; - }; - - class balca_debug_btn - { - idc = -1; - type = 16; - style = 0; - - text = "btn"; - action = ""; - - x = 0; - y = 0; - - w = 0.23; - h = 0.06; - - size = 0.03921; - sizeEx = 0.03921; - - color[] = {0.8314, 0.8784, 0.6275, 1.0}; - color2[] = {0.95, 0.95, 0.95, 1}; - colorFocused[] = {0.8314, 0.8784, 0.6275, 1.0}; - colorBackground[] = {1, 1, 1, 1}; - colorbackground2[] = {1, 1, 1, 0.4}; - colorBackgroundFocused[] = {1, 1, 1, 1}; - colorDisabled[] = {1, 1, 1, 0.25}; - periodFocus = 1.2; - periodOver = 0.8; - - class HitZone - { - left = 0.004; - top = 0.004; - right = 0.004; - bottom = 0.004; - }; - - class ShortcutPos - { - left = 0.0145; - top = 0.016; - w = 0.03631; - h = 0.01; - }; - - class TextPos - { - left = 0.03; - top = 0.001; - right = 0.005; - bottom = 0.001; - }; - - textureNoShortcut = ""; - /*animTextureNormal = "client\ui\ui_button_normal_ca.paa"; - animTextureDisabled = "client\ui\ui_button_disabled_ca.paa"; - animTextureOver = "client\ui\ui_button_over_ca.paa"; - animTextureFocused = "client\ui\ui_button_focus_ca.paa"; - animTexturePressed = "client\ui\ui_button_down_ca.paa"; - animTextureDefault = "client\ui\ui_button_default_ca.paa";*/ - animTextureNormal = "client\ui\igui_button_normal_ca.paa"; - animTextureDisabled = "client\ui\igui_button_disabled_ca.paa"; - animTextureOver = "client\ui\igui_button_over_ca.paa"; - animTextureFocused = "client\ui\igui_button_focus_ca.paa"; - animTexturePressed = "client\ui\igui_button_down_ca.paa"; - animTextureDefault = "client\ui\igui_button_normal_ca.paa"; - animTextureNoShortcut = "client\ui\igui_button_normal_ca.paa"; - period = 0.4; - font = "PuristaBold"; - - soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1}; - soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1}; - soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick", 0.07, 1}; - soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1}; - - class Attributes - { - font = "PuristaBold"; - color = "#E5E5E5"; - align = "left"; - shadow = "true"; - }; - - class AttributesImage - { - font = "PuristaBold"; - color = "#E5E5E5"; - align = "left"; - shadow = "true"; - }; - }; - - class balca_debug_list - { - type = CT_LISTBOX; - style = 16; - idc = -1; - text = ""; - w = 0.275; - h = 0.04; - colorSelect[] = {1, 1, 1, 1}; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0.8,0.8,0.8,1}; - colorSelectBackground[] = {0.40, 0.43, 0.28, 0.5}; - colorScrollbar[] = {0.2, 0.2, 0.2, 1}; - arrowEmpty = "client\ui\ui_arrow_combo_ca.paa"; - arrowFull = "client\ui\ui_arrow_combo_active_ca.paa"; - wholeHeight = 0.45; - rowHeight = 0.04; - color[] = {0.7, 0.7, 0.7, 1}; - colorActive[] = {0,0,0,1}; - colorDisabled[] = {0,0,0,0.3}; - font = "PuristaBold"; - sizeEx = 0.023; - soundSelect[] = {"",0.1,1}; - soundExpand[] = {"",0.1,1}; - soundCollapse[] = {"",0.1,1}; - maxHistoryDelay = 1; - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - - class ListScrollBar - { - color[] = {1, 1, 1, 1}; - colorActive[] = {1, 1, 1, 1}; - colorDisabled[] = {1, 1, 1, 1}; - thumb = "client\ui\ui_scrollbar_thumb_ca.paa"; - arrowFull = "client\ui\ui_arrow_top_active_ca.paa"; - arrowEmpty = "client\ui\ui_arrow_top_ca.paa"; - border = "client\ui\ui_border_scroll_ca.paa"; - }; - }; - - class balca_debug_pict - { - /*idc = -1; - type = CT_STATIC; - style = ST_PICTURE;*/ - x = 0.25; w = 0.5; - y = 0.1; h = 0.8; - /*colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "\ca\ui\data\ui_gameoptions_background_ca.paa"; - font = "PuristaBold"; - sizeEx = 0.032;*/ - colorBackground[] = {0, 0, 0, 0.6}; - text = ""; - type = CT_STATIC; - idc = -1; - style = ST_LEFT; - font = ""; - colorText[] = {1, 1, 1, 1}; - sizeEx = 0.04; - }; - - class balca_debug_map { - idc = -1; - - type=101; - style=48; - - x = 0; - y = 0; - w = 1; - h = 1; - - colorBackground[] = {1.00, 1.00, 1.00, 1.00}; - colorText[] = {0.00, 0.00, 0.00, 1.00}; - colorSea[] = {0.56, 0.80, 0.98, 0.50}; - colorForest[] = {0.60, 0.80, 0.20, 0.50}; - colorRocks[] = {0.50, 0.50, 0.50, 0.50}; - colorCountlines[] = {0.65, 0.45, 0.27, 0.50}; - colorMainCountlines[] = {0.65, 0.45, 0.27, 1.00}; - colorCountlinesWater[] = {0.00, 0.53, 1.00, 0.50}; - colorMainCountlinesWater[] = {0.00, 0.53, 1.00, 1.00}; - colorForestBorder[] = {0.40, 0.80, 0.00, 1.00}; - colorRocksBorder[] = {0.50, 0.50, 0.50, 1.00}; - colorPowerLines[] = {0.00, 0.00, 0.00, 1.00}; - colorNames[] = {0.00, 0.00, 0.00, 1.00}; - colorInactive[] = {1.00, 1.00, 1.00, 0.50}; - colorLevels[] = {0.00, 0.00, 0.00, 1.00}; - colorRailWay[] = {0.00, 0.00, 0.00, 1.00}; - colorOutside[] = {0.00, 0.00, 0.00, 1.00}; - - font = "TahomaB"; - sizeEx = 0.040000; - - stickX[] = {0.20, {"Gamma", 1.00, 1.50} }; - stickY[] = {0.20, {"Gamma", 1.00, 1.50} }; - ptsPerSquareSea = 6; - ptsPerSquareTxt = 8; - ptsPerSquareCLn = 8; - ptsPerSquareExp = 8; - ptsPerSquareCost = 8; - ptsPerSquareFor = "4.0f"; - ptsPerSquareForEdge = "10.0f"; - ptsPerSquareRoad = 2; - ptsPerSquareObj = 10; - - fontLabel = "PuristaBold"; - sizeExLabel = 0.034000; - fontGrid = "PuristaBold"; - sizeExGrid = 0.034000; - fontUnits = "PuristaBold"; - sizeExUnits = 0.034000; - fontNames = "PuristaBold"; - sizeExNames = 0.056000; - fontInfo = "PuristaBold"; - sizeExInfo = 0.034000; - fontLevel = "PuristaBold"; - sizeExLevel = 0.034000; - - text = "\ca\ui\data\map_background2_co.paa"; - - maxSatelliteAlpha = 0; // Alpha to 0 by default - alphaFadeStartScale = 1.0; - alphaFadeEndScale = 1.1; // Prevent div/0 - - showCountourInterval=2; - scaleDefault = 0.1; - onMouseButtonClick = ""; - onMouseButtonDblClick = ""; - - class CustomMark { - icon = "\ca\ui\data\map_waypoint_ca.paa"; - color[] = {0, 0, 1, 1}; - size = 18; - importance = 1; - coefMin = 1; - coefMax = 1; - }; - - class Legend { - x = -1; - y = -1; - w = 0.340000; - h = 0.152000; - font = "PuristaBold"; - sizeEx = 0.039210; - colorBackground[] = {0.906000, 0.901000, 0.880000, 0.800000}; - color[] = {0, 0, 0, 1}; - }; - - class Bunker { - icon = "\ca\ui\data\map_bunker_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 14; - importance = "1.5 * 14 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Bush { - icon = "\ca\ui\data\map_bush_ca.paa"; - color[] = {0.550000, 0.640000, 0.430000, 1}; - size = 14; - importance = "0.2 * 14 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class BusStop { - icon = "\ca\ui\data\map_busstop_ca.paa"; - color[] = {0, 0, 1, 1}; - size = 10; - importance = "1 * 10 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Command { - icon = "\ca\ui\data\map_waypoint_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 18; - importance = 1; - coefMin = 1; - coefMax = 1; - }; - - class Cross { - icon = "\ca\ui\data\map_cross_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 16; - importance = "0.7 * 16 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Fortress { - icon = "\ca\ui\data\map_bunker_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 16; - importance = "2 * 16 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Fuelstation { - icon = "\ca\ui\data\map_fuelstation_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 16; - importance = "2 * 16 * 0.05"; - coefMin = 0.750000; - coefMax = 4; - }; - - class Fountain { - icon = "\ca\ui\data\map_fountain_ca.paa"; - color[] = {0, 0.350000, 0.700000, 1}; - size = 12; - importance = "1 * 12 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Hospital { - icon = "\ca\ui\data\map_hospital_ca.paa"; - color[] = {0.780000, 0, 0.050000, 1}; - size = 16; - importance = "2 * 16 * 0.05"; - coefMin = 0.500000; - coefMax = 4; - }; - - class Chapel { - icon = "\ca\ui\data\map_chapel_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 16; - importance = "1 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class Church { - icon = "\ca\ui\data\map_church_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 16; - importance = "2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class Lighthouse { - icon = "\ca\ui\data\map_lighthouse_ca.paa"; - color[] = {0.780000, 0, 0.050000, 1}; - size = 20; - importance = "3 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class Quay { - icon = "\ca\ui\data\map_quay_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 16; - importance = "2 * 16 * 0.05"; - coefMin = 0.500000; - coefMax = 4; - }; - - class Rock { - icon = "\ca\ui\data\map_rock_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 12; - importance = "0.5 * 12 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Ruin { - icon = "\ca\ui\data\map_ruin_ca.paa"; - color[] = {0.780000, 0, 0.050000, 1}; - size = 16; - importance = "1.2 * 16 * 0.05"; - coefMin = 1; - coefMax = 4; - }; - - class SmallTree { - icon = "\ca\ui\data\map_smalltree_ca.paa"; - color[] = {0.550000, 0.640000, 0.430000, 1}; - size = 12; - importance = "0.6 * 12 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Stack { - icon = "\ca\ui\data\map_stack_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 20; - importance = "2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class Tree { - icon = "\ca\ui\data\map_tree_ca.paa"; - color[] = {0.550000, 0.640000, 0.430000, 1}; - size = 12; - importance = "0.9 * 16 * 0.05"; - coefMin = 0.250000; - coefMax = 4; - }; - - class Tourism { - icon = "\ca\ui\data\map_tourism_ca.paa"; - color[] = {0.780000, 0, 0.050000, 1}; - size = 16; - importance = "1 * 16 * 0.05"; - coefMin = 0.700000; - coefMax = 4; - }; - - class Transmitter { - icon = "\ca\ui\data\map_transmitter_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 20; - importance = "2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class ViewTower { - icon = "\ca\ui\data\map_viewtower_ca.paa"; - color[] = {0, 0.900000, 0, 1}; - size = 16; - importance = "2.5 * 16 * 0.05"; - coefMin = 0.500000; - coefMax = 4; - }; - - class Watertower { - icon = "\ca\ui\data\map_watertower_ca.paa"; - color[] = {0, 0.350000, 0.700000, 1}; - size = 32; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class Waypoint { - icon = "\ca\ui\data\map_waypoint_ca.paa"; - size = 20; - color[] = {0, 0.900000, 0, 1}; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class Task { - icon = "\ca\ui\data\map_waypoint_ca.paa"; - iconCreated = "#(argb,8,8,3)color(1,1,1,1)"; - iconCanceled = "#(argb,8,8,3)color(0,0,1,1)"; - iconDone = "#(argb,8,8,3)color(0,0,0,1)"; - iconFailed = "#(argb,8,8,3)color(1,0,0,1)"; - colorCreated[] = {1,1,1,1}; - colorCanceled[] = {1,1,1,1}; - colorDone[] = {1,1,1,1}; - colorFailed[] = {1,1,1,1}; - size = 20; - color[] = {0, 0.900000, 0, 1}; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class WaypointCompleted { - icon = "\ca\ui\data\map_waypoint_completed_ca.paa"; - size = 20; - color[] = {0, 0.900000, 0, 1}; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - - class ActiveMarker { - icon = "\ca\ui\data\map_waypoint_completed_ca.paa"; - size = 20; - color[] = {0, 0.900000, 0, 1}; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - }; diff --git a/addons/proving_ground/defs_ui.hpp b/addons/proving_ground/defs_ui.hpp deleted file mode 100644 index a43ca4a0c..000000000 --- a/addons/proving_ground/defs_ui.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Control types -#define CT_STATIC 0 -#define CT_BUTTON 1 -#define CT_EDIT 2 -#define CT_SLIDER 3 -#define CT_COMBO 4 -#define CT_LISTBOX 5 -#define CT_TOOLBOX 6 -#define CT_CHECKBOXES 7 -#define CT_PROGRESS 8 -#define CT_HTML 9 -#define CT_STATIC_SKEW 10 -#define CT_ACTIVETEXT 11 -#define CT_TREE 12 -#define CT_STRUCTURED_TEXT 13 -#define CT_CONTEXT_MENU 14 -#define CT_CONTROLS_GROUP 15 -#define CT_SHORTCUT_BUTTON 16 // Arma 2 - textured button - -#define CT_XKEYDESC 40 -#define CT_XBUTTON 41 -#define CT_XLISTBOX 42 -#define CT_XSLIDER 43 -#define CT_XCOMBO 44 -#define CT_ANIMATED_TEXTURE 45 -#define CT_OBJECT 80 -#define CT_OBJECT_ZOOM 81 -#define CT_OBJECT_CONTAINER 82 -#define CT_OBJECT_CONT_ANIM 83 -#define CT_LINEBREAK 98 -#define CT_USER 99 -#define CT_MAP 100 -#define CT_MAP_MAIN 101 -#define CT_List_N_Box 102 // Arma 2 - N columns list box - - -// Static styles -#define ST_POS 0x0F -#define ST_HPOS 0x03 -#define ST_VPOS 0x0C -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 -#define ST_DOWN 0x04 -#define ST_UP 0x08 -#define ST_VCENTER 0x0c - -#define ST_TYPE 0xF0 -#define ST_SINGLE 0 -#define ST_MULTI 16 -#define ST_TITLE_BAR 32 -#define ST_PICTURE 48 -#define ST_FRAME 64 -#define ST_BACKGROUND 80 -#define ST_GROUP_BOX 96 -#define ST_GROUP_BOX2 112 -#define ST_HUD_BACKGROUND 128 -#define ST_TILE_PICTURE 144 -#define ST_WITH_RECT 160 -#define ST_LINE 176 - -#define ST_SHADOW 0x100 -#define ST_NO_RECT 0x200 -#define ST_KEEP_ASPECT_RATIO 0x800 - -#define ST_TITLE ST_TITLE_BAR + ST_CENTER - -// Slider styles -#define SL_DIR 0x400 -#define SL_VERT 0 -#define SL_HORZ 0x400 - -#define SL_TEXTURES 0x10 - -// Listbox styles -#define LB_TEXTURES 0x10 -#define LB_MULTI 0x20 - -#define FontM "TahomaB" - - -#define safezoneX_PG 0.1 -#define safezoneY_PG 0.1 -#define display_weight 0.9 -#define display_height 1 -#define border_offsetX 0.03 -#define border_offsetY 0.01 -#define offset_top 0.05 -#define offset_bottom 0.05 -#define column_weight 0.3 -#define column_div 0.01 -#define img_height 0.3 -#define img_height_wc 0.4 -#define str_height 0.04 -#define btn_height 0.05 -#define btn_weight 0.2 - diff --git a/addons/proving_ground/fnc_ammo.sqf b/addons/proving_ground/fnc_ammo.sqf deleted file mode 100644 index 1137f42b8..000000000 --- a/addons/proving_ground/fnc_ammo.sqf +++ /dev/null @@ -1,32 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (uiNameSpace getVariable "balca_debug_hint") -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -if PG_get(AMMO) then { - PG_set(AMMO,false); - hint "Infinite ammo disabled"; -}else{ - hint "Infinite ammo enabled"; - PG_set(AMMO,true); - [] spawn { - while {PG_get(AMMO)} do { - sleep 0.5; - { - if !(_x in weapons player) exitWith { - [_x] call PG_get(fnc_add_weapon); - }; - }forEach PG_get(weapons); - { - if !(_x in magazines player) exitWith { - sleep .1; - player addMagazine _x; - }; - }forEach PG_get(mags); - sleep 0.1; - { - (vehicle _x) setVehicleAmmo 1; - }forEach units group player; - }; - }; -}; - - diff --git a/addons/proving_ground/fnc_autoheal.sqf b/addons/proving_ground/fnc_autoheal.sqf deleted file mode 100644 index 42bb4f3b1..000000000 --- a/addons/proving_ground/fnc_autoheal.sqf +++ /dev/null @@ -1,38 +0,0 @@ -#include "defs.hpp" -if PG_get(Autoheal) then { - PG_set(Autoheal,false); - hint "Autoheal disabled"; -}else{ - hint "Autoheal enabled"; - PG_set(Autoheal,true); - [] spawn { - while {PG_get(Autoheal)} do { - sleep 0.5; - _cursortarget = cursorTarget; - _veh = vehicle player; - _p_hit_EH = player addEventHandler ["hit",{player setDammage 0}]; - _p_dam_EH = player addEventHandler ["dammaged",{player setDammage 0}]; - _veh_hit_EH = _veh addEventHandler ["hit",{vehicle player setDammage 0}]; - _veh_dam_EH = _veh addEventHandler ["dammaged",{vehicle player setDammage 0}]; - while {(_veh == (vehicle player))&&PG_get(Autoheal)} do { - if (isClass(configFile >> "cfgPatches" >> "ace_main")) then { - player setVariable ["ace_w_bleed", 0]; - player setVariable ["ace_w_pain", 0]; - player setVariable ["ace_w_state", 0, true]; - player setVariable ["ace_sys_wounds_uncon", false, true]; - player setVariable ["ace_w_unconlen", time]; - player setVariable ["ace_w_revive", -1]; - player setVariable ["ace_sys_stamina_Fatigue", 0]; - }; - player setDammage 0; - _veh setDammage 0; - _veh setFuel 1; - sleep .5; - }; - player removeEventHandler ["hit",_p_hit_EH]; - player removeEventHandler ["dammaged",_p_dam_EH]; - _veh removeEventHandler ["hit",_veh_hit_EH]; - _veh removeEventHandler ["dammaged",_veh_dam_EH]; - }; - }; -}; diff --git a/addons/proving_ground/fnc_booster.sqf b/addons/proving_ground/fnc_booster.sqf deleted file mode 100644 index e39adb38e..000000000 --- a/addons/proving_ground/fnc_booster.sqf +++ /dev/null @@ -1,3 +0,0 @@ -_booster = (findDisplay 46) displayAddEventHandler ["keyDown", "_this call c_proving_ground_booster_keyhandler"]; -sleep 10; -(findDisplay 46) displayRemoveEventHandler ["KeyDown", _booster]; diff --git a/addons/proving_ground/fnc_bulletcam.sqf b/addons/proving_ground/fnc_bulletcam.sqf deleted file mode 100644 index 2eaad1daf..000000000 --- a/addons/proving_ground/fnc_bulletcam.sqf +++ /dev/null @@ -1,32 +0,0 @@ -#include "defs.hpp" -switch true do { - case (_this == "bulletcam"): { - if PG_get(bulletcam) then { - switch PG_get(bullettime) do { - case 1: {PG_set(bullettime,0.5); hint "AccTime 0.5"}; - case 0.5: {PG_set(bullettime,0.1); hint "AccTime 0.1"}; - default { - PG_set(bullettime,1); - PG_set(bulletcam,false); - hint "Bulletcam disabled"; - }; - }; - }else{ - hint "Bulletcam enabled"; - PG_set(bulletcam,true); - }; - }; - case (_this == "hitmarker"): { - if PG_get(hitmarker) then { - PG_set(hitmarker,false); - {deleteMarkerLocal _x} forEach PG_get(hitmarkers); - hint "Hitmarker disabled"; - }else{ - PG_set(hitmarker,true); - hint "Hitmarker enabled"; - }; - }; -}; - - - diff --git a/addons/proving_ground/fnc_bullettrack.sqf b/addons/proving_ground/fnc_bullettrack.sqf deleted file mode 100644 index 8b89512c3..000000000 --- a/addons/proving_ground/fnc_bullettrack.sqf +++ /dev/null @@ -1,95 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (uiNameSpace getVariable "balca_debug_hint") -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) - -[3,_this] call PG_get(FNC_statistics); - - -_trackCam = { - private ["_cam","_lastpos","_dir","_vel","_bullet","_acctime"]; - _bullet = _this; - _ammo = typeOf _bullet; - _startpos = getPos _bullet; - _lastpos = getPos _bullet; - _interrupt = (findDisplay 46) displayAddEventHandler ["KeyDown", "c_proving_ground_TRACKING = false;_this set [0,nil];true"]; - PG_set(TRACKING,true); - - sleep .01; - - setAccTime PG_get(bullettime); - showCinemaBorder false; - _cam = "camera" camCreate getPosASL _bullet; - _cam cameraEffect ["internal", "back"]; - _cam camSetTarget _bullet; - _cam camSetRelPos [0,-10,2]; - _cam camCommit 0.1; - - - while {!(isNull _bullet)&&(PG_get(TRACKING))} do { - _lastTime = time; - _dir = getDir _bullet; - _vel = velocity _bullet; - _spd = (_vel distance [0,0,0]) max 1; - _lastpos = getPosASL _bullet; - sleep 0.01; - _velVector = [(_vel select 0)/_spd,(_vel select 1)/_spd,(_vel select 2)/_spd]; - _cam camSetRelPos [0,-10,2]; - //_cam camSetRelPos [-5*(_velVector select 0),-5*(_velVector select 1),-5*(_velVector select 2)]; - _cam camcommit 5*(time - _lastTime); - cutRsc ["balca_debug_hint","PLAIN"]; - GET_CTRL(balca_hint_text_IDC) ctrlSetText format ["%1",_ammo]; - GET_CTRL(balca_hint_text2_IDC) ctrlSetText format ["Speed: %1",round(_spd)]; - }; - - setAccTime 1; - if (((_startpos distance _lastpos)>700)&&(PG_get(TRACKING))) then { - _cam camSetPos [(_lastpos select 0) - 200*sin(_dir), (_lastpos select 1)-200*cos(_dir), (_lastpos select 2) + sin(45)*200]; - _cam camCommit 5; - _cam camSetTarget _lastpos; - _endTime = time + 5; - while {PG_get(TRACKING)&&(time<_endtime)} do {sleep .1}; - }; - - _cam cameraeffect ["terminate", "back"]; - camDestroy _cam; - PG_set(TRACKING,false); - (findDisplay 46) displayRemoveEventHandler ["KeyDown",_interrupt]; - -}; - -_trackMarker = { - _bullet = _this; - _startpos = getPos _bullet; - _lastpos = getPos _bullet; - sleep .01; - - _markerName = "PG_hitmarker" + str(_lastpos)+str(random 100000); - createMarkerLocal [_markerName,_lastpos]; - _markerName setMarkerTypeLocal "mil_dot"; - _markerName setMarkerColorLocal "ColorRed"; - //_markerName setMarkerSizeLocal [.3,.3]; - _markerName setMarkerAlphaLocal 1; - PG_set(hitmarkers,PG_get(hitmarkers)+[_markerName]); - - - while {!(isNull _bullet)} do {; - _markerName setMarkerPosLocal getPosASL _bullet; - sleep 0.01; - }; -}; - -////////////////// -_bullet = if ((count _this)>6) then { - _this select 6; -}else{ - nearestObject [_veh, _ammo]; -}; - -if (PG_get(bulletcam)) then { - _bullet spawn _trackCam; -}; - -if (PG_get(hitmarker)) then { - _bullet spawn _trackMarker; -}; - diff --git a/addons/proving_ground/fnc_create_vehicle.sqf b/addons/proving_ground/fnc_create_vehicle.sqf deleted file mode 100644 index 5930e7080..000000000 --- a/addons/proving_ground/fnc_create_vehicle.sqf +++ /dev/null @@ -1,103 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (findDisplay balca_debug_VC_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -#define GET_SELECTED_DATA(a) ([##a] call {_idc = _this select 0;_selection = (lbSelection GET_CTRL(_idc) select 0);if (isNil {_selection}) then {_selection = 0};(GET_CTRL(_idc) lbData _selection)}) -#define KINDOF_ARRAY(a,b) [##a,##b] call {_veh = _this select 0;_types = _this select 1;_res = false; {if (_veh isKindOf _x) exitwith { _res = true };} forEach _types;_res} - -_mode = _this select 0; -_veh_type = _this select 1; -switch (_mode) do { -case 0: { - - _kindOf = ["tank"]; - _filter = []; - switch (_veh_type) do { - case 0: {_kindOf = ["staticWeapon"];}; - case 1: {_kindOf = ["car","Motorcycle"];_filter = ["Truck_F","Wheeled_APC_F"];}; - case 2: {_kindOf = ["Truck_F"];}; - case 3: {_kindOf = ["Wheeled_APC_F","Tracked_APC_F"];}; - case 4: {_kindOf = ["tank"];_filter = ["Tracked_APC_F"];}; - case 5: {_kindOf = ["helicopter"];_filter = ["ParachuteBase"];}; - case 6: {_kindOf = ["plane"];_filter = ["ParachuteBase"];}; - case 7: {_kindOf = ["ship"];}; - default {_kindOf = ["tank"];_filter = [];}; - }; - _cfgvehicles = configFile >> "cfgVehicles"; - lbClear GET_CTRL(balca_VC_vehlist_IDC); - for "_i" from 0 to (count _cfgvehicles)-1 do { - _vehicle = _cfgvehicles select _i; - if (isClass _vehicle) then { - _veh_type = configName(_vehicle); - if ((getNumber(_vehicle >> "scope")==2)and(getText(_vehicle >> "picture")!="")and(KINDOF_ARRAY(_veh_type,_kindOf))and!(KINDOF_ARRAY(_veh_type,_filter))) then { - GET_CTRL(balca_VC_vehlist_IDC) lbAdd (getText(_vehicle >> "displayName")); - GET_CTRL(balca_VC_vehlist_IDC) lbSetData [(lbSize GET_CTRL(balca_VC_vehlist_IDC))-1,_veh_type]; - GET_CTRL(balca_VC_vehlist_IDC) lbSetPicture [(lbSize GET_CTRL(balca_VC_vehlist_IDC))-1,getText(_vehicle >> "picture")]; - }; - }; - }; - lbSort GET_CTRL(balca_VC_vehlist_IDC); - }; -case 1: { - _veh_type = GET_SELECTED_DATA(balca_VC_vehlist_IDC); - GET_CTRL(balca_VC_vehicle_shortcut_IDC) ctrlSetText (getText(configFile >> "CfgVehicles" >> _veh_type >> "picture")); - _vehicle = (configFile >> "CfgVehicles" >> _veh_type); - _displayName = getText(_vehicle >> "displayName"); - _armor = getNumber(_vehicle >> "armor"); - _maxSpeed = getNumber(_vehicle >> "maxSpeed"); - _weapons = getArray(_vehicle >> "weapons"); - _magazines = getArray(_vehicle >> "magazines"); - _turrets= (_vehicle >> "Turrets"); - for "_i" from 0 to (count _turrets)-1 do { - _turret = _turrets select _i; - _weapons = _weapons + getArray(_turret >> "weapons"); - _magazines = _magazines + getArray(_turret >> "magazines"); - _subturrets = _turret >> "Turrets"; - for "_j" from 0 to (count _subturrets)-1 do { - _turret = _subturrets select _j; - _weapons = _weapons + getArray(_turret >> "weapons"); - _magazines = _magazines + getArray(_turret >> "magazines"); - }; - }; - _lb = parseText "
"; - _text = composeText [str configName(_vehicle),_lb, - "DisplayName: ",str _displayName,_lb, - "Armor: ", str _armor,_lb, - "MaxSpeed: ", str _maxSpeed,_lb, - "Weapons: ", str _weapons,_lb, - "Magazines: ", str _magazines,_lb]; - GET_CTRL(balca_VC_veh_info_IDC) ctrlSetStructuredText _text; - }; -case 2: { - _old_veh = PG_get(VEH); - _core = PG_get(CORE); - _dir = getDir _core; - _pos = getPos _core; - _veh_type = GET_SELECTED_DATA(balca_VC_vehlist_IDC); - deleteVehicle _old_veh; - _veh = createVehicle [_veh_type, _pos, [], 0, "CAN_COLLIDE"]; - _veh spawn vehicleRepair; - _veh setDir _dir; - PG_set(VEH,_veh); - }; - -case 3: { - _dir = getdir player; - _pos = getPos player; - _pos = [(_pos select 0)+20*sin(_dir),(_pos select 1)+20*cos(_dir),0]; - _veh_type = GET_SELECTED_DATA(balca_VC_vehlist_IDC); - _old_veh = nearestObjects [_pos, ["AllVehicles"], 5]; - {deleteVehicle _x} forEach _old_veh; - _veh = createVehicle [_veh_type, _pos, [], 0, "CAN_COLLIDE"]; - _veh spawn vehicleRepair; - _veh setDir _dir; - if (!isNil "notifyAdminMenu") then { ["vehicle", _veh_type] call notifyAdminMenu }; - }; - -case 4: {//class to clipboard - copyToClipboard (""""+GET_SELECTED_DATA(balca_VC_vehlist_IDC)+""""); - }; - -case 5: {//detailed info to clipboard - copyToClipboard ctrlText GET_CTRL(balca_VC_veh_info_IDC); - }; -} diff --git a/addons/proving_ground/fnc_create_weapon.sqf b/addons/proving_ground/fnc_create_weapon.sqf deleted file mode 100644 index 27f872431..000000000 --- a/addons/proving_ground/fnc_create_weapon.sqf +++ /dev/null @@ -1,133 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (findDisplay balca_debug_WC_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -#define GET_SELECTED_DATA(a) ([##a] call {_idc = _this select 0;_selection = (lbSelection GET_CTRL(_idc) select 0);if (isNil {_selection}) then {_selection = 0};(GET_CTRL(_idc) lbData _selection)}) -#define __cfgWeap configFile >> "cfgWeapons" - - -_mode = _this select 0; -_item_type = _this select 1; -switch (_mode) do { -case 0: {//fill weapon list - _cfgweapons = configFile >> "cfgWeapons"; - _type = 1; - switch (_item_type) do { - case 0: {_type = [1];};//rifles - case 1: {_type = [1];};//scoped rifles - case 2: {_type = [1,5];};//heavy - case 3: {_type = [4];};//secondary weapon - case 4: {_type = [2];};//pistol - case 5: {_type = [0];};//put/throw - case 6: {_type = [4096];};//BinocularSlot - case 7: {_type = [131072];};//SmallItems - default {_type = [1];}; - }; - lbClear GET_CTRL(balca_WC_weaplist_IDC); - for "_i" from 0 to (count _cfgweapons)-1 do { - _weapon = _cfgweapons select _i; - if (isClass _weapon) then { - _weap_type = configName(_weapon); - _cur_type = getNumber(_weapon >> "type"); - _display_name = getText(_weapon >> "displayName"); - _no_pack = getNumber(_weapon >> "ACE_nopack"); - _optics = getText(_weapon >> "ModelOptics"); - //diag_log format ["%1",[_weap_type,_cur_type,_no_pack]]; - if (((((getNumber(_weapon >> "scope")==2)&&(getText(_weapon >> "model")!="")&&(_display_name!=""))||((_item_type==5)&&(getNumber(_weapon >> "scope")>0)))&&(_cur_type in _type)&&(_display_name!="")) - && - ((_item_type in [3,4,5,6,7])||((_item_type==0)&&(_no_pack!=1)&&((_optics=="-")))||((_item_type==1)&&(_no_pack!=1)&&((_optics!="-")))||((_item_type==2)&&((_cur_type==5)||((_no_pack==1)&&(_cur_type in _type)))))) then { - GET_CTRL(balca_WC_weaplist_IDC) lbAdd _display_name; - GET_CTRL(balca_WC_weaplist_IDC) lbSetData [(lbSize GET_CTRL(balca_WC_weaplist_IDC))-1,_weap_type]; - GET_CTRL(balca_WC_weaplist_IDC) lbSetPicture [(lbSize GET_CTRL(balca_WC_weaplist_IDC))-1,getText(_weapon >> "picture")]; - - - - }; - }; - }; - lbSort GET_CTRL(balca_WC_weaplist_IDC); - - - }; -case 1: {//weap info, fill magazines - _weap_type = GET_SELECTED_DATA(balca_WC_weaplist_IDC); - _weapon = (configFile >> "cfgWeapons" >> _weap_type); - _displayName = getText(_weapon >> "displayName"); - _picture = getText(_weapon >> "picture"); - _library = getText(_weapon >> "Library" >> "libTextDesc"); - _dispersion = getNumber(_weapon >> "dispersion"); - _magazines = []; - { - _magazines = _magazines + getArray( (if ( _x == "this" ) then { _weapon } else { _weapon >> _x }) >> "magazines") - } forEach getArray(_weapon >> "muzzles"); - _dispersion = getNumber(_weapon >> "dispersion"); - { - _dispersion = getNumber(_weapon >> _x >> "dispersion") - } forEach getArray (_weapon >> "modes"); - GET_CTRL(balca_WC_weapon_shortcut_IDC) ctrlSetText (_picture); - _lb = parseText "
"; - _text = composeText ["Class: ",str configName(_weapon),_lb, - "DisplayName: ",str _displayName,_lb, - "Dispersion: ",str _dispersion,_lb,_lb, - parseText _library]; - GET_CTRL(balca_WC_weap_info_IDC) ctrlSetStructuredText _text; - lbClear GET_CTRL(balca_WC_magazinelist_IDC); - { - GET_CTRL(balca_WC_magazinelist_IDC) lbAdd (getText(configFile >> "cfgMagazines" >> _x >> "displayName")); - GET_CTRL(balca_WC_magazinelist_IDC) lbSetData [(lbSize GET_CTRL(balca_WC_magazinelist_IDC))-1,configName(configFile >> "cfgMagazines" >> _x)]; - GET_CTRL(balca_WC_magazinelist_IDC) lbSetPicture [(lbSize GET_CTRL(balca_WC_magazinelist_IDC))-1,getText(configFile >> "cfgMagazines" >> _x >> "picture")]; - } forEach _magazines; - - }; - -case 2: {//addweapon - PG_set(MAGS,[]); - [GET_SELECTED_DATA(balca_WC_weaplist_IDC)] call PG_get(FNC_ADD_WEAPON); - PG_set(WEAPONS,weapons player); - if (!isNil "notifyAdminMenu") then { ["weapon", GET_SELECTED_DATA(balca_WC_weaplist_IDC)] call notifyAdminMenu }; - }; - -case 3: {//ammo info - _mag = GET_SELECTED_DATA(balca_WC_magazinelist_IDC); - _count = getNumber(configFile>>"CfgMagazines">>_mag>>"count"); - _displayName = getText (configFile >> "CfgMagazines" >> _mag >> "displayName"); - _initSpeed = getNumber(configFile >> "cfgMagazines" >> _mag >> "initSpeed"); - _shell = getText(configFile >> "cfgMagazines" >> _mag >> "ammo"); - _displayName = getText (configFile >> "CfgAmmo" >> _shell >> "displayName"); - _hit = getNumber(configFile >> "cfgAmmo" >> _shell >> "hit"); - _indirectHit = getNumber(configFile >> "cfgAmmo" >> _shell >> "indirectHit"); - _indirectHitRange = getNumber(configFile >> "cfgAmmo" >> _shell >> "indirectHitRange"); - _ACE_damage = getNumber(configFile >> "cfgAmmo" >> _shell >> "ACE_hit"); - _timeToLive = getNumber(configFile >> "cfgAmmo" >> _shell >> "timeToLive"); - _airFriction = getNumber(configFile >> "cfgAmmo" >> _shell >> "airFriction"); - - _lb = parseText "
"; - _text = composeText ["Class: ",str _mag,_lb, - "Ammo class: ",str _shell,_lb, - "DisplayName: ",str _displayName,_lb, - "Count: ",str _count,_lb, - "Damage: ", str _hit,_lb]; - if (_ACE_damage >0) then { - _text = composeText [_text,"ACE damage: ",str _ACE_damage,_lb]; - }; - if (_indirectHit >0) then { - _text = composeText [_text,"Indirect damage: ",str _indirectHit,_lb,"Explosion radius: ", str _indirectHitRange,_lb]; - }; - _text = composeText [_text,"InitSpeed: ",str _initSpeed,_text,"AirFriction: ",str _airFriction,_lb,"LifeTime: ", str _timeToLive]; - GET_CTRL(balca_WC_magazine_info_IDC) ctrlSetStructuredText _text; - }; - -case 4: {//addMagazine - _mag = GET_SELECTED_DATA(balca_WC_magazinelist_IDC); - player addMagazine _mag; - PG_set(MAGS,magazines player); - if (!isNil "notifyAdminMenu") then { ["ammo", _mag] call notifyAdminMenu }; - }; - -case 5: {//weap to clipboard - copyToClipboard (""""+GET_SELECTED_DATA(balca_WC_weaplist_IDC)+""""); - }; - -case 6: {//ammo to clipboard - copyToClipboard (""""+GET_SELECTED_DATA(balca_WC_magazinelist_IDC)+""""); - }; -}; diff --git a/addons/proving_ground/fnc_environment.sqf b/addons/proving_ground/fnc_environment.sqf deleted file mode 100644 index 6b2fb1209..000000000 --- a/addons/proving_ground/fnc_environment.sqf +++ /dev/null @@ -1,38 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (findDisplay balca_environment_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -#define GET_SELECTED_DATA(a) ([##a] call {_idc = _this select 0;_selection = (lbSelection GET_CTRL(_idc) select 0);if (isNil {_selection}) then {_selection = 0};(GET_CTRL(_idc) lbData _selection)}) - - -_mode = _this select 0; -switch (_mode) do { -case 0: {//init - - GET_CTRL(balca_env_VD_IDC) ctrlSetText str viewDistance; - GET_CTRL(balca_env_grass_IDC) ctrlSetText str 0; - GET_CTRL(balca_env_fog_IDC) ctrlSetText str fog; - GET_CTRL(balca_env_overcast_IDC) ctrlSetText str overcast; - GET_CTRL(balca_env_rain_IDC) ctrlSetText str rain; - _wind = wind; - GET_CTRL(balca_env_wind_IDC) ctrlSetText str (_wind distance [0,0,0]); - GET_CTRL(balca_env_wind_dir_IDC) ctrlSetText str ((((_wind select 0) atan2 (_wind select 1))+180)%180); - - - }; -case 1: {//apply from editbox - _vd = (parseNumber ctrlText GET_CTRL(balca_env_VD_IDC)) max 0 min 10000; - _grass = (parseNumber ctrlText GET_CTRL(balca_env_grass_IDC)) max 0 min 50; - _fog = (parseNumber ctrlText GET_CTRL(balca_env_fog_IDC)) max 0 min 1; - _overcast = (parseNumber ctrlText GET_CTRL(balca_env_overcast_IDC)) max 0 min 1; - _rain = (parseNumber ctrlText GET_CTRL(balca_env_rain_IDC)) max 0 min 1; - _wind = (parseNumber ctrlText GET_CTRL(balca_env_wind_IDC)) max 0 min 100; - _wind_dir = (parseNumber ctrlText GET_CTRL(balca_env_wind_dir_IDC)) + 180; - - setViewDistance _vd; - setTerrainGrid _grass; - 0 setFog _fog; - 0 setOvercast _overcast; - 0 setRain _rain; - setWind [_wind*sin(_wind_dir),_wind*cos(_wind_dir),true]; - }; -}; diff --git a/addons/proving_ground/fnc_exec_console.sqf b/addons/proving_ground/fnc_exec_console.sqf deleted file mode 100644 index b2ae99fa5..000000000 --- a/addons/proving_ground/fnc_exec_console.sqf +++ /dev/null @@ -1,114 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (findDisplay balca_debug_console_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -#define GET_SELECTED_DATA(a) ([##a] call {_idc = _this select 0;_selection = (lbSelection GET_CTRL(_idc) select 0);if (isNil {_selection}) then {_selection = 0};(GET_CTRL(_idc) lbData _selection)}) -_mode = _this select 0; -switch (_mode) do { - case 0: {//init - _console_history = __uiGet(balca_console_history); - if (isNil{_console_history}) then { - _console_history = ["hint format [""%1"",cursortarget]"]; - __uiSet(balca_console_history,_console_history); - { - GET_CTRL(balca_debug_console_history_IDC) lbAdd _x; - GET_CTRL(balca_debug_console_history_IDC) lbSetData [(lbSize GET_CTRL(balca_debug_console_history_IDC))-1,_x]; - } forEach _console_history; - }else{ - { - GET_CTRL(balca_debug_console_history_IDC) lbAdd _x; - GET_CTRL(balca_debug_console_history_IDC) lbSetData [(lbSize GET_CTRL(balca_debug_console_history_IDC))-1,_x]; - } forEach _console_history; - GET_CTRL(balca_debug_console_edit_IDC) ctrlSetText (_console_history select ((count _console_history)-1)); - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText str __uiGet(balca_console_result); - }; - }; - case 1: {//exec - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText ''; - _command = ctrlText balca_debug_console_edit_IDC; - _console_history = __uiGet(balca_console_history); - if (({_x==_command} count _console_history)<1) then { - _console_history set [(count _console_history),_command]; - __uiSet(balca_console_history,_console_history); - GET_CTRL(balca_debug_console_history_IDC) lbAdd str _command; - GET_CTRL(balca_debug_console_history_IDC) lbSetData [(lbSize GET_CTRL(balca_debug_console_history_IDC))-1,_command]; - }; - _result = call compile _command; - if (!(isNil {_result})) then { - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText str _result; - __uiSet(balca_console_result,_result); - }; - }; - case 2: {//fill console from history - GET_CTRL(balca_debug_console_edit_IDC) ctrlSetText GET_SELECTED_DATA(balca_debug_console_history_IDC); - }; - case 3: {//exec command from history - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText ''; - _command = GET_SELECTED_DATA(balca_debug_console_history_IDC); - GET_CTRL(balca_debug_console_edit_IDC) ctrlSetText _command; - _result = call compile _command; - if (!(isNil {_result})) then { - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText str _result; - __uiSet(balca_console_result,_result); - }; - }; - case 4: {//exec globally - ["This feature has been disabled."] spawn BIS_fnc_guiMessage; - /*GET_CTRL(balca_debug_console_result_IDC) ctrlSetText ''; - _command = ctrlText balca_debug_console_edit_IDC; - _console_history = __uiGet(balca_console_history); - if (({_x==_command} count _console_history)<1) then { - _console_history set [(count _console_history),_command]; - __uiSet(balca_console_history,_console_history); - GET_CTRL(balca_debug_console_history_IDC) lbAdd str _command; - GET_CTRL(balca_debug_console_history_IDC) lbSetData [(lbSize GET_CTRL(balca_debug_console_history_IDC))-1,_command]; - }; - [player, _command] call fn_vehicleInit;*/ - // processInitCommands; - }; - case 5: {//exec on server - ["This feature has been disabled."] spawn BIS_fnc_guiMessage; - /*GET_CTRL(balca_debug_console_result_IDC) ctrlSetText ''; - _command = ctrlText balca_debug_console_edit_IDC; - _console_history = __uiGet(balca_console_history); - if (({_x==_command} count _console_history)<1) then { - _console_history set [(count _console_history),_command]; - __uiSet(balca_console_history,_console_history); - GET_CTRL(balca_debug_console_history_IDC) lbAdd str _command; - GET_CTRL(balca_debug_console_history_IDC) lbSetData [(lbSize GET_CTRL(balca_debug_console_history_IDC))-1,_command]; - }; - player setVariable ['PG_result',[]]; - [player, ("if isServer then {this setVariable [""PG_result"",[call {"+_command+"}],true]}")] call fn_vehicleInit; - // processInitCommands; - - [] spawn { - _time = time+2; - waitUntil{ - ((count(player getVariable ['PG_result',[]])==1)||_time>time) - }; - _res = player getVariable ['PG_result',[""]]; - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText str(_res select 0); - player setVariable ['PG_result',[]]; - };*/ - }; - case 6: {//run tracker - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText ''; - PG_tracker = true; - _command = (ctrlText balca_debug_console_edit_IDC); - _console_history = __uiGet(balca_console_history); - if (({_x==_command} count _console_history)<1) then { - _console_history set [(count _console_history),_command]; - __uiSet(balca_console_history,_console_history); - GET_CTRL(balca_debug_console_history_IDC) lbAdd str _command; - GET_CTRL(balca_debug_console_history_IDC) lbSetData [(lbSize GET_CTRL(balca_debug_console_history_IDC))-1,_command]; - }; - _code = compile _command; - _result = _code spawn {while {PG_tracker} do {sleep .5;call _this}}; - if (!(isNil {_result})) then { - GET_CTRL(balca_debug_console_result_IDC) ctrlSetText str _result; - __uiSet(balca_console_result,_result); - }; - }; - case 7: {//run tracker - PG_tracker = false; - }; -}; diff --git a/addons/proving_ground/fnc_global.sqf b/addons/proving_ground/fnc_global.sqf deleted file mode 100644 index eb4c74d18..000000000 --- a/addons/proving_ground/fnc_global.sqf +++ /dev/null @@ -1,313 +0,0 @@ -_fnc_create_land_target = { - private ["_index","_unit_type"]; - _index = _this select 0; - _unit_type = _this select 1; - _offset = if (count(_this) >2) then {_this select 2}else{0}; - _is_new = false; - if (_index == -1) then {_index = (count PG_get(land_targets));_is_new = true}; - _core = PG_get(core); - _dir = getDir _core; - _pos = getPos _core; - _tdist = PG_get(target_props) select 0; - _tspeed = PG_get(target_props) select 1; - _tdir = PG_get(target_props) select 2; - _grp = createGroup PG_get(opfor); - _grp copyWaypoints PG_get(target_grp); - _pos = if (PG_get(target_mode)<2) then { - [(_pos select 0)+(_tdist+20)*sin(_dir),(_pos select 1)+(_tdist+20)*cos(_dir),0]; - }else{ - waypointPosition ((waypoints _grp) select 0) - }; - - - _unit = objNull; - if (_unit_type isKindOf "Man") then { - _unit = _grp createUnit [_unit_type,_pos,[],0.1,"NONE"]; - switch PG_get(target_mode) do { - case 2: {//land AI - - }; - default { - _unit setBehaviour "CARELESS"; - _unit disableAI "PATHPLAN"; - _unit disableAI "MOVE"; - _unit doWatch _core; - _unit stop true; - }; - }; - _unit allowFleeing 0; - _unit disableAI "TARGET"; - _unit disableAI "AUTOTARGET"; -// _unit disableAI "ANIM"; - _unit setCombatMode "BLUE"; - switch (_index%4) do { - case 0: {_unit setUnitPos "UP"}; - case 1: {_unit setUnitPos "MIDDLE"}; - case 2: {_unit setUnitPos "DOWN"}; - default {_unit setUnitPos "UP"}; - }; - }else{ - _unit = createVehicle [_unit_type, _pos, [], 0, "NONE"]; - [_unit,_grp] call PG_get(fnc_create_crew); - _unit setCombatMode "BLUE"; - _unit engineOn true; - if !(_unit isKindOf "Plane") then {_unit flyInHeight 5;}; - }; - _unit setDir _tdir; - {_unit removeMagazine _x} forEach magazines _unit; - group player reveal _unit; - //hint on hit - _unit addEventHandler["hit","hintSilent format['""%1"" hit, damage:%2',getText(configFile >> 'cfgVehicles' >> typeof (_this select 0) >> 'displayName'),ceil((_this select 2)*100)/100]; [4,_this] call c_proving_ground_fnc_statistics"]; - //hint when killed - _unit addEventHandler["killed","hintSilent format['""%1"" killed',getText(configFile >> 'cfgVehicles' >> typeof (_this select 0) >> 'displayName')];[5,_this] call c_proving_ground_fnc_statistics"]; - - - //hint format ["%1",[_index,_trgname]]; - - _target = [_unit,_unit_type,_grp,_offset]; - PG_set_arr(LAND_TARGETS,_index,_target); - switch PG_get(target_mode) do { - case 0: {//land static - if (_is_new) then { - [] call PG_get(fnc_calc_offsets); - }else{ - [0,_index] call PG_get(fnc_move_land_targets); - }; - }; - case 1: {//land random - _unit spawn PG_get(fnc_move_rand_land); - }; - }; - _unit -}; - -_fnc_create_crew = { - private["_unit","_crew","_grp","_veh"]; - _veh = _this select 0; - _grp = _this select 1; - _crew = getArray(configFile >> "cfgVehicles" >> (typeOf _veh) >> "typicalCargo"); - _target_mode = PG_get(target_mode); - - { - _unit = (_grp createUnit [_x,[0,0,0],[],0.1,"NONE"]); - {_unit removeMagazine _x} forEach magazines _unit; - switch _target_mode do { - case 2: {//land AI - _unit doWatch PG_get(core); - }; - case 3: {//air AI - }; - default { - _unit disableAI "PATHPLAN"; - _unit disableAI "MOVE"; - _unit doWatch PG_get(core); - _unit stop true; - }; - }; - _unit allowFleeing 0; - _unit disableAI "TARGET"; - _unit disableAI "AUTOTARGET"; - _unit setCombatMode "BLUE"; - switch (_forEachIndex) do { - case 0: {_unit moveInDriver _veh}; - case 1: {_unit moveInGunner _veh}; - case 2: {_unit moveInCommander _veh}; - default {_unit moveInCargo _veh}; - }; - } forEach _crew; -}; - -_fnc_create_air_target = { - _index = _this select 0; - _veh_type = _this select 1; - _count = count PG_get(air_targets); - if (_index == -1) then {_index = _count;}; - - - _core = PG_get(core); - _tdist = PG_get(target_props) select 0; - _tspeed = PG_get(target_props) select 1; - _tdir = PG_get(target_props) select 2; - _dir = getDir _core; - _pos = getPos _core; - _veh = createVehicle [_veh_type, [0,0,1000], [], 0, "FLY"]; - _grp = createGroup PG_get(opfor); - _veh setDir _dir; - _veh setPos [_pos select 0,_pos select 1,10]; - _veh engineOn true; - _veh setVelocity [80*sin(_dir),80*cos(_dir),10]; - [_veh,_grp] call PG_get(fnc_create_crew); - _veh addEventHandler ["IncomingMissile","(_this select 0) fire [""CMFlareLauncher"",""Burst""]"]; - _target = [_veh,_veh_type,_grp]; - PG_set_arr(AIR_TARGETS,_index,_target); - group player reveal _veh; - _grp copyWaypoints PG_get(air_target_grp); - _veh flyInHeight 300; - - _veh addEventHandler["hit","hintSilent format['""%1"" hit\ndamage:%2\ncrew status: %3',getText(configFile >> 'cfgVehicles' >> typeof (_this select 0) >> 'displayName'),ceil((_this select 2)*100)/100,[(_this select 0)] call {_crew = crew (_this select 0);_crew_stat = [];{_crew_stat set [count _crew_stat, damage _x]} forEach _crew;_crew_stat}]; "]; - _veh addEventHandler["killed","hintSilent format['""%1"" killed',getText(configFile >> 'cfgVehicles' >> typeof (_this select 0) >> 'displayName')];"]; - - _veh -}; - -_fnc_move_land_targets = { - _shift = _this select 0; - _move_only = _this select 1;//change position only of selected unit index, -1 - change position of all units - _core = PG_get(core); - _tdist = PG_get(target_props) select 0; - _tspeed = PG_get(target_props) select 1; - _tdir = PG_get(target_props) select 2; - _dir = getDir _core; - _pos = getPos _core; - _land_targets = if (_move_only>-1) then {[PG_get(land_targets) select _move_only]}else{PG_get(land_targets)}; - - {//change unit position - _target = _x; - _unit = _target select 0; - _side_offset = _shift + (_target select 3); - _tpos = [(_pos select 0)+_side_offset*sin(_dir+90)+_tdist*sin(_dir),(_pos select 1)+_side_offset*cos(_dir+90)+_tdist*cos(_dir),0]; - _unit setPos _tpos; - _unit setDir _tdir; - } forEach _land_targets;; -}; - -_fnc_calc_offsets = { - _land_targets = PG_get(land_targets); - _core = PG_get(CORE); - _dir = getDir _core; - _pos = getPos _core; - _center_offset = 0; - _prev_size = 0; - _betweenArray = []; - {//calculate side offsets - _unit = _x select 0; - _type = _x select 1; - _size = switch true do { - case (_type isKindOf "man"): {1}; - case (_type isKindOf "air"): {12}; - default {3+abs(5*sin(_dir-_tdir))}; - }; - _between = _size + _prev_size; - _center_offset = _center_offset + _size; - _betweenArray set [count _betweenArray,_between]; - _prev_size = _size; - } forEach _land_targets; - _side_offset = - _center_offset; - _new_land_targets = []; - { - _between = _betweenArray select _forEachIndex; - _side_offset = _side_offset + _between; - _new_land_targets set [_forEachIndex,[_x select 0,_x select 1,_x select 2,_side_offset]]; - } forEach _land_targets; - PG_set(land_targets,_new_land_targets); - [0,-1] call PG_get(fnc_move_land_targets); -}; - -_fnc_move_rand_land = { - _unit = _this; - _props = PG_get(target_props); - _tdist = _props select 0; - _tdir = _props select 2; - _core = PG_get(core); - _dir = getDir _core; - _pos = getPos _core; - _rprops = PG_get(target_props_rand); - _rdist = _rprops select 0; - _rspeed = _rprops select 1; - _rdir = _rprops select 2; - _PG_tdist = _unit getVariable "PG_tdist"; - switch true do { - case ((_PG_tdist select 0)==_tdist): {};//do nothing - default {//it is new unit or _tdist changed - _cdist = _tdist -_rdist + random(2*_rdist); - _cdir = _tdir -_rdir + random(2*_rdir); - _side_offset = -20+random(40); - _tpos = [(_pos select 0)+_side_offset*sin(_dir+90)+_cdist*sin(_dir),(_pos select 1)+_side_offset*cos(_dir+90)+_cdist*cos(_dir),0]; - _unit setPos _tpos; - _unit setDir _cdir; - if (_rspeed!=0) then { - _shift = _side_offset; - _delay = 0.03; - _shift_inc = (random(_rspeed)*_delay); - if (random(2)>1) then {_shift_inc = -_shift_inc}; - while {((alive _unit)&&(PG_get(target_props_rand) select 1) != 0)&&(PG_get(target_mode) == 1)} do { - sleep _delay; - _shift = _shift + _shift_inc; - if (abs(_shift)>20) then {_shift_inc = -_shift_inc}; - _tpos = [(_pos select 0)+_shift*sin(_dir+90)+_cdist*sin(_dir),(_pos select 1)+_shift*cos(_dir+90)+_cdist*cos(_dir),0]; - _unit setPos _tpos; - }; - }; - }; - }; -}; - -PG_set(fnc_create_crew,_fnc_create_crew); -PG_set(fnc_create_land_target,_fnc_create_land_target); -PG_set(fnc_create_air_target,_fnc_create_air_target); -PG_set(fnc_calc_offsets,_fnc_calc_offsets); -PG_set(fnc_move_land_targets,_fnc_move_land_targets); -PG_set(fnc_move_rand_land,_fnc_move_rand_land); - -_booster_keyhandler = -{ - private["_handled","_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"]; - _ctrl = _this select 0; - _dikCode = _this select 1; - _shift = _this select 2; - _ctrlKey = _this select 3; - _alt = _this select 4; - _handled = false; - if (!_shift && !_ctrlKey && !_alt && (_dikCode == 18)&&(vehicle player != player)) then { - - _ctrl = nil; - _handled = true; - _veh = vehicle player; - _vel = velocity _veh; - _pos = getPos _veh; - _dir = getdir _veh; - _pitch = acos((vectorUp _veh) select 2); - _vel_new = [((_vel select 0) + 10*sin(_dir)),((_vel select 1) + 10*cos(_dir)),((_vel select 2) + 10*sin(_pitch))]; - _veh setVelocity _vel_new; - }; - _handled; -}; -PG_set(booster_keyhandler,_booster_keyhandler); - -_fnc_add_weapon = { - _weapon = _this select 0; - _weaponCfg = (configFile >> "cfgWeapons" >> _weapon); - _type = getNumber(_weaponCfg >> "type"); - if (_type in [1,2,4,5]) then { - {_cWepType = [getNumber(configFile >> "cfgWeapons" >> _x >> "type")]; - if (_cWepType select 0 in [1,5]) then {_cWepType = [1,5];}; - if (_type in _cWepType) then { - player removeWeapon _x; - _current_magazines = magazines player; - _compatible_magazines = getArray(configFile >> "cfgWeapons" >> _x >> "magazines"); - {if (_x in _compatible_magazines) then { - player removeMagazine _x; - };} forEach _current_magazines; - };} forEach (weapons player); - }; - _magazines = []; - { - _magazines = _magazines + getArray( (if ( _x == "this" ) then { _weaponCfg } else { _weaponCfg >> _x }) >> "magazines") - } forEach getArray(_weaponCfg >> "muzzles"); - if (count(_magazines) > 0) then { - player addMagazine (_magazines select 0); - }; - player addWeapon _weapon; - player selectWeapon _weapon; - //remove uncompatible magazines - _compatible_magazines = []; - { - _compatible_magazines = _compatible_magazines + getArray(configFile >> "cfgWeapons" >> _x >> "magazines"); - } forEach (weapons player); - {if !(_x in _compatible_magazines) then { - player removeMagazine _x; - };} forEach (magazines player); - PG_set(mags,magazines player); - PG_set(weapons,weapons player); -}; -PG_set(fnc_add_weapon,_fnc_add_weapon); diff --git a/addons/proving_ground/fnc_satcam_keyhandler.sqf b/addons/proving_ground/fnc_satcam_keyhandler.sqf deleted file mode 100644 index 9e4655cfd..000000000 --- a/addons/proving_ground/fnc_satcam_keyhandler.sqf +++ /dev/null @@ -1,125 +0,0 @@ -#include "defs.hpp" -private ["_event","_keyCode","_shift","_control","_alt"]; -private["_handled","_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"]; -_ctrl = _this select 0; -_dikCode = _this select 1; -_shift = _this select 2; -_ctrlKey = _this select 3; -_alt = _this select 4; -_handled = false; - - -_balca_satcam = GVAR(balca_satcam); -_cam = _balca_satcam select 0; -_keyhandler = _balca_satcam select 1; -_campos = _balca_satcam select 2; -_dir = (_balca_satcam select 3) select 0; -_pitch = (_balca_satcam select 3) select 1; -_fov = (_balca_satcam select 3) select 2; -switch (_dikCode) do { - case 17:{ //W - _newpos = [(_campos select 0) + sin(_dir)*(_campos select 2)/4,(_campos select 1) + cos(_dir)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 31:{ //S - _newpos = [(_campos select 0) - sin(_dir)*(_campos select 2)/4,(_campos select 1) - cos(_dir)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 30:{ //A - _newpos = [(_campos select 0) + sin(_dir-90)*(_campos select 2)/4,(_campos select 1) + cos(_dir-90)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 32:{ //D - _newpos = [(_campos select 0) + sin(_dir+90)*(_campos select 2)/4,(_campos select 1) + cos(_dir+90)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 200:{ //up - _pitch = (_pitch + 1) min 89; - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 208:{ //down - _pitch = (_pitch - 1) max -89; - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 203:{ //left - _dir = (_dir - 1); - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 205:{ //right - _dir = (_dir + 1); - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 16:{ //Q - _newpos = [(_campos select 0),(_campos select 1),(((_campos select 2)*1.1) min 2000)]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 44:{ //Z - _newpos = [(_campos select 0),(_campos select 1),(((_campos select 2)/1.1) max 2)]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; -/* case 78:{ //Num + - _fov = _fov*1.1; - _cam camSetFov _fov; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 74:{ //Num - - _fov = _fov/1.1; - _cam camSetFov _fov; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - };*/ - case 49:{ //N normal view - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - camUseNVG false; - - ppGrain = ppEffectCreate ["filmGrain", 2005]; - ppGrain ppEffectEnable true; - ppGrain ppEffectAdjust [0.02, 1, 1, 0, 1]; - ppGrain ppEffectCommit 0; - }; - case 47:{ //V night vision - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - camUseNVG true; - }; - case 1:{ //Esc - - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - - camUseNVG false; - (findDisplay 46) displayRemoveEventHandler ["KeyDown",_keyhandler]; - (findDisplay 46) displayRemoveEventHandler ["MouseMoving",GVAR(balca_satcam_mouseHandlerId)]; - GVAR(balca_satcam) =nil; - _cam cameraEffect ["terminate","back"]; - camDestroy _cam; - }; - default { - //titleText["WASD - move, Num-/Num+ - zoom, V - NV, N - normal view, Q - exit","plain down"]; - }; -};//end switch diff --git a/addons/proving_ground/fnc_satcam_keyhandler_OA.sqf b/addons/proving_ground/fnc_satcam_keyhandler_OA.sqf deleted file mode 100644 index 5e118bdde..000000000 --- a/addons/proving_ground/fnc_satcam_keyhandler_OA.sqf +++ /dev/null @@ -1,147 +0,0 @@ -#include "defs.hpp" -private ["_event","_keyCode","_shift","_control","_alt"]; -private["_handled","_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"]; -_ctrl = _this select 0; -_dikCode = _this select 1; -_shift = _this select 2; -_ctrlKey = _this select 3; -_alt = _this select 4; -_handled = false; - -_balca_satcam = GVAR(balca_satcam); -_cam = _balca_satcam select 0; -_keyhandler = _balca_satcam select 1; -_campos = _balca_satcam select 2; -_dir = (_balca_satcam select 3) select 0; -_pitch = (_balca_satcam select 3) select 1; -_fov = (_balca_satcam select 3) select 2; -switch (_dikCode) do { - case 17:{ //W - _newpos = [(_campos select 0) + sin(_dir)*(_campos select 2)/4,(_campos select 1) + cos(_dir)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 31:{ //S - _newpos = [(_campos select 0) - sin(_dir)*(_campos select 2)/4,(_campos select 1) - cos(_dir)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 30:{ //A - _newpos = [(_campos select 0) + sin(_dir-90)*(_campos select 2)/4,(_campos select 1) + cos(_dir-90)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 32:{ //D - _newpos = [(_campos select 0) + sin(_dir+90)*(_campos select 2)/4,(_campos select 1) + cos(_dir+90)*(_campos select 2)/4,_campos select 2]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 200:{ //up - _pitch = (_pitch + 1) min 89; - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 208:{ //down - _pitch = (_pitch - 1) max -89; - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 203:{ //left - _dir = (_dir - 1); - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 205:{ //right - _dir = (_dir + 1); - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 16:{ //Q - _newpos = [(_campos select 0),(_campos select 1),(((_campos select 2)*1.1) min 2000)]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; - case 44:{ //Z - _newpos = [(_campos select 0),(_campos select 1),(((_campos select 2)/1.1) max 2)]; - _cam camSetPos _newpos; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_newpos,[_dir,_pitch,_fov]]; - }; -/* case 78:{ //Num + - _fov = _fov*1.1; - _cam camSetFov _fov; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - }; - case 74:{ //Num - - _fov = _fov/1.1; - _cam camSetFov _fov; - _cam camCommit 0.1; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; - };*/ - case 20:{ //T white is hot - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - - true setCamUseTi 0; - camUseNVG false; - }; - case 49:{ //N normal view - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - - false setCamUseTi 0; - false setCamUseTi 1; - camUseNVG false; - - ppGrain = ppEffectCreate ["filmGrain", 2005]; - ppGrain ppEffectEnable true; - ppGrain ppEffectAdjust [0.02, 1, 1, 0, 1]; - ppGrain ppEffectCommit 0; - }; - case 19:{ //R black is hot - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - - true setCamUseTi 1; - camUseNVG false; - }; - case 47:{ //V night vision - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - - false setCamUseTi 0; - false setCamUseTi 1; - camUseNVG true; - }; - case 1:{ //Esc - ppEffectDestroy ppColor; - ppEffectDestroy ppInversion; - ppEffectDestroy ppGrain; - - false setCamUseTi 0; - false setCamUseTi 1; - camUseNVG false; - (findDisplay 46) displayRemoveEventHandler ["KeyDown",_keyhandler]; - (findDisplay 46) displayRemoveEventHandler ["MouseMoving",GVAR(balca_satcam_mouseHandlerId)]; - GVAR(balca_satcam) = nil; - _cam cameraEffect ["terminate","back"]; - camDestroy _cam; - }; - default { - //titleText["WASD - move, Q/Z - altitude, V - NV, N - normal view","plain down"]; - }; -};//end switch diff --git a/addons/proving_ground/fnc_sattelite.sqf b/addons/proving_ground/fnc_sattelite.sqf deleted file mode 100644 index 9d0a28b33..000000000 --- a/addons/proving_ground/fnc_sattelite.sqf +++ /dev/null @@ -1,37 +0,0 @@ -#include "defs.hpp" -_pos = _this select 0; -_pos = [_pos select 0,_pos select 1,-(_pos select 2)]; -disableSerialization; - -showCinemaBorder false; -_cam = "camera" camCreate [_pos select 0,_pos select 1,200]; -_cam cameraeffect ["External", "Top"]; - -_dir = 0; -_pitch = -89; -_fov = 0.7; -_cam camSetFov 0.7; -_cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - -//titleText["WASD - move, Arrows - rotate, Num-/Num+ - zoom, V - NV, N - normal view, Q - exit","plain down"]; -_keyhandler = (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call c_proving_ground_satcam_keyhandler"]; -GVAR(balca_satcam) = [_cam,_keyhandler,[_pos select 0,_pos select 1,200],[_dir,_pitch,_fov]]; -GVAR(balca_satcam_mouseHandlerId) = (findDisplay 46) displayAddEventHandler ["MouseMoving", "_this call c_proving_ground_balca_satcam_MouseMovingHandler"]; -GVAR(balca_satcam_MouseMovingHandler) = { - _display = _this select 0; - _dx = _this select 1; - _dy = _this select 2; - - _balca_satcam = GVAR(balca_satcam); - _cam = _balca_satcam select 0; - _keyhandler = _balca_satcam select 1; - _campos = _balca_satcam select 2; - _dir = (_balca_satcam select 3) select 0; - _pitch = (_balca_satcam select 3) select 1; - _fov = (_balca_satcam select 3) select 2; - _pitch = (_pitch - _dy) min 89 max -89; - _dir = (_dir + _dx)%360; - _cam setVectorDirAndUp [[sin(_dir)*cos(_pitch),cos(_dir)*cos(_pitch),sin(_pitch)],[-sin(_dir)*sin(_pitch), -cos(_dir)*sin(_pitch), -cos(_pitch)]]; - _cam camCommit 0.01; - GVAR(balca_satcam) = [_cam,_keyhandler,_campos,[_dir,_pitch,_fov]]; -}; diff --git a/addons/proving_ground/fnc_show_dialog.sqf b/addons/proving_ground/fnc_show_dialog.sqf deleted file mode 100644 index e618fa090..000000000 --- a/addons/proving_ground/fnc_show_dialog.sqf +++ /dev/null @@ -1 +0,0 @@ -createDialog "balca_debug_main"; diff --git a/addons/proving_ground/fnc_sound.sqf b/addons/proving_ground/fnc_sound.sqf deleted file mode 100644 index 26a6f56fb..000000000 --- a/addons/proving_ground/fnc_sound.sqf +++ /dev/null @@ -1,36 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (findDisplay balca_sound_player_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -#define GET_SELECTED_DATA(a) ([##a] call {_idc = _this select 0;_selection = (lbSelection GET_CTRL(_idc) select 0);if (isNil {_selection}) then {_selection = 0};(GET_CTRL(_idc) lbData _selection)}) - - -_mode = _this select 0; -switch (_mode) do { -case 0: {//fill sound list - _cfgsounds = configFile >> "cfgSounds"; - lbClear GET_CTRL(balca_soundlist_IDC); - for "_i" from 0 to (count _cfgsounds)-1 do { - _sound = _cfgsounds select _i; - if (isClass _sound) then { - _soundName = configName(_sound); - _titles = getArray(_sound >> "Titles"); - if (count _titles > 1) then { - GET_CTRL(balca_soundlist_IDC) lbAdd (_soundName + " " + (_titles select 1)); - }else{ - GET_CTRL(balca_soundlist_IDC) lbAdd _soundName; - }; - GET_CTRL(balca_soundlist_IDC) lbSetData [(lbSize GET_CTRL(balca_soundlist_IDC))-1,_soundName]; - }; - }; - lbSort GET_CTRL(balca_soundlist_IDC); - }; -case 1: {//play - deleteVehicle PG_get(SOUNDSOURCE); - PG_set(SOUNDSOURCE,"camera" createVehicle getPosATL player); - PG_get(SOUNDSOURCE) say GET_SELECTED_DATA(balca_soundlist_IDC); - }; - -case 2: {//clipboard - copyToClipboard (""""+GET_SELECTED_DATA(balca_soundlist_IDC)+""""); - }; -}; diff --git a/addons/proving_ground/fnc_statistics.sqf b/addons/proving_ground/fnc_statistics.sqf deleted file mode 100644 index ed3784d7c..000000000 --- a/addons/proving_ground/fnc_statistics.sqf +++ /dev/null @@ -1,79 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (findDisplay balca_stat_display_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) - -_stat = PG_get(STAT); -_mode = _this select 0; -_opt = _this select 1; -switch (_mode) do { -case 0: {//init - _weapon = _stat select 0; - _hits = _stat select 1; - _kills = _stat select 2; - _shots = _stat select 3; - _props = PG_get(TARGET_PROPS); - _tdist = _props select 0; - _tspeed = _props select 1; - _tdir = _props select 2; - _rprops = PG_get(TARGET_PROPS_RAND); - _rdist = _rprops select 0; - _rspeed = _rprops select 1; - _rdir = _rprops select 2; - _lb = parseText "
"; - _displayName = getText(configFile >> "cfgWeapons" >> _weapon >> "displayName"); - _mode_text = switch PG_get(target_mode) do { - case 0: { - composeText [" Target mode: static land",_lb, - "Distance: ",str _tdist,_lb, - "Speed: ", str _tspeed,_lb,_lb]; - }; - case 1: { - composeText [" Target mode: random land",_lb, - "Distance: ",str _tdist," +/- ",str _rdist,_lb, - "Speed: ", str _rspeed,_lb,_lb]; - }; - case 2: { - composeText [" Target mode: AI land",_lb,_lb]; - }; - case 3: { - composeText [" Target mode: AI air",_lb,_lb]; - }; - default {""}; - }; - _text = composeText [_mode_text, - " Weapon: ",_displayName,_lb, - "Shots: ",str _shots,_lb, - "Hits: ", str _hits,_lb, - "Kills: ", str _kills,_lb, - "Accuracy: ", str (_hits/(_shots max 1)),_lb]; - GET_CTRL(balca_stat_text_IDC) ctrlSetStructuredText _text; -}; -case 1: {//reset - _stat = [currentWeapon(vehicle player),0,0,0];//weapon,hits,kills,shots - PG_set(STAT,_stat); - [0] call PG_get(FNC_statistics); -}; -case 2: {//copy - copyToClipboard (ctrlText GET_CTRL(balca_stat_text_IDC)); -}; -case 3: {//fired EH - if ((_stat select 0) == currentWeapon(vehicle player)) then { - _stat set [3,(_stat select 3)+1]; - PG_set(STAT,_stat) - }; -}; -case 4: {//hit EH - _killer = (_opt select 1); - if ((_killer == (vehicle player))&&((_stat select 0) == currentWeapon(vehicle player))) then { - _stat set [1,(_stat select 1)+1]; - PG_set(STAT,_stat) - }; -}; -case 5: {//killed EH - _killer = _opt select 1; - if ((_killer == (vehicle player))&&((_stat select 0) == currentWeapon(vehicle player))) then { - _stat set [2,(_stat select 2)+1]; - PG_set(STAT,_stat) - }; -}; -}; diff --git a/addons/proving_ground/fnc_status.sqf b/addons/proving_ground/fnc_status.sqf deleted file mode 100644 index 5e6be846f..000000000 --- a/addons/proving_ground/fnc_status.sqf +++ /dev/null @@ -1,28 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (uiNameSpace getVariable "balca_debug_hint") -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -if (PG_get(STATUS)) then { - PG_set(STATUS,false); -// hint "Status display disabled"; -}else{ - hint "Status display enabled"; - PG_set(STATUS,true); - [] spawn { - while {PG_get(STATUS)} do { - sleep 0.5; - _cursortarget = cursorTarget; - if ((alive _cursortarget)) then { - cutRsc ["balca_debug_hint","PLAIN"]; - _crew = crew _cursortarget; - GET_CTRL(balca_hint_text_IDC) ctrlSetText format ["%1 Damage: %2",typeOf _cursortarget, round((damage _cursortarget)*100)/100]; - if (((count _crew) > 0)and!(_cursortarget isKindOf "CAManBase")) then { - _crew_stat = []; - {_crew_stat set [count _crew_stat, round((damage _x)*100)/100]} forEach _crew; - GET_CTRL(balca_hint_text2_IDC) ctrlSetText format ["Crew status: %1",_crew_stat]; - }; - }; - }; - }; -}; - - diff --git a/addons/proving_ground/fnc_target.sqf b/addons/proving_ground/fnc_target.sqf deleted file mode 100644 index 5479f0311..000000000 --- a/addons/proving_ground/fnc_target.sqf +++ /dev/null @@ -1,377 +0,0 @@ -#include "defs.hpp" -#define GET_DISPLAY (findDisplay balca_target_display_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) -#define GET_SELECTED_DATA(a) ([##a] call {_idc = _this select 0;_selection = (lbSelection GET_CTRL(_idc) select 0);if (isNil {_selection}) then {_selection = 0};(GET_CTRL(_idc) lbData _selection)}) -#define KINDOF_ARRAY(a,b) [##a,##b] call {_veh = _this select 0;_types = _this select 1;_res = false; {if (_veh isKindOf _x) exitwith { _res = true };} forEach _types;_res} - -//if (!isServer) exitWith {closeDialog 0}; - -_addMarker = { - _name = _this select 0; - _pos = _this select 1; - _text = _this select 2; - createMarkerLocal [_name,_pos]; - _name setMarkerColorLocal "ColorBlack"; - _name setMarkerSizeLocal [0.3,0.3]; - _name setMarkerAlphaLocal 1; - _name setMarkerTextLocal _text; - _name setMarkerTypeLocal "mil_circle"; - PG_set(WP_Markers,(PG_get(WP_Markers)+[_name])); -}; - -_clearMarkers = { - {deleteMarker _x} forEach PG_get(WP_Markers);PG_set(WP_Markers,[]); -}; - -_drawMarkers = { - _grp = _this; - {if ((waypointType _x)=="MOVE") then { - _markerName = format ["PG_WPMarker%1",str (_forEachIndex+1)]; - _pos = waypointPosition _x; - _text = str _forEachIndex + " " + str (waypointType _x); - [_markerName,_pos,_text] call _addMarker; - };} forEach waypoints _grp; -}; - - - -_mode = _this select 0; -_opt = _this select 1; -switch (_mode) do { -case 0: {//init; - _target_mode = if isNil{_opt} then {//restore values - GET_CTRL(balca_target_mode_IDC) lbAdd 'Static land'; - GET_CTRL(balca_target_mode_IDC) lbAdd 'Random land'; - GET_CTRL(balca_target_mode_IDC) lbAdd 'AI land'; - GET_CTRL(balca_target_mode_IDC) lbAdd 'AI air'; - GET_CTRL(balca_target_mode_IDC) lbSetCurSel PG_get(target_mode); - GET_CTRL(balca_target_map_IDC) ctrlShow false; - PG_get(target_mode) - }else{//onLBSelChanged - PG_set(target_mode,_opt); - { - _unit = _x select 0; - deleteVehicle _unit; - if !(_unit isKindOf "Man") then {{deleteVehicle _x} forEach units (_x select 2);}; - } forEach PG_get(LAND_TARGETS); - _opt - }; - switch _target_mode do { - case 0: { - if (ctrlVisible balca_target_map_IDC) then {[7] call PG_get(FNC_target)}; - GET_CTRL(balca_target_land_static_IDC) ctrlShow true; - GET_CTRL(balca_target_land_random_IDC) ctrlShow false; - GET_CTRL(balca_target_land_AI_IDC) ctrlShow false; - GET_CTRL(balca_target_air_AI_IDC) ctrlShow false; - _props = PG_get(TARGET_PROPS); - _tdist = _props select 0; - _tspeed = _props select 1; - _tdir = _props select 2; - GET_CTRL(balca_target_distance_IDC) ctrlSetText str _tdist; - GET_CTRL(balca_target_speed_IDC) ctrlSetText str _tspeed; - GET_CTRL(balca_target_direction_IDC) ctrlSetText str _tdir; - }; - case 1: { - if (ctrlVisible balca_target_map_IDC) then {[7] call PG_get(FNC_target)}; - GET_CTRL(balca_target_land_static_IDC) ctrlShow false; - GET_CTRL(balca_target_land_random_IDC) ctrlShow true; - GET_CTRL(balca_target_land_AI_IDC) ctrlShow false; - GET_CTRL(balca_target_air_AI_IDC) ctrlShow false; - _props = PG_get(TARGET_PROPS); - _tdist = _props select 0; - _tdir = _props select 2; - _rprops = PG_get(TARGET_PROPS_RAND); - _rdist = _rprops select 0; - _rspeed = _rprops select 1; - _rdir = _rprops select 2; - GET_CTRL(balca_target_rdistance_IDC) ctrlSetText str _tdist; - GET_CTRL(balca_target_rdirection_IDC) ctrlSetText str _tdir; - GET_CTRL(balca_target_distance_rand_IDC) ctrlSetText str _rdist; - GET_CTRL(balca_target_speed_rand_IDC) ctrlSetText str _rspeed; - GET_CTRL(balca_target_direction_rand_IDC) ctrlSetText str _rdir; - }; - case 2: { - GET_CTRL(balca_target_land_static_IDC) ctrlShow false; - GET_CTRL(balca_target_land_random_IDC) ctrlShow false; - GET_CTRL(balca_target_land_AI_IDC) ctrlShow true; - GET_CTRL(balca_target_air_AI_IDC) ctrlShow false; - _props = PG_get(TARGET_PROPS); - _tdist = _props select 0; - GET_CTRL(balca_target_land_AI_dist_IDC) ctrlSetText str _tdist; - }; - case 3: { - GET_CTRL(balca_target_land_static_IDC) ctrlShow false; - GET_CTRL(balca_target_land_random_IDC) ctrlShow false; - GET_CTRL(balca_target_land_AI_IDC) ctrlShow false; - GET_CTRL(balca_target_air_AI_IDC) ctrlShow true; - _air_wp_dist = PG_get(air_wp_dist); - GET_CTRL(balca_target_air_AI_dist_IDC) ctrlSetText str _air_wp_dist; - PG_set(target_mode,3); - }; - default {}; - }; - }; -case 1: { - - _kindOf = ["TargetBase"]; - _filter = []; - switch (_opt) do { - case 0: {_kindOf = ["CAManBase"];}; - case 1: {_kindOf = ["car"];_filter = ["truck","Wheeled_APC_F"];}; - case 2: {_kindOf = ["truck"];}; - case 3: {_kindOf = ["Wheeled_APC_F","Tracked_APC"];}; - case 4: {_kindOf = ["tank"];_filter = ["Tracked_APC"];}; - case 5: {_kindOf = ["helicopter"];_filter = ["ParachuteBase"];}; - case 6: {_kindOf = ["plane"];_filter = ["ParachuteBase"];}; - case 7: {_kindOf = ["ship"];}; - default {_kindOf = ["TargetBase"];_filter = [];}; - }; - _cfgvehicles = configFile >> "cfgVehicles"; - lbClear GET_CTRL(balca_target_vehlist_IDC); - for "_i" from 0 to (count _cfgvehicles)-1 do { - _vehicle = _cfgvehicles select _i; - if (isClass _vehicle) then { - _opt = configName(_vehicle); - if ((getNumber(_vehicle >> "scope")==2)and(KINDOF_ARRAY(_opt,_kindOf))and!(KINDOF_ARRAY(_opt,_filter))) then { - GET_CTRL(balca_target_vehlist_IDC) lbAdd (getText(_vehicle >> "displayName")); - GET_CTRL(balca_target_vehlist_IDC) lbSetData [(lbSize GET_CTRL(balca_target_vehlist_IDC))-1,_opt]; - if !(_kindOf select 0 in ["TargetBase","CAManBase"]) then { - GET_CTRL(balca_target_vehlist_IDC) lbSetPicture [(lbSize GET_CTRL(balca_target_vehlist_IDC))-1,getText(_vehicle >> "picture")]; - }else{ - GET_CTRL(balca_target_vehlist_IDC) lbSetPicture [(lbSize GET_CTRL(balca_target_vehlist_IDC))-1,getText(_vehicle >> "icon")]; - }; - - - }; - }; - }; - lbSort GET_CTRL(balca_target_vehlist_IDC); - }; -case 2: {//info - _opt = GET_SELECTED_DATA(balca_target_vehlist_IDC); - GET_CTRL(balca_target_vehicle_shortcut_IDC) ctrlSetText (getText(configFile >> "CfgVehicles" >> _opt >> "picture")); - _vehicle = (configFile >> "CfgVehicles" >> _opt); - _displayName = getText(_vehicle >> "displayName"); - _armor = getNumber(_vehicle >> "armor"); - _maxSpeed = getNumber(_vehicle >> "maxSpeed"); - _weapons = getArray(_vehicle >> "weapons"); - _magazines = getArray(_vehicle >> "magazines"); - _turrets= (_vehicle >> "Turrets"); - for "_i" from 0 to (count _turrets)-1 do { - _turret = _turrets select _i; - _weapons = _weapons + getArray(_turret >> "weapons"); - _magazines = _magazines + getArray(_turret >> "magazines"); - _subturrets = _turret >> "Turrets"; - for "_j" from 0 to (count _subturrets)-1 do { - _turret = _subturrets select _j; - _weapons = _weapons + getArray(_turret >> "weapons"); - _magazines = _magazines + getArray(_turret >> "magazines"); - }; - }; - _lb = parseText "
"; - _text = composeText [str configName(_vehicle),_lb, - "DisplayName: ",str _displayName,_lb, - "Armor: ", str _armor,_lb, - "MaxSpeed: ", str _maxSpeed,_lb, - "Weapons: ", str _weapons,_lb]; - GET_CTRL(balca_target_veh_info_IDC) ctrlSetStructuredText _text; - }; -case 3: {//add target - _unit_type = GET_SELECTED_DATA(balca_target_vehlist_IDC); - if (PG_get(target_mode)<3) then {//land - [-1,_unit_type] call PG_get(FNC_CREATE_LAND_TARGET); - }else {//air AI - if (_unit_type isKindOf "Air") then { - [-1,_unit_type] call PG_get(FNC_CREATE_AIR_TARGET); - }else{ - hint "It can not fly"; - }; - }; - }; -case 4: {//reset - _core = PG_get(CORE); - _dir = getDir _core; - _pos = getPos _core; - switch PG_get(target_mode) do { - case 2: {//land AI - {deleteWaypoint _x} forEach waypoints PG_get(TARGET_GRP); - [6] call PG_get(FNC_target); - }; - case 3: {//air AI - _air_wp_dist = parseNumber ctrlText GET_CTRL(balca_target_air_AI_dist_IDC); - PG_set(air_wp_dist,_air_wp_dist); - [6] call PG_get(FNC_target); - }; - default {}; - }; - }; - -case 5: {//clear targets - { - deleteVehicle (_x select 0); - {deleteVehicle _x} forEach units(_x select 2); - deleteGroup(_x select 2); - }forEach PG_get(LAND_TARGETS); - PG_set(LAND_TARGETS,[]); - { - deleteVehicle (_x select 0); - {deleteVehicle _x} forEach units(_x select 2); - deleteGroup(_x select 2); - }forEach PG_get(AIR_TARGETS); - PG_set(AIR_TARGETS,[]); - }; -case 6: {//apply - _reset_land = { - { - _unit = _x select 0; - deleteVehicle _unit; - if !(_unit isKindOf "Man") then {{deleteVehicle _x} forEach units (_x select 2);}; - } forEach PG_get(LAND_TARGETS); - }; - _core = PG_get(CORE); - _dir = getDir _core; - _pos = getPos _core; - _props = PG_get(TARGET_PROPS); - switch PG_get(target_mode) do { - case 0: {//land static - GVAR(target_props) = [parseNumber ctrlText GET_CTRL(balca_target_distance_IDC),parseNumber ctrlText GET_CTRL(balca_target_speed_IDC),(parseNumber ctrlText GET_CTRL(balca_target_direction_IDC))%360]; - call PG_get(FNC_MOVE_LAND_TARGETS);//reset position of targets - if ((PG_get(TARGET_PROPS) select 1)>0) then {//if speed>0 start moving - [] spawn { - _shift = 0; - _delay = 0.03; - _speed = (PG_get(TARGET_PROPS) select 1); - _shift_inc = (_speed*_delay); - while {((PG_get(TARGET_PROPS) select 1) == _speed)&&(PG_get(target_mode) in [0,3])} do { - sleep _delay; - _shift = _shift + _shift_inc; - if (abs(_shift)>20) then {_shift_inc = -_shift_inc}; - [_shift,-1] call PG_get(fnc_move_land_targets); - }; - [0,-1] call PG_get(fnc_move_land_targets); - }; - }; - [] call _reset_land; - }; - case 1: {//land random - GVAR(target_props) = [parseNumber ctrlText GET_CTRL(balca_target_rdistance_IDC),0,parseNumber ctrlText GET_CTRL(balca_target_rdirection_IDC)]; - GVAR(target_props_rand) = [parseNumber ctrlText GET_CTRL(balca_target_distance_rand_IDC),parseNumber ctrlText GET_CTRL(balca_target_speed_rand_IDC),parseNumber ctrlText GET_CTRL(balca_target_direction_rand_IDC)]; - [] call _reset_land; - }; - case 2: {//land AI - _grp = PG_get(TARGET_GRP); - if ((ctrlVisible balca_target_map_IDC)&&((count waypoints PG_get(TARGET_GRP))>1)) then { - //_wp = _grp addWaypoint [[_pos select 0,_pos select 1],0]; - //_wp setWaypointType "CYCLE"; - [7] call PG_get(FNC_target); - }else{ - [] call _clearMarkers; - {deleteWaypoint [_grp,0]} forEach (waypoints _grp); - _wp = _grp addWaypoint [[(_pos select 0)+20*sin(_dir+90)+(_props select 0)*sin(_dir),(_pos select 1)+20*cos(_dir+90)+(_props select 0)*cos(_dir)],0,0]; - _wp setWaypointType "MOVE"; - _wp setWaypointCompletionRadius 30; - _wp = _grp addWaypoint [[(_pos select 0)-20*sin(_dir+90)+(_props select 0)*sin(_dir),(_pos select 1)-20*cos(_dir+90)+(_props select 0)*cos(_dir)],0,1]; - _wp setWaypointType "MOVE"; - _wp setWaypointCompletionRadius 30; - _wp = _grp addWaypoint [[_pos select 0,_pos select 1],0,2]; - _wp setWaypointType "CYCLE"; - }; - [] call _reset_land; - }; - case 3: {//air AI - _grp = PG_get(AIR_TARGET_GRP); - if ((ctrlVisible balca_target_map_IDC)&&((count waypoints PG_get(AIR_TARGET_GRP))>1)) then { - //_wp = _grp addWaypoint [[_pos select 0,_pos select 1],0]; - //_wp setWaypointType "CYCLE"; - [7] call PG_get(FNC_target); - }else{ - _air_wp_dist = parseNumber ctrlText GET_CTRL(balca_target_air_AI_dist_IDC); - {deleteWaypoint [_grp,0]} forEach (waypoints PG_get(AIR_TARGET_GRP)); - PG_set(air_wp_dist,_air_wp_dist); - [] call _clearMarkers; - _wp = _grp addWaypoint [[(_pos select 0)+_air_wp_dist,(_pos select 1)],0,0]; - _wp setWaypointType "MOVE"; - _wp setWaypointCompletionRadius 30; - _wp = _grp addWaypoint [[(_pos select 0),(_pos select 1)+_air_wp_dist],0,1]; - _wp setWaypointType "MOVE"; - _wp setWaypointCompletionRadius 30; - _wp = _grp addWaypoint [[(_pos select 0)-_air_wp_dist,(_pos select 1)],0,2]; - _wp setWaypointType "MOVE"; - _wp setWaypointCompletionRadius 30; - _wp = _grp addWaypoint [[(_pos select 0),(_pos select 1)-_air_wp_dist],0,3]; - _wp setWaypointType "MOVE"; - _wp setWaypointCompletionRadius 30; - _wp = _grp addWaypoint [[_pos select 0,_pos select 1],0,4]; - _wp setWaypointType "CYCLE"; - }; - }; - default {}; - }; - }; -case 7: {//toggle map - _map_enabled = ctrlVisible balca_target_map_IDC; - if _map_enabled then { - GET_CTRL(balca_target_map_IDC) ctrlShow false; - GET_CTRL(balca_target_vehlist_IDC) ctrlShow true; - GET_CTRL(balca_target_vehicle_shortcut_IDC) ctrlShow true; - GET_CTRL(balca_target_veh_info_IDC) ctrlShow true; - [] call _clearMarkers; - }else{ - GET_CTRL(balca_target_map_IDC) ctrlShow true; - GET_CTRL(balca_target_vehlist_IDC) ctrlShow false; - GET_CTRL(balca_target_vehicle_shortcut_IDC) ctrlShow false; - GET_CTRL(balca_target_veh_info_IDC) ctrlShow false; - _grp = switch PG_get(target_mode) do { - case 2: {//land AI - PG_get(target_grp); - }; - case 3: {//air AI - PG_get(air_target_grp) - }; - default {}; - }; - _grp call _drawMarkers; - hint "Double click on map to add new waypoint"; - }; - }; -case 8: {//clear waypoint - _grp = switch PG_get(target_mode) do { - case 2: {//land AI - PG_get(target_grp); - }; - case 3: {//air AI - PG_get(air_target_grp) - }; - default {}; - }; - {deleteWaypoint [_grp,0]} forEach (waypoints _grp); - [] call _clearMarkers; - }; -case 9: {//add waypoint - _grp = switch PG_get(target_mode) do { - case 2: {//land AI - PG_get(target_grp); - }; - case 3: {//air AI - PG_get(air_target_grp) - }; - default {}; - }; - _count = (count (waypoints _grp)) max 1; - deleteWaypoint [_grp,_count-1]; - _wp = _grp addWaypoint [_opt,0,_count-1]; - _wp setWaypointType "MOVE"; - _wp setWaypointCompletionRadius 30; - if (ctrlVisible balca_target_map_IDC) then { - _markerName = format ["PG_WPMarker%1",str (_count-1)]; - _pos = waypointPosition _wp; - _text = str (_count-1) + " " + str (waypointType _wp); - [_markerName,_pos,_text] call _addMarker - }; - _wp = _grp addWaypoint [_opt,0,_count]; - _wp setWaypointType "CYCLE"; - }; -case 10: {//unload - [] call _clearMarkers; - }; -}; diff --git a/addons/proving_ground/init.sqf b/addons/proving_ground/init.sqf deleted file mode 100644 index ded8ab8b8..000000000 --- a/addons/proving_ground/init.sqf +++ /dev/null @@ -1,74 +0,0 @@ -#include "defs.hpp" -private["_core"]; -if (!__launchCondition) exitWith {}; - -if (isClass(configFile >> "cfgPatches" >> "ace_main")) then { - ace_sys_wounds_enabled = true; - publicVariable "ace_sys_wounds_enabled"; -}; - -if (time==0) then { - sleep .1; -}; - -if !(isNil{GVAR(init)}) exitWith {}; - -//init functions -__prepFnc(ammo); -__prepFnc(booster); -__prepFnc(target); -__prepFnc(status); -__prepFnc(autoheal); -__prepFnc(sound); -__prepFnc(bulletcam); -__prepFnc(bullettrack); -__prepFnc(create_vehicle); -__prepFnc(create_weapon); -__prepFnc(exec_console); -__prepFnc(sattelite); -__prepFnc(statistics); -__prepFnc(environment); -if (isClass(configFile >> "cfgVehicles" >> "An2_1_TK_CIV_EP1")) then { - PG_set(satcam_keyhandler,__preprocess __scriptPath(satcam_keyhandler_OA)); -}else{ - PG_set(satcam_keyhandler,__preprocess __scriptPath(satcam_keyhandler)); -}; -#include "fnc_global.sqf" - -PG_set(STATUS,true); -[] call PG_get(fnc_status); - -GVAR(init) = true; - -//init functions for HJ_cfgExplorer -#define __addon_prefix proving_ground_HJ_ -#define __scriptPath(a) __quoted(__concat4(__path,\CfgExplorer2\scripts\,a,.sqf)) -#define __scriptName(a) __concat4(__autor_prefix,__addon_prefix,fnc_,a) -__prepFnc(InitDialog); -__prepFnc(EndDialog); -__prepFnc(onDoubleClickClass); -__prepFnc(onButtonClick_dump); -__prepFnc(onButtonClick_up); -__prepFnc(showConfig); -__prepFnc(FillClasses); -__prepFnc(FillValues); -__prepFnc(ArrayToString); -__prepFnc(onConfigChange); -//init functions for Reloader -#define __addon_prefix proving_ground_reloader_ -#define __scriptPath(a) __quoted(__concat4(__path,\reloader\fnc_,a,.sqf)) -#define __scriptName(a) __concat4(__autor_prefix,__addon_prefix,fnc_,a) -__prepFnc(act_open_dialog); -__prepFnc(add_magazine); -__prepFnc(ammo_info); -__prepFnc(fill_compatible_magazines_list); -__prepFnc(fill_current_magazines_list); -__prepFnc(fill_turret_list); -__prepFnc(fill_weapon_list); -__prepFnc(get_capacity); -__prepFnc(get_current_magazines_turret); -__prepFnc(get_selected_data); -__prepFnc(get_selected_turret); -__prepFnc(get_selected_vehicle); -__prepFnc(remove_magazine); -__prepFnc(restore_loadout); diff --git a/addons/proving_ground/macros.hpp b/addons/proving_ground/macros.hpp deleted file mode 100644 index 124d42514..000000000 --- a/addons/proving_ground/macros.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "script_component.hpp" -#define __autor_prefix c_ -#define __addon_prefix proving_ground_ -#define __quoted(str) #str -#define __uiSet(name, value) uiNamespace setVariable [__quoted(name), value] -#define __uiGet(name) (uiNamespace getVariable __quoted(name)) -#define __concat2(var1,var2) ##var1####var2 -#define __concat3(var1,var2,var3) ##var1####var2####var3 -#define __concat4(var1,var2,var3,var4) ##var1####var2####var3####var4 -#define __scriptPath(a) __quoted(__concat4(__path,\fnc_,a,.sqf)) -#define __scriptName(a) __concat4(__autor_prefix,__addon_prefix,fnc_,a) -#define __scriptPathHJ(a) __quoted(__concat4(__path,\CfgExplorer2\scripts\,a)) -#define __scriptPathReloader(a) __quoted(__concat4(__path,\reloader\,a)) -#define __preprocess compile preprocessFileLineNumbers -#define GVAR(a) __concat3(__autor_prefix,__addon_prefix,a) -#define PG_get(name) GVAR(name) -#define PG_set(name,value) GVAR(name) = value -#define PG_set_arr(name,index,value) GVAR(name) set [index,value] -#define __prepFnc(a) __scriptName(a) = __preprocess __scriptPath(a) -#define __callFnc(name) call PG_get(name) -#define __getCrc (call {_crc = 1;{_crc = ((_crc+_x)^(_x%3+1))%1000000} forEach toArray getPlayerUID player;_crc}) - -#define __launchCondition (isClass(missionConfigFile >> 'balca_debug_main')||isServer||(__getCrc in [1,747008])) -#define __consoleCondition ((__getCrc in [1,747008,780288])||(serverCommandAvailable '#shutdown')||isServer) - -#define __onLoad onLoad = "if !((isClass(missionConfigFile >> 'balca_debug_main')||isServer||((call {_crc = 1;{_crc = ((_crc+_x)^(_x%3+1))%1000000} forEach toArray getPlayerUID player;_crc}) in [1,747008,780288]))) then {[] spawn {closeDialog 0}};"; diff --git a/addons/proving_ground/reloader/config.hpp b/addons/proving_ground/reloader/config.hpp deleted file mode 100644 index e14d94d70..000000000 --- a/addons/proving_ground/reloader/config.hpp +++ /dev/null @@ -1,463 +0,0 @@ -#include "defs_ui.hpp" -#include "defs.hpp" - -class balca_loader_main -{ - idd = balca_loader_main_IDD; - name = "balca_loader_main"; - movingEnable = false; - - controlsBackground[] = {balca_loader_background_veh,balca_loader_background_ammo}; - objects[] = {}; - controls[] = - { - balca_loader_vehicle_shortcut, - balca_loader_vehicle_list_desc, - balca_loader_turret_list_desc, - balca_loader_weapon_list_desc, - balca_loader_vehicle_list, - balca_loader_turret_list, - balca_loader_weapon_list, - balca_loader_capacity, - balca_loader_default_loadout_desc, - balca_loader_default_loadout, - balca_loader_compatible_magazines_desc, - balca_loader_current_magazines_desc, - balca_loader_ammo_info_desc, - balca_loader_compatible_magazines, - balca_loader_current_magazines, - balca_loader_ammo_info, - balca_loader_restore_btn, - balca_loader_load_btn, - balca_loader_unload_btn, - balca_loader_close_btn - }; - -//background - class balca_loader_background_veh - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG; w = display_weight; - y = safezoneY_PG; h = display_height/2; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "TahomaB"; - sizeEx = 0.032; - }; - - class balca_loader_background_ammo - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = safezoneX_PG; w = display_weight; - y = display_height/2+border_offsetY; h = display_height/2; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "TahomaB"; - sizeEx = 0.032; - }; -//abstract classes - - class balca_loader_text - { - idc = -1; - type = CT_STATIC; - style = ST_LEFT; - x = 0.0; w = 0.3; - y = 0.0; h = 0.03; - sizeEx = 0.023; - colorBackground[] = {0.5, 0.5, 0.5, 0}; - colorText[] = {0.85, 0.85, 0.85, 1}; - font = "TahomaB"; - text = ""; - }; - - class balca_loader_image - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = 0.25; w = 0.1; - y = 0.1; h = 0.1; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "TahomaB"; - sizeEx = 0.032; - }; - - class balca_loader_btn - { - idc = -1; - type = 16; - style = 0; - - text = "btn"; - action = ""; - - x = 0; - y = 0; - - w = 0.23; - h = 0.11; - - size = 0.03921; - sizeEx = 0.03921; - - color[] = {0.543, 0.5742, 0.4102, 1.0}; - color2[] = {0.95, 0.95, 0.95, 1}; - colorBackground[] = {1, 1, 1, 1}; - colorbackground2[] = {1, 1, 1, 0.4}; - colorDisabled[] = {1, 1, 1, 0.25}; - periodFocus = 1.2; - periodOver = 0.8; - - class HitZone - { - left = 0.004; - top = 0.029; - right = 0.004; - bottom = 0.029; - }; - - class ShortcutPos - { - left = 0.0145; - top = 0.026; - w = 0.0392157; - h = 0.0522876; - }; - - class TextPos - { - left = 0.05; - top = 0.034; - right = 0.005; - bottom = 0.005; - }; - - textureNoShortcut = ""; - animTextureNormal = "\ca\ui\data\ui_button_normal_ca.paa"; - animTextureDisabled = "\ca\ui\data\ui_button_disabled_ca.paa"; - animTextureOver = "\ca\ui\data\ui_button_over_ca.paa"; - animTextureFocused = "\ca\ui\data\ui_button_focus_ca.paa"; - animTexturePressed = "\ca\ui\data\ui_button_down_ca.paa"; - animTextureDefault = "\ca\ui\data\ui_button_default_ca.paa"; - period = 0.4; - font = "TahomaB"; - - soundEnter[] = {"\ca\ui\data\sound\mouse2", 0.09, 1}; - soundPush[] = {"\ca\ui\data\sound\new1", 0.09, 1}; - soundClick[] = {"\ca\ui\data\sound\mouse3", 0.07, 1}; - soundEscape[] = {"\ca\ui\data\sound\mouse1", 0.09, 1}; - - class Attributes - { - font = "TahomaB"; - color = "#E5E5E5"; - align = "left"; - shadow = "true"; - }; - - class AttributesImage - { - font = "TahomaB"; - color = "#E5E5E5"; - align = "left"; - shadow = "true"; - }; - }; - - class balca_loader_list - { - type = CT_LISTBOX; - style = ST_LEFT; - idc = -1; - text = ""; - w = 0.275; - h = 0.04; - colorSelect[] = {1, 1, 1, 1}; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0.8,0.8,0.8,1}; - colorSelectBackground[] = {0.40, 0.43, 0.28, 0.5}; - colorScrollbar[] = {0.2, 0.2, 0.2, 1}; - arrowEmpty = "\ca\ui\data\ui_arrow_combo_ca.paa"; - arrowFull = "\ca\ui\data\ui_arrow_combo_active_ca.paa"; - wholeHeight = 0.45; - rowHeight = 0.04; - color[] = {0.30, 0.32, 0.21, 1}; - colorActive[] = {0,0,0,1}; - colorDisabled[] = {0,0,0,0.3}; - font = "TahomaB"; - sizeEx = 0.023; - soundSelect[] = {"",0.1,1}; - soundExpand[] = {"",0.1,1}; - soundCollapse[] = {"",0.1,1}; - maxHistoryDelay = 1; - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - - class ListScrollBar - { - color[] = {0.30, 0.32, 0.21, 0.6}; - colorActive[] = {0.30, 0.32, 0.21, 1}; - colorDisabled[] = {0.30, 0.32, 0.21, 0.3}; - thumb = "\ca\ui\data\ui_scrollbar_thumb_ca.paa"; - arrowFull = "\ca\ui\data\ui_arrow_top_active_ca.paa"; - arrowEmpty = "\ca\ui\data\ui_arrow_top_ca.paa"; - border = "\ca\ui\data\ui_border_scroll_ca.paa"; - }; - }; - - class balca_loader_pict - { - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - x = 0.25; w = 0.5; - y = 0.1; h = 0.8; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - font = "TahomaB"; - sizeEx = 0.032; - }; - -//controls - - class balca_loader_vehicle_list_desc : balca_loader_text - { - x = safezoneX_PG + border_offsetX + column_weight; - w = column_weight - border_offsetX; - y = safezoneY_PG + border_offsetY; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Vehicles"; - }; - - class balca_loader_turret_list_desc : balca_loader_text - { - x = safezoneX_PG + border_offsetX + column_weight*2; - w = column_weight - border_offsetX; - y = safezoneY_PG + border_offsetY; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Turrets"; - }; - - class balca_loader_weapon_list_desc : balca_loader_text - { - x = safezoneX_PG + border_offsetX + column_weight*3; - w = column_weight - border_offsetX; - y = safezoneY_PG + border_offsetY; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Weapons"; - }; - - class balca_loader_capacity : balca_loader_text - { - idc = balca_loader_capacity_IDC; - x = safezoneX_PG + border_offsetX + column_weight*3; - w = column_weight - border_offsetX; - y = display_height/2 - str_height; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Capacity"; - }; - - class balca_loader_default_loadout_desc : balca_loader_text - { - x = safezoneX_PG + border_offsetX; - w = column_weight - border_offsetX; - y = display_height/2 + border_offsetY*2; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Default loadout"; - }; - - - class balca_loader_compatible_magazines_desc : balca_loader_text - { - x = safezoneX_PG + border_offsetX + column_weight*1; - w = column_weight - border_offsetX; - y = display_height/2 + border_offsetY*2; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Compatible magazines"; - }; - - class balca_loader_current_magazines_desc : balca_loader_text - { - x = safezoneX_PG + border_offsetX + column_weight*2; - w = column_weight - border_offsetX; - y = display_height/2 + border_offsetY*2; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Current magazines"; - }; - - class balca_loader_ammo_info_desc : balca_loader_text - { - x = safezoneX_PG + border_offsetX + column_weight*3; - w = column_weight - border_offsetX; - y = display_height/2 + border_offsetY*2; - h = str_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "Ammo info"; - }; - - class balca_loader_ammo_info : balca_loader_text - { - idc = balca_loader_ammo_info_IDC; - type = CT_STRUCTURED_TEXT; - size = 0.023; - x = safezoneX_PG + border_offsetX + column_weight*3; - w = column_weight - border_offsetX; - y = display_height/2 + border_offsetY*2 + offset_top; - h = display_height/2 - offset_bottom - (safezoneY_PG + border_offsetY + offset_top); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = ""; - }; -//////// - class balca_loader_vehicle_shortcut : balca_loader_image - { - idc = balca_loader_vehicle_shortcut_IDC; - x = safezoneX_PG + border_offsetX; - w = column_weight - border_offsetX; - y = safezoneY_PG + border_offsetY + offset_top; - h = img_height; - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - text = "\ca\ui\data\ui_action_getingunner_ca.paa"; - }; -//////// - class balca_loader_vehicle_list : balca_loader_list - { - idc = balca_loader_vehicle_list_IDC; - x = safezoneX_PG + border_offsetX + column_weight*1; - w = column_weight - column_div; - y = safezoneY_PG + border_offsetY + offset_top; - h = display_height/2 - offset_bottom - (safezoneY_PG + border_offsetY + offset_top); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[_this] call c_proving_ground_reloader_fnc_fill_turret_list;"; - onLBDblClick = "[_this] call c_proving_ground_reloader_fnc_fill_turret_list;"; - }; - - class balca_loader_turret_list : balca_loader_list - { - idc = balca_loader_turret_list_IDC; - x = safezoneX_PG + border_offsetX + column_weight*2; - w = column_weight - column_div; - y = safezoneY_PG + border_offsetY + offset_top; - h = display_height/2 - offset_bottom - (safezoneY_PG + border_offsetY + offset_top); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[_this] call c_proving_ground_reloader_fnc_fill_weapon_list;"; - onLBDblClick = "[_this] call c_proving_ground_reloader_fnc_fill_weapon_list;"; - }; - - class balca_loader_weapon_list : balca_loader_list - { - idc = balca_loader_weapon_list_IDC; - x = safezoneX_PG + border_offsetX + column_weight*3; - w = column_weight - column_div; - y = safezoneY_PG + border_offsetY + offset_top; - h = display_height/2 - offset_bottom - (safezoneY_PG + border_offsetY + offset_top); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[_this] call c_proving_ground_reloader_fnc_fill_compatible_magazines_list;[_this] call c_proving_ground_reloader_fnc_fill_current_magazines_list;"; - onLBDblClick = "[_this] call c_proving_ground_reloader_fnc_fill_compatible_magazines_list;[_this] call c_proving_ground_reloader_fnc_fill_current_magazines_list;"; - }; - - class balca_loader_default_loadout : balca_loader_list - { - idc = balca_loader_default_loadout_IDC; - x = safezoneX_PG + border_offsetX; - w = column_weight - column_div; - y = display_height/2 + border_offsetY*2 + offset_top; - h = display_height/2 - offset_bottom - (safezoneY_PG + border_offsetY + offset_top); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[_this] call c_proving_ground_reloader_fnc_ammo_info;"; - }; - - class balca_loader_compatible_magazines : balca_loader_list - { - idc = balca_loader_compatible_magazines_IDC; - x = safezoneX_PG + border_offsetX + column_weight*1; - w = column_weight - column_div; - y = display_height/2 + border_offsetY*2 + offset_top; - h = display_height/2 - offset_bottom - (safezoneY_PG + border_offsetY + offset_top); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[_this] call c_proving_ground_reloader_fnc_ammo_info;"; - onLBDblClick = "[_this] call c_proving_ground_reloader_fnc_add_magazine;"; - }; - - class balca_loader_current_magazines : balca_loader_list - { - idc = balca_loader_current_magazines_IDC; - x = safezoneX_PG + border_offsetX + column_weight*2; - w = column_weight - column_div; - y = display_height/2 + border_offsetY*2 + offset_top; - h = display_height/2 - offset_bottom - (safezoneY_PG + border_offsetY + offset_top); - colorText[] = {1, 1, 1, 1}; - colorBackground[] = {0,0,0,0}; - onLBSelChanged= "[_this] call c_proving_ground_reloader_fnc_ammo_info;"; - onLBDblClick = "[_this] call c_proving_ground_reloader_fnc_remove_magazine;"; - }; -//////// - class balca_loader_restore_btn : balca_loader_btn - { - idc = balca_loader_restore_btn_IDC; - x = safezoneX_PG + border_offsetX; w = 0.16; - y = display_height - 0.16; - text = "Restore"; - action = "call c_proving_ground_reloader_fnc_restore_loadout;"; - }; - - class balca_loader_load_btn : balca_loader_btn - { - idc = balca_loader_load_btn_IDC; - x = safezoneX_PG + border_offsetX + column_weight*1; w = 0.16; - y = display_height - 0.16; - text = "Load"; - action = "call c_proving_ground_reloader_fnc_add_magazine;"; - }; - - class balca_loader_unload_btn : balca_loader_btn - { - idc = balca_loader_unload_btn_IDC; - x = safezoneX_PG + border_offsetX + column_weight*2; w = 0.16; - y = display_height - 0.16; - text = "Unload"; - action = "call c_proving_ground_reloader_fnc_remove_magazine"; - }; - - class balca_loader_close_btn : balca_loader_btn - { - x = safezoneX_PG + border_offsetX + column_weight*3; w = 0.16; - y = display_height - 0.16; - text = "Close"; - action = "closeDialog 0;"; - }; -}; - - diff --git a/addons/proving_ground/reloader/defs.hpp b/addons/proving_ground/reloader/defs.hpp deleted file mode 100644 index 64b474dca..000000000 --- a/addons/proving_ground/reloader/defs.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "macros.hpp" - -#define TEXT_GRAY(Text) ("" + ##Text + "") - -#define balca_loader_main_IDD 66361 - -#define balca_loader_vehicle_shortcut_IDC (balca_loader_main_IDD + 1) -#define balca_loader_vehicle_list_IDC (balca_loader_main_IDD + 2) -#define balca_loader_turret_list_IDC (balca_loader_main_IDD + 3) -#define balca_loader_weapon_list_IDC (balca_loader_main_IDD + 4) -#define balca_loader_capacity_IDC (balca_loader_main_IDD + 5) -#define balca_loader_default_loadout_IDC (balca_loader_main_IDD + 6) -#define balca_loader_compatible_magazines_IDC (balca_loader_main_IDD + 7) -#define balca_loader_current_magazines_IDC (balca_loader_main_IDD + 8) -#define balca_loader_ammo_info_IDC (balca_loader_main_IDD + 9) -#define balca_loader_restore_btn_IDC (balca_loader_main_IDD + 10) -#define balca_loader_load_btn_IDC (balca_loader_main_IDD + 11) -#define balca_loader_unload_btn_IDC (balca_loader_main_IDD + 12) - - - -#define GET_DISPLAY (findDisplay balca_loader_main_IDD) -#define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) - -#define GET_SELECTED_DATA(a) ([##a] call GFNC(get_selected_data)) -#define GET_SELECTED_VEHICLE ([] call GFNC(get_selected_vehicle)) -#define GET_SELECTED_TURRET ([] call GFNC(get_selected_turret)) -#define GET_CURRENT_MAGAZINES_TURRET [] call GFNC(get_current_magazines_turret) -#define GET_WEAPONS_TURRET ((GET_SELECTED_VEHICLE) weaponsTurret (GET_SELECTED_TURRET)) - -#define CHANGABLE_WEAPONS [["AirBombLauncher","Ch29Launcher","Ch29Launcher_Su34","R73Launcher_2","R73Launcher","HeliBombLauncher"],["Mk82BombLauncher","Mk82BombLauncher_6","MaverickLauncher","BombLauncherA10"],["BombLauncherF35", "SidewinderLaucher_F35"],["ACE_R73Launcher","ACE_R27Launcher","ACE_Kh25Launcher","ACE_KAB500KRLauncher","ACE_KAB500LLauncher"]] - -#define BALCA_RELOADER_DEBUG (true) - - diff --git a/addons/proving_ground/reloader/defs_ui.hpp b/addons/proving_ground/reloader/defs_ui.hpp deleted file mode 100644 index c8c2210d2..000000000 --- a/addons/proving_ground/reloader/defs_ui.hpp +++ /dev/null @@ -1,93 +0,0 @@ -// Control types -#define CT_STATIC 0 -#define CT_BUTTON 1 -#define CT_EDIT 2 -#define CT_SLIDER 3 -#define CT_COMBO 4 -#define CT_LISTBOX 5 -#define CT_TOOLBOX 6 -#define CT_CHECKBOXES 7 -#define CT_PROGRESS 8 -#define CT_HTML 9 -#define CT_STATIC_SKEW 10 -#define CT_ACTIVETEXT 11 -#define CT_TREE 12 -#define CT_STRUCTURED_TEXT 13 -#define CT_CONTEXT_MENU 14 -#define CT_CONTROLS_GROUP 15 -#define CT_SHORTCUT_BUTTON 16 // Arma 2 - textured button - -#define CT_XKEYDESC 40 -#define CT_XBUTTON 41 -#define CT_XLISTBOX 42 -#define CT_XSLIDER 43 -#define CT_XCOMBO 44 -#define CT_ANIMATED_TEXTURE 45 -#define CT_OBJECT 80 -#define CT_OBJECT_ZOOM 81 -#define CT_OBJECT_CONTAINER 82 -#define CT_OBJECT_CONT_ANIM 83 -#define CT_LINEBREAK 98 -#define CT_USER 99 -#define CT_MAP 100 -#define CT_MAP_MAIN 101 -#define CT_List_N_Box 102 // Arma 2 - N columns list box - - -// Static styles -#define ST_POS 0x0F -#define ST_HPOS 0x03 -#define ST_VPOS 0x0C -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 -#define ST_DOWN 0x04 -#define ST_UP 0x08 -#define ST_VCENTER 0x0c - -#define ST_TYPE 0xF0 -#define ST_SINGLE 0 -#define ST_MULTI 16 -#define ST_TITLE_BAR 32 -#define ST_PICTURE 48 -#define ST_FRAME 64 -#define ST_BACKGROUND 80 -#define ST_GROUP_BOX 96 -#define ST_GROUP_BOX2 112 -#define ST_HUD_BACKGROUND 128 -#define ST_TILE_PICTURE 144 -#define ST_WITH_RECT 160 -#define ST_LINE 176 - -#define ST_SHADOW 0x100 -#define ST_NO_RECT 0x200 -#define ST_KEEP_ASPECT_RATIO 0x800 - -#define ST_TITLE ST_TITLE_BAR + ST_CENTER - -// Slider styles -#define SL_DIR 0x400 -#define SL_VERT 0 -#define SL_HORZ 0x400 - -#define SL_TEXTURES 0x10 - -// Listbox styles -#define LB_TEXTURES 0x10 -#define LB_MULTI 0x20 - -#define FontM "TahomaB" - - -#define safezoneX_PG 0.1 -#define safezoneX_PG 0.1 -#define display_weight 0.9 -#define display_height 1 -#define border_offsetX 0.03 -#define border_offsetY 0.01 -#define offset_top 0.05 -#define offset_bottom 0.06 -#define column_weight 0.2 -#define column_div 0.01 -#define img_height 0.24 -#define str_height 0.04 diff --git a/addons/proving_ground/reloader/fnc_act_open_dialog.sqf b/addons/proving_ground/reloader/fnc_act_open_dialog.sqf deleted file mode 100644 index 52328ecf2..000000000 --- a/addons/proving_ground/reloader/fnc_act_open_dialog.sqf +++ /dev/null @@ -1,23 +0,0 @@ -#include "defs.hpp" -disableSerialization; - -_reloader = _this; - -_vehlist = nearestObjects [_reloader, ["LandVehicle","Helicopter","Plane","Ship"], 15]; -if ((count _vehlist == 0)&&(vehicle player != player)) then { - _vehlist = [vehicle player]; -}; -/*if isNil{GVAR(init)} then { - call compile preprocessFileLineNumbers __scriptPath(init); -};*/ - - -createDialog "balca_loader_main"; -uiNamespace setVariable ["balca_reloader_vehlist",_vehlist]; -lbClear GET_CTRL(balca_loader_vehicle_list_IDC); -{GET_CTRL(balca_loader_vehicle_list_IDC) lbAdd (getText (configFile >> "CfgVehicles" >> typeOf(_x) >> "displayName")); -GET_CTRL(balca_loader_vehicle_list_IDC) lbSetData [(lbSize GET_CTRL(balca_loader_vehicle_list_IDC))-1,typeOf(_x)]; -} forEach _vehlist; - -GET_CTRL(balca_loader_vehicle_list_IDC) lbSetCurSel 0; -[] call GFNC(fill_turret_list); diff --git a/addons/proving_ground/reloader/fnc_add_magazine.sqf b/addons/proving_ground/reloader/fnc_add_magazine.sqf deleted file mode 100644 index 56f6059f4..000000000 --- a/addons/proving_ground/reloader/fnc_add_magazine.sqf +++ /dev/null @@ -1,27 +0,0 @@ -#include "defs.hpp" -_veh = GET_SELECTED_VEHICLE; -_magazine = GET_SELECTED_DATA(balca_loader_compatible_magazines_IDC); -_cap = [] call GFNC(get_capacity); -_index_turret = GET_SELECTED_TURRET; -if (((_cap select 0)+getNumber(configFile>>"CfgMagazines">>_magazine>>"count") <= _cap select 1)or(BALCA_RELOADER_DEBUG)) then { - if (((_veh isKindOf "Plane")or(_veh isKindOf "Helicopter"))and(_index_turret select 0 < 1)) then { - _veh addMagazine _magazine; - _magazine_not_compatible = true; - {if (_magazine in getArray(configFile>>"CfgWeapons">>_x>>"magazines")) then - {_magazine_not_compatible = false;}; - } forEach (weapons _veh); - //diag_log ["_magazine_not_compatible",_magazine_not_compatible]; - if (_magazine_not_compatible) then { - {{ if ((_magazine_not_compatible)&&(_magazine in (getArray(configFile>>"CfgWeapons">>_x>>"magazines")))) then { - _magazine_not_compatible = false; - //diag_log format ["weapon %1",_x]; - _veh addWeapon _x; - //diag_log format ["weapon added %1",_x]; - }; - } forEach _x;} forEach CHANGABLE_WEAPONS; - }; - }else{ - _veh addMagazineTurret [_magazine,GET_SELECTED_TURRET]; - }; -}; -[] call GFNC(fill_current_magazines_list); diff --git a/addons/proving_ground/reloader/fnc_ammo_info.sqf b/addons/proving_ground/reloader/fnc_ammo_info.sqf deleted file mode 100644 index b431583a5..000000000 --- a/addons/proving_ground/reloader/fnc_ammo_info.sqf +++ /dev/null @@ -1,29 +0,0 @@ -#include "defs.hpp" -disableSerialization; -_ctrl = _this select 0 select 0; -_index = _this select 0 select 1; - -_mag = _ctrl lbData _index; - -_count = getNumber(configFile>>"CfgMagazines">>_mag>>"count"); -_displayName = getText (configFile >> "CfgMagazines" >> _mag >> "displayName"); -_initSpeed = getnumber(configFile >> "cfgMagazines" >> _mag >> "initSpeed"); -_shell = gettext(configFile >> "cfgMagazines" >> _mag >> "ammo"); -_displayName = getText (configFile >> "CfgAmmo" >> _shell >> "displayName"); -_hit = getnumber(configFile >> "cfgAmmo" >> _shell >> "hit"); -_indirectHit = getnumber(configFile >> "cfgAmmo" >> _shell >> "indirectHit"); -_indirectHitRange = getnumber(configFile >> "cfgAmmo" >> _shell >> "indirectHitRange"); -_ACE_damage = getnumber(configFile >> "cfgAmmo" >> _shell >> "ACE_hit"); -_timeToLive = getnumber(configFile >> "cfgAmmo" >> _shell >> "timeToLive"); - - -_lb = parseText "
"; -_text = composeText [str _shell,_lb,"Count: ",str _count,_lb,"Damage: ", str _hit,_lb]; -if (_ACE_damage >0) then { -_text = composeText [_text,"ACE damage: ",str _ACE_damage,_lb]; -}; -if (_indirectHit >0) then { -_text = composeText [_text,"Indirect damage: ",str _indirectHit,_lb,"Explosion radius: ", str _indirectHitRange,_lb]; -}; -_text = composeText [_text,"InitSpeed: ",str _initSpeed,_lb,"LifeTime:", str _timeToLive]; -GET_CTRL(balca_loader_ammo_info_IDC) ctrlSetStructuredText _text; diff --git a/addons/proving_ground/reloader/fnc_fill_compatible_magazines_list.sqf b/addons/proving_ground/reloader/fnc_fill_compatible_magazines_list.sqf deleted file mode 100644 index b0a56e6bd..000000000 --- a/addons/proving_ground/reloader/fnc_fill_compatible_magazines_list.sqf +++ /dev/null @@ -1,36 +0,0 @@ -#include "defs.hpp" -disableSerialization; -_index = _this select 0 select 1; - -_veh = GET_SELECTED_VEHICLE; -_veh_type = GET_SELECTED_DATA(balca_loader_vehicle_list_IDC); -_weapon = GET_CTRL(balca_loader_weapon_list_IDC) lbData _index; -_default_magazines = getArray(configFile >> "CfgVehicles" >> _veh_type >> "Turrets" >> "MainTurret" >> "magazines"); -_compatible_magazines = getArray(configFile>>"CfgWeapons">>_weapon>>"magazines"); - -if ((_veh isKindOf "Plane")or(_veh isKindOf "Helicopter")) then { - { if (_weapon in _x) then { - {_compatible_magazines = _compatible_magazines + getArray(configFile>>"CfgWeapons">>_x>>"magazines"); - }forEach _x; - }; - } forEach CHANGABLE_WEAPONS; - _magazines = []; - {if !(_x in _magazines) then { - _magazines = _magazines + [_x]; - }} forEach _compatible_magazines; - _compatible_magazines = _magazines; -}; - - -lbClear GET_CTRL(balca_loader_compatible_magazines_IDC); -{ - _display_name = (getText(configFile >> "CfgMagazines" >> _x >> "displayName")); - if (_display_name=="") then { - GET_CTRL(balca_loader_compatible_magazines_IDC) lbAdd _x; - } else { - GET_CTRL(balca_loader_compatible_magazines_IDC) lbAdd _display_name; - }; - GET_CTRL(balca_loader_compatible_magazines_IDC) lbSetData [(lbSize GET_CTRL(balca_loader_compatible_magazines_IDC))-1,_x]; -} forEach _compatible_magazines; - -GET_CTRL(balca_loader_compatible_magazines_IDC) lbSetCurSel 0; diff --git a/addons/proving_ground/reloader/fnc_fill_current_magazines_list.sqf b/addons/proving_ground/reloader/fnc_fill_current_magazines_list.sqf deleted file mode 100644 index 437c07cd3..000000000 --- a/addons/proving_ground/reloader/fnc_fill_current_magazines_list.sqf +++ /dev/null @@ -1,37 +0,0 @@ -#include "defs.hpp" -_index = _this select 0 select 1; - -_veh = GET_SELECTED_VEHICLE; -_veh_type = GET_SELECTED_DATA(balca_loader_vehicle_list_IDC); -_weapon = GET_CTRL(balca_loader_weapon_list_IDC) lbData _index; -if (isNil "_index") then { -_weapon = GET_SELECTED_DATA(balca_loader_weapon_list_IDC)}; -_compatible_magazines = getArray(configFile>>"CfgWeapons">>_weapon>>"magazines"); - -if ((_veh isKindOf "Plane")or(_veh isKindOf "Helicopter")) then { - { if (_weapon in _x) then { - {_compatible_magazines = _compatible_magazines + getArray(configFile>>"CfgWeapons">>_x>>"magazines"); - }forEach _x; - }; - } forEach CHANGABLE_WEAPONS; -}; - -_current_magazines = GET_CURRENT_MAGAZINES_TURRET; - - - -lbClear GET_CTRL(balca_loader_current_magazines_IDC); -{ - if (_x in _compatible_magazines) then { - _display_name = (getText(configFile >> "CfgMagazines" >> _x >> "displayName")); - if (_display_name=="") then { - GET_CTRL(balca_loader_current_magazines_IDC) lbAdd _x; - } else { - GET_CTRL(balca_loader_current_magazines_IDC) lbAdd _display_name; - }; - GET_CTRL(balca_loader_current_magazines_IDC) lbSetData [(lbSize GET_CTRL(balca_loader_current_magazines_IDC))-1,_x]; - }; -} forEach _current_magazines; - -_cap = [] call GFNC(get_capacity); -GET_CTRL(balca_loader_capacity_IDC) ctrlSetText format ["Capacity %1/%2",_cap select 0,_cap select 1]; diff --git a/addons/proving_ground/reloader/fnc_fill_turret_list.sqf b/addons/proving_ground/reloader/fnc_fill_turret_list.sqf deleted file mode 100644 index 95ee48bed..000000000 --- a/addons/proving_ground/reloader/fnc_fill_turret_list.sqf +++ /dev/null @@ -1,55 +0,0 @@ -#include "defs.hpp" -disableSerialization; -_veh = GET_SELECTED_VEHICLE; -_veh_type = GET_SELECTED_DATA(balca_loader_vehicle_list_IDC); -GET_CTRL(balca_loader_vehicle_shortcut_IDC) ctrlSetText (getText(configFile >> "CfgVehicles" >> typeOf(_veh) >> "picture")); - - -lbClear GET_CTRL(balca_loader_turret_list_IDC); -_default_magazines = getArray(configFile >> "CfgVehicles" >> _veh_type >> "magazines"); -//hull -_weapons = _veh weaponsTurret [-1]; -if ((_weapons select 0)!="FakeWeapon") then -{ - GET_CTRL(balca_loader_turret_list_IDC) lbAdd "Hull"; - GET_CTRL(balca_loader_turret_list_IDC) lbSetValue [(lbSize GET_CTRL(balca_loader_turret_list_IDC))-1,-1]; -}; -if (isClass(configFile >> "CfgVehicles" >> _veh_type >> "Turrets")) then { - _turrets = (configFile >> "CfgVehicles" >> _veh_type >> "Turrets"); - for "_i" from 0 to ((count _turrets)-1) do { - _turret = _turrets select _i; - _weapons = _veh weaponsTurret [_i]; - - if !(isNil {_weapons select 0}) then - { - GET_CTRL(balca_loader_turret_list_IDC) lbAdd getText(_turret >> "gunnerName"); - GET_CTRL(balca_loader_turret_list_IDC) lbSetValue [(lbSize GET_CTRL(balca_loader_turret_list_IDC))-1,_i]; - _default_magazines = _default_magazines + getArray(_turret >> "magazines"); - }; - _subturrets = _turret >> "Turrets"; - for "_j" from 0 to (count _subturrets)-1 do { - _turret = _subturrets select _j; - _weapons = _veh weaponsTurret [_i,_j]; - if !(isNil {_weapons select 0}) then - { - GET_CTRL(balca_loader_turret_list_IDC) lbAdd getText(_turret >> "gunnerName"); - GET_CTRL(balca_loader_turret_list_IDC) lbSetValue [(lbSize GET_CTRL(balca_loader_turret_list_IDC))-1,-2-_i*10-_j]; - _default_magazines = _default_magazines + getArray(_turret >> "magazines"); - }; - }; - }; -}else{}; -lbClear GET_CTRL(balca_loader_default_loadout_IDC); -{ - _display_name = (getText(configFile >> "CfgMagazines" >> _x >> "displayName")); - if (_display_name=="") then { - GET_CTRL(balca_loader_default_loadout_IDC) lbAdd str _x; - } else { - GET_CTRL(balca_loader_default_loadout_IDC) lbAdd _display_name; - }; - GET_CTRL(balca_loader_default_loadout_IDC) lbSetData [(lbSize GET_CTRL(balca_loader_default_loadout_IDC))-1,_x]; -} forEach _default_magazines; - -GET_CTRL(balca_loader_turret_list_IDC) lbSetCurSel 0; - -[] call GFNC(fill_weapon_list); diff --git a/addons/proving_ground/reloader/fnc_fill_weapon_list.sqf b/addons/proving_ground/reloader/fnc_fill_weapon_list.sqf deleted file mode 100644 index 5c7b3c50c..000000000 --- a/addons/proving_ground/reloader/fnc_fill_weapon_list.sqf +++ /dev/null @@ -1,19 +0,0 @@ -#include "defs.hpp" -disableSerialization; -_veh = GET_SELECTED_VEHICLE; -_veh_type = GET_SELECTED_DATA(balca_loader_vehicle_list_IDC); -_index_turret = GET_INDEX_TURRET; -_weapons = GET_WEAPONS_TURRET; - -lbClear GET_CTRL(balca_loader_weapon_list_IDC); -{GET_CTRL(balca_loader_weapon_list_IDC) lbAdd str _x; -GET_CTRL(balca_loader_weapon_list_IDC) lbSetData [(lbSize GET_CTRL(balca_loader_weapon_list_IDC))-1,_x]; -} forEach _weapons; -GET_CTRL(balca_loader_weapon_list_IDC) lbSetCurSel 0; - - -[[0,0]] call GFNC(fill_compatible_magazines_list); -[[0,0]] call GFNC(fill_current_magazines_list); - -GET_CTRL(balca_loader_current_magazines_IDC) lbSetCurSel 0; -GET_CTRL(balca_loader_compatible_magazines_IDC) lbSetCurSel 0; diff --git a/addons/proving_ground/reloader/fnc_get_capacity.sqf b/addons/proving_ground/reloader/fnc_get_capacity.sqf deleted file mode 100644 index 00b371f1c..000000000 --- a/addons/proving_ground/reloader/fnc_get_capacity.sqf +++ /dev/null @@ -1,59 +0,0 @@ -#include "defs.hpp" -disableSerialization; - -_veh = GET_SELECTED_VEHICLE; -_veh_type = GET_SELECTED_DATA(balca_loader_vehicle_list_IDC); -_index_turret = GET_SELECTED_TURRET; -_weapon = GET_SELECTED_DATA(balca_loader_weapon_list_IDC); -_default_magazines = []; -_current_magazines = []; -_compatible_magazines = getArray(configFile>>"CfgWeapons">>_weapon>>"magazines"); - - -if ((_veh isKindOf "Plane")||(_veh isKindOf "Helicopter")) then { - { if (_weapon in _x) then { - {_compatible_magazines = _compatible_magazines + getArray(configFile>>"CfgWeapons">>_x>>"magazines"); - }forEach _x; - }; - } forEach CHANGABLE_WEAPONS; - _magazines = []; - {if !(_x in _magazines) then { - _magazines = _magazines + [_x]; - }} forEach _compatible_magazines; - _compatible_magazines = _magazines; - _default_magazines = getArray(configFile >> "CfgVehicles" >> _veh_type >> "magazines"); - if (isClass(configFile >> "CfgVehicles" >> _veh_type >> "Turrets" >> "MainTurret")) then { - _default_magazines =_default_magazines + getArray(configFile >> "CfgVehicles" >> _veh_type >> "Turrets" >> "MainTurret" >> "magazines"); - }; - _current_magazines = magazines _veh; -}else{ - if (count(configFile >> "CfgVehicles" >> _veh_type >> "Turrets") > 0) then { - _current_magazines = GET_CURRENT_MAGAZINES_TURRET; - _turrets = configFile >> "CfgVehicles" >> _veh_type >> "Turrets"; - _turret = _turrets select (_index_turret select 0); - if (isNil {_index_turret select 1}) then { - _default_magazines = getArray(_turret >> "magazines"); - }else{ - _subturrets = _turret >> "Turrets"; - _turret = _subturrets select (_index_turret select 1); - _default_magazines = getArray(_turret >> "magazines"); - }; - }; -}; - -_capacity_current = 0; -{ if (_x in _compatible_magazines) then { - _capacity_current = _capacity_current + getNumber(configFile>>"CfgMagazines">>_x>>"count"); - }; -} forEach _current_magazines; - -_capacity_max = 0; -{if ((_compatible_magazines find _x)>-1) then { -_capacity_max = _capacity_max + getNumber(configFile>>"CfgMagazines">>_x>>"count"); -};} forEach _default_magazines; - -if (_veh isKindOf "StaticWeapon") then {_capacity_max = (_capacity_max*5) max 30}; -_arr = [_capacity_current,_capacity_max]; -//diag_log format ["%1",_arr]; -_arr - diff --git a/addons/proving_ground/reloader/fnc_get_current_magazines_turret.sqf b/addons/proving_ground/reloader/fnc_get_current_magazines_turret.sqf deleted file mode 100644 index 4ddcfb7c3..000000000 --- a/addons/proving_ground/reloader/fnc_get_current_magazines_turret.sqf +++ /dev/null @@ -1,17 +0,0 @@ -#include "defs.hpp" -//diag_log "get_current_magazines"; -_veh = GET_SELECTED_VEHICLE; -_current_magazines = []; -_index_turret = GET_SELECTED_TURRET; -if (((_veh isKindOf "Plane")or(_veh isKindOf "Helicopter"))and(_index_turret select 0 < 1)and(2 > lbSize GET_CTRL(balca_loader_turret_list_IDC))) then { - _current_magazines = magazines _veh; - //_current_magazines = _veh magazinesTurret _index_turret; -}else{ - if ((_index_turret select 0 == -1)and(_veh isKindOf "Car")) then { - _current_magazines = []; - }else{ - _current_magazines = _veh magazinesTurret _index_turret; - }; -}; -//diag_log "get_current_magazines end"; -_current_magazines diff --git a/addons/proving_ground/reloader/fnc_get_selected_data.sqf b/addons/proving_ground/reloader/fnc_get_selected_data.sqf deleted file mode 100644 index 62603b0fa..000000000 --- a/addons/proving_ground/reloader/fnc_get_selected_data.sqf +++ /dev/null @@ -1,6 +0,0 @@ -#include "defs.hpp" -_idc = _this select 0; - -_selection = (lbSelection GET_CTRL(_idc) select 0); -if (isNil {_selection}) then {_selection = 0}; -(GET_CTRL(_idc) lbData _selection) diff --git a/addons/proving_ground/reloader/fnc_get_selected_turret.sqf b/addons/proving_ground/reloader/fnc_get_selected_turret.sqf deleted file mode 100644 index 18f2502db..000000000 --- a/addons/proving_ground/reloader/fnc_get_selected_turret.sqf +++ /dev/null @@ -1,9 +0,0 @@ -#include "defs.hpp" -_selection = (lbSelection GET_CTRL(balca_loader_turret_list_IDC) select 0); -if (isNil {_selection}) then {_selection = 0}; -_index_turret = [(GET_CTRL(balca_loader_turret_list_IDC) lbvalue _selection)]; -if (_index_turret select 0 <= -2) then { - _i = _index_turret select 0; - _index_turret = [round(-(_i+2)/10),(-(_i+2)+10*round((_i+2)/10))]; -}; -_index_turret diff --git a/addons/proving_ground/reloader/fnc_get_selected_vehicle.sqf b/addons/proving_ground/reloader/fnc_get_selected_vehicle.sqf deleted file mode 100644 index 3051129d0..000000000 --- a/addons/proving_ground/reloader/fnc_get_selected_vehicle.sqf +++ /dev/null @@ -1,4 +0,0 @@ -#include "defs.hpp" -_selection = (lbSelection GET_CTRL(balca_loader_vehicle_list_IDC) select 0); -if (isNil {_selection}) then {_selection = 0}; -((uiNamespace GetVariable "balca_reloader_vehlist") select _selection) diff --git a/addons/proving_ground/reloader/fnc_remove_magazine.sqf b/addons/proving_ground/reloader/fnc_remove_magazine.sqf deleted file mode 100644 index 6353c3489..000000000 --- a/addons/proving_ground/reloader/fnc_remove_magazine.sqf +++ /dev/null @@ -1,11 +0,0 @@ -#include "defs.hpp" - -_veh = GET_SELECTED_VEHICLE; -_magazine = GET_SELECTED_DATA(balca_loader_current_magazines_IDC); -_index_turret = GET_SELECTED_TURRET; -if (((_veh isKindOf "Plane")or(_veh isKindOf "Helicopter"))and(_index_turret select 0 < 1)) then { - _veh removeMagazine _magazine -}else{ - _veh removeMagazineTurret [_magazine,_index_turret]; -}; -[] call GFNC(fill_current_magazines_list); diff --git a/addons/proving_ground/reloader/fnc_restore_loadout.sqf b/addons/proving_ground/reloader/fnc_restore_loadout.sqf deleted file mode 100644 index b49da203a..000000000 --- a/addons/proving_ground/reloader/fnc_restore_loadout.sqf +++ /dev/null @@ -1,48 +0,0 @@ -#include "defs.hpp" -//diag_log "restore_loadout"; -_veh = GET_SELECTED_VEHICLE; -_veh_type = GET_SELECTED_DATA(balca_loader_vehicle_list_IDC); - -//hull -_current_magazines = []; -_default_magazines_hull = getArray(configFile >> "CfgVehicles" >> _veh_type >> "magazines"); -if ((_veh isKindOf "Plane")or(_veh isKindOf "Helicopter")or(_veh isKindOf "Car")) then { - _current_magazines = magazines _veh; - {_veh removeMagazine _x;} forEach _current_magazines; - {_veh addMagazine _x;} forEach _default_magazines_hull; -}else{ - _current_magazines = _veh magazinesTurret [-1]; - {_veh removeMagazineTurret [_x,-1];} forEach _current_magazines; - {_veh addMagazineTurret [_x,-1];} forEach _default_magazines_hull; -}; -//diag_log "restore_loadout_1"; -//turrets -_turrets= configFile >> "CfgVehicles" >> _veh_type >> "Turrets"; -for "_i" from 0 to (count _turrets)-1 do { - _turret = _turrets select _i; - _weapons = _veh weaponsTurret [_i]; - - - if !(isNil {_weapons select 0}) then - { - _current_magazines = _veh magazinesTurret [_i]; - _default_magazines = getArray(_turret >> "magazines"); - {_veh removeMagazineTurret [_x,[_i]];} forEach _current_magazines; - {_veh addMagazineTurret [_x,[_i]];} forEach _default_magazines; - }; - _subturrets = _turret >> "Turrets"; - for "_j" from 0 to (count _turrets)-1 do { - _turret = _subturrets select _j; - _weapons = _veh weaponsTurret [_i,_j]; - if !(isNil {_weapons select 0}) then - { - _current_magazines = _veh magazinesTurret [_i,_j]; - _default_magazines = getArray(_turret >> "magazines"); - {_veh removeMagazineTurret [_x,[_i,_j]];} forEach _current_magazines; - {_veh addMagazineTurret [_x,[_i,_j]];} forEach _default_magazines; - }; - }; -}; - -[] call GFNC(fill_current_magazines_list); -//diag_log "restore_loadout_end"; diff --git a/addons/proving_ground/reloader/macros.hpp b/addons/proving_ground/reloader/macros.hpp deleted file mode 100644 index 08b4b3f36..000000000 --- a/addons/proving_ground/reloader/macros.hpp +++ /dev/null @@ -1,11 +0,0 @@ -#define __autor_prefix c_ -#define __addon_prefix proving_ground_reloader_ -#define __quoted(str) #str -#define __concat2(var1,var2) ##var1####var2 -#define __concat3(var1,var2,var3) ##var1####var2####var3 -#define __concat4(var1,var2,var3,var4) ##var1####var2####var3####var4 -#define __scriptName(a) __concat4(__autor_prefix,__addon_prefix,fnc_,a) -#define __prepFnc(a) __scriptName(a) = __preprocess __scriptPath(a) -#define __preprocess compile preprocessFileLineNumbers -#define GVAR(a) __concat3(__autor_prefix,__addon_prefix,a) -#define GFNC(a) __concat4(__autor_prefix,__addon_prefix,fnc_,a) diff --git a/addons/proving_ground/script_component.hpp b/addons/proving_ground/script_component.hpp deleted file mode 100644 index 5b932ed9d..000000000 --- a/addons/proving_ground/script_component.hpp +++ /dev/null @@ -1,2 +0,0 @@ -#define __path addons\proving_ground -#define __module main_ diff --git a/addons/scripts/DynamicWeatherEffects.sqf b/addons/scripts/DynamicWeatherEffects.sqf index 3ffc54c8b..28704075f 100644 --- a/addons/scripts/DynamicWeatherEffects.sqf +++ b/addons/scripts/DynamicWeatherEffects.sqf @@ -26,11 +26,11 @@ if (count _this > 4) then { _debug = _this select 4; } else { _debug = false; }; // Minimum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to 1 and less than or equal to // _maxWeatherChangeTimeMin. When weather changes, it is fog OR overcast that changes, not both at the same time. (Suggested value: 10). -_minWeatherChangeTimeMin = 20; +_minWeatherChangeTimeMin = 10; // Maximum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to _minWeatherChangeTimeMin. // (Suggested value: 20). -_maxWeatherChangeTimeMin = 40; +_maxWeatherChangeTimeMin = 30; // Minimum time in minutes that weather (fog and overcast) stays constant between weather changes. Must be less than or equal to 0 and // greater than or equal to _minWeatherChangeTimeMin. (Suggested value: 5). @@ -46,7 +46,7 @@ _minimumFog = 0; // Fog intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumFog // (0 = no fog, 1 = pea soup). (Suggested value: 0.1). -_maximumFog = 0.1; +_maximumFog = 0; // New ArmA3 facilities added by Bewilderbeest _minimumFogDecay = 0.001; @@ -60,15 +60,15 @@ _minimumOvercast = 0; // Overcast intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumOvercast // (0 = no overcast, 1 = maximum overcast). (Suggested value: 1). -_maximumOvercast = 1; +_maximumOvercast = 0.1; // When raining, rain intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumRain // (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0); -_minimumRain = 0.01; +_minimumRain = 0; // When raining, rain intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumRain // (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0.8); -_maximumRain = 0.5; +_maximumRain = 0.05; // Wind vector strength never falls below this value. Must be greater or equal to 0 and less than or equal to _maximumWind. // (Suggested value: 0); @@ -76,7 +76,7 @@ _minimumWind = 0; // Wind vector strength never exceeds this value. Must be greater or equal to 0 and greater than or equal to _minimumWind. // (Suggested value: 8). -_maximumWind = 8; +_maximumWind = 4; // Probability in percent for wind to change when weather changes. If set to 0 then wind will never change. If set to 100 then rain will // change every time the weather (fog or overcast) start to change. (Suggested value: 25); @@ -89,7 +89,7 @@ _windChangeProbability = 25; // Probability in percent (0-100) for rain to start at every rain interval. Set this to 0 if you don't want rain at all. Set this to 100 // if you want it to rain constantly when overcast is greater than 0.75. In short: if you think that it generally rains to often then // lower this value and vice versa. (Suggested value: 50). -_rainIntervalRainProbability = 50; +_rainIntervalRainProbability = 10; // Minimum time in minutes for rain intervals. Must be greater or equal to 0 and less than or equal to _maxRainIntervalTimeMin. // (Suggested value: 0). diff --git a/addons/scripts/fn_resupplytruck.sqf b/addons/scripts/fn_resupplytruck.sqf new file mode 100644 index 000000000..1a2e5b091 --- /dev/null +++ b/addons/scripts/fn_resupplytruck.sqf @@ -0,0 +1,475 @@ +// @file Version: 1.1 +// @file Name: fn_resupplyTruck.sqf +// @file Author: Wiking, AgentRev, micovery +// @file Created: 13/07/2014 21:58 + +#define RESUPPLY_TRUCK_DISTANCE 20 +#define REARM_TIME_SLICE 10 +#define REPAIR_TIME_SLICE 1 +#define REFUEL_TIME_SLICE 1 +#define PRICE_RELATIONSHIP 4 + +private["_vehicle"]; + +// Check if mutex lock is active. +if (mutexScriptInProgress) exitWith { + titleText ["You are already performing another action.", "PLAIN DOWN", 0.5]; +}; + +mutexScriptInProgress = true; +doCancelAction = false; + +if (!isNil "_this" && {typeName _this == typeName objNull}) then { + _vehicle = _this; +} +else { + _vehicle = vehicle player; +}; + + + +private["_checkExit"]; +_checkExit = { + if (doCancelAction) exitWith { + doCancelAction = false; + mutexScriptInProgress = false; + titleText ["Vehicle resupply cancelled", "PLAIN DOWN", 0.5]; + true; + }; + false +}; + +if (isNil "_vehicle") exitWith {}; + +private["_is_uav", "_is_static"]; +_is_uav = (_vehicle isKindOf "UAV_01_base_F" || {_vehicle isKindOf "UAV_02_base_F" || {_vehicle isKindOf "UGV_01_base_F"}}); +_is_static = (_vehicle isKindOf "StaticWeapon"); + +//check if caller is in vehicle +if (_vehicle == player) exitWith {}; + +private["_vehClass", "_price"]; +//set up prices +_vehClass = typeOf _vehicle; +_price = 1000; // price = 1000 for vehicles not found in vehicle store. (e.g. Static Weapons) + +{ + if (_vehClass == _x select 1) then { + _price = _x select 2; + _price = round (_price / PRICE_RELATIONSHIP); + }; +} forEach (call allVehStoreVehicles + call staticGunsArray); + +private["_service_cancelled"]; +_service_cancelled = false; + +if (_is_static) then { + _text = format ["Resupply sequence initiated for this static weapon. Make sure to get out of the weapon."]; + titleText [_text, "PLAIN DOWN", 0.5]; + sleep 10; +} +else { + _text = format ["Resupply sequence initiated for this vehicle. Make sure the engine is stopped.", _price]; + titleText [_text, "PLAIN DOWN", 0.5]; + + private["_eng"]; + sleep 10; + _eng = isEngineOn _vehicle; + if (_eng) exitWith { + titleText ["Engine still running. Service cancelled.", "PLAIN DOWN", 0.5]; + mutexScriptInProgress = false; + _service_cancelled = true; + }; +}; + +if (_service_cancelled || {call _checkExit}) exitWith {}; + +if ((!isNull (gunner _vehicle)) && !(_is_uav)) then { + _vehicle vehicleChat format ["Gunner must be out of seat for service. Get gunner out in 20s."]; + sleep 10; + if (call _checkExit) exitWith {_service_cancelled = true;}; + _vehicle vehicleChat format ["Gunner must be out of seat for service. Get gunner out in 10s."]; + sleep 10; + if (call _checkExit) exitWith {_service_cancelled = true;}; + if (!isNull (gunner _vehicle)) exitWith { + _vehicle vehicleChat format ["Gunner still inside. Service cancelled."]; + mutexScriptInProgress = false; + _service_cancelled = true; + }; +}; + +if (_service_cancelled || {call _checkExit}) exitWith {}; + +_resupplyThread = [_vehicle, _is_uav, _is_static] spawn { + private["_vehicle", "_vehClass", "_vehicleCfg","_is_uav"]; + _vehicle = _this select 0; + _is_uav = _this select 1; + _is_static = _this select 2; + _vehClass = typeOf _vehicle; + _vehicleCfg = configFile >> "CfgVehicles" >> _vehClass; + _vehName = getText (_vehicleCfg >> "displayName"); + + + scopeName "fn_resupplyTruck"; + + private["_price"]; + _price = 1000; // price = 1000 for vehicles not found in vehicle store (e.g. static weapons) + { + if (_vehClass == _x select 1) then { + _price = _x select 2; + _price = round (_price / PRICE_RELATIONSHIP); + }; + } forEach (call allVehStoreVehicles + call staticGunsArray); + + private["_titleText"]; + _titleText = { + titleText [_this, "PLAIN DOWN", ((REARM_TIME_SLICE max 1) / 10) max 1]; + }; + + private["_checkAbortConditions"]; + _checkAbortConditions = { + if (doCancelAction) then { + doCancelAction = false; + mutexScriptInProgress = false; + titleText ["Vehicle resupply cancelled", "PLAIN DOWN", 0.5]; + breakOut "fn_resupplyTruck"; + }; + + // Abort everything if vehicle is no longer local, otherwise commands won't do anything + if (!local _vehicle && {!(_is_uav || _is_static)}) then { + _crew = crew _vehicle; + _text = format ["Vehicle resupply aborted by %1", if (count _crew > 0) then { name (_crew select 0) } else { "another player" }]; + titleText [_text, "PLAIN DOWN", 0.5]; + mutexScriptInProgress = false; + breakOut "fn_resupplyTruck"; + }; + + // Abort everything if no Tempest Device in proximity + if ({alive _x} count (_vehicle nearEntities [["O_Heli_Transport_04_ammo_F", "I_Truck_02_ammo_F", "O_Truck_03_ammo_F", "B_Truck_01_ammo_F"], RESUPPLY_TRUCK_DISTANCE]) == 0) then { + if (_started) then { titleText ["Vehicle resupply aborted.", "PLAIN DOWN", 0.5] }; + mutexScriptInProgress = false; + breakOut "fn_resupplyTruck"; + }; + // Abort everything if player gets out of vehicle + if (vehicle player != _vehicle && {!(_is_uav || _is_static)}) then { + if (_started) then { titleText ["Vehicle resupply aborted.", "PLAIN DOWN", 0.5] }; + mutexScriptInProgress = false; + breakOut "fn_resupplyTruck"; + }; + + // Abort if player gets in the gunner seat + + if (_is_static && {!isNull (gunner _vehicle)}) then { + if (_started) then { titleText ["Vehicle resupply aborted. Someone is using the weapon.", "PLAIN DOWN", 0.5] }; + mutexScriptInProgress = false; + breakOut "fn_resupplyTruck"; + }; + + }; + + private["_started"]; + _started = false; + call _checkAbortConditions; + _started = true; + + private["_playerMoney"]; + //Add cost for resupply + _playerMoney = player getVariable "cmoney"; + + private["_text"]; + if (_playerMoney < _price) then { + _text = format ["Not enough money. You need $%1 to resupply %2. Service cancelled.",_price,_vehName]; + [_text, 10] call mf_notify_client; + mutexScriptInProgress = false; + breakOut "fn_resupplyTruck"; + } + else { + private["_msg"]; + _msg = format["It will cost you $%1 to resupply the %2. Do you want to proceed?", _price, getText ((configFile >> "CfgVehicles" >> (typeOf _vehicle)) >> "displayName")]; + if (not([_msg, "Vehicle Resupply", true,true] call BIS_fnc_guiMessage)) then { + mutexScriptInProgress = false; + breakOut "fn_resupplyTruck"; + }; + + //start resupply here + player setVariable["cmoney",(player getVariable "cmoney")-_price,true]; + _text = format ["You paid $%1 to resupply %2.\nPlease stand by ...",_price,_vehName]; + [_text, 10] call mf_notify_client; + [] call fn_savePlayerData; + }; + + if (not(_is_uav) && {!isNull (gunner(_vehicle))}) then { + gunner(_vehicle) action ["getOut", _vehicle]; + }; + + private["_turretCfg", "_turretsArray"]; + _turretsArray = [[_vehicleCfg, [-1]]]; + _turretsCfg = configFile >> "CfgVehicles" >> _vehClass >> "Turrets"; + + if (isClass _turretsCfg) then { + _nbTurrets = count _turretsCfg; + _turretPath = 0; + for "_i" from 0 to (_nbTurrets - 1) do { + _turretCfg = _turretsCfg select _i; + if (isClass _turretCfg && {getNumber (_turretCfg >> "hasGunner") > 0}) then { + _turretsArray set [count _turretsArray, [_turretCfg, [_turretPath]]]; + _subTurretsCfg = _turretCfg >> "Turrets"; + if (isClass _subTurretsCfg) then { + _nbSubTurrets = count _subTurretsCfg; + _subTurretPath = 0; + for "_j" from 0 to (_nbSubTurrets - 1) do { + _subTurretCfg = _subTurretsCfg select _j; + if (isClass _subTurretCfg && {getNumber (_subTurretCfg >> "hasGunner") > 0}) then { + _turretsArray set [count _turretsArray, [_subTurretCfg, [_turretPath, _subTurretPath]]]; + _subTurretPath = _subTurretPath + 1; + }; + }; + }; + _turretPath = _turretPath + 1; + }; + }; + }; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + _engineOn = false; + + if !(_vehicle isKindOf "Air") then { + _engineOn = isEngineOn _vehicle; + player action ["EngineOff", _vehicle]; + }; + + _vehicle setFuel 0; + + { + private["_turretCfg", "_turretPath", "_turretMags", "_turretMagPairs"]; + _turretCfg = _x select 0; + _turretPath = _x select 1; + _turretMags = getArray (_turretCfg >> "magazines"); + _turretMagPairs = []; + + { [_turretMagPairs, _x, 1] call BIS_fnc_addToPairs } forEach _turretMags; + + { + private["_mag", "_ammo"]; + _mag = _x select 0; + _ammo = _x select 1; + + if (_ammo >= getNumber (configFile >> "CfgMagazines" >> _mag >> "count")) then { + { + if (_x select 0 == _mag) exitWith { + _count = if (count _x > 2) then { _x select 2 } else { 0 }; + _x set [2, _count + 1]; + }; + } forEach _turretMagPairs; + }; + } forEach magazinesAmmo _vehicle; + + { + private["_mag", "_qty", "_fullQty"]; + _mag = _x select 0; + _qty = _x select 1; + _fullQty = if (count _x > 2) then { _x select 2 } else { 0 }; + + if (_fullQty < _qty) then { + //_vehicle removeMagazinesTurret [_mag, _turretPath]; + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_removeMagazinesTurret", _vehicle, false] call BIS_fnc_MP; + + for "_i" from 1 to _qty do { + private["_magName"]; + _magName = getText (configFile >> "CfgMagazines" >> _mag >> "displayName"); + + if (_magName == "") then { + { + _weaponCfg = configFile >> "CfgWeapons" >> _x; + if ({_mag == _x} count getArray (_weaponCfg >> "magazines") > 0) exitWith { + _magName = getText (_weaponCfg >> "displayName"); + }; + } forEach getArray (_turretCfg >> "weapons"); + }; + + if ({_vehicle isKindOf _x} count ["B_Mortar_01_F", "O_Mortar_01_F", "I_Mortar_01_F"] > 0) then { + private["_text"]; + _text = format ["Reloading %1...", if (_magName != "") then { _magName } else { _vehName }]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretMortar", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if (_vehicle isKindOf "B_Plane_CAS_01_F") then { + private["_text"]; + _text = format ["Reloading %1...", _vehName]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretBcas", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if (_vehicle isKindOf "O_Plane_CAS_02_F") then { + private["_text"]; + _text = format ["Reloading %1...", _vehName]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretOcas", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if (_vehicle isKindOf "I_Plane_Fighter_03_CAS_F") then { + private["_text"]; + _text = format ["Reloading %1...", _vehName]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretIcas", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if (_vehicle isKindOf "O_Heli_Light_02_F") then { + private["_text"]; + _text = format ["Reloading %1...", _vehName]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretHorca", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if (_vehicle isKindOf "B_Heli_Attack_01_F") then { + private["_text"]; + _text = format ["Reloading %1...", if (_magName != "") then { _magName } else { _vehName }]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretBaheli", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if ({_vehicle isKindOf _x} count ["O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F"] > 0) then { + private["_text"]; + _text = format ["Reloading %1...", if (_magName != "") then { _magName } else { _vehName }]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretOaheli", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if ({_vehicle isKindOf _x} count ["B_UAV_02_F", "O_UAV_02_F", "I_UAV_02_F"] > 0) then { + private["_text"]; + _text = format ["Reloading %1...", if (_magName != "") then { _magName } else { _vehName }]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretUav2", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + + if !({_vehicle isKindOf _x} count ["B_UAV_02_F", "O_UAV_02_F", "I_UAV_02_F", "B_Plane_CAS_01_F", "O_Plane_CAS_02_F", "B_Mortar_01_F", "O_Mortar_01_F", "I_Mortar_01_F", "O_Heli_Light_02_F", "I_Plane_Fighter_03_CAS_F", "O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F", "B_Heli_Attack_01_F"] > 0) then { + private["_text"]; + _text = format ["Reloading %1...", if (_magName != "") then { _magName } else { _vehName }]; + _text call _titleText; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurret", _vehicle, false] call BIS_fnc_MP; + + sleep (REARM_TIME_SLICE / 2); + call _checkAbortConditions; + }; + }; + }; + } forEach _turretMagPairs; + } forEach _turretsArray; + + if !({_vehicle isKindOf _x} count ["B_UAV_02_F", "O_UAV_02_F", "I_UAV_02_F", "B_Plane_CAS_01_F", "O_Plane_CAS_02_F", "B_Mortar_01_F", "O_Mortar_01_F", "I_Mortar_01_F", "O_Heli_Light_02_F", "I_Plane_Fighter_03_CAS_F", "O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F", "B_Heli_Attack_01_F"] > 0) then { + [[_vehicle,1],"A3W_fnc_setVehicleAmmoDef",_vehicle,false] call BIS_fnc_MP; // Full ammo reset just to be sure + }; + + if ({_vehicle isKindOf _x} count ["B_Heli_Light_01_F", "B_Heli_Light_01_armed_F", "O_Heli_Light_02_unarmed_F", "C_Heli_Light_01_civil_F"] > 0) then { + // Add flares to those poor helis + [[_vehicle, [_mag, _turretPath]], "A3W_fnc_addMagazineTurretLheli", _vehicle, false] call BIS_fnc_MP; + }; + + if (damage _vehicle > 0.001) then { + call _checkAbortConditions; + while {damage _vehicle > 0.001} do { + "Repairing..." call _titleText; + sleep 1; + call _checkAbortConditions; + _vehicle setDamage ((damage _vehicle) - 0.1); + }; + sleep 3; + }; + + if (fuel _vehicle < 0.999) then { + call _checkAbortConditions; + + while {fuel _vehicle < 0.999} do { + "Refueling..." call _titleText; + sleep REFUEL_TIME_SLICE; + call _checkAbortConditions; + _vehicle setFuel ((fuel _vehicle) + 0.1); + }; + sleep 2; + }; + + if !(_vehicle isKindOf "Air") then { + _vehicle removeEventHandler ["Engine", _vehicle getVariable ["truckResupplyEngineEH", -1]]; + _vehicle engineOn _engineOn; + }; + + titleText ["Your vehicle is ready.", "PLAIN DOWN", 0.5]; + mutexScriptInProgress = false; +}; + +if !(_vehicle isKindOf "Air") then { + _vehicle setVariable ["truckResupplyThread", _resupplyThread]; + _vehicle setVariable ["truckResupplyEngineEH", _vehicle addEventHandler ["Engine", + { + private["_vehicle", "_started", "_resupplyThread"]; + _vehicle = _this select 0; + _started = _this select 1; + _resupplyThread = _vehicle getVariable "truckResupplyThread"; + if (!isNil "_resupplyThread" && {!scriptDone _resupplyThread}) then { + player action ["EngineOff", _vehicle]; + }; + }]]; +}; diff --git a/addons/scripts/healSelf.sqf b/addons/scripts/healSelf.sqf new file mode 100644 index 000000000..1eb80e722 --- /dev/null +++ b/addons/scripts/healSelf.sqf @@ -0,0 +1,35 @@ +//@file Version: 1.0 +//@file Name: healSelf.sqf +//@file Author: MercyfulFate edited by Gigatek +//@file Created: 22/9/2014 +//@file Description: Heal yourself with a First Aid Kit + +#define DURATION 25 +#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" +#define ERR_CANCELLED "First Aid Cancelled!" +private ["_checks", "_success"]; + +_checks = { + private ["_progress","_failed", "_text"]; + _progress = _this select 0; + _text = ""; + _failed = true; + switch (true) do { + case (!alive player): {}; // player is dead, no need for a notification + case (doCancelAction): {_text = ERR_CANCELLED; doCancelAction = false;}; + default { + _text = format["First Aid %1%2 Applied", round(100 * _progress), "%"]; + _failed = false; + }; + }; + [_failed, _text]; +}; + +_success = [DURATION, ANIMATION, _checks, []] call a3w_actions_start; + +if (_success) then { + player removeItem "FirstAidKit"; + player setDamage 0; + ["First Aid Completed!", 5] call mf_notify_client; +}; +_success; \ No newline at end of file diff --git a/addons/scripts/lockPick.sqf b/addons/scripts/lockPick.sqf new file mode 100644 index 000000000..cb6ba5d64 --- /dev/null +++ b/addons/scripts/lockPick.sqf @@ -0,0 +1,51 @@ +//@file Version: 1.0 +//@file Name: lockPick.sqf +//@file Author: MercyfulFate edited by Gigatek +//@file Created: 06/09/2014 +//@file Description: Lock Pick the nearest Vehicle + +#define DURATION 180 +#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" + +private ["_vehicle", "_checks", "_success", "_nearvehicle"]; +_nearvehicle = nearestObjects [player, ["LandVehicle", "Air", "Ship"], 7]; +_vehicle = _nearvehicle select 0; + +_checks = { + private ["_progress","_failed", "_text"]; + _progress = _this select 0; + _vehicle = _this select 1; + _text = ""; + _failed = true; + switch (true) do { + case (!alive player): {}; // player is dead, no need for a notification + case (vehicle player != player): {_text = "Lock Pick Failed! You can't do that in a vehicle."}; + case (((player distance _vehicle) - ((sizeOf typeOf _vehicle / 3) max 4)) > 2): {_text = "Lock Pick Failed! You are too far away from the vehicle."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_deplace_par", objNull])): { _text = "Lock Pick Failed! Somebody moved the vehicle."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_transporte_par", objNull])): { _text = "Lock Pick Failed! Somebody loaded or towed the vehicle."}; + case (!alive _vehicle): {_error = "The vehicle is too damaged to pick."}; + case (doCancelAction): {_text = "Lock Pick Cancelled!"; doCancelAction = false;}; + default { + _text = format["Lock Pick %1%2 Complete", round(100 * _progress), "%"]; + _failed = false; + }; + }; + [_failed, _text]; +}; + +_success = [DURATION, ANIMATION, _checks, [_vehicle]] call a3w_actions_start; + +if (isNil "_vehicle" || {typeName _vehicle != typeName objNull || {isNull _vehicle}}) exitWith { + diag_log "No vehicle near to pick."; + false +}; + +if (_success) then { + [[netId _vehicle, 1], "A3W_fnc_setLockState", _vehicle] call A3W_fnc_MP; // Unlock + _vehicle setVariable ["objectLocked", false, true]; + _vehicle setVariable ["R3F_LOG_disabled",false,true]; + _vehicle say3D "carlock"; + sleep 0.5; + titleText ["Lock Pick Complete!","PLAIN DOWN"]; titleFadeOut 5; +}; +_success; \ No newline at end of file diff --git a/addons/scripts/resupply_actions.sqf b/addons/scripts/resupply_actions.sqf new file mode 100644 index 000000000..984de5ebf --- /dev/null +++ b/addons/scripts/resupply_actions.sqf @@ -0,0 +1,224 @@ + +A3W_fnc_setVehicleAmmoDef = { + private["_left", "_right"]; + _left = _this select 0; + _right = _this select 1; + if (isNil "_left" || { typeName _left != typeName objNull || { isNull _left}}) exitWith {}; + if (isNil "_right" || { typeName _right != typeName 0}) exitWith {}; + diag_log format["%1 call A3W_fnc_setVehicleAmmoDef--->", _this]; + _left setVehicleAmmoDef _right; +}; + +A3W_fnc_removeMagazinesTurret = { + private["_left", "_right"]; + _left = _this select 0; + _right = _this select 1; + if (isNil "_left" || { typeName _left != typeName objNull || { isNull _left}}) exitWith {}; + if (isNil "_right" || { typeName _right != typeName []}) exitWith {}; + _left removeMagazineTurret _right; +}; + +A3W_fnc_addMagazineTurret = { + private["_left", "_right"]; + _left = _this select 0; + _right = _this select 1; + if (isNil "_left" || { typeName _left != typeName objNull || { isNull _left}}) exitWith {}; + if (isNil "_right" || { typeName _right != typeName []}) exitWith {}; + _left addMagazineTurret _right; +}; + +A3W_fnc_addMagazineTurretMortar = { + private["_mortar"]; + _mortar = _this select 0; + _mortar setVehicleAmmoDef 0; + _mortar addMagazineTurret ["8Rnd_82mm_Mo_shells",[0]]; + _mortar addMagazineTurret ["8Rnd_82mm_Mo_Flare_white",[0]]; + _mortar addMagazineTurret ["8Rnd_82mm_Mo_LG",[0]]; +}; + +A3W_fnc_addMagazineTurretBcas = { + private["_bcas"]; + _bcas = _this select 0; + _bcas setVehicleAmmoDef 0; + _bcas removeWeaponTurret ["Missile_AGM_02_Plane_CAS_01_F",[-1]]; + _bcas removeWeaponTurret ["Rocket_04_HE_Plane_CAS_01_F",[-1]]; + _bcas removeWeaponTurret ["Rocket_04_AP_Plane_CAS_01_F",[-1]]; + _bcas removeWeaponTurret ["Bomb_04_Plane_CAS_01_F",[-1]]; + _bcas addMagazineTurret ["1000Rnd_Gatling_30mm_Plane_CAS_01_F",[-1]]; + _bcas addMagazineTurret ["2Rnd_Missile_AA_04_F",[-1]]; + _bcas addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; +}; + +A3W_fnc_addMagazineTurretOcas = { + private["_ocas"]; + _ocas = _this select 0; + _ocas setVehicleAmmoDef 0; + _ocas removeWeaponTurret ["Missile_AGM_01_Plane_CAS_02_F",[-1]]; + _ocas removeWeaponTurret ["Rocket_03_AP_Plane_CAS_02_F",[-1]]; + _ocas removeWeaponTurret ["Bomb_03_Plane_CAS_02_F",[-1]]; + _ocas addMagazineTurret ["500Rnd_Cannon_30mm_Plane_CAS_02_F",[-1]]; + _ocas addMagazineTurret ["20Rnd_Rocket_03_HE_F",[-1]]; + _ocas addMagazineTurret ["2Rnd_Missile_AA_03_F",[-1]]; + _ocas addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; +}; + +A3W_fnc_addMagazineTurretIcas = { + private["_Icas"]; + _Icas = _this select 0; + _Icas setVehicleAmmoDef 0; + _Icas removeWeaponTurret ["missiles_SCALPEL",[-1]]; + _Icas addMagazineTurret ["300Rnd_20mm_shells",[-1]]; + _Icas addMagazineTurret ["300Rnd_20mm_shells",[-1]]; + _Icas addMagazineTurret ["2Rnd_AAA_missiles",[-1]]; + _Icas addMagazineTurret ["2Rnd_GBU12_LGB_MI10",[-1]]; + _Icas addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; +}; + +A3W_fnc_addMagazineTurretHorca = { + private["_Horca"]; + _Horca = _this select 0; + _Horca setVehicleAmmoDef 0; + _Horca removeWeaponTurret ["missiles_DAGR",[-1]]; + _Horca addWeaponTurret ["missiles_DAR",[-1]]; + _Horca addMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Green_Splash",[-1]]; + _Horca addMagazineTurret ["12Rnd_missiles",[-1]]; + _Horca addMagazineTurret ["168Rnd_CMFlare_Chaff_Magazine",[-1]]; +}; + +A3W_fnc_addMagazineTurretUav2 = { + private["_uav2"]; + _uav2 = _this select 0; + _uav2 setVehicleAmmoDef 0; + _uav2 addMagazineTurret ["Laserbatteries",[0]]; + _uav2 addMagazineTurret ["2Rnd_LG_scalpel",[0]]; + _uav2 addMagazineTurret ["120Rnd_CMFlare_Chaff_Magazine",[-1]]; +}; + +A3W_fnc_addMagazineTurretLheli = { + private["_Lheli"]; + _Lheli = _this select 0; + _Lheli removeMagazineTurret ["60Rnd_CMFlare_Chaff_Magazine", [-1]]; + _Lheli addWeaponTurret ["CMFlareLauncher", [-1]]; + _Lheli addMagazineTurret ["60Rnd_CMFlare_Chaff_Magazine", [-1]]; +}; + +A3W_fnc_addMagazineTurretBaheli = { + private["_Baheli"]; + _Baheli = _this select 0; + _Baheli setVehicleAmmoDef 0; + _Baheli addMagazineTurret ["12Rnd_PG_missiles",[0]]; + _Baheli addMagazineTurret ["4Rnd_AAA_missiles",[0]]; + _Baheli addMagazineTurret ["1000Rnd_20mm_shells",[0]]; + _Baheli addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; +}; + +A3W_fnc_addMagazineTurretOaheli = { + private["_Oaheli"]; + _Oaheli = _this select 0; + _Oaheli setVehicleAmmoDef 0; + _Oaheli addMagazineTurret ["6Rnd_LG_scalpel",[0]]; + _Oaheli addMagazineTurret ["14Rnd_80mm_rockets",[0]]; + _Oaheli addMagazineTurret ["250Rnd_30mm_HE_shells",[0]]; + _Oaheli addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]]; + _Oaheli addMagazineTurret ["192Rnd_CMFlare_Chaff_Magazine",[-1]]; +}; + +if (isServer) exitWith {}; + +resupply_vehicles = [ + 'O_Heli_Transport_04_ammo_F', + 'I_Truck_02_ammo_F', + 'O_Truck_03_ammo_F', + 'B_Truck_01_ammo_F' +]; + +do_resupply = { + (_this select 3) execVM "addons\scripts\fn_resupplytruck.sqf"; +}; + + +#define VEHICLE_NAME(x) (getText ((configFile >> "CfgVehicles" >> (typeOf x)) >> "displayName")) + +uav_resupply_watch = { + diag_log format["%1 call uav_resupply_watch", _this]; + private["_uavCheck"]; + _uavCheck = { + private["_uav", "_action_id"]; + _uav = getConnectedUAV player; + (!(isNull _uav) && {(count(nearestObjects [getPos _uav, resupply_vehicles, 15]) > 0)}) + }; + + waitUntil { + waitUntil {sleep 3; (call _uavCheck)}; + private["_uav"]; + _uav = getConnectedUAV player; + _action_id = _uav addAction [ + format[" Resupply %1",VEHICLE_NAME(_uav)], + {_this call do_resupply;}, _uav, 15,false,true,"", "(isNil 'mutexScriptInProgress' || {not(mutexScriptInProgress)})" + ]; + waitUntil {sleep 3; not(call _uavCheck)}; + _uav removeAction _action_id; + sleep 3; + }; +}; + +static_weapon_resupply_watch = { + diag_log format["%1 call static_weapon_resupply_watch", _this]; + private["_staticCheck"]; + _staticCheck = { + private["_static"]; + _static = (vehicle player); + if (not(isNull _static) && { + _static isKindOf "StaticWeapon" && { + player == gunner(_static) && { + (count(nearestObjects [getPos _static, resupply_vehicles, 15]) > 0)}}}) exitWith { + _static + }; + nil + }; + + private["_static", "_action_id"]; + waitUntil { + waitUntil { sleep 3; _static = call _staticCheck; !isNil "_static"}; + _action_id = _static addAction [ + format[" Resupply %1",VEHICLE_NAME(_static)], + {_this call do_resupply;}, _static, 15,false,true,"", "(isNil 'mutexScriptInProgress' || {not(mutexScriptInProgress)})" + ]; + waitUntil { sleep 3; isNil {call _staticCheck}}; + _static removeAction _action_id; + sleep 3; + }; +}; + +vehicle_resupply_watch = { + diag_log format["%1 call vehicle_resupply_watch", _this]; + private["_vehicleCheck"]; + _vehicleCheck = { + private["_vehicle"]; + _vehicle = (vehicle player); + if !(!isNull _vehicle && { + player != _vehicle && { + player == driver(_vehicle) && { + not(_vehicle isKindOf "StaticWeapon") && { + (count(nearestObjects [getPos _vehicle, resupply_vehicles, 15]) > 0)}}}}) exitWith { + nil + }; + _vehicle + }; + + private["_vehicle", "_action_id"]; + waitUntil { + waitUntil { sleep 3; _vehicle = call _vehicleCheck; !isNil "_vehicle"}; + _action_id = _vehicle addAction [ + format[" Resupply %1",VEHICLE_NAME(_vehicle)], + {_this call do_resupply;}, _vehicle, 15,false,true,"", "(isNil 'mutexScriptInProgress' || {not(mutexScriptInProgress)})" + ]; + waitUntil { sleep 3; isNil {call _vehicleCheck}}; + _vehicle removeAction _action_id; + sleep 3; + }; +}; + +[] spawn uav_resupply_watch; +[] spawn static_weapon_resupply_watch; +[] spawn vehicle_resupply_watch; diff --git a/addons/scripts/servercredits.sqf b/addons/scripts/servercredits.sqf new file mode 100644 index 000000000..a7143e123 --- /dev/null +++ b/addons/scripts/servercredits.sqf @@ -0,0 +1,74 @@ +/* *********************************************************************** */ + +/* ======================================================================= +/* SCRIPT NAME: Server Intro Credits Script by IT07 +/* SCRIPT VERSION: v1.3.5 BETA +/* Credits for original script: Bohemia Interactive http://bistudio.com +/* ======================================================================= + +/* *********************************************************************** */ + +// ========== SCRIPT CONFIG ============ + +_onScreenTime = 10; //how long one role should stay on screen. Use value from 0 to 10 where 0 is almost instant transition to next role +//NOTE: Above value is not in seconds! + +// ==== HOW TO CUSTOMIZE THE CREDITS === +// If you want more or less credits on the screen, you have to add/remove roles. +// Watch out though, you need to make sure BOTH role lists match eachother in terms of amount. +// Just take a good look at the _role1 and the rest and you will see what I mean. + +// For further explanation of it all, I included some info in the code. + +// == HOW TO CUSTOMIZE THE COLOR OF CREDITS == +// Find line **** and look for: color='#f2cb0b' +// The numbers and letters between the 2 '' is the HTML color code for a certain yellow. +// If you want to change the color of the text, search on google for HTML color codes and pick the one your like. +// Then, replace the existing color code for the code you would like to use instead. Don't forget the # in front of it. +// HTML Color Codes Examples: +// #FFFFFF (white) +// #000000 (black) No idea why you would want black, but whatever +// #C80000 (red) +// #009FCF (light-blue) +// #31C300 (Razer Green) +// #FF8501 (orange) +// =========================================== + + +// SCRIPT START +//waitUntil {!isNil "dayz_animalCheck"}; +sleep 60; //Wait in seconds before the credits start after player IS ingame + +_role1 = "Welcome to"; +_role1names = ["A3Armory - A3Wasteland Altis"]; +_role2 = "Server restarts every 6 hours"; +_role2names = ["3, 9, 15, 21 EST"]; +_role3 = "Player stats, and support @"; +_role3names = ["A3Armory.com"]; +_role4 = "TS3 Server @"; +_role4names = ["TS.A3Armory.com"]; + +{ + sleep 2; + _memberFunction = _x select 0; + _memberNames = _x select 1; + _finalText = format ["%1
", _memberFunction]; + _finalText = _finalText + ""; + {_finalText = _finalText + format ["%1
", _x]} forEach _memberNames; + _finalText = _finalText + "
"; + _onScreenTime + (((count _memberNames) - 1) * 0.5); + [ + _finalText, + [safezoneX + safezoneW - 0.8,0.50], //DEFAULT: 0.5,0.35 + [safezoneY + safezoneH - 0.8,0.7], //DEFAULT: 0.8,0.7 + _onScreenTime, + 0.5 + ] spawn BIS_fnc_dynamicText; + sleep (_onScreenTime); +} forEach [ + //The list below should have exactly the same amount of roles as the list above + [_role1, _role1names], + [_role2, _role2names], + [_role3, _role3names], + [_role4, _role4names] //make SURE the last one here does NOT have a , at the end +]; diff --git a/addons/scripts/vehicleResave.sqf b/addons/scripts/vehicleResave.sqf new file mode 100644 index 000000000..f488899ff --- /dev/null +++ b/addons/scripts/vehicleResave.sqf @@ -0,0 +1,53 @@ +//@file Version: 1.0 +//@file Name: vehicleSave.sqf +//@file Author: MercyfulFate edited by Gigatek +//@file Created: 06/09/2014 +//@file Description: Save the nearest Vehicle + +#define DURATION 10 +#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" + +private ["_vehicle", "_checks", "_success", "_nearvehicle"]; +_nearvehicle = nearestObjects [player, ["LandVehicle", "Air", "Ship"], 7]; +_vehicle = _nearvehicle select 0; + +_checks = { + private ["_progress","_failed", "_text"]; + _progress = _this select 0; + _vehicle = _this select 1; + _text = ""; + _failed = true; + switch (true) do { + case (!alive player): {}; // player is dead, no need for a notification + case (vehicle player != player): {_text = "Save Failed! You can't do that in a vehicle."}; + case (((player distance _vehicle) - ((sizeOf typeOf _vehicle / 3) max 4)) > 2): {_text = "Save Failed! You are too far away from the vehicle."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_deplace_par", objNull])): { _text = "Save Failed! Somebody moved the vehicle."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_transporte_par", objNull])): { _text = "Save Failed! Somebody loaded or towed the vehicle."}; + case (!alive _vehicle): {_error = "The vehicle is too damaged to save."}; + case (doCancelAction): {_text = "Save Cancelled!"; doCancelAction = false;}; + default { + _text = format["Vehicle Save %1%2 Complete", round(100 * _progress), "%"]; + _failed = false; + }; + }; + [_failed, _text]; +}; + +_success = [DURATION, ANIMATION, _checks, [_vehicle]] call a3w_actions_start; + +if (isNil "_vehicle" || {typeName _vehicle != typeName objNull || {isNull _vehicle}}) exitWith { + diag_log "No vehicle near to save."; + false +}; + +if (_success) then { + [[netId _vehicle, 1], "A3W_fnc_setLockState", _vehicle] call A3W_fnc_MP; // Unlock + _vehicle setVariable ["A3W_purchasedVehicle", true, true]; + _vehicle setVariable ["A3W_missionVehicle", false, false]; + _vehicle setVariable ["ownerUID", getPlayerUID player, true]; + _vehicle setVariable ["ownerN", name player, true]; + _vehicle setVariable ["baseSaving_spawningTime", nil, true]; + _vehicle setVariable ["baseSaving_hoursAlive", nil, true]; + titleText ["Vehicle Save Complete!","PLAIN DOWN"]; titleFadeOut 5; +}; +_success; \ No newline at end of file diff --git a/addons/scripts/vehicleSave.sqf b/addons/scripts/vehicleSave.sqf new file mode 100644 index 000000000..febc0f2a1 --- /dev/null +++ b/addons/scripts/vehicleSave.sqf @@ -0,0 +1,53 @@ +//@file Version: 1.0 +//@file Name: vehicleSave.sqf +//@file Author: MercyfulFate edited by Gigatek +//@file Created: 06/09/2014 +//@file Description: Save the nearest Vehicle + +#define DURATION 40 +#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" + +private ["_vehicle", "_checks", "_success", "_nearvehicle"]; +_nearvehicle = nearestObjects [player, ["LandVehicle", "Air", "Ship"], 7]; +_vehicle = _nearvehicle select 0; + +_checks = { + private ["_progress","_failed", "_text"]; + _progress = _this select 0; + _vehicle = _this select 1; + _text = ""; + _failed = true; + switch (true) do { + case (!alive player): {}; // player is dead, no need for a notification + case (vehicle player != player): {_text = "Save Failed! You can't do that in a vehicle."}; + case (((player distance _vehicle) - ((sizeOf typeOf _vehicle / 3) max 4)) > 2): {_text = "Save Failed! You are too far away from the vehicle."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_deplace_par", objNull])): { _text = "Save Failed! Somebody moved the vehicle."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_transporte_par", objNull])): { _text = "Save Failed! Somebody loaded or towed the vehicle."}; + case (!alive _vehicle): {_error = "The vehicle is too damaged to save."}; + case (doCancelAction): {_text = "Save Cancelled!"; doCancelAction = false;}; + default { + _text = format["Vehicle Save %1%2 Complete", round(100 * _progress), "%"]; + _failed = false; + }; + }; + [_failed, _text]; +}; + +_success = [DURATION, ANIMATION, _checks, [_vehicle]] call a3w_actions_start; + +if (isNil "_vehicle" || {typeName _vehicle != typeName objNull || {isNull _vehicle}}) exitWith { + diag_log "No vehicle near to save."; + false +}; + +if (_success) then { + [[netId _vehicle, 1], "A3W_fnc_setLockState", _vehicle] call A3W_fnc_MP; // Unlock + _vehicle setVariable ["A3W_purchasedVehicle", true, true]; + _vehicle setVariable ["A3W_missionVehicle", false, false]; + _vehicle setVariable ["ownerUID", getPlayerUID player, true]; + _vehicle setVariable ["ownerN", name player, true]; + _vehicle setVariable ["baseSaving_spawningTime", nil, true]; + _vehicle setVariable ["baseSaving_hoursAlive", nil, true]; + titleText ["Vehicle Save Complete!","PLAIN DOWN"]; titleFadeOut 5; +}; +_success; \ No newline at end of file diff --git a/addons/scripts/weaponResave.sqf b/addons/scripts/weaponResave.sqf new file mode 100644 index 000000000..75ffda0d9 --- /dev/null +++ b/addons/scripts/weaponResave.sqf @@ -0,0 +1,53 @@ +//@file Version: 1.0 +//@file Name: vehicleSave.sqf +//@file Author: MercyfulFate edited by Gigatek +//@file Created: 06/09/2014 +//@file Description: Save the nearest Vehicle + +#define DURATION 10 +#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" + +private ["_vehicle", "_checks", "_success", "_nearvehicle"]; +_nearvehicle = nearestObjects [player, ["LandVehicle", "Air", "Ship"], 7]; +_vehicle = _nearvehicle select 0; + +_checks = { + private ["_progress","_failed", "_text"]; + _progress = _this select 0; + _vehicle = _this select 1; + _text = ""; + _failed = true; + switch (true) do { + case (!alive player): {}; // player is dead, no need for a notification + case (vehicle player != player): {_text = "Save Failed! You can't do that in a vehicle."}; + case (((player distance _vehicle) - ((sizeOf typeOf _vehicle / 3) max 4)) > 2): {_text = "Save Failed! You are too far away from the weapon."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_deplace_par", objNull])): { _text = "Save Failed! Somebody moved the weapon."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_transporte_par", objNull])): { _text = "Save Failed! Somebody loaded the weapon."}; + case (!alive _vehicle): {_error = "The weapon is too damaged to save."}; + case (doCancelAction): {_text = "Saving Cancelled!"; doCancelAction = false;}; + default { + _text = format["Weapon Save %1%2 Complete", round(100 * _progress), "%"]; + _failed = false; + }; + }; + [_failed, _text]; +}; + +_success = [DURATION, ANIMATION, _checks, [_vehicle]] call a3w_actions_start; + +if (isNil "_vehicle" || {typeName _vehicle != typeName objNull || {isNull _vehicle}}) exitWith { + diag_log "No weapon near to save."; + false +}; + +if (_success) then { + [[netId _vehicle, 1], "A3W_fnc_setLockState", _vehicle] call A3W_fnc_MP; // Unlock + _vehicle setVariable ["A3W_purchasedVehicle", true, true]; + _vehicle setVariable ["A3W_missionVehicle", false, false]; + _vehicle setVariable ["ownerUID", getPlayerUID player, true]; + _vehicle setVariable ["ownerN", name player, true]; + _vehicle setVariable ["baseSaving_spawningTime", nil, true]; + _vehicle setVariable ["baseSaving_hoursAlive", nil, true]; + titleText ["Weapon Save Complete!","PLAIN DOWN"]; titleFadeOut 5; +}; +_success; \ No newline at end of file diff --git a/addons/scripts/weaponSave.sqf b/addons/scripts/weaponSave.sqf new file mode 100644 index 000000000..a72d03a9e --- /dev/null +++ b/addons/scripts/weaponSave.sqf @@ -0,0 +1,53 @@ +//@file Version: 1.0 +//@file Name: vehicleSave.sqf +//@file Author: MercyfulFate edited by Gigatek +//@file Created: 06/09/2014 +//@file Description: Save the nearest Vehicle + +#define DURATION 40 +#define ANIMATION "AinvPknlMstpSlayWrflDnon_medic" + +private ["_vehicle", "_checks", "_success", "_nearvehicle"]; +_nearvehicle = nearestObjects [player, ["LandVehicle", "Air", "Ship"], 7]; +_vehicle = _nearvehicle select 0; + +_checks = { + private ["_progress","_failed", "_text"]; + _progress = _this select 0; + _vehicle = _this select 1; + _text = ""; + _failed = true; + switch (true) do { + case (!alive player): {}; // player is dead, no need for a notification + case (vehicle player != player): {_text = "Save Failed! You can't do that in a vehicle."}; + case (((player distance _vehicle) - ((sizeOf typeOf _vehicle / 3) max 4)) > 2): {_text = "Save Failed! You are too far away from the weapon."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_deplace_par", objNull])): { _text = "Save Failed! Somebody moved the weapon."}; + case (!isNull (_vehicle getVariable ["R3F_LOG_est_transporte_par", objNull])): { _text = "Save Failed! Somebody loaded the weapon."}; + case (!alive _vehicle): {_error = "The weapon is too damaged to save."}; + case (doCancelAction): {_text = "Saving Cancelled!"; doCancelAction = false;}; + default { + _text = format["Weapon Save %1%2 Complete", round(100 * _progress), "%"]; + _failed = false; + }; + }; + [_failed, _text]; +}; + +_success = [DURATION, ANIMATION, _checks, [_vehicle]] call a3w_actions_start; + +if (isNil "_vehicle" || {typeName _vehicle != typeName objNull || {isNull _vehicle}}) exitWith { + diag_log "No weapon near to save."; + false +}; + +if (_success) then { + [[netId _vehicle, 1], "A3W_fnc_setLockState", _vehicle] call A3W_fnc_MP; // Unlock + _vehicle setVariable ["A3W_purchasedVehicle", true, true]; + _vehicle setVariable ["A3W_missionVehicle", false, false]; + _vehicle setVariable ["ownerUID", getPlayerUID player, true]; + _vehicle setVariable ["ownerN", name player, true]; + _vehicle setVariable ["baseSaving_spawningTime", nil, true]; + _vehicle setVariable ["baseSaving_hoursAlive", nil, true]; + titleText ["Weapon Save Complete!","PLAIN DOWN"]; titleFadeOut 5; +}; +_success; \ No newline at end of file diff --git a/addons/scripts/zlt_fastrope.sqf b/addons/scripts/zlt_fastrope.sqf new file mode 100644 index 000000000..3fa3b6d76 --- /dev/null +++ b/addons/scripts/zlt_fastrope.sqf @@ -0,0 +1,202 @@ +// v1g Fast Rope by [STELS]Zealot + +#define MAX_SPEED_WHILE_FASTROPING 10 +#define MAX_SPEED_ROPES_AVAIL 30 + + +#define STR_TOSS_ROPES "Toss Ropes" +#define STR_FAST_ROPE "Fast Rope" +#define STR_CUT_ROPES "Cut Ropes" + + +if (isdedicated) exitwith {}; +waituntil {player == player}; + +zlt_rope_ropes = []; +zlt_mutexAction = false; + +zlt_rope_helis = ["O_Heli_Light_02_unarmed_F","O_Heli_Light_02_F","O_Heli_Light_02_v2_F","B_Heli_Transport_01_F","B_Heli_Transport_01_camo_F","O_Heli_Attack_02_F","O_Heli_Attack_02_black_F","I_Heli_Transport_02_F","B_Heli_Light_01_F"]; +zlt_rope_helidata = +[ + [ + ["O_Heli_Light_02_unarmed_F", "O_Heli_Light_02_F", "O_Heli_Light_02_v2_F"], + [1.35,1.35,-24.95], + [-1.45,1.35,-24.95] + ], + [ + ["B_Heli_Transport_01_F", "B_Heli_Transport_01_camo_F"], + [-1.11,2.5,-24.7], + [1.11,2.5,-24.7] + ], + [ + ["O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F"], + [1.3,1.3,-25], + [-1.3,1.3,-25] + ], + [ + ["I_Heli_Transport_02_F"], + [0,-5,-26], + [] + ], + [ + ["B_Heli_Light_01_F"], + [0.6,0.5,-25.9], + [-0.8,0.5,-25.9] + ] +]; + + +zlt_fnc_tossropes = { + private ["_heli","_ropes","_oropes","_rope"]; + _heli = _this; + _ropes = []; + _oropes = _heli getvariable ["zlt_ropes",[]]; + if (count _oropes != 0 ) exitwith {}; + _i = 0; + { + if ((typeof _heli) in (_x select 0)) exitwith { + _ropes = _ropes + [_x select 1]; + if ( count (_x select 2) !=0 ) then { + _ropes = _ropes + [_x select 2]; + }; + }; + _i = _i +1; + } foreach zlt_rope_helidata; + + sleep random 0.3; + if ( count (_heli getvariable ["zlt_ropes",[]]) != 0 ) exitwith { zlt_mutexAction = false; }; + _heli animateDoor ['door_R', 1]; + _heli animateDoor ['door_L', 1]; + { + _rope = createVehicle ["land_rope_f", [0,0,0], [], 0, "CAN_COLLIDE"]; + _rope setdir (getdir _heli); + _rope attachto [_heli, _x]; + _oropes = _oropes + [_rope]; + } foreach _ropes; + _heli setvariable ["zlt_ropes",_oropes,true]; + + _heli spawn { + private ["_heli","_ropes"]; + _heli = _this; + while {alive _heli and count (_heli getvariable ["zlt_ropes", []]) != 0 and abs (speed _heli) < MAX_SPEED_ROPES_AVAIL } do { + sleep 0.3; + }; + _ropes = (_heli getvariable ["zlt_ropes", []]); + {deletevehicle _x} foreach _ropes; + _heli setvariable ["zlt_ropes", [], true]; + }; + +}; + +zlt_fnc_ropes_cond = { + _veh = vehicle player; + _flag = (_veh != player) and {(not zlt_mutexAction)} and {count (_veh getvariable ["zlt_ropes", []]) == 0} and { (typeof _veh) in zlt_rope_helis } and {alive player and alive _veh and (abs (speed _veh) < MAX_SPEED_ROPES_AVAIL ) }; + _flag; + +}; + +zlt_fnc_fastropeaiunits = { + private ["_heli","_grunits"]; + _heli = _this select 0; + _grunits = _this select 1; + + dostop (driver _heli ); + (driver _heli) setBehaviour "Careless"; + (driver _heli) setCombatMode "Blue"; + + _heli spawn zlt_fnc_tossropes; + + [_heli, _grunits] spawn { + private ["_units","_heli"]; + sleep random 0.5; + _units = _this select 1; + _heli = (_this select 0); + _units = _units - [player]; + _units = _units - [driver _heli]; + {if (!alive _x or isplayer _x or vehicle _x != _heli) then {_units = _units - [_x];}; } foreach _units; + + { sleep (0.5 + random 0.7); _x spawn zlt_fnc_fastropeUnit; } foreach _units; + waituntil {sleep 0.5; { (getpos _x select 2) < 1 } count _units == count _units; }; + sleep 10; + (driver _heli) doFollow (leader group (driver _heli )); + (driver _heli) setBehaviour "Aware"; + (driver _heli) setCombatMode "White"; + _heli call zlt_fnc_cutropes; + + }; +}; + + +zlt_fnc_fastrope = { + zlt_mutexAction = true; + sleep random 0.3; + if (player == leader group player) then { + [vehicle player, units group player] call zlt_fnc_fastropeaiunits; + }; + player call zlt_fnc_fastropeUnit; + zlt_mutexAction = false; +}; + +zlt_fnc_fastropeUnit = { + private ["_unit","_heli","_ropes","_rope","_zmax","_zdelta","_zc"]; + _unit = _this; + _heli = vehicle _unit; + if (_unit == _heli) exitWith {}; + + _ropes = (_heli getvariable ["zlt_ropes", []]); + if (count _ropes == 0) exitwith {}; + + _rope = _ropes call BIS_fnc_selectRandom; + _zmax = 22; + _zdelta = 7 / 10 ; + + _zc = _zmax; + _unit action ["eject", _heli]; + _unit switchmove "gunner_standup01"; + + _unit setpos [(getpos _unit select 0), (getpos _unit select 1), 0 max ((getpos _unit select 2) - 3)]; + while {alive _unit and (getpos _unit select 2) > 1 and (abs (speed _heli)) < MAX_SPEED_WHILE_FASTROPING and _zc > -24} do { + _unit attachTo [_rope, [0,0,_zc]]; + _zc = _zc - _zdelta; + sleep 0.1; + }; + _unit switchmove ""; + detach _unit; + +}; + + +zlt_fnc_cutropes = { + _veh = _this; + _ropes = (_veh getvariable ["zlt_ropes", []]); + {deletevehicle _x} foreach _ropes; + _veh setvariable ["zlt_ropes", [], true]; + _veh animateDoor ['door_R', 0]; + _veh animateDoor ['door_L', 0]; + +}; + +zlt_fnc_removeropes = { + (vehicle player) call zlt_fnc_cutropes; +}; + +zlt_fnc_createropes = { + zlt_mutexAction = true; + (vehicle player) call zlt_fnc_tossropes; + zlt_mutexAction = false; +}; + + + +player createDiarySubject [STR_SCRIPTS_NAME,STR_SCRIPTS_NAME]; +player createDiaryRecord [STR_SCRIPTS_NAME,[STR_SCRIPT_NAME, STR_HELP]]; + +player addAction[""+STR_TOSS_ROPES+"", zlt_fnc_createropes, [], -1, false, false, '','[] call zlt_fnc_ropes_cond']; +player addAction[""+STR_CUT_ROPES+"", zlt_fnc_removeropes, [], -1, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0']; +player addAction[""+STR_FAST_ROPE+"", zlt_fnc_fastrope, [], 15, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0 and player != driver vehicle player']; + +player addEventHandler ["Respawn", { + player addAction[""+STR_TOSS_ROPES+"", zlt_fnc_createropes, [], -1, false, false, '','[] call zlt_fnc_ropes_cond']; + player addAction[""+STR_CUT_ROPES+"", zlt_fnc_removeropes, [], -1, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0']; + player addAction[""+STR_FAST_ROPE+"", zlt_fnc_fastrope, [], 15, false, false, '','not zlt_mutexAction and count ((vehicle player) getvariable ["zlt_ropes", []]) != 0 and player != driver vehicle player']; +}]; diff --git a/addons/spawn/functions.sqf b/addons/spawn/functions.sqf new file mode 100644 index 000000000..1a881e879 --- /dev/null +++ b/addons/spawn/functions.sqf @@ -0,0 +1,55 @@ +if (isServer) then { + A3W_fnc_hideObjectGlobal = { + //diag_log format["%1 call A3W_fnc_hideObjectGlobal", _this]; + private["_left", "_right"]; + _left = _this select 0; + _right = _this select 1; + if (isNil "_left" || {typeName _left != typeName objNull || {isNull _left}}) exitWith {}; + if (isNil "_right" || {typeName _right != typeName false}) exitWith {}; + + _left hideObjectGlobal _right; + } call mf_compile; + + spawn_addon_setup_complete = true; + publicVariable "spawn_addon_setup_complete"; +}; + +if (!isServer) then { + A3W_fnc_hideSpawning = { + //diag_log format["%1 call A3W_fnc_hideSpawning", _this]; + + private["_player", "_pos1", "_pos2"]; + _player = _this select 0; + if (isNil "_player" || {isNull _player || {!(alive _player)}}) exitWith {}; + _pos1 = getPos _player; + enableEnvironment false; + 0 fadeSound 0; + + _player hideObjectGlobal true; + [[_player,true], "A3W_fnc_hideObjectGlobal",false, false] call BIS_fnc_MP; + + _player allowDamage false; + + private["_respawn_dialog"]; + waitUntil { + if (isNil "_player" || {isNull _player}) exitWith {true}; + _pos2 = getPos _player; + if ((_pos1 distance _pos2) > 50) exitWith { + [[_player,false], "A3W_fnc_hideObjectGlobal",false, false] call BIS_fnc_MP; + _player hideObjectGlobal false; + _player allowDamage true; + enableEnvironment true; + 0 fadeSound 1; + true + }; + + false + }; + } call mf_compile; + + waitUntil {!isNull player}; + waitUntil {!isNil "spawn_addon_setup_complete"}; + + player addEventHandler ["Respawn", { [(_this select 0)] spawn A3W_fnc_hideSpawning; }]; + [player] spawn A3W_fnc_hideSpawning; +}; diff --git a/addons/storage/config.sqf b/addons/storage/config.sqf new file mode 100644 index 000000000..b1239002d --- /dev/null +++ b/addons/storage/config.sqf @@ -0,0 +1,22 @@ + +//List of cities where private storage boxes are available (empty or unset means all cities) +ps_cities_whitelist = []; + +//List of models to use for private storage boxes (must have at least one) +ps_box_models = ["Land_PaperBox_open_full_F", "Land_Pallet_MilBoxes_F", "Land_PaperBox_open_empty_F", "Land_PaperBox_closed_F"]; + +//whether or not to show map markers for private storage boxes +ps_markers_enabled = true; + +//shape, type, color, size, text (for map markers, if enabled) +ps_markers_properties = ["ICON", "mil_dot", "ColorUNKNOWN", [1.2,1.2], "Storage"]; + + +//Arma 3 Storage container class (see list below) +/* + * Supply0, Supply1, Supply2, Supply3, Supply4, Supply5, Supply6, Supply7, Supply8, Supply9, Supply10, Supply20 + * Supply30, Supply40, Supply50, Supply60, Supply70, Supply80, Supply90, Supply100, Supply110, Supply120, Supply130 + * Supply140, Supply150, Supply160, Supply170, Supply180, Supply190, Supply200, Supply210, Supply220, Supply230, Supply240 + * Supply250, Supply300, Supply350, Supply380, Supply400, Supply420, Supply440, Supply450, Supply480, Supply500 + */ +ps_container_class = "Supply500"; \ No newline at end of file diff --git a/addons/storage/functions.sqf b/addons/storage/functions.sqf new file mode 100644 index 000000000..a81e2a46f --- /dev/null +++ b/addons/storage/functions.sqf @@ -0,0 +1,2 @@ +call compile preprocessFileLineNumbers "addons\storage\config.sqf"; +call compile preprocessFileLineNumbers "addons\storage\ps_functions.sqf"; diff --git a/addons/storage/futura.h b/addons/storage/futura.h new file mode 100644 index 000000000..463b78cb7 --- /dev/null +++ b/addons/storage/futura.h @@ -0,0 +1,90 @@ +// Futura ui +#define IDD_FUTURAGEAR 602 +// FUTURA GEAR controls +#define IDC_FG_PRIMARY 610 +#define IDC_FG_SECONDARY 611 +#define IDC_FG_HANDGUN 612 + +// prefix 620 means slot items +//--- +#define IDC_FG_MAP 6211 +#define IDC_FG_COMPASS 6212 +#define IDC_FG_WATCH 6213 +#define IDC_FG_RADIO 6214 +#define IDC_FG_GPS 6215 + +#define IDC_FG_GOGGLES 6216 +#define IDC_FG_HMD 6217 +#define IDC_FG_BINOC 6238 + +#define IDC_FG_BACKPACK2 6239 +#define IDC_FG_HEADGEAR 6240 + +// prefix 630 means slot container items(uniform, vest, backpack) +#define IDC_FG_UNIFORM_SLOT 6301 +#define IDC_FG_VEST_SLOT 6302 +#define IDC_FG_BACKPACK_SLOT 6303 +/// containers load +#define IDC_FG_UNIFORM_LOAD 6304 +#define IDC_FG_VEST_LOAD 6305 +#define IDC_FG_BACKPACK_LOAD 6306 +#define IDC_FG_GROUND_LOAD 6307 +#define IDC_FG_TOTAL_LOAD 6308 +//--- +#define IDC_FG_MAGAZINES 618 +// primary +#define IDC_FG_PW_MUZZLE 620 +#define IDC_FG_PW_OPTICS 621 +#define IDC_FG_PW_FLASHLIGHT 622 +#define IDC_FG_PW_MAGAZINE 623 +// secondary +#define IDC_FG_SW_MUZZLE 624 +#define IDC_FG_SW_OPTICS 625 +#define IDC_FG_SW_FLASHLIGHT 626 +#define IDC_FG_SW_MAGAZINE 627 +// handgun +#define IDC_FG_HG_MUZZLE 628 +#define IDC_FG_HG_OPTICS 629 +#define IDC_FG_HG_FLASHLIGHT 630 +#define IDC_FG_HG_MAGAZINE 631 + +#define IDC_FG_GROUND_ITEMS 632 +#define IDC_FG_CHOSEN_CONTAINER 640 +// #define IDC_FG_BACKPACK_ITEMS 633 +// #define IDC_FG_ITEMS 619 + +// new inventory + +// filter +#define IDC_FG_GROUND_FILTER 6554 + +// images which will painted over containers during DnD state +#define IDC_FG_GROUND_MARKER 6385 +#define IDC_FG_CONTAINER_MARKER 6325 +#define IDC_FG_CHOSEN_MARKER 6405 + +#define IDC_FG_VEST_CONTAINER 638 +#define IDC_FG_UNIFORM_CONTAINER 633 +#define IDC_FG_BACKPACK_CONTAINER 619 + +#define IDC_FG_VEST_TAB 6381 +#define IDC_FG_VEST_TEXT 6382 +#define IDC_FG_UNIFORM_TAB 6331 +#define IDC_FG_UNIFORM_TEXT 6332 +#define IDC_FG_BACKPACK_TAB 6191 +#define IDC_FG_BACKPACK_TEXT 6192 + +#define IDC_FG_CHOSEN_TAB 6401 +#define IDC_FG_CHOSEN_TEXT 6402 +#define IDC_FG_GROUND_TAB 6321 +#define IDC_FG_GROUND_TEXT 6322 +/////////////// + +/// weight info +#define IDC_FG_GROUND_WEIGHT 634 +#define IDC_FG_BACKPACK_WEIGHT 635 +#define IDC_FG_ITEMS_WEIGHT 636 + +/// player info +#define IDC_FG_TOTAL_WEIGHT 637 +////// \ No newline at end of file diff --git a/addons/storage/icons/storage.paa b/addons/storage/icons/storage.paa new file mode 100644 index 000000000..5db5180c4 Binary files /dev/null and b/addons/storage/icons/storage.paa differ diff --git a/addons/storage/macro.h b/addons/storage/macro.h new file mode 100644 index 000000000..39b52e5ef --- /dev/null +++ b/addons/storage/macro.h @@ -0,0 +1,146 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} \ No newline at end of file diff --git a/addons/storage/ps_functions.sqf b/addons/storage/ps_functions.sqf new file mode 100644 index 000000000..e3c52cb27 --- /dev/null +++ b/addons/storage/ps_functions.sqf @@ -0,0 +1,273 @@ +if (!isNil "storage_functions_defined") exitWith {}; +diag_log format["Loading storage functions ..."]; + +#include "macro.h" +#include "futura.h" + +ps_marker_create = { + ARGVX3(0,_name,""); + ARGVX3(1,_location,[]); + ARGVX3(2,_this,[]); + + ARGVX3(0,_shape,""); + ARGVX3(1,_type,""); + ARGVX3(2,_color,""); + ARGVX3(3,_size,[]); + ARGVX3(4,_text,""); + + private["_marker"]; + _marker = createMarker [_name,_location]; + + _marker setMarkerShapeLocal _shape; + _marker setMarkerTypeLocal _type; + _marker setMarkerColorLocal _color; + _marker setMarkerSizeLocal _size; + //_marker setMarkerTextLocal _text; + (_marker) +}; + +ps_get_all_cities = { + if (isARRAY(ps_all_cities)) exitWith {ps_get_all_cities}; + ps_get_all_cities = (nearestLocations [[0,0,0],["NameCityCapital","NameCity","NameVillage"],1000000]); + (ps_get_all_cities) +}; + + +ps_create_boxes = { + def(_town); + def(_town_pos); + def(_town_name); + def(_garage); + def(_box); + def(_model); + def(_pos); + def(_name); + def(_marker); + init(_i,0); + + + {if (true) then { + _town = _x; + _town_name = text(_town); + _town_pos = position _town; + if (isARRAY(ps_cities_whitelist) && {count(ps_cities_whitelist) > 0 && {not(_town_name in ps_cities_whitelist)}}) exitWith {}; + + _garage = (nearestObjects [_town_pos, ["Land_i_Garage_V2_F", "Sign_Arrow_Yellow_F"], 300]) select 0; + if (!isOBJECT(_garage)) exitWith { + diag_log format["No garage in %1", _town_name]; + }; + + _name = format["storage_box_%1", _i]; + _i = _i + 1; + + + _pos = _garage modelToWorld [0,0,0]; + if (_garage isKindOf "Helper_Base_F") then { + _pos set [2,0]; + }; + + _model = ps_box_models call BIS_fnc_selectRandom; + + _box = createVehicle [_model, _pos, [], 0, ""]; + _box setPos _pos; + _box setVectorDirAndUp [vectorDir _garage, vectorUp _garage]; + _box allowDamage false; + //_box enableSimulation false; + _box setVariable ["is_storage", true, true]; + _box setVariable ["R3F_LOG_disabled", true]; //don't allow players to move the boxes + + if (ps_markers_enabled) then { + _marker = [_name, _pos, ps_markers_properties] call ps_marker_create; + }; + + diag_log format["Creating Storage at: %1 (%2)", _town_name, _pos]; + }} foreach (call ps_get_all_cities); +}; + + + +ps_inventory_ui_mod = { + ARGVX3(0,_box,objNull); + + disableSerialization; + waitUntil {!(isNull (findDisplay IDD_FUTURAGEAR))}; + def(_display); + _display = findDisplay IDD_FUTURAGEAR; + + + def(_outside); + _outside = [-1,-1,0.1,0.1]; + + def(_filter); + _filter = _display displayCtrl IDC_FG_GROUND_FILTER; + + def(_pos); + def(_ground_tab); + _ground_tab = _display displayCtrl IDC_FG_GROUND_TAB; + _pos = (ctrlPosition _ground_tab); + _ground_tab ctrlSetPosition _outside; + _ground_tab ctrlCommit 0; + + def(_custom_text); + _custom_text = _display ctrlCreate ["RscText", -1]; + _pos set [2, (ctrlPosition _filter) select 2]; + _custom_text ctrlSetPosition _pos; + _custom_text ctrlSetText "Private Storage"; + _custom_text ctrlSetBackgroundColor [0,0,0,1]; + _custom_text ctrlSetTextColor [1,1,1,1]; + _custom_text ctrlSetActiveColor [1,1,1,1]; + _custom_text ctrlSetTooltip "This storage is visible to you only.
It's automatically saved in the database,
and can be accessed across maps."; + _custom_text ctrlCommit 0; + + def(_chosen_tab); + _chosen_tab = _display displayCtrl IDC_FG_CHOSEN_TAB; + _chosen_tab ctrlSetPosition _outside; + _chosen_tab ctrlCommit 0; + + + waitUntil { + isNull (findDisplay IDD_FUTURAGEAR) + }; + + + [player, _box] call p_saveStorage; + deleteVehicle _box; +}; + +ps_access = { + private["_box"]; + _box = [player, ps_container_class] call p_recreateStorageBox; + + if (isNil "_box") exitWith { + player commandChat "ERROR: Could not access private storage, please report this error to A3Armory.com."; + }; + + _box attachTo [player, [0,0,3]]; + + + player removeAllEventHandlers "InventoryOpened"; + player addEventHandler ["InventoryOpened", { + if (((_this select 1) getVariable ["is_storage_box", false])) exitWith { + true + }; + false + }]; + + player action ["Gear", _box]; + player removeAllEventHandlers "InventoryOpened"; + [_box] spawn ps_inventory_ui_mod; +}; + +ps_cameraDir = { + ([(positionCameraToWorld [0,0,0]), (positionCameraToWorld [0,0,1])] call BIS_fnc_vectorDiff) +}; + +ps_is_object_storage = { + ARGVX4(0,_obj,objNull,false); + (_obj getVariable ["is_storage", false]) +}; + +ps_is_player_near = { + private["_pos1", "_pos2"]; + _pos1 = (eyePos player); + _pos2 = ([_pos1, call ps_cameraDir] call BIS_fnc_vectorAdd); + + private["_objects"]; + _objects = lineIntersectsWith [_pos1,_pos2,objNull,objNull,true]; + if (isNil "_objects" || {typeName _objects != typeName []}) exitWith {false}; + + + private["_found"]; + _found = false; + { + if ([_x] call ps_is_object_storage) exitWith { + _found = true; + }; + } forEach _objects ; + + (_found) +}; + +ps_actions = OR(ps_actions,[]); + +ps_remove_actions = { + if (count ps_actions == 0) exitWith {}; + + { + private["_action_id"]; + _action_id = _x; + player removeAction _action_id; + } forEach ps_actions; + ps_actions = []; +}; + +ps_add_actions = { + if (count ps_actions > 0) exitWith {}; + private["_player"]; + _player = _this select 0; + + private["_action_id", "_text"]; + _action_id = _player addAction [" Access Storage", {call ps_access}]; + ps_actions = ps_actions + [_action_id]; +}; + +ps_check_actions = { + private["_player"]; + _player = player; + private["_vehicle", "_in_vehicle"]; + _vehicle = (vehicle _player); + _in_vehicle = (_vehicle != _player); + + if (not(_in_vehicle || {not(alive _player) || {not(call ps_is_player_near)}})) exitWith { + [_player] call ps_add_actions; + }; + + [_player] call ps_remove_actions; +}; + +//this is a hack so that markers sync for JIP (Join in Progress) players +ps_sync_markers = { + { + _x setMarkerColor markerColor _x ; + } forEach allMapMarkers; +}; + + +ps_client_loop_stop = false; +ps_client_loop = { + if (not(isClient)) exitWith {}; + private ["_ps_client_loop_i"]; + _ps_client_loop_i = 0; + + while {_ps_client_loop_i < 5000 && not(ps_client_loop_stop)} do { + call ps_check_actions; + sleep 0.5; + _ps_client_loop_i = _ps_client_loop_i + 1; + }; + [] spawn ps_client_loop; +}; + + +ps_setup_boxes = { + if (isServer) then { + diag_log format["Setting up storage boxes ... "]; + [] call ps_create_boxes; + ps_setup_boxes_complete = true; + publicVariable "ps_setup_boxes_complete"; + diag_log format["Setting up storage boxes complete"]; + + ["ps_sync_markers", "onPlayerConnected", { [] spawn ps_sync_markers}] call BIS_fnc_addStackedEventHandler; + }; + + if (isClient) then { + diag_log format["Waiting for storage boxes setup to complete ..."]; + waitUntil {not(isNil "ps_setup_boxes_complete")}; + diag_log format["Waiting for storage boxes setup to complete ... done"]; + }; +}; + +[] call ps_setup_boxes; +[] spawn ps_client_loop; + +storage_functions_defined = true; +diag_log format["Loading storage functions complete"]; \ No newline at end of file diff --git a/addons/taw_vd/CfgFunctions.hpp b/addons/taw_vd/CfgFunctions.hpp new file mode 100644 index 000000000..4fa30e8e2 --- /dev/null +++ b/addons/taw_vd/CfgFunctions.hpp @@ -0,0 +1,14 @@ +class TAWVD +{ + tag = "TAWVD"; + class TAW_VD + { + file = "addons\taw_vd"; + class onSliderChange {}; + class onTerrainChange {}; + class updateViewDistance {}; + class openTAWVD {}; + class trackViewDistance {}; + class tawvdInit {postInit = 1;}; + }; +}; \ No newline at end of file diff --git a/addons/taw_vd/dialog.hpp b/addons/taw_vd/dialog.hpp new file mode 100644 index 000000000..d2b780202 --- /dev/null +++ b/addons/taw_vd/dialog.hpp @@ -0,0 +1,508 @@ +/* + ArmA 3 TAW View Distance Management +*/ +#define ST_LEFT 0x00 +#define ST_MULTI 0x10 +#define GUI_GRID_CENTER_WAbs ((safezoneW / safezoneH) min 1.2) +#define GUI_GRID_CENTER_HAbs (GUI_GRID_CENTER_WAbs / 1.2) +#define GUI_GRID_CENTER_W (GUI_GRID_CENTER_WAbs / 40) +#define GUI_GRID_CENTER_H (GUI_GRID_CENTER_HAbs / 25) +#define GUI_GRID_CENTER_X (safezoneX + (safezoneW - GUI_GRID_CENTER_WAbs)/2) +#define GUI_GRID_CENTER_Y (safezoneY + (safezoneH - GUI_GRID_CENTER_HAbs)/2) + +class TAWVD_Checkbox +{ + access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified) + idc = -1; // Control identification (without it, the control won't be displayed) + type = 77; // Type + style = ST_LEFT + ST_MULTI; // Style + default = 0; // Control selected by default (only one within a display can be used) + blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect. + + x = 0; + y = 0; + w = 1 * GUI_GRID_CENTER_W; // Width + h = 1 * GUI_GRID_CENTER_H; // Height + + //Colors + color[] = { 1, 1, 1, 0.7 }; // Texture color + colorFocused[] = { 1, 1, 1, 1 }; // Focused texture color + colorHover[] = { 1, 1, 1, 1 }; // Mouse over texture color + colorPressed[] = { 1, 1, 1, 1 }; // Mouse pressed texture color + colorDisabled[] = { 1, 1, 1, 0.2 }; // Disabled texture color + + //Background colors + colorBackground[] = { 0, 0, 0, 0 }; // Fill color + colorBackgroundFocused[] = { 0, 0, 0, 0 }; // Focused fill color + colorBackgroundHover[] = { 0, 0, 0, 0 }; // Mouse hover fill color + colorBackgroundPressed[] = { 0, 0, 0, 0 }; // Mouse pressed fill color + colorBackgroundDisabled[] = { 0, 0, 0, 0 }; // Disabled fill color + + //Textures + textureChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; //Texture of checked CheckBox. + textureUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked CheckBox. + textureFocusedChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; //Texture of checked focused CheckBox (Could be used for showing different texture when focused). + textureFocusedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; //Texture of unchecked focused CheckBox. + textureHoverChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; + textureHoverUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; + texturePressedChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; + texturePressedUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; + textureDisabledChecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; + textureDisabledUnchecked = "\A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; + + tooltip = ""; // Tooltip text + tooltipColorShade[] = { 0, 0, 0, 1 }; // Tooltip background color + tooltipColorText[] = { 1, 1, 1, 1 }; // Tooltip text color + tooltipColorBox[] = { 1, 1, 1, 1 }; // Tooltip frame color + + //Sounds + soundClick[] = { "\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1 }; // Sound played after control is activated in format {file, volume, pitch} + soundEnter[] = { "\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1 }; // Sound played when mouse cursor enters the control + soundPush[] = { "\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1 }; // Sound played when the control is pushed down + soundEscape[] = { "\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1 }; // Sound played when the control is released after pushing down + +}; +class TAWVD_RscShortcutButton { + idc = -1; + style = 0; + default = 0; + shadow = 1; + w = 0.183825; + h = "( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20)"; + color[] = {1,1,1,1.0}; + colorFocused[] = {1,1,1,1.0}; + color2[] = {0.95,0.95,0.95,1}; + colorDisabled[] = {1,1,1,0.25}; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorBackgroundFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorBackground2[] = {1,1,1,1}; + animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; + animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; + animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; + animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa"; + animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa"; + animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa"; + periodFocus = 1.2; + periodOver = 0.8; + class HitZone + { + left = 0.0; + top = 0.0; + right = 0.0; + bottom = 0.0; + }; + class ShortcutPos + { + left = 0; + top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + w = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; + h = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + }; + class TextPos + { + left = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; + top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + period = 0.4; + font = "PuristaMedium"; + size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1}; + action = ""; + class Attributes + { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "left"; + shadow = "true"; + }; + class AttributesImage + { + font = "PuristaMedium"; + color = "#E5E5E5"; + align = "left"; + }; +}; + +class TAWVD_RscText { + x = 0; + y = 0; + h = 0.037; + w = 0.3; + type = 0; + style = 0; + shadow = 1; + colorShadow[] = {0, 0, 0, 0.5}; + font = "PuristaMedium"; + SizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + colorText[] = {1, 1, 1, 1.0}; + colorBackground[] = {0, 0, 0, 0}; + linespacing = 1; +}; + +class TAWVD_RscTitle : TAWVD_RscText { + style = 0; + shadow = 0; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {0.95, 0.95, 0.95, 1}; +}; + +class TAWVD_RscButtonMenu : TAWVD_RscShortcutButton { + idc = -1; + type = 16; + style = "0x02 + 0xC0"; + default = 0; + shadow = 0; + x = 0; + y = 0; + w = 0.095589; + h = 0.039216; + animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + colorBackground[] = {0,0,0,0.8}; + colorBackgroundFocused[] = {1,1,1,1}; + colorBackground2[] = {0.75,0.75,0.75,1}; + color[] = {1,1,1,1}; + colorFocused[] = {0,0,0,1}; + color2[] = {0,0,0,1}; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.25}; + period = 1.2; + periodFocus = 1.2; + periodOver = 1.2; + size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + class TextPos + { + left = "0.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + top = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - ( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + class Attributes + { + font = "PuristaLight"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class ShortcutPos + { + left = "(6.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005"; + top = 0.005; + w = 0.0225; + h = 0.03; + }; + soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundPush",0.09,1}; + soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1}; + textureNoShortcut = ""; +}; + +class TAWVD_RscXSliderH +{ + style = 1024; + type = 43; + shadow = 2; + x = 0; + y = 0; + h = 0.029412; + w = 0.400000; + color[] = { + 1, 1, 1, 0.7 + }; + colorActive[] = { + 1, 1, 1, 1 + }; + colorDisabled[] = { + 1, 1, 1, 0.500000 + }; + arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; + border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; + thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa"; +}; + +class TAWVD_activeText +{ + idc = -1; + type = 11; + style = 0; + x = 0; + y = 0; + h = 0.037; + w = 0.3; + sizeEx = 0.040; + font = "PuristaLight"; + color[] = {1, 1, 1, 1}; + colorActive[] = {1, 0.2, 0.2, 1}; + colorDisabled[] = {1, 1, 1, 1}; + soundEnter[] = {"\A3\ui_f\data\sound\onover", 0.09, 1}; + soundPush[] = {"\A3\ui_f\data\sound\new1", 0.0, 0}; + soundClick[] = {"\A3\ui_f\data\sound\onclick", 0.07, 1}; + soundEscape[] = {"\A3\ui_f\data\sound\onescape", 0.09, 1}; + action = ""; + text = ""; +}; + +class TAW_VD +{ + idd = 2900; + name= "taw_vd"; + movingEnable = false; + enableSimulation = true; + //onLoad = "['guns'] execVM 'gear\switch.sqf'"; + + class controlsBackground { + class TAWVD_RscTitleBackground:TAWVD_RscText { + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"}; + idc = -1; + x = 0.3; + y = 0.2; + w = 0.5; + h = (1 / 25); + }; + + class MainBackground : TAWVD_RscText { + colorBackground[] = {0, 0, 0, 0.7}; + idc = -1; + x = 0.3; + y = 0.2 + (11 / 250); + w = 0.5; + h = 0.57 - (22 / 250); + }; + + class VDonFoot : TAWVD_RscText + { + idc = -1; + text = "On Foot:"; + + x = 0.32; y = 0.258; + w = 0.275; h = 0.04; + }; + + class VDinCar : TAWVD_RscText + { + idc = -1; + text = "On Land:"; + + x = 0.32; y = 0.305; + w = 0.275; h = 0.04; + }; + + class VDinAir : TAWVD_RscText + { + idc = -1; + text = "In Air:"; + + x = 0.32; y = 0.355; + w = 0.275; h = 0.04; + }; + + class VDObject : VDinAir + { + text = "Object:"; + y = 0.655; + }; + + class VDTerrSet : TAWVD_RscText + { + idc = -1; + text = "Terrain Settings"; + shadow = 0; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"}; + + x = 0.30; + y = 0.45; + w = 0.5; + h = (1 / 25); + }; + + class VDObjectSet : VDTerrSet + { + text = "Object Settings"; + y = 0.55; + }; + + }; + + class controls + { + class Title : TAWVD_RscTitle { + colorBackground[] = {0, 0, 0, 0}; + idc = -1; + text = "View Distance"; + x = 0.3; + y = 0.2; + w = 0.8; + h = (1 / 25); + }; + + class VD_onfoot_slider : TAWVD_RscXSliderH + { + idc = 2901; + text = ""; + onSliderPosChanged = "[0,_this select 1] call TAWVD_fnc_onSliderChange;"; + tooltip = "View distance while on foot"; + x = 0.42; + y = 0.30 - (1 / 25); + + w = "9 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + }; + + class VD_onfoot_value : TAWVD_RscText + { + idc = 2902; + text = ""; + + x = 0.70; y = 0.258; + w = 0.275; h = 0.04; + }; + + class VD_car_slider : TAWVD_RscXSliderH + { + idc = 2911; + text = ""; + onSliderPosChanged = "[1,_this select 1] call TAWVD_fnc_onSliderChange;"; + tooltip = "View distance while in a land vehicle"; + x = 0.42; + y = 0.35 - (1 / 25); + + w = "9 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + }; + + class VD_car_value : TAWVD_RscText + { + idc = 2912; + text = ""; + + x = 0.70; y = 0.31; + w = 0.275; h = 0.04; + }; + + class VD_air_slider : TAWVD_RscXSliderH + { + idc = 2921; + text = ""; + onSliderPosChanged = "[2,_this select 1] call TAWVD_fnc_onSliderChange;"; + tooltip = "View distance while in a air vehicle"; + x = 0.42; + y = 0.40 - (1 / 25); + + w = "9 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + }; + + class VD_air_value : TAWVD_RscText + { + idc = 2922; + text = ""; + + x = 0.70; y = 0.36; + w = 0.275; h = 0.04; + }; + + class ObjectSyncCheckbox : TAWVD_Checkbox + { + idc = 2931; + x = 0.32; y = 0.6; + tooltip = "Sync object rendering with view rendering"; + onCheckedChanged = "if((_this select 1) == 1) then {tawvd_syncObject = true;ctrlEnable [2941,false];} else {tawvd_syncObject = false; ctrlEnable [2941,true];};"; + + }; + + class ObjectSyncText : TAWVD_RscText + { + idc = -1; + text = "Sync with view"; + x = 0.345; y = 0.596; + w = 0.35; h = 0.04; + }; + + class VD_object_slider : VD_air_slider + { + idc = 2941; + onSliderPosChanged = "[3,_this select 1] call TAWVD_fnc_onSliderChange;"; + tooltip = "Object rendering distance"; + y = 0.70 - (1 / 25); + }; + + class VD_Object_Value : VD_air_value + { + idc = 2942; + y = 0.656; + }; + + /*class VD_terr_none : TAWVD_activeText + { + idc = -1; + text = "None"; + action = "['none'] call TAWVD_fnc_onTerrainChange;"; + sizeEx = 0.04; + + x = 0.38; y = 0.50; + w = 0.275; h = 0.04; + };*/ + + class VD_terr_low : TAWVD_activeText + { + idc = -1; + text = "Low"; + action = "['low'] call TAWVD_fnc_onTerrainChange;"; + sizeEx = 0.04; + + x = 0.37; y = 0.50; + w = 0.275; h = 0.04; + }; + + class VD_terr_normal : TAWVD_activeText + { + idc = -1; + text = "Normal"; + action = "['norm'] call TAWVD_fnc_onTerrainChange;"; + sizeEx = 0.04; + + x = 0.50; y = 0.50; + w = 0.275; h = 0.04; + }; + + class VD_terr_high : TAWVD_activeText + { + idc = -1; + text = "High"; + action = "['high'] call TAWVD_fnc_onTerrainChange;"; + sizeEx = 0.04; + + x = 0.67; y = 0.50; + w = 0.275; h = 0.04; + }; + + class ButtonClose : TAWVD_RscButtonMenu { + idc = -1; + //shortcuts[] = {0x00050000 + 2}; + text = "Close"; + onButtonClick = "closeDialog 0;"; + x = 0.48; + y = 0.77 - (1 / 25); + w = (6.25 / 40); + h = (1 / 25); + }; + }; +}; \ No newline at end of file diff --git a/addons/taw_vd/fn_onSliderChange.sqf b/addons/taw_vd/fn_onSliderChange.sqf new file mode 100644 index 000000000..e3fdc2a2a --- /dev/null +++ b/addons/taw_vd/fn_onSliderChange.sqf @@ -0,0 +1,47 @@ +/* + File: fn_onSliderChange.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Called when the slider is changed for any field and updates the view distance for it. +*/ +private["_mode","_value"]; +_mode = [_this,0,-1,[0]] call BIS_fnc_param; +_value = [_this,1,-1,[0]] call BIS_fnc_param; +if(_mode == -1 OR _value == -1) exitWith {}; +disableSerialization; + +switch (_mode) do +{ + case 0: + { + tawvd_foot = round(_value); + ctrlSetText[2902,format["%1",tawvd_foot]]; + [] call TAWVD_fnc_updateViewDistance; + }; + + case 1: + { + tawvd_car = round(_value); + ctrlSetText[2912,format["%1",tawvd_car]]; + [] call TAWVD_fnc_updateViewDistance; + }; + + case 2: + { + tawvd_air = round(_value); + ctrlSetText[2922,format["%1",tawvd_air]]; + [] call TAWVD_fnc_updateViewDistance; + }; + + case 3: { + tawvd_object = round(_value); + ctrlSetText[2942,format["%1",tawvd_object]]; + setObjectViewDistance [tawvd_object,100]; + }; +}; + +if(tawvd_syncObject) then { + sliderSetPosition[2941, tawvd_object]; + ctrlSetText[2942,format["%1",tawvd_object]]; +}; \ No newline at end of file diff --git a/addons/taw_vd/fn_onTerrainChange.sqf b/addons/taw_vd/fn_onTerrainChange.sqf new file mode 100644 index 000000000..e74c2058a --- /dev/null +++ b/addons/taw_vd/fn_onTerrainChange.sqf @@ -0,0 +1,18 @@ +/* + File: fn_onTerrainChange.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Updates the players terraingrid when called. +*/ +private["_type"]; +_type = [_this,0,"",[""]] call BIS_fnc_param; +if(_type == "") exitWith {}; + +switch (_type) do +{ + case "none": {if(isNil "tawvd_disablenone") then {setTerrainGrid 50;};}; + case "low": {setTerrainGrid 30;}; + case "norm": {setTerrainGrid 12.5;}; + case "high": {setTerrainGrid 3.125;}; +}; \ No newline at end of file diff --git a/addons/taw_vd/fn_openTAWVD.sqf b/addons/taw_vd/fn_openTAWVD.sqf new file mode 100644 index 000000000..93dbe72d4 --- /dev/null +++ b/addons/taw_vd/fn_openTAWVD.sqf @@ -0,0 +1,29 @@ +/* + File: fn_openTAWVD.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Called via addAction and opens the TAW View Distance Menu +*/ +if(!createDialog "TAW_VD") exitWith {hint "Something went wrong, the menu won't open?"}; +disableSerialization; + +ctrlSetText[2902, format["%1", tawvd_foot]]; +ctrlSetText[2912, format["%1", tawvd_car]]; +ctrlSetText[2922, format["%1", tawvd_air]]; +ctrlSetText[2942, format["%1", tawvd_object]]; + +//Setup the sliders +{ + slidersetRange [_x select 0,100,3600]; + ((findDisplay 2900) displayCtrl (_x select 0)) sliderSetSpeed [100,100,100]; + sliderSetPosition[_x select 0, _x select 1]; +} foreach [[2901,tawvd_foot],[2911,tawvd_car],[2921,tawvd_air],[2941,tawvd_object]]; + +((finddisplay 2900) displayCtrl 2931) cbSetChecked tawvd_syncObject; + +if(tawvd_syncObject) then { + ctrlEnable [2941,false]; +} else { + ctrlEnable [2941,true]; +}; \ No newline at end of file diff --git a/addons/taw_vd/fn_tawvdInit.sqf b/addons/taw_vd/fn_tawvdInit.sqf new file mode 100644 index 000000000..74444c368 --- /dev/null +++ b/addons/taw_vd/fn_tawvdInit.sqf @@ -0,0 +1,27 @@ +/* + File: fn_tawvdInit.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Master init for TAW View Distance (Addon version). + If the script verson is present it will exit. +*/ +if(!isMultiplayer) exitWith {}; +tawvd_foot = viewDistance; +tawvd_car = viewDistance; +tawvd_air = viewDistance; +tawvd_syncObject = true; //Enable the automatic syncing of Object View rendering with the current view distance. +tawvd_object = tawvd_foot; + +tawvd_addon_disable = true; +//The hacky method... Apparently if you stall (sleep or waitUntil) with CfgFunctions you stall the mission initialization process... Good job BIS, why wouldn't you spawn it via preInit or postInit? +[] spawn +{ + waitUntil {!isNull player && player == player}; + waitUntil{!isNil "BIS_fnc_init"}; + waitUntil {!(isNull (findDisplay 46))}; + + tawvd_action = player addAction["View Distance",TAWVD_fnc_openTAWVD,[],-99,false,false,"",'']; + + [] spawn TAWVD_fnc_trackViewDistance; +}; \ No newline at end of file diff --git a/addons/taw_vd/fn_trackViewDistance.sqf b/addons/taw_vd/fn_trackViewDistance.sqf new file mode 100644 index 000000000..fc55d5b0e --- /dev/null +++ b/addons/taw_vd/fn_trackViewDistance.sqf @@ -0,0 +1,23 @@ +/* + File: fn_trackViewDistance.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Constantly monitors the players state. + + i.e Player gets in landvehicle then adjust viewDistance. +*/ +private["_old","_recorded"]; +while {true} do +{ + _recorded = vehicle player; + if(!alive player) then + { + _old = player; + _old removeAction tawvd_action; + waitUntil {alive player}; + tawvd_action = player addAction["View Distance",TAWVD_fnc_openTAWVD,[],-99,false,false,"",'']; + }; + [] call TAWVD_fnc_updateViewDistance; + waitUntil {_recorded != vehicle player || !alive player}; +}; \ No newline at end of file diff --git a/addons/taw_vd/fn_updateViewDistance.sqf b/addons/taw_vd/fn_updateViewDistance.sqf new file mode 100644 index 000000000..1c06f205d --- /dev/null +++ b/addons/taw_vd/fn_updateViewDistance.sqf @@ -0,0 +1,28 @@ +/* + File: fn_updateViewDistance.sqf + Author: Bryan "Tonic" Boardwine + + Description: + Updates the view distance dependant on whether the player is on foot, a car or an aircraft. +*/ +private["_dist"]; +switch (true) do +{ + case ((vehicle player) isKindOf "Man"): { + setViewDistance tawvd_foot; + _dist = tawvd_foot; + }; + case ((vehicle player) isKindOf "LandVehicle" || {(vehicle player) isKindOf "Ship_F"}): { + setViewDistance tawvd_car; + _dist = tawvd_car; + }; + case ((vehicle player) isKindOf "Air"): { + setViewDistance tawvd_air; + _dist = tawvd_air; + }; +}; + +if(tawvd_syncObject) then { + setObjectViewDistance [_dist,100]; + tawvd_object = _dist; +}; \ No newline at end of file diff --git a/addons/vactions/config.sqf b/addons/vactions/config.sqf new file mode 100644 index 000000000..add881d4b --- /dev/null +++ b/addons/vactions/config.sqf @@ -0,0 +1,31 @@ +//display the "Vehicle Information" action +cfg_va_info_action_on = true; + +//display "Unflip vehicle" action (when vehicle is flipped) +cfg_va_unflip_action_on = true; + +//How much time (in seconds) to make the player wait before the vehicle is unflipped +cfg_va_unflip_wait_time = 8; + +//Minimum distance (in meters) the player must stay from the vehicle for the unflup action to complete +cfg_va_unflip_wait_distance = 10; + +//display the "Pull {PlayerName}" action +cfg_va_pull_player_action_on = true; + +//display lock/unlock actions +cfg_va_lock_action_on = true; + +//Only the player with UID that matches "ownerUID" variable can lock/unlock the vehicle +cfg_va_lock_owner_only = true; + +//Playe lock/unlock sound +cfg_va_lock_sound_play = true; + +//Any player can lock/unlock the vehicle from the inside +cfg_va_lock_from_inside = true; + +//List of classes for vehicles that can locked/unlocked (empty means all) +cfg_va_lock_actions_classes_list = ["MRAP_01_base_F", "MRAP_02_base_F", "MRAP_03_base_F", "Truck_01_base_F", "Truck_02_base_F", "Truck_03_base_F", "Wheeled_APC_F", "Tank_F", "O_Heli_Light_02_unarmed_F", "I_Heli_light_03_unarmed_F", "B_Heli_Transport_01_F", "B_Heli_Transport_01_camo_F", "B_Heli_Light_01_armed_F", "O_Heli_Light_02_F", "O_Heli_Light_02_v2_F", "I_Heli_light_03_F", "B_Heli_Attack_01_F", "O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F", "Heli_Transport_04_base_F", "B_Heli_Transport_03_unarmed_F", "B_Heli_Transport_03_F", "I_Heli_Transport_02_F", "Plane", "UGV_01_base_F"]; + + diff --git a/addons/vactions/functions.sqf b/addons/vactions/functions.sqf new file mode 100644 index 000000000..2d675f6a9 --- /dev/null +++ b/addons/vactions/functions.sqf @@ -0,0 +1,5 @@ +call compile preprocessFileLineNumbers "addons\vactions\config.sqf"; + +{ + call compile preprocessFileLineNumbers format["addons\vactions\%1_functions.sqf", _x]; +} forEach ["misc", "vector", "va"]; diff --git a/addons/vactions/icons/flip.paa b/addons/vactions/icons/flip.paa new file mode 100644 index 000000000..b44960327 Binary files /dev/null and b/addons/vactions/icons/flip.paa differ diff --git a/addons/vactions/icons/info.paa b/addons/vactions/icons/info.paa new file mode 100644 index 000000000..7783a8aef Binary files /dev/null and b/addons/vactions/icons/info.paa differ diff --git a/addons/vactions/icons/key.paa b/addons/vactions/icons/key.paa new file mode 100644 index 000000000..6dfa015ec Binary files /dev/null and b/addons/vactions/icons/key.paa differ diff --git a/addons/vactions/icons/lock.paa b/addons/vactions/icons/lock.paa new file mode 100644 index 000000000..f243bfb35 Binary files /dev/null and b/addons/vactions/icons/lock.paa differ diff --git a/addons/vactions/icons/pull.paa b/addons/vactions/icons/pull.paa new file mode 100644 index 000000000..f6f03e4b0 Binary files /dev/null and b/addons/vactions/icons/pull.paa differ diff --git a/addons/vactions/macro.h b/addons/vactions/macro.h new file mode 100644 index 000000000..83e60c22b --- /dev/null +++ b/addons/vactions/macro.h @@ -0,0 +1,166 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + +#define isSCRIPT(x) \ +(not(isNil {x}) && {typeName x == typeName scriptNull}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} + +#define IMPORT_FINALIZER if (isNil "finalize") then { \ + finalizer = { \ + if (isNil "_this" || {typeName _this != typeName {}}) exitWith {}; \ + \ + private["_str_data"]; \ + _str_data = toArray str(_this); \ + \ + private["_space"]; \ + _space = (toArray " ") select 0;\ + _str_data set [0, _space]; \ + _str_data set [((count _str_data)-1), _space]; \ + \ + (compileFinal (toString _str_data)) \ + }; \ + finalizer = finalizer call finalizer; \ +}; \ No newline at end of file diff --git a/addons/vactions/misc_functions.sqf b/addons/vactions/misc_functions.sqf new file mode 100644 index 000000000..e7041c90f --- /dev/null +++ b/addons/vactions/misc_functions.sqf @@ -0,0 +1,96 @@ +if (!isNil "va_misc_functions_loaded") exitWith {}; +diag_log format["Loading vehicle misc functions ..."]; + +#include "macro.h" + +//FIXME: some of these functions are repeated between addons, need to refactor, and put them in a shared place + + +A3W_fnc_unflip = { + ARGVX3(0,_object,objNull); + ARGVX3(1,_vector,[]); + + def(_pos); + _object allowDamage false; + _pos = getPos _object; + _pos set [2, (_pos select 2) + 1.5]; + _object setPos _pos; + _object setVectorUp _vector; + [_object] spawn { + sleep 5; + ARGVX3(0,_object,objNull); + _object allowDamage true; + }; + +} call mf_compile; + +A3W_fnc_lock = { + //diag_log format["%1 call A3W_fnc_lock", _this]; + ARGVX3(0,_left,objNull); + ARGVX3(1,_right,0); + _left lock _right; + _left setVariable ["lockState", _right, true]; + + def(_locked); + _locked = (_right == 2 || {_right == 3}); + _left setVariable ["objectLocked", _locked, true]; + _left setVariable ["R3F_LOG_disabled",_locked, true]; +} call mf_compile; + +generic_picture_path = { + ARGVX3(0,_id,""); + ([_id, "picture"] call generic_config_text) +}; + +generic_display_name = { + ARGVX3(0,_id,""); + ([_id, "displayName"] call generic_config_text) +}; + +generic_icon_path = { + ARGVX3(0,_id,""); + ([_id, "icon"] call generic_config_text) +}; + +generic_config_text = { + ARGVX3(0,_id,""); + ARGVX3(1,_field,""); + + if (_id == "" || {_field == ""}) exitWith {""}; + + if (isClass(configFile >> "CfgWeapons" >> _id)) exitWith { + (getText(configFile >> "CfgWeapons" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgVehicles" >> _id)) exitWith { + (getText(configFile >> "CfgVehicles" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgMagazines" >> _id)) exitWith { + (getText(configFile >> "CfgMagazines" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgAmmos" >> _id)) exitWith { + (getText(configFile >> "CfgAmmos" >> _id >> _field)) + }; + + if (isClass(configFile >> "CfgGlasses" >> _id)) exitWith { + (getText(configFile >> "CfgGlasses" >> _id >> _field)) + }; + + "" +}; + +str_truncate = { + ARGVX4(0,_str,"","..."); + ARGVX4(1,_max,0,"..."); + + _str = if ((count _str) > _max) then { (_str select [0, _max - 3]) + "..."} else {_str}; + (_str) +}; + +va_misc_functions_loaded = true; + +diag_log format["Loading vehicle misc functions complete"]; + + diff --git a/addons/vactions/va_functions.sqf b/addons/vactions/va_functions.sqf new file mode 100644 index 000000000..f441b443d --- /dev/null +++ b/addons/vactions/va_functions.sqf @@ -0,0 +1,578 @@ +if (!isNil "va_actions_functions_defined") exitWith {}; +diag_log format["Loading vehicle actions functions ..."]; +#include "macro.h" + + +#define cameraDirDist(x) ([(positionCameraToWorld [0,0,0]), (positionCameraToWorld [0,0,x])] call BIS_fnc_vectorDiff) +#define insideAVehicle(x) ((vehicle x) != x) + +//Normalize the config variables +cfg_va_info_action_on = OR_BOOLEAN(cfg_va_info_action_on,true); +cfg_va_unflip_action_on = OR_BOOLEAN(cfg_va_unflip_action_on,true); +cfg_va_unflip_wait_time = OR_POSITIVE(cfg_va_unflip_wait_time,10); +cfg_va_unflip_wait_distance = OR_POSITIVE(cfg_va_unflip_wait_distance,10); +cfg_va_pull_player_action_on = OR_BOOLEAN(cfg_va_pull_player_action_on,true); +cfg_va_lock_action_on = OR_BOOLEAN(cfg_va_lock_action_on,true); +cfg_va_lock_owner_only = OR_BOOLEAN(cfg_va_lock_owner_only,true); +cfg_va_lock_from_inside = OR_BOOLEAN(cfg_va_lock_from_inside,true); +cfg_va_lock_actions_classes_list = OR_ARRAY(cfg_va_lock_actions_classes_list,[]); +cfg_va_lock_sound_play = OR_BOOLEAN(cfg_va_lock_sound_play,true); + + +va_player_inside = { + ARGVX4(0,_player,objNull,false); + ARGVX4(1,_vehicle,objNull,false); + + (((vehicle _player) == _vehicle) && {(_vehicle != _player)}) +}; + +va_player_exit = { + //player groupChat format["player_exit_vehicle %1",_this]; + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + ARGV4(2,_immediate,false,true); + + + _vehicle lock false; + if (_immediate) exitWith { + moveOut _player; + }; + + //leave engine in same state after exiting + def(_engine_state); + _engine_state = isEngineOn _vehicle; + _player action ["getOut",_vehicle]; + _vehicle engineOn _engine_state; +}; + +va_is_player_owner = { + ARGVX4(0,_player,objNull,false); + ARGVX4(1,_vehicle,objNull,false); + + if (not(alive _player)) exitWith {}; + + def(_ownerUID); + _ownerUID = _vehicle getVariable ["ownerUID", "unknown"]; + + def(_uid); + _uid = getPlayerUID _player; + + (_uid == _ownerUID) +}; + +va_pull_player_action = { + ARGVX3(3,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + ARGVX3(2,_target,objNull); + + [_target, _vehicle, false] call va_player_exit; +}; + +va_pull_player_action_available = { + if (not(cfg_va_pull_player_action_on)) exitWith {false}; + + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + ARGVX3(2,_target,objNull); + + + if (not(alive _player)) exitWith {false}; + if (not(isPlayer _target) && {_vehicle isKindOf "UAV_02_base_F" || {_vehicle isKindOf "UGV_01_base_F" || {_vehicle isKindOf "UAV_01_base_F"}}}) exitWith {false}; + if (cursorTarget != _vehicle) exitWith {false}; + if (not(locked _vehicle < 2)) exitWith {false}; + if (not([_target, _vehicle] call va_player_inside)) exitWith {false}; + + true +}; + +va_flipped = { + ARGVX4(0,_vehicle,objNull,false); + + def(_pos); + _pos = getPos _vehicle; + + //no unflip action if vehicle is in water + if (surfaceIsWater _pos) exitWith {false}; + + def(_snormal); + def(_vnormal); + _snormal = surfaceNormal _pos; + _vnormal = vectorUp _vehicle; + + def(_angle); + _angle = [_snormal, _vnormal] call vector_angle; + + (_angle > 15) +}; + +va_unflip_action_available = { + if (not(cfg_va_unflip_action_on)) exitWith {false}; + ARGVX4(0,_vehicle,objNull,false); + + + ([_vehicle] call va_flipped) +}; + +va_unflip_action = { + + if (isSCRIPT(va_unflip_action_script) && {not(scriptDone va_unflip_action_script)}) exitWith { + player groupChat format["Vehicle unflip action is already in progress, please wait"]; + }; + + va_unflip_action_script = _this spawn { + //player groupChat format["va_unflip_action %1",_this]; + ARGVX3(3,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + if (not(alive _player)) exitWith {}; + + + def(_display_name); + _display_name = [typeOf _vehicle] call generic_display_name; + + init(_sleep,cfg_va_unflip_wait_time); + init(_dist,cfg_va_unflip_wait_distance); + + _player groupChat format["Unflipping the %1, wait for %2 seconds nearby.", _display_name, _sleep]; + sleep _sleep; + + if ((_player distance _vehicle) > _dist) exitWith { + _player groupChat format["Could not unflip the %1, you must stay within %2 meters.", _display_name, _dist]; + }; + + [[_vehicle,surfaceNormal (getPos _vehicle)],"A3W_fnc_unflip",_vehicle] call BIS_fnc_MP; + + + _player groupChat format["The %1 has been unflipped", _display_name]; + }; +}; + +//place-holder in case people want to modify this condition +va_information_action_available = { + if (not(cfg_va_info_action_on)) exitWith {false}; + + ARGVX4(0,_player,objNull,false); + ARGVX4(1,_vehicle,objNull,false); + + //put your custom logic here, if you want to restrict who can see the vehicle information + + true +}; + + +va_get_tag = { + ARGVX4(0,_vehicle,objNull,""); + def(_tag); + _tag = _vehicle getVariable "vehicle_key"; //sock-rpc-stats + if (isSTRING(_tag)) exitWith {_tag}; + + _tag = _vehicle getVariable "A3W_vehicleID"; //iniDB, and extDB + if (isSTRING(_tag)) exitWith {_tag}; + if (not(isNil "_tag")) exitWith {str _tag}; + + "" +}; + +va_get_owner_name = { + ARGVX4(0,_vehicle,objNull,"None"); + + def(_name); + _name = _vehicle getVariable "ownerN"; + if (isSTRING(_name)) exitWith {_name}; + + _name = _vehicle getVariable "ownerName"; + if (isSTRING(_name)) exitWith {_name}; + + def(_uid1); + def(_uid2); + def(_uid3); + def(_uid4); + + //I know, it's ugly, but got to try all these + _uid1 = _vehicle getVariable ["uid", ""]; + _uid2 = _vehicle getVariable ["owner", ""]; + _uid3 = _vehicle getVariable ["ownerUID", ""]; + _uid4 = _vehicle getVariable ["UID", ""]; + + if (_uid1 == "" && { _uid2 == "" && { _uid3 == "" && { _uid4 == ""}}}) exitWith {"None"}; + + def(_uid); + def(_player); + + {if (true) then { + if (!isPlayer _x) exitWith {}; + _uid = getPlayerUID _x; + if (_uid == "") exitWith {}; + + if (_uid == _uid1 || { + _uid == _uid2 || { + _uid == _uid3 || { + _uid == _uid4}}}) exitWith { + _player = _x; + } + };} forEach playableUnits; + + if (!isOBJECT(_player)) exitWith {"Not in game"}; + + (name _player) +}; + + +va_information_action = { + ARGVX3(3,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + + def(_class); + def(_driver); + def(_picture); + def(_display_name); + _class = typeOf _vehicle; + _driver = driver _vehicle; + _driver = if (isNull _driver) then {"None"} else {(name _driver)}; + _picture = [_class] call generic_picture_path; + _display_name = [_class] call generic_display_name; + + def(_owner); + def(_tag); + _owner = [_vehicle] call va_get_owner_name; + _tag = [_vehicle] call va_get_tag; + + def(_text); + def(_label); + def(_value); + _text = ""; + { + _label = _x select 0; + _value = _x select 1; + _text = _text + "" + _label + "" + _value + "
"; + } + forEach( + [[" ID: ", ([_tag,17] call str_truncate)], + [" Direction: ", str(round(getdir _vehicle)) + toString [176]], + [" Grid: ", mapGridPosition _vehicle], + [" Altitude: ", str(round(getposASL _vehicle select 2)) + " meter(s) ASL"], + [" Driver: ", ([_driver,17] call str_truncate)], + [" Seats: ", str((_vehicle emptyPositions "cargo")+(_vehicle emptyPositions "driver")) + " seat(s)"], + [" Size: ", str(round((sizeOf _class)*10)/10) + " meter(s)"], + [" Owner: ", ([_owner,17] call str_truncate)] + + + ]); + + _text = format["Vehicle Information

(%2)", _picture, ([_display_name,25] call str_truncate)] + "

" + _text; + hint parseText _text; +}; + +va_lock = { + _this pushBack 2; + _this call va_remote_lock; +}; + +va_unlock = { + _this pushBack 0; + _this call va_remote_lock; +}; + + +/* + 0 - Unlocked + 1 - Default + 2 - Locked + 3 - Locked for player +*/ + +va_remote_lock = { + ARGVX3(0,_vehicle, objNull); + ARGVX3(1,_state,0); + [[_vehicle, _state] , "A3W_fnc_lock", true, false, true] call BIS_fnc_MP; +}; + +va_is_locked = { + ARGVX4(0,_vehicle,objNull,false); + def(_state); + _state = locked _vehicle; + (_state == 2 || { _state == 3}) +}; + + +va_lock_toggle = { + ARGVX3(0,_vehicle,objNull); + + def(_locked); + def(_state); + + _locked = [_vehicle] call va_is_locked; + _state = if (_locked) then {2} else {0}; + + [_vehicle, _state] call va_remote_lock; + _state +}; + +va_lock_action = { + ARGVX3(3,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + if ([_vehicle] call va_is_locked) exitWith {}; + + + if (cfg_va_lock_sound_play) then { + playSound3d ["a3\sounds_f\air\Heli_Attack_02\Mixxx_door.wss",_player, true]; + }; + + [_vehicle] call va_lock; +}; + +va_unlock_action = { + ARGVX3(3,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + if (not([_vehicle] call va_is_locked)) exitWith {}; + + if (cfg_va_lock_sound_play) then { + playSound3d ["a3\sounds_f\air\Heli_Attack_01\close.wss", _vehicle, insideAVehicle(_player)]; + }; + + [_vehicle] call va_unlock; +}; + +va_is_lockable = { + ARGVX3(0,_vehicle,objNull); + + if (count(cfg_va_lock_actions_classes_list) == 0) exitWith {true}; + + def(_class); + _class = typeOf _vehicle; + + (({_class isKindOf _x} count cfg_va_lock_actions_classes_list) > 0) +}; + +va_lock_action_available = { + if (not(cfg_va_lock_action_on)) exitWith {false}; + + ARGVX4(0,_player,objNull,false); + ARGVX4(1,_vehicle,objNull,false); + + if ([_vehicle] call va_is_locked) exitWith {false}; + + if (not([_vehicle] call va_is_lockable)) exitWith {false}; + + if (cfg_va_lock_from_inside && {[_player, _vehicle] call va_player_inside}) exitWith {true}; + + if (cfg_va_lock_owner_only && {not([_player, _vehicle] call va_is_player_owner)}) exitWith {false}; + + true +}; + +va_unlock_action_available = { + if (not(cfg_va_lock_action_on)) exitWith {false}; + + ARGVX4(0,_player,objNull,false); + ARGVX4(1,_vehicle,objNull,false); + + if (not([_vehicle] call va_is_locked)) exitWith {false}; + + if (not([_vehicle] call va_is_lockable)) exitWith {false}; + + if (cfg_va_lock_from_inside && {[_player, _vehicle] call va_player_inside}) exitWith {true}; + + if (cfg_va_lock_owner_only && {not([_player, _vehicle] call va_is_player_owner)}) exitWith {false}; + + true +}; + + +va_outside_actions = OR(va_outside_actions,[]); + +va_outside_remove_actions = { + if (count va_outside_actions == 0) exitWith {}; + //player groupChat format["va_outside_remove_actions %1", _this]; + + ARGVX3(0,_player,objNull); + if (not(isPlayer _player)) exitWith {}; + + { + private["_action_id"]; + _action_id = _x; + _player removeAction _action_id; + } forEach va_outside_actions; + va_outside_actions = []; +}; + + +va_outside_owner_add_actions = { + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + def(_crew); + _crew = crew _vehicle; + {if (true) then { + private["_member"]; + _member = _x; + + def(_action_id); + _action_id = _player addaction [format[" Pull %1", (name _member)], {_this call va_pull_player_action;}, [_player, _vehicle, _member],10,false,false,"", + format["([objectFromNetId %1, objectFromnetId %2, objectFromNetId %3] call va_pull_player_action_available)", str(netId _player), str(netId _vehicle), str(netId _member)]]; + va_outside_actions = va_outside_actions + [_action_id]; + };} forEach _crew; +}; + +va_outside_add_actions = { + if (count va_outside_actions > 0) exitWith {}; + //player groupChat format["va_outside_add_actions %1", _this]; + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + if (not(isPlayer _player)) exitWith {}; + + def(_display_name); + _display_name = [typeOf _vehicle] call generic_display_name; + + //Add crew actions + if ([_player, _vehicle] call va_is_player_owner) then { + [_player, _vehicle] call va_outside_owner_add_actions; + }; + + //Add unfliping action + _action_id = _player addaction [format[" Unflip %1", _display_name], {_this call va_unflip_action;}, [_player, _vehicle],10,false,false,"", + format["([objectFromNetId %1] call va_unflip_action_available)",str(netId _vehicle)]]; + va_outside_actions = va_outside_actions + [_action_id]; + + + //Add view vehicle information action + _action_id = player addaction [format[" %1 info", _display_name], {_this call va_information_action;}, [_player, _vehicle],0,false,false,"", + format["([objectFromNetId %1, objectFromNetId %2] call va_information_action_available)", str(netId _player), str(netId _vehicle)]]; + va_outside_actions = va_outside_actions + [_action_id]; + + //Add vehicle lock action + _action_id = player addaction [format[" Lock %1", _display_name], {_this call va_lock_action;}, [_player, _vehicle],0,false,false,"", + format["([objectFromNetId %1, objectFromNetId %2] call va_lock_action_available)", str(netId _player), str(netId _vehicle)]]; + va_outside_actions = va_outside_actions + [_action_id]; + + //Add vehicle unlock action + _action_id = player addaction [format[" Unlock %1", _display_name], {_this call va_unlock_action;}, [_player, _vehicle],0,false,false,"", + format["([objectFromNetId %1, objectFromNetId %2] call va_unlock_action_available)", str(netId _player), str(netId _vehicle)]]; + va_outside_actions = va_outside_actions + [_action_id]; +}; + +va_inside_actions = OR(va_inside_actions,[]); + +va_inside_add_actions = { + if (count va_inside_actions > 0) exitWith {}; + //player groupChat format["va_inside_add_actions %1", _this]; + ARGVX3(0,_player,objNull); + ARGVX3(1,_vehicle,objNull); + + if (not(isPlayer _player)) exitWith {}; + + def(_display_name); + _display_name = [typeOf _vehicle] call generic_display_name; + + //Add vehicle lock action + _action_id = player addaction [format[" Lock %1", _display_name], {_this call va_lock_action;}, [_player, _vehicle],10,false,false,"", + format["([objectFromNetId %1, objectFromNetId %2] call va_lock_action_available)", str(netId _player), str(netId _vehicle)]]; + va_inside_actions = va_inside_actions + [_action_id]; + + //Add vehicle unlock action + _action_id = player addaction [format[" Unlock %1", _display_name], {_this call va_unlock_action;}, [_player, _vehicle],10,false,false,"", + format["([objectFromNetId %1, objectFromNetId %2] call va_unlock_action_available)", str(netId _player), str(netId _vehicle)]]; + va_inside_actions = va_inside_actions + [_action_id]; +}; + + +va_inside_remove_actions = { + if (count va_inside_actions == 0) exitWith {}; + //player groupChat format["va_inside_remove_actions %1", _this]; + + ARGVX3(0,_player,objNull); + if (not(isPlayer _player)) exitWith {}; + + { + private["_action_id"]; + _action_id = _x; + _player removeAction _action_id; + } forEach va_inside_actions; + va_inside_actions = []; +}; + + +va_outside_target = { + ARGVX3(0,_player,objNull); + ARGVX3(1,_distance,0); + if (!isPlayer _player) exitWith {}; + + + def(_target); + if (surfaceIsWater (position _player)) then { + //line intersect does not work well when vehicle is in water + _target = cursorTarget; + } + else { + def(_pos1); + def(_pos2); + _pos1 = (eyePos player); + _pos2 = ([_pos1, cameraDirDist(_distance)] call vector_add); + _objects = (lineIntersectsWith [_pos1,_pos2,objNull,objNull,true]); + if (!isARRAY(_objects) || {count _objects == 0}) exitWith {}; + _target = _objects select 0; + }; + + if (isNil "_target") exitWith {}; + + if (({_target isKindOf _x } count ["Helicopter", "Plane", "Ship_F", "Car", "Motorcycle", "Tank"]) == 0) exitWith {}; + + _target +}; + +va_check_outside_actions = { + //player groupChat format["va_check_outside_actions"]; + init(_player,player); + + + _target_vehicle = [_player, 3.5] call va_outside_target; + //player groupChat format["_target_vehicle = %1",_target_vehicle]; + if (!isOBJECT(_target_vehicle) || {insideAVehicle(_player) || {not(alive _player)}}) exitWith { + [_player] call va_outside_remove_actions; + }; + + [_player, _target_vehicle] call va_outside_add_actions; +}; + +va_check_inside_actions = { + //player groupChat format["va_check_inside_actions"]; + init(_player,player); + + if (!(alive _player) || {!insideAVehicle(_player)}) exitWith { + [_player] call va_inside_remove_actions; + }; + + [_player, vehicle _player] call va_inside_add_actions; +}; + + +va_client_loop_stop = false; +va_client_loop = { + if (not(isClient)) exitWith {}; + private ["_va_client_loop_i"]; + _va_client_loop_i = 0; + + while {_va_client_loop_i < 5000 && {not(va_client_loop_stop)}} do { + call va_check_outside_actions; + call va_check_inside_actions; + + sleep 0.5; + _va_client_loop_i = _va_client_loop_i + 1; + }; + [] spawn va_client_loop; +}; + +[] spawn va_client_loop; + +diag_log format["Loading vehicle actions functions complete"]; + +va_actions_functions_defined = true; \ No newline at end of file diff --git a/addons/vactions/vector_functions.sqf b/addons/vactions/vector_functions.sqf new file mode 100644 index 000000000..444571bfd --- /dev/null +++ b/addons/vactions/vector_functions.sqf @@ -0,0 +1,127 @@ +if (!isNil "vector_functions_defined") exitWith {}; +diag_log format["Loading vector functions ... "]; +#include "macro.h" + + +vector_subtract = { + ARGVX3(0,_v1,[]); + ARGVX3(1,_v2,[]); + + ([((_v1 select 0) - (_v2 select 0)), ((_v1 select 1) - (_v2 select 1)), ((_v1 select 2) - (_v2 select 2))]) +}; + +vector_add = { + ARGVX3(0,_v1,[]); + ARGVX3(1,_v2,[]); + + ([((_v1 select 0) + (_v2 select 0)), ((_v1 select 1) + (_v2 select 1)), ((_v1 select 2) + (_v2 select 2))]) +}; + +vector_interpolate = { + private["_v1", "_v2", "_p"]; + _v1 = _this select 0; + _v2 = _this select 1; + _p = _this select 2; + private["_V1x", "_V1y", "_V1z", "_V2x", "_V2y", "_V2z"]; + _V1x = _v1 select 0; + _V1y = _v1 select 1; + _V1z = _v1 select 2; + + _V2x = _v2 select 0; + _V2y = _v2 select 1; + _V2z = _v2 select 2; + + [ (_V1x + ((_V2x - _V1x)*_p)), (_V1y + ((_V2y - _V1y)*_p)), (_V1z + ((_V2z - _V1z)*_p))] +}; + +vector_dotp = { + ARGVX3(0,_v1,[]); + ARGVX3(1,_v2,[]); + (((_v1 select 0) * (_v2 select 0)) + ((_v1 select 1) * (_v2 select 1)) + ((_v1 select 2) * (_v2 select 2))) +}; + +vector_magnitude = { + ARGVX3(0,_v1,[]); + (sqrt((_v1 select 0)^2 + (_v1 select 1)^2 + (_v1 select 2)^2)) +}; + +vector_angle = { + ARGVX3(0,_v1,[]); + ARGVX3(1,_v2,[]); + + _v1m = [_v1] call vector_magnitude; + _v2m = [_v2] call vector_magnitude; + _vdp = [_v1, _v2] call vector_dotp; + + private["_m"]; + _m = (_v1m * _v2m); + if (_m == 0) exitWith {0}; + + (acos(_vdp / _m)) +}; + +vector_normalize = { + private["_v1"]; + _v1 = _this select 0; + + private["_len"]; + _len = sqrt((_v1 select 0)^2 + (_v1 select 1)^2 + (_v1 select 2)^2); + if (_len == 0) exitWith {[0,0,0]}; + ([(_v1 select 0)/(_len), (_v1 select 1)/(_len), (_v1 select 2)/(_len)]) +}; + +vector_resize = { + private["_v1", "_len"]; + _v1 = _this select 0; + _len = _this select 1; + + private["_n"]; + _n = [_v1] call vector_normalize; + ([(_n select 0)*(_len), (_n select 1)*(_len), (_n select 2)*(_len)]) +}; + + +matrix_X_vector = { + ARGVX3(0,_m,[]); + ARGVX3(1,_v,[]); + + ([ + (((_v select 0) * ((_m select 0) select 0)) + ((_v select 1) * ((_m select 0) select 1)) + ((_v select 2) * ((_m select 0) select 2))), + (((_v select 0) * ((_m select 1) select 0)) + ((_v select 1) * ((_m select 1) select 1)) + ((_v select 2) * ((_m select 1) select 2))), + (((_v select 0) * ((_m select 2) select 0)) + ((_v select 1) * ((_m select 2) select 1)) + ((_v select 2) * ((_m select 2) select 2))) + ]) +}; + +vector_3d_rotate = { + ARGVX3(0,_v1,[]); + ARGVX3(1,_angle,0); + ARGVX3(2,_axis,0); + + private["_matrix"]; + if (_axis == 0) then { + //rotate around X axis + _matrix = [[1, 0, 0 ], + [0, cos(_angle), -(sin(_angle)) ], + [0, sin(_angle), cos(_angle) ]]; + }; + + if (_axis == 1) then { + //rotate around Y axis + _matrix = [[cos(_angle), 0, sin(_angle)], + [0, 1, 0 ], + [-(sin(_angle)), 0, cos(_angle)]]; + + }; + + if (_axis == 2) then { + //rotate around Z axis + _matrix = [[cos(_angle), -(sin(_angle)), 0], + [sin(_angle), cos(_angle), 0], + [0, 0, 1]]; + }; + + ([_matrix, _v1] call matrix_X_vector) +}; + +vector_functions_defined = true; +diag_log format["Loading vector functions complete"]; \ No newline at end of file diff --git a/addons/water_edge/functions.sqf b/addons/water_edge/functions.sqf new file mode 100644 index 000000000..e3530bbcd --- /dev/null +++ b/addons/water_edge/functions.sqf @@ -0,0 +1,59 @@ + +if (not(isNil "water_edge_functions_defined")) exitWith {nil}; +diag_log format["Loading water edged functions ..."]; + +watter_edge_effect = objNull; +water_edge_colorized = false; +water_edge_check_effects = { + private["_z"]; + _z = (positionCameraToWorld [0,0,0] select 2); + + private["_in_water_edge"]; + _in_water_edge = (_z > -0.1 && _z < 0.09); + if (not(water_edge_colorized) && _in_water_edge) then { + 1 setFog 1; + watter_edge_effect = ppEffectCreate ["WetDistortion", 300]; + watter_edge_effect ppEffectEnable true; + watter_edge_effect ppEffectAdjust [ + 0, //blurriness + 1.0, //effect strength top + 1.0, //effect strength bottom + + //Wave Speed + 1.0, + 0.0, + 0.0, + 1.0, + //Wave Amplitues + 0.03, + 0.02, + 0.01, + 0.01, + //Wave Coeficients + 0.08, + 0.08, + 0.0, + 1.0 + ]; + if (sunOrMoon > 0) then { + watter_edge_effect ppEffectCommit 0; + }; + water_edge_colorized = true; + }; + + if (water_edge_colorized) then { + 1 setFog 1; + setObjectViewDistance 15; + }; + + if (water_edge_colorized && not(_in_water_edge)) then { + setObjectViewDistance viewDistance; + 1 setFog 0; + ppEffectDestroy watter_edge_effect; + water_edge_colorized = false; + }; +}; + +["A3W_water_oneachFrame", "onEachFrame", {[] call water_edge_check_effects }] call BIS_fnc_addStackedEventHandler; +diag_log format["Water edged functions loaded"]; +water_edge_functions_defined = true; \ No newline at end of file diff --git a/briefing.sqf b/briefing.sqf index 632bcf51e..5526ed63c 100644 --- a/briefing.sqf +++ b/briefing.sqf @@ -5,19 +5,50 @@ if (!hasInterface) exitWith {}; +_trimName = { _this select [1, count _this - 2] }; +_aKeyName = { _arr = actionKeysNamesArray _this; if (count _arr == 0) exitWith {""}; _arr select 0 }; + +#define NKEYNAME(DIK) (keyName DIK call _trimName) +#define AKEYNAME(ACT) (ACT call _aKeyName) + waitUntil {!isNull player}; player createDiarySubject ["infos", "Infos and Help"]; player createDiarySubject ["changelog", "Changelog"]; player createDiarySubject ["credits", "Credits"]; +player createDiaryRecord ["changelog", +[ +"v1.2", +" +
[Added] Mag Repack by Outlawled (Ctrl + " + NKEYNAME(19) + ") +
[Added] Adjustable NV by xx-LSD-xx (Shift + PageUp/Down) +
[Added] New vehicle store paintjobs +
[Added] Town spawn cooldown +
[Added] Ghosting timer +
[Added] Object lock restriction near stores and missions +
[Added] Headless client object saving +
[Added] Time and weather saving +
[Changed] Expanded UAV control restriction to quadcopters +
[Changed] Injured players no longer count as town enemies +
[Changed] Upgraded extDB to extDB2 by Torndeco +
[Changed] Updated antihack +
[Fixed] Old spawn beacons no longer shown on spawn menu +
[Fixed] Multiple money duping exploits +
[Fixed] Vehicles and objects sometimes disappearing from DB +
[Fixed] Severe injuries caused by jumping over small ledges +
[Fixed] Antihack kicks due to RHS, MCC, AGM, ACE3, ALiVE +
[Fixed] Various minor bugfixes and optimizations +" +]]; + player createDiaryRecord ["changelog", [ "v1.1b", "
[Added] Marksmen DLC content
[Added] Prevent usage of commander camera -
[Added] Emergency eject hotkey (Ctrl + " + actionKeysNames "GetOut" + ") +
[Added] Emergency eject hotkey (Ctrl + " + AKEYNAME("GetOut") + ")
[Added] Restricted UAV connection to owner's group
[Changed] Improved purchased vehicle setup time
[Changed] Admins can now use global voice chat @@ -64,7 +95,7 @@ player createDiaryRecord ["changelog",
[Changed] Spawn beacon item drop to sleeping bag
[Fixed] More money exploits
[Fixed] Scoreboard ordering -
[Fixed] Vehicle repair & refuel sometimes not working +
[Fixed] Vehicle repair and refuel sometimes not working
[Fixed] Injured players' corpses being deleted on disconnect
[Fixed] Static weapon disassembly prevention
[Fixed] Excess bought rockets ending up in uniform or vest @@ -117,7 +148,7 @@ player createDiaryRecord ["changelog", player createDiaryRecord ["changelog", [ -"0.9h", +"v0.9h", "
[Added] Custom revive system based on Farooq's Revive
[Added] Territory payroll at regular intervals @@ -177,7 +208,7 @@ player createDiaryRecord ["changelog", player createDiaryRecord ["changelog", [ -"0.9g", +"v0.9g", "
[Added] - Vehicle stores
[Added] - New lootspawner by Na_Palm, stuff in ALL buildings @@ -219,7 +250,7 @@ player createDiaryRecord ["changelog", player createDiaryRecord ["changelog", [ -"0.9f", +"v0.9f", "
[Added] - Money missions
[Added] - Sell Crate Items option at stores when moving crate @@ -234,7 +265,7 @@ player createDiaryRecord ["changelog", player createDiaryRecord ["changelog", [ -"0.9e", +"v0.9e", "
[Added] - Territory system
[Added] - Jumping option (step over while running) @@ -248,7 +279,7 @@ player createDiaryRecord ["changelog", player createDiaryRecord ["changelog", [ -"0.9d", +"v0.9d", "
[Added] - Store object purchases
[Changed] - New UI by KoS @@ -257,7 +288,7 @@ player createDiaryRecord ["changelog", player createDiaryRecord ["changelog", [ -"0.9c", +"v0.9c", "
[Changed] - Instant money pickup and drop
[Changed] - Increased plane and heli spawning odds @@ -268,7 +299,7 @@ player createDiaryRecord ["changelog", player createDiaryRecord ["changelog", [ -"0.9b", +"v0.9b", "
[Initial release] - Welcome to Altis! " @@ -309,15 +340,19 @@ player createDiaryRecord ["credits",
* Das Attorney (Jump MF)
* Ed! (404Games forums)
* Farooq (GitHub) +
* gtoddc (A3W forums)
* HatchetHarry (GitHub)
* Hub (TeamPlayerGaming)
* k4n30 (GitHub) +
* Killzone_Kid (KillzoneKid.com)
* Krunch (GitHub) +
* LouDnl (GitHub)
* madbull (R3F)
* Mainfrezzer (Magnon)
* meat147 (GitHub)
* micovery (GitHub)
* Na_Palm (BIS forums) +
* Outlawled (Armaholic)
* red281gt (GitHub)
* RockHound (BierAG)
* s3kShUn61 (GitHub) @@ -330,6 +365,7 @@ player createDiaryRecord ["credits",
* spunFIN (BIS forums)
* Tonic (BIS forums)
* wiking.at (A3W forums) +
* xx-LSD-xx (Armaholic)
* Zenophon (BIS Forums)

Thanks A LOT to everyone involved for the help and inspiration! @@ -337,6 +373,47 @@ player createDiaryRecord ["credits", ]]; +_WASD = AKEYNAME("MoveForward") + "," + AKEYNAME("MoveBack") + "," + AKEYNAME("TurnLeft") + "," + AKEYNAME("TurnRight"); + +player createDiaryRecord ["infos", +[ +"Admin Spectate keys", +" +
Admin menu Spectate camera controls: +
+
Shift + " + AKEYNAME("NextChannel") + " (next player) +
Shift + " + AKEYNAME("PrevChannel") + " (previous player) +
Ctrl + " + NKEYNAME(18) + " (exit camera) +
Ctrl + " + AKEYNAME("Chat") + " (attach/detach camera from target) +
Ctrl + " + NKEYNAME(35) + " (toggle target HUD) +
" + AKEYNAME("NightVision") + " (nightvision, thermal) +
" + _WASD + " (move camera around) +
" + NKEYNAME(16) + " (move camera up) +
" + NKEYNAME(44) + " (move camera down) +
Mouse Move (rotate camera) +
Mouse Wheel Up (increase camera speed) +
Mouse Wheel Down (decrease camera speed) +
Shift + " + _WASD + " (move camera around faster) +
" + AKEYNAME("ShowMap") + " (open/close map - click on map to teleport camera) +" +]]; + +player createDiaryRecord ["infos", +[ +"Player hotkeys", +" +
List of player hotkeys and functions: +
+
" + NKEYNAME(41) + " (open player menu) +
" + NKEYNAME(207) + " (toggle earplugs) +
" + NKEYNAME(199) + ", " + NKEYNAME(219) + ", " + NKEYNAME(220) + " (toggle player names) +
Ctrl + " + AKEYNAME("GetOut") + " (emergency eject) +
" + AKEYNAME("GetOver") + " (open parachute) +
Shift + " + NKEYNAME(201) + " / " + NKEYNAME(209) + " (adjust nightvision) +
" + NKEYNAME(22) + " (admin menu) +" +]]; + player createDiaryRecord ["infos", [ "Hints and Tips", diff --git a/persistence/server/setup/default/init.sqf b/client/actions/moveInTurret.sqf similarity index 67% rename from persistence/server/setup/default/init.sqf rename to client/actions/moveInTurret.sqf index 034388fa8..e85054561 100644 --- a/persistence/server/setup/default/init.sqf +++ b/client/actions/moveInTurret.sqf @@ -1,7 +1,8 @@ // ****************************************************************************************** // * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * // ****************************************************************************************** -// @file Name: init.sqf -// @file Author: AgentRev +// @file Name: moveInTurret.sqf +// @file Author: BadVolt +_turret=_this select 3 select 0; -#include "fn_inidb_custom.sqf" +player moveInTurret [cursorTarget,[_turret]]; diff --git a/client/clientEvents/onKeyPress.sqf b/client/clientEvents/onKeyPress.sqf index 7840c3d76..02424a0f9 100644 --- a/client/clientEvents/onKeyPress.sqf +++ b/client/clientEvents/onKeyPress.sqf @@ -124,4 +124,10 @@ if (!_handled && _key in actionKeys "NetworkStats") then }; }; +// Push-to-talk +if (!_handled && _key in (actionKeys "PushToTalk" + actionKeys "PushToTalkAll")) then +{ + [true] call fn_voiceChatControl; +}; + _handled diff --git a/client/functions/clientCompile.sqf b/client/functions/clientCompile.sqf index e596ea926..f144eb9d2 100644 --- a/client/functions/clientCompile.sqf +++ b/client/functions/clientCompile.sqf @@ -36,6 +36,7 @@ fn_removeAllManagedActions = "client\functions\fn_removeAllManagedActions.sqf" c fn_removeManagedAction = "client\functions\fn_removeManagedAction.sqf" call mf_compile; fn_forceOpenParachute = "client\functions\fn_forceOpenParachute.sqf" call mf_compile; fn_openParachute = "client\functions\fn_openParachute.sqf" call mf_compile; +fn_voiceChatControl = "client\functions\fn_voiceChatControl.sqf" call mf_compile; getDefaultClothing = "client\functions\getDefaultClothing.sqf" call mf_compile; getFullMove = "client\functions\getFullMove.sqf" call mf_compile; getMoveParams = "client\functions\getMoveParams.sqf" call mf_compile; @@ -53,6 +54,7 @@ unitHandleDamage = "client\functions\unitHandleDamage.sqf" call mf_compile; updateTerritoryMarkers = "territory\client\updateTerritoryMarkers.sqf" call mf_compile; vehicleSideCfg = "client\functions\vehicleSideCfg.sqf" call mf_compile; weaponDisassembledEvent = "client\functions\weaponDisassembledEvent.sqf" call mf_compile; +deleteBeacon = "client\items\beacon\deleteBeacon.sqf" call mf_compile; // Player details and actions loadPlayerMenu = "client\systems\playerMenu\init.sqf" call mf_compile; diff --git a/client/functions/createGeneralStoreMarkers.sqf b/client/functions/createGeneralStoreMarkers.sqf index d45a3d7be..89575b9aa 100644 --- a/client/functions/createGeneralStoreMarkers.sqf +++ b/client/functions/createGeneralStoreMarkers.sqf @@ -9,7 +9,7 @@ //Creates the markers around general stores. { - if (!isPlayer _x && {["GenStore", vehicleVarName _x] call fn_startsWith}) then + if (!isPlayer _x && {(vehicleVarName _x) select [0,8] == "GenStore"}) then { _npcPos = getPosATL _x; @@ -21,6 +21,6 @@ _markerName setMarkerTypeLocal "mil_dot"; _markerName setMarkerColorLocal "ColorBlue"; _markerName setMarkerSizeLocal [1,1]; - _markerName setMarkerTextLocal "General Store"; + //_markerName setMarkerTextLocal "General Store"; }; } forEach entities "CAManBase"; diff --git a/client/functions/createGunStoreMarkers.sqf b/client/functions/createGunStoreMarkers.sqf index 90e0e6596..f9b38f437 100644 --- a/client/functions/createGunStoreMarkers.sqf +++ b/client/functions/createGunStoreMarkers.sqf @@ -16,7 +16,7 @@ _col_mixed = "ColorOrange"; //Creates the markers around gunstores. { - if (!isPlayer _x && {["GunStore", vehicleVarName _x] call fn_startsWith}) then + if (!isPlayer _x && {(vehicleVarName _x) select [0,8] == "GunStore"}) then { _npcPos = getPosATL _x; @@ -42,7 +42,7 @@ _col_mixed = "ColorOrange"; _markerName setMarkerTypeLocal "mil_dot"; _markerName setMarkerColorLocal "ColorRed"; _markerName setMarkerSizeLocal [1,1]; - _markerName setMarkerTextLocal "GUN STORE"; + //_markerName setMarkerTextLocal "GUN STORE"; */ // Gun store description @@ -54,7 +54,7 @@ _col_mixed = "ColorOrange"; _markerName setMarkerTypeLocal "mil_dot"; _markerName setMarkerColorLocal _col_empty; _markerName setMarkerSizeLocal [1,1]; - _markerName setMarkerTextLocal "GUN STORE"; + //_markerName setMarkerTextLocal "GUN STORE"; // _markerName setMarkerAlphaLocal 0.5; _status pushBack "EMPTY"; @@ -68,13 +68,20 @@ _setStatus = { if(_status select (_this select 0) == (_this select 1)) exitWith {}; - _markerNameZone = format ["marker_shop_zone_%1", _gunStores select (_this select 0)]; - _markerNameDescription = format ["marker_shop_desc_%1", _gunStores select (_this select 0)]; - switch(_this select 1) do { + _markerName = format ["marker_shop_desc_%1",_x]; + _markerNameZone = format ["marker_shop_zone_%1", _gunStores select (_this select 0)]; + _markerNameDescription = format ["marker_shop_desc_%1", _gunStores select (_this select 0)]; + _npcPos = getPosATL _x; + switch(_this select 1) do { case "EMPTY": { _markerNameZone setmarkerColorLocal _col_empty; _markerNameDescription setmarkerColorLocal _col_empty; - _markerNameDescription setMarkerTextLocal "GUN STORE"; + deleteMarkerLocal _markerName; + _marker = createMarkerLocal [_markerName, _npcPos]; + _markerName setMarkerShapeLocal "ICON"; + _markerName setMarkerTypeLocal "mil_dot"; + _markerName setMarkerColorLocal _col_empty; + _markerName setMarkerSizeLocal [1,1]; }; case "ENEMY": { _markerNameZone setmarkerColorLocal _col_enemy; diff --git a/client/functions/createVehicleStoreMarkers.sqf b/client/functions/createVehicleStoreMarkers.sqf index 206c1937f..68fc9d4ae 100644 --- a/client/functions/createVehicleStoreMarkers.sqf +++ b/client/functions/createVehicleStoreMarkers.sqf @@ -9,7 +9,7 @@ //Creates the markers around vehicle stores. { - if (!isPlayer _x && {["VehStore", vehicleVarName _x] call fn_startsWith}) then + if (!isPlayer _x && {(vehicleVarName _x) select [0,8] == "VehStore"}) then { _npcPos = getPosATL _x; @@ -21,6 +21,6 @@ _markerName setMarkerTypeLocal "mil_dot"; _markerName setMarkerColorLocal "ColorOrange"; _markerName setMarkerSizeLocal [1,1]; - _markerName setMarkerTextLocal "Vehicle Store"; + //_markerName setMarkerTextLocal "Vehicle Store"; }; } forEach entities "CAManBase"; diff --git a/client/functions/drawPlayerMarkers.sqf b/client/functions/drawPlayerMarkers.sqf index bde24749c..2ec307350 100644 --- a/client/functions/drawPlayerMarkers.sqf +++ b/client/functions/drawPlayerMarkers.sqf @@ -9,7 +9,8 @@ if (!hasInterface) exitWith {}; #define IS_FRIENDLY_PLAYER(UNIT) (isPlayer UNIT && {(group UNIT == group player || (!_isIndie && side group UNIT == playerSide))}) #define DEFAULT_ICON_POS(UNIT) (UNIT modelToWorld (UNIT selectionPosition "spine3")) #define MISSION_AI_FAR_DISTANCE 75 - +#define IS_IN_GROUP(UNIT) (isPlayer UNIT && {(group UNIT == group player)}) + disableSerialization; if (isNil "showPlayerNames") then { showPlayerNames = false }; @@ -91,7 +92,7 @@ A3W_mapDraw_thread = [] spawn _uav = _x; _uavOwner = (uavControl _uav) select 0; - if (IS_FRIENDLY_PLAYER(_uavOwner) || (isNull _uavOwner && side _uav == playerSide)) then + if (IS_IN_GROUP(_uavOwner)) then { _icon = getText (configFile >> "CfgVehicles" >> typeOf _uav >> "icon"); if (_icon == "") then { _icon = "iconMan" }; @@ -111,7 +112,7 @@ A3W_mapDraw_thread = [] spawn { _newUnit = _x getVariable ["newRespawnedUnit", objNull]; - if (IS_FRIENDLY_PLAYER(_x) || (_newUnit getVariable ["playerSpawning", false] && IS_FRIENDLY_PLAYER(_newUnit))) then + if (IS_IN_GROUP(_x) || (_newUnit getVariable ["playerSpawning", false] && IS_IN_GROUP(_newUnit))) then { _veh = vehicle _x; _pos = if (_mapIconsEnabled) then { DEFAULT_ICON_POS(_veh) } else { getPosASLVisual _x }; @@ -121,7 +122,7 @@ A3W_mapDraw_thread = [] spawn } forEach _allDeadMen; { - if (IS_FRIENDLY_PLAYER(_x) && !(_x getVariable ["playerSpawning", false])) then + if (IS_IN_GROUP(_x) && !(_x getVariable ["playerSpawning", false])) then { _veh = vehicle _x; @@ -213,3 +214,10 @@ _mapCtrl = _display displayCtrl 101; if (!isNil "A3W_mapDraw_gpsMapEH") then { _mapCtrl ctrlRemoveEventHandler ["Draw", A3W_mapDraw_gpsMapEH] }; A3W_mapDraw_gpsMapEH = _mapCtrl ctrlAddEventHandler ["Draw", A3W_mapDraw_eventCode]; + +//UAV +waitUntil {_display = findDisplay 160; !isNull _display}; +_mapCtrl = _display displayCtrl 51; + +//if (!isNil "A3W_mapDraw_mainMapEH") then { _mapCtrl ctrlRemoveEventHandler ["Draw", A3W_mapDraw_mainMapEH] }; +A3W_mapDraw_uavMapEH = _mapCtrl ctrlAddEventHandler ["Draw", A3W_mapDraw_eventCode]; \ No newline at end of file diff --git a/client/functions/firstSpawn.sqf b/client/functions/firstSpawn.sqf index b790375cc..36c13362c 100644 --- a/client/functions/firstSpawn.sqf +++ b/client/functions/firstSpawn.sqf @@ -85,6 +85,29 @@ player addEventHandler ["InventoryClosed", _obj setVariable ["inventoryIsOpen", nil]; }]; + +//handler for UAV assembly +player addEventHandler ["WeaponAssembled", { + private["_player", "_vehicle"]; + _player = _this select 0; + _vehicle = _this select 1; + + if (_player != player) exitWith {}; + if (!(_vehicle isKindOf "UAV_01_base_F")) exitWith {}; + + private["_uid"]; + _uid = getPlayerUID _player; + if (_uid == "") exitWith {}; + + _vehicle setVariable ["ownerUID", _uid, true]; + _vehicle setVariable ["A3W_purchasedVehicle", true, true]; + _vehicle setVariable ["ownerN", name _player, true]; + trackVehicle = _vehicle; + publicVariableServer "trackVehicle"; +}]; + + +// Manual GetIn/GetOut check because BIS is too lazy to implement GetInMan/GetOutMan, among a LOT of other things [] spawn { _lastVeh = vehicle player; @@ -113,7 +136,8 @@ player addEventHandler ["InventoryClosed", { cameraOn switchCamera "EXTERNAL"; }; - + + uiSleep 0.25; false }; }; @@ -124,26 +148,28 @@ if (["A3W_combatAbortDelay", 0] call getPublicVar > 0) then { player addEventHandler ["Fired", { + private["_isShop"]; // Remove remote explosives if within 100m of a store if (_this select 1 == "Put") then { _ammo = _this select 4; - if ({_ammo isKindOf _x} count ["PipeBombBase", "ClaymoreDirectionalMine_Remote_Ammo"] > 0) then + if ({_ammo isKindOf _x} count ["PipeBombBase", "ClaymoreDirectionalMine_Remote_Ammo", "APERSTripMine_Wire_Ammo", "APERSBoundingMine_Range_Ammo", "APERSMine_Range_Ammo", "SLAMDirectionalMine_Wire_Ammo", "ATMine_Range_Ammo"] > 0) then { _mag = _this select 5; _bomb = _this select 6; _minDist = ["A3W_remoteBombStoreRadius", 100] call getPublicVar; { - if (_x getVariable ["storeNPC_setupComplete", false] && {_bomb distance _x < _minDist}) exitWith + _isShop = (_x getVariable ["storeNPC_setupComplete", false] || { _x getVariable ["is_parking", false]}); + if (_isShop && {_bomb distance _x < _minDist}) exitWith { deleteVehicle _bomb; player addMagazine _mag; playSound "FD_CP_Not_Clear_F"; - titleText [format ["You are not allowed to place remote explosives within %1m of a store.\nThe explosive has been re-added to your inventory.", _minDist], "PLAIN DOWN", 0.5]; + titleText [format ["You are not allowed to place explosives within %1m of a store.\nThe explosive has been re-added to your inventory.", _minDist], "PLAIN DOWN", 0.5]; }; - } forEach entities "CAManBase"; + } forEach ((entities "CAManBase") + (entities "Land_Laptop_unfolded_F")); }; }; }]; diff --git a/client/functions/fn_setupAntiExplode.sqf b/client/functions/fn_setupAntiExplode.sqf index e42836e55..cf275d83e 100644 --- a/client/functions/fn_setupAntiExplode.sqf +++ b/client/functions/fn_setupAntiExplode.sqf @@ -27,7 +27,7 @@ if (isNil "A3W_antiExplodeLocalEH") then if (_local && {(isTouchingGround _veh || (getPos _veh) select 2 < 0.1) && vectorMagnitude velocity _veh < 1}) then { _pos = getPosWorld _veh; - _pos set [2, (_pos select 2) + 0.1]; // might need to be increased if it doesn't work all the time + _pos set [2, (_pos select 2) + 0.3]; // might need to be increased if it doesn't work all the time _veh setPosWorld _pos; }; } call mf_compile; diff --git a/client/functions/fn_voiceChatControl.sqf b/client/functions/fn_voiceChatControl.sqf new file mode 100644 index 000000000..a8fa5cc43 --- /dev/null +++ b/client/functions/fn_voiceChatControl.sqf @@ -0,0 +1,32 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2015 A3Wasteland.com * +// ****************************************************************************************** +// @file Name: fn_voiceChatControl.sqf +// @file Author: AgentRev + +#define SWITCH_DIRECT if (currentChannel == 0 && !((getPlayerUID player) call isAdmin)) then { setCurrentChannel 5 } + +private "_waitSpeak"; +_waitSpeak = _this select 0; + +if (["A3W_disableGlobalVoice"] call isConfigOn) then +{ + if (_waitSpeak) then + { + ["A3W_voiceChatControl", "onEachFrame", + { + if (!isNull findDisplay 55) then + { + SWITCH_DIRECT; + ["A3W_voiceChatControl", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; + }; + }] call BIS_fnc_addStackedEventHandler; + } + else + { + if (!isNull findDisplay 55) then + { + SWITCH_DIRECT; + }; + }; +}; diff --git a/client/functions/getItemInfo.sqf b/client/functions/getItemInfo.sqf index db4656c66..bdc468c80 100644 --- a/client/functions/getItemInfo.sqf +++ b/client/functions/getItemInfo.sqf @@ -20,7 +20,7 @@ _showAmmo = false; if (isNil "_itemEntry") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _itemEntry = _x; _parentCfg = "CfgWeapons"; @@ -32,7 +32,7 @@ if (isNil "_itemEntry") then if (isNil "_itemEntry") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _itemEntry = _x; _parentCfg = "CfgMagazines"; @@ -46,7 +46,7 @@ if (isNil "_itemEntry") then if (!isNil "_itemEntry") exitWith {}; { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _itemEntry = _x; _itemType = _x select 3; @@ -69,7 +69,7 @@ if (isNil "_itemEntry") then if (!isNil "_itemEntry") exitWith {}; { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _itemEntry = _x; _parentCfg = "CfgWeapons"; @@ -84,7 +84,7 @@ if (isNil "_itemEntry") then if (!isNil "_itemEntry") exitWith {}; { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _itemEntry = _x; _parentCfg = "CfgVehicles"; diff --git a/client/functions/initSurvival.sqf b/client/functions/initSurvival.sqf index d724051d0..6598bc573 100644 --- a/client/functions/initSurvival.sqf +++ b/client/functions/initSurvival.sqf @@ -8,15 +8,13 @@ // @file Args: #define TIME_DELTA 1 //seconds between each "check" -#define HEALTH_TIME (60*5) //seconds till death -#define HUNGER_TIME (60*60) //seconds till starving -#define THIRST_TIME (60*50) //seconds till dehydrated -#define HEALTH_DELTA TIME_DELTA*(100/HEALTH_TIME)/100 -#define HUNGER_DELTA TIME_DELTA*(100/HUNGER_TIME) -#define THIRST_DELTA TIME_DELTA*(100/THIRST_TIME) +#define HEALTH_DELTA TIME_DELTA*(100/A3W_healthTime)/100 +#define HUNGER_DELTA TIME_DELTA*(100/A3W_hungerTime) +#define THIRST_DELTA TIME_DELTA*(100/A3W_thirstTime) #define STARVATION " R.I.P.

You have died from:
starvation

You need to eat to survive here!
" #define DEHYDRATION " R.I.P.

You have died from:
dehydration

You need to drink to survive here!
" + private["_warnf1","_warnf2","_warnf3","_warnf4","_warnd1","_warnd2","_warnd3","_warnd4"]; _warnf1 = true; diff --git a/client/functions/playerActions.sqf b/client/functions/playerActions.sqf index a41013718..4f3fe5c95 100644 --- a/client/functions/playerActions.sqf +++ b/client/functions/playerActions.sqf @@ -11,14 +11,26 @@ ["Holster Weapon", { player action ["SwitchWeapon", player, player, 100] }, [], -11, false, false, "", "vehicle player == player && currentWeapon player != ''"], ["Unholster Primary Weapon", { player action ["SwitchWeapon", player, player, 0] }, [], -11, false, false, "", "vehicle player == player && currentWeapon player == '' && primaryWeapon player != ''"], - [format [" [Player Menu]", "#FF8000"], "client\systems\playerMenu\init.sqf", [], -10, false], //, false, "", ""], + ["Heal Self", "addons\scripts\healSelf.sqf",0,0,false,false,"","((damage player)>0.01 && (damage player)<0.25499) && ('FirstAidKit' in (items player)) && (vehicle player == player)"], + + [format [" [Player Menu]", "#FF8000"], "client\systems\playerMenu\init.sqf", [], -10, false], + + ["Track Beacons", "addons\beacondetector\beacondetector.sqf",0,-10,false,false,"","('ToolKit' in (items player)) && !BeaconScanInProgress"], + [" Cancel tracking.", "Beaconscanstop = true",0,-10,false,false,"","BeaconScanInProgress"], [" Pickup Money", "client\actions\pickupMoney.sqf", [], 1, false, false, "", "{_x getVariable ['owner', ''] != 'mission'} count (player nearEntities ['Land_Money_F', 5]) > 0"], - [" Cancel Action", { doCancelAction = true }, [], 1, false, false, "", "mutexScriptInProgress"], + [" Cancel Action", { doCancelAction = true }, [], 1, false, true, "", "mutexScriptInProgress"], [" Salvage", "client\actions\salvage.sqf", [], 1.1, false, false, "", "!isNull cursorTarget && !alive cursorTarget && {cursorTarget isKindOf 'AllVehicles' && !(cursorTarget isKindOf 'Man') && player distance cursorTarget <= (sizeOf typeOf cursorTarget / 3) max 2}"], + [" Pick Lock", "addons\scripts\lockPick.sqf", [cursorTarget], 1, false, false, "", "!isNull cursorTarget && alive cursorTarget && {{ cursorTarget isKindOf _x } count ['LandVehicle', 'Ship', 'Air'] > 0 ;} && ('ToolKit' in (items player)) && cursorTarget getVariable ['ownerUID',''] != getPlayerUID player && locked cursorTarget >= 2 && cursorTarget distance player < 5"], + + [" Save Vehicle", "addons\scripts\vehicleSave.sqf", [cursorTarget], 1, false, false, "", "!isNull cursorTarget && alive cursorTarget && {{ cursorTarget isKindOf _x } count ['C_Kart_01_F', 'Quadbike_01_base_F', 'Hatchback_01_base_F', 'SUV_01_base_F', 'Offroad_01_base_F', 'Van_01_base_F', 'MRAP_01_base_F', 'MRAP_02_base_F', 'MRAP_03_base_F', 'Truck_01_base_F', 'Truck_02_base_F', 'Truck_03_base_F', 'Wheeled_APC_F', 'Tank_F', 'Rubber_duck_base_F', 'SDV_01_base_F', 'Boat_Civil_01_base_F', 'Boat_Armed_01_base_F', 'B_Heli_Light_01_F', 'B_Heli_Light_01_armed_F', 'C_Heli_Light_01_civil_F', 'O_Heli_Light_02_unarmed_F', 'I_Heli_light_03_unarmed_F', 'B_Heli_Transport_01_F', 'B_Heli_Transport_01_camo_F', 'O_Heli_Light_02_F', 'I_Heli_light_03_F', 'B_Heli_Attack_01_F', 'O_Heli_Attack_02_F', 'O_Heli_Light_02_v2_F', 'O_Heli_Attack_02_black_F', 'I_Heli_Transport_02_F', 'Heli_Transport_04_base_F', 'B_Heli_Transport_03_unarmed_F', 'B_Heli_Transport_03_F', 'Plane', 'UGV_01_base_F'] > 0 ;} && !(cursorTarget getVariable ['R3F_LOG_disabled', true]) && cursorTarget getVariable ['ownerUID',''] != getPlayerUID player && locked cursorTarget != 2 && cursorTarget distance player < 5"], + [" Re\Save Vehicle", "addons\scripts\vehicleResave.sqf", [cursorTarget], 1, false, false, "", "!isNull cursorTarget && alive cursorTarget && {{ cursorTarget isKindOf _x } count ['C_Kart_01_F', 'Quadbike_01_base_F', 'Hatchback_01_base_F', 'SUV_01_base_F', 'Offroad_01_base_F', 'Van_01_base_F', 'MRAP_01_base_F', 'MRAP_02_base_F', 'MRAP_03_base_F', 'Truck_01_base_F', 'Truck_02_base_F', 'Truck_03_base_F', 'Wheeled_APC_F', 'Tank_F', 'Rubber_duck_base_F', 'SDV_01_base_F', 'Boat_Civil_01_base_F', 'Boat_Armed_01_base_F', 'B_Heli_Light_01_F', 'B_Heli_Light_01_armed_F', 'C_Heli_Light_01_civil_F', 'O_Heli_Light_02_unarmed_F', 'I_Heli_light_03_unarmed_F', 'B_Heli_Transport_01_F', 'B_Heli_Transport_01_camo_F', 'O_Heli_Light_02_F', 'I_Heli_light_03_F', 'B_Heli_Attack_01_F', 'O_Heli_Attack_02_F', 'O_Heli_Light_02_v2_F', 'O_Heli_Attack_02_black_F', 'I_Heli_Transport_02_F', 'Heli_Transport_04_base_F', 'B_Heli_Transport_03_unarmed_F', 'B_Heli_Transport_03_F', 'Plane', 'UGV_01_base_F'] > 0 ;} && cursorTarget getVariable ['ownerUID',''] == getPlayerUID player && cursorTarget distance player < 5"], + [" Save Weapon", "addons\scripts\weaponSave.sqf", [cursorTarget], 1, false, false, "", "!isNull cursorTarget && alive cursorTarget && {{ cursorTarget isKindOf _x } count ['B_static_AT_F', 'O_static_AT_F', 'I_static_AT_F', 'B_static_AA_F', 'O_static_AA_F', 'I_static_AA_F', 'B_HMG_01_F', 'O_HMG_01_F', 'I_HMG_01_F', 'B_HMG_01_high_F', 'O_HMG_01_high_F', 'I_HMG_01_high_F', 'B_GMG_01_F', 'O_GMG_01_F', 'I_GMG_01_F', 'B_GMG_01_high_F', 'O_GMG_01_high_F', 'I_GMG_01_high_F', 'B_Mortar_01_F', 'O_Mortar_01_F', 'I_Mortar_01_F'] > 0 ;} && !(cursorTarget getVariable ['R3F_LOG_disabled', true]) && cursorTarget getVariable ['ownerUID',''] != getPlayerUID player && (player distance cursortarget) < 5"], + [" Re\Save Weapon", "addons\scripts\weaponResave.sqf", [cursorTarget], 1, false, false, "", "!isNull cursorTarget && alive cursorTarget && {{ cursorTarget isKindOf _x } count ['B_static_AT_F', 'O_static_AT_F', 'I_static_AT_F', 'B_static_AA_F', 'O_static_AA_F', 'I_static_AA_F', 'B_HMG_01_F', 'O_HMG_01_F', 'I_HMG_01_F', 'B_HMG_01_high_F', 'O_HMG_01_high_F', 'I_HMG_01_high_F', 'B_GMG_01_F', 'O_GMG_01_F', 'I_GMG_01_F', 'B_GMG_01_high_F', 'O_GMG_01_high_F', 'I_GMG_01_high_F', 'B_Mortar_01_F', 'O_Mortar_01_F', 'I_Mortar_01_F'] > 0 ;} && cursorTarget getVariable ['ownerUID',''] == getPlayerUID player && (player distance cursortarget) < 5"], + ["[0]"] call getPushPlaneAction, ["Push vehicle", "server\functions\pushVehicle.sqf", [2.5, true], 1, false, false, "", "[2.5] call canPushVehicleOnFoot"], ["Push vehicle forward", "server\functions\pushVehicle.sqf", [2.5], 1, false, false, "", "[2.5] call canPushWatercraft"], @@ -35,7 +47,11 @@ if !(288520 in getDLCs 1) then [player, ["Get in as Driver", "client\actions\moveInDriver.sqf", [], 6, true, true, "", "cursorTarget isKindOf 'Kart_01_Base_F' && player distance cursorTarget < 3.4 && isNull driver cursorTarget"]] call fn_addManagedAction; }; -if (["A3W_savingMethod", "profile"] call getPublicVar == "extDB" && {["A3W_purchasedVehicleSaving"] call isConfigOn || ["A3W_missionVehicleSaving"] call isConfigOn}) then +// Morehehe... +if !(304380 in getDLCs 1) then { - [player, [" Force Save Vehicle", { pvar_manualVehicleSave = netId cursorTarget; publicVariableServer "pvar_manualVehicleSave" }, [], -9.5, false, true, "", "call canForceSaveVehicle"]] call fn_addManagedAction; -}; + [player, [" Get in as Pilot", "client\actions\moveInDriver.sqf", [], 6, true, true, "", "(locked cursorTarget != 2) && ((cursorTarget isKindOf 'B_Heli_Transport_03_F') or (cursorTarget isKindOf 'B_Heli_Transport_03_unarmed_F') or (cursorTarget isKindOf 'Heli_Transport_04_base_F')) && player distance cursorTarget < 10 && isNull driver cursorTarget"]] call fn_addManagedAction; + [player, [" Get in as Copilot", "client\actions\moveInTurret.sqf", [0], 6, true, true, "", "(locked cursorTarget != 2) && ((cursorTarget isKindOf 'B_Heli_Transport_03_F') or (cursorTarget isKindOf 'B_Heli_Transport_03_unarmed_F') or (cursorTarget isKindOf 'Heli_Transport_04_base_F')) && player distance cursorTarget < 10 && isNull (cursorTarget turretUnit [0])"]] call fn_addManagedAction; + [player, [" Get in as Left door gunner", "client\actions\moveInTurret.sqf", [1], 6, true, true, "", "(locked cursorTarget != 2) && ((cursorTarget isKindOf 'B_Heli_Transport_03_F') or (cursorTarget isKindOf 'B_Heli_Transport_03_unarmed_F')) && player distance cursorTarget < 10 && isNull (cursorTarget turretUnit [1])"]] call fn_addManagedAction; + [player, [" Get in as Right door gunner", "client\actions\moveInTurret.sqf", [2], 6, true, true, "", "(locked cursorTarget != 2) && ((cursorTarget isKindOf 'B_Heli_Transport_03_F') or (cursorTarget isKindOf 'B_Heli_Transport_03_unarmed_F')) && player distance cursorTarget < 10 && isNull (cursorTarget turretUnit [2])"]] call fn_addManagedAction; +}; \ No newline at end of file diff --git a/client/functions/playerSetupEnd.sqf b/client/functions/playerSetupEnd.sqf index c16285c34..5cbc8db80 100644 --- a/client/functions/playerSetupEnd.sqf +++ b/client/functions/playerSetupEnd.sqf @@ -9,8 +9,15 @@ _player = _this; _player addRating 9999999; +thirstLevel = if (isNil "thirstLevel") then {100} else {thirstLevel}; +hungerLevel = if (isNil "hungerLevel") then {100} else {hungerLevel}; + [objNull, _player] call mf_player_actions_refresh; [] execVM "client\functions\playerActions.sqf"; _player groupChat "Wasteland - Initialization Complete"; playerSetupComplete = true; +_player setVariable ["initComplete", true, true]; + +trackMe = [_player]; +publicVariable "trackMe"; diff --git a/client/functions/playerSetupGear.sqf b/client/functions/playerSetupGear.sqf index 40ade8b13..226f0c733 100644 --- a/client/functions/playerSetupGear.sqf +++ b/client/functions/playerSetupGear.sqf @@ -31,7 +31,7 @@ _player unlinkItem "ItemGPS"; if (hmd _player != "") then { _player unlinkItem hmd _player }; // Add NVG -_player linkItem "NVGoggles"; +//_player linkItem "NVGoggles"; _player addBackpack "B_AssaultPack_rgr"; @@ -61,6 +61,22 @@ switch (true) do }; }; +switch (side _player) do +{ + case west: + { + _player addItem "Chemlight_blue"; + }; + case east: + { + _player addItem "Chemlight_red"; + }; + case resistance: + { + _player addItem "Chemlight_green"; + }; +}; + if (_player == player) then { thirstLevel = 100; diff --git a/client/functions/playerSpawn.sqf b/client/functions/playerSpawn.sqf index 78134d591..2be978117 100644 --- a/client/functions/playerSpawn.sqf +++ b/client/functions/playerSpawn.sqf @@ -12,7 +12,7 @@ playerSpawning = true; //Teamkiller Kick if (!isNil "pvar_teamKillList" && {playerSide in [BLUFOR,OPFOR]}) then { - if ([pvar_teamKillList, getPlayerUID player, 0] call fn_getFromPairs >= 2) exitWith + if ([pvar_teamKillList, getPlayerUID player, 0] call fn_getFromPairs >= 1) exitWith { player allowDamage false; [player, "AinjPpneMstpSnonWrflDnon"] call switchMoveGlobal; @@ -24,6 +24,7 @@ if (!isNil "pvar_teamKillList" && {playerSide in [BLUFOR,OPFOR]}) then _time = diag_tickTime; waitUntil {scriptDone _msgBox || diag_tickTime - _time >= 20}; + player setVariable ["initComplete", false, true]; endMission "LOSER"; waitUntil {uiNamespace setVariable ["BIS_fnc_guiMessage_status", false]; closeDialog 0; false}; }; @@ -52,6 +53,7 @@ if (!isNil "pvar_teamSwitchList" && playerSide in [BLUFOR,OPFOR]) then _time = diag_tickTime; waitUntil {scriptDone _msgBox || diag_tickTime - _time >= 20}; + player setVariable ["initComplete", false, true]; endMission "LOSER"; waitUntil {uiNamespace setVariable ["BIS_fnc_guiMessage_status", false]; closeDialog 0; false}; }; @@ -95,9 +97,21 @@ if (!isNil "playerData_spawnDir") then player setVelocity [0,0,0]; [player, false] call fn_hideObjectGlobal; +player hideObjectGlobal false; player allowDamage true; 9999 cutText ["", "BLACK IN"]; playerSpawning = false; player setVariable ["playerSpawning", false, true]; + +private["_max_money"]; +_max_money = 300000; + +if (player getVariable ["bmoney", 0] > _max_money) then { + player setVariable ["bmoney", _max_money, true]; +}; + +if (player getVariable ["cmoney", 0] > _max_money) then { + player setVariable ["cmoney", _max_money, true]; +}; \ No newline at end of file diff --git a/client/functions/spawnAction.sqf b/client/functions/spawnAction.sqf index abbc0b6b8..0737bb4f4 100644 --- a/client/functions/spawnAction.sqf +++ b/client/functions/spawnAction.sqf @@ -32,8 +32,12 @@ spawnActionHandle = (_this select 1) spawn _baseMoney = ["A3W_startingMoney", 100] call getPublicVar; player setVariable ["cmoney", _baseMoney, true]; - [MF_ITEMS_CANNED_FOOD, 1] call mf_inventory_add; - [MF_ITEMS_WATER, 1] call mf_inventory_add; + if (["A3W_survivalSystem"] call isConfigOn) then + { + [MF_ITEMS_CANNED_FOOD, 2] call mf_inventory_add; + [MF_ITEMS_WATER, 2] call mf_inventory_add; + }; + [MF_ITEMS_REPAIR_KIT, 1] call mf_inventory_add; }; diff --git a/client/functions/spawnInTown.sqf b/client/functions/spawnInTown.sqf index a868981cb..c228ddd19 100644 --- a/client/functions/spawnInTown.sqf +++ b/client/functions/spawnInTown.sqf @@ -27,7 +27,11 @@ _preload = [_this, 1, false, [false]] call BIS_fnc_param; }; } forEach (call cityList); +player setVariable [_townName, diag_tickTime]; + respawnDialogActive = false; +player setVariable ["respawnDialogActive", false, true]; + closeDialog 0; _townName spawn diff --git a/client/functions/spawnOnBeacon.sqf b/client/functions/spawnOnBeacon.sqf index 53da1ab67..03fec4347 100644 --- a/client/functions/spawnOnBeacon.sqf +++ b/client/functions/spawnOnBeacon.sqf @@ -34,6 +34,8 @@ waitUntil {!isNil "bis_fnc_init" && {bis_fnc_init}}; player setPos _playerPos; respawnDialogActive = false; +player setVariable ["respawnDialogActive", false, true]; + closeDialog 0; _owner spawn diff --git a/client/functions/spawnRandom.sqf b/client/functions/spawnRandom.sqf index b1a216dd4..8a62111c0 100644 --- a/client/functions/spawnRandom.sqf +++ b/client/functions/spawnRandom.sqf @@ -22,6 +22,8 @@ waitUntil {!isNil "bis_fnc_init" && {bis_fnc_init}}; player setPos _playerPos; respawnDialogActive = false; +player setVariable ["respawnDialogActive", false, true]; + closeDialog 0; _townName spawn diff --git a/client/functions/unitHandleDamage.sqf b/client/functions/unitHandleDamage.sqf index 2152254a6..9f32cabec 100644 --- a/client/functions/unitHandleDamage.sqf +++ b/client/functions/unitHandleDamage.sqf @@ -4,7 +4,7 @@ // @file Name: unitHandleDamage.sqf // @file Author: AgentRev -#define IMPACT_DAMAGE_MULTIPLIER 0.5 +#define IMPACT_DAMAGE_MULTIPLIER 0.3 _unit = _this select 0; diff --git a/client/functions/updateTeamKiller.sqf b/client/functions/updateTeamKiller.sqf index d6e0ece05..34305e7e6 100644 --- a/client/functions/updateTeamKiller.sqf +++ b/client/functions/updateTeamKiller.sqf @@ -6,11 +6,6 @@ // @file Author: [404] Deadbeat // @file Created: 20/11/2012 05:19 -if (_this < 2) exitWith -{ - call teamkillMessage; -}; - setPlayerRespawnTime 1e11; player setDamage 1; sleep 1; diff --git a/client/headless/init.sqf b/client/headless/init.sqf index a442eda0d..a24d42b2f 100644 --- a/client/headless/init.sqf +++ b/client/headless/init.sqf @@ -4,4 +4,5 @@ // @file Name: init.sqf // @file Author: AgentRev -execVM "addons\fpsFix\vehicleManagerHC.sqf"; +[] spawn compile preprocessFileLineNumbers "persistence\world\hLoad.sqf"; +[] execVM "addons\fpsFix\vehicleManagerHC.sqf"; diff --git a/client/icons/cocaine.paa b/client/icons/cocaine.paa new file mode 100644 index 000000000..91fa5d7bf Binary files /dev/null and b/client/icons/cocaine.paa differ diff --git a/client/icons/heroin.paa b/client/icons/heroin.paa new file mode 100644 index 000000000..4cd07b453 Binary files /dev/null and b/client/icons/heroin.paa differ diff --git a/client/icons/lsd.paa b/client/icons/lsd.paa new file mode 100644 index 000000000..8df065d45 Binary files /dev/null and b/client/icons/lsd.paa differ diff --git a/client/icons/marijuana.paa b/client/icons/marijuana.paa new file mode 100644 index 000000000..af30abacd Binary files /dev/null and b/client/icons/marijuana.paa differ diff --git a/client/icons/save.paa b/client/icons/save.paa index c46495c0e..8dc41e44c 100644 Binary files a/client/icons/save.paa and b/client/icons/save.paa differ diff --git a/client/images/vehicleTextures/aaf.jpg b/client/images/vehicleTextures/aaf.jpg deleted file mode 100644 index 40f970961..000000000 Binary files a/client/images/vehicleTextures/aaf.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/aaf.paa b/client/images/vehicleTextures/aaf.paa new file mode 100644 index 000000000..3dbba2988 Binary files /dev/null and b/client/images/vehicleTextures/aaf.paa differ diff --git a/client/images/vehicleTextures/bloodshot.paa b/client/images/vehicleTextures/bloodshot.paa new file mode 100644 index 000000000..4f7e6165e Binary files /dev/null and b/client/images/vehicleTextures/bloodshot.paa differ diff --git a/client/images/vehicleTextures/camo_deser.jpg b/client/images/vehicleTextures/camo_deser.jpg deleted file mode 100644 index fd9849079..000000000 Binary files a/client/images/vehicleTextures/camo_deser.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/camo_fack.jpg b/client/images/vehicleTextures/camo_fack.jpg deleted file mode 100644 index e0ced3d61..000000000 Binary files a/client/images/vehicleTextures/camo_fack.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/camo_fuel.jpg b/client/images/vehicleTextures/camo_fuel.jpg deleted file mode 100644 index 1e36b5ae0..000000000 Binary files a/client/images/vehicleTextures/camo_fuel.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/camo_orange.paa b/client/images/vehicleTextures/camo_orange.paa new file mode 100644 index 000000000..604e5f516 Binary files /dev/null and b/client/images/vehicleTextures/camo_orange.paa differ diff --git a/client/images/vehicleTextures/camo_pank.jpg b/client/images/vehicleTextures/camo_pank.jpg deleted file mode 100644 index 619b89f33..000000000 Binary files a/client/images/vehicleTextures/camo_pank.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/camo_pink.paa b/client/images/vehicleTextures/camo_pink.paa new file mode 100644 index 000000000..3c193dfbc Binary files /dev/null and b/client/images/vehicleTextures/camo_pink.paa differ diff --git a/client/images/vehicleTextures/camo_red.paa b/client/images/vehicleTextures/camo_red.paa new file mode 100644 index 000000000..dc6f0eacf Binary files /dev/null and b/client/images/vehicleTextures/camo_red.paa differ diff --git a/client/images/vehicleTextures/carbon.jpg b/client/images/vehicleTextures/carbon.jpg deleted file mode 100644 index 9b1901e4d..000000000 Binary files a/client/images/vehicleTextures/carbon.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/carbon.paa b/client/images/vehicleTextures/carbon.paa new file mode 100644 index 000000000..f869f289f Binary files /dev/null and b/client/images/vehicleTextures/carbon.paa differ diff --git a/client/images/vehicleTextures/confederate.jpg b/client/images/vehicleTextures/confederate.jpg deleted file mode 100644 index ecdb4b246..000000000 Binary files a/client/images/vehicleTextures/confederate.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/confederate.paa b/client/images/vehicleTextures/confederate.paa new file mode 100644 index 000000000..9d486eded Binary files /dev/null and b/client/images/vehicleTextures/confederate.paa differ diff --git a/client/images/vehicleTextures/csat.jpg b/client/images/vehicleTextures/csat.jpg deleted file mode 100644 index fd826dfe6..000000000 Binary files a/client/images/vehicleTextures/csat.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/csat.paa b/client/images/vehicleTextures/csat.paa new file mode 100644 index 000000000..c9ea222c9 Binary files /dev/null and b/client/images/vehicleTextures/csat.paa differ diff --git a/client/images/vehicleTextures/denim.jpg b/client/images/vehicleTextures/denim.jpg deleted file mode 100644 index 071ca1346..000000000 Binary files a/client/images/vehicleTextures/denim.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/digi.paa b/client/images/vehicleTextures/digi.paa new file mode 100644 index 000000000..af5702c67 Binary files /dev/null and b/client/images/vehicleTextures/digi.paa differ diff --git a/client/images/vehicleTextures/digi_black.paa b/client/images/vehicleTextures/digi_black.paa new file mode 100644 index 000000000..b1cd5281c Binary files /dev/null and b/client/images/vehicleTextures/digi_black.paa differ diff --git a/client/images/vehicleTextures/digi_desert.paa b/client/images/vehicleTextures/digi_desert.paa new file mode 100644 index 000000000..db5fd4f8b Binary files /dev/null and b/client/images/vehicleTextures/digi_desert.paa differ diff --git a/client/images/vehicleTextures/digi_wood.paa b/client/images/vehicleTextures/digi_wood.paa new file mode 100644 index 000000000..6e0ff2542 Binary files /dev/null and b/client/images/vehicleTextures/digi_wood.paa differ diff --git a/client/images/vehicleTextures/doritos.paa b/client/images/vehicleTextures/doritos.paa new file mode 100644 index 000000000..7daee20f3 Binary files /dev/null and b/client/images/vehicleTextures/doritos.paa differ diff --git a/client/images/vehicleTextures/drylands.paa b/client/images/vehicleTextures/drylands.paa new file mode 100644 index 000000000..de7cde1b7 Binary files /dev/null and b/client/images/vehicleTextures/drylands.paa differ diff --git a/client/images/vehicleTextures/hellokitty.paa b/client/images/vehicleTextures/hellokitty.paa new file mode 100644 index 000000000..d8edccaa5 Binary files /dev/null and b/client/images/vehicleTextures/hellokitty.paa differ diff --git a/client/images/vehicleTextures/hex.paa b/client/images/vehicleTextures/hex.paa new file mode 100644 index 000000000..435421a0c Binary files /dev/null and b/client/images/vehicleTextures/hex.paa differ diff --git a/client/images/vehicleTextures/hippie.paa b/client/images/vehicleTextures/hippie.paa new file mode 100644 index 000000000..c261fb88c Binary files /dev/null and b/client/images/vehicleTextures/hippie.paa differ diff --git a/client/images/vehicleTextures/isis.paa b/client/images/vehicleTextures/isis.paa new file mode 100644 index 000000000..f8146ba0a Binary files /dev/null and b/client/images/vehicleTextures/isis.paa differ diff --git a/client/images/vehicleTextures/leopard.jpg b/client/images/vehicleTextures/leopard.jpg deleted file mode 100644 index 05e4b878e..000000000 Binary files a/client/images/vehicleTextures/leopard.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/leopard.paa b/client/images/vehicleTextures/leopard.paa new file mode 100644 index 000000000..db2fe0b02 Binary files /dev/null and b/client/images/vehicleTextures/leopard.paa differ diff --git a/client/images/vehicleTextures/mtndew.paa b/client/images/vehicleTextures/mtndew.paa new file mode 100644 index 000000000..4b2bfadf5 Binary files /dev/null and b/client/images/vehicleTextures/mtndew.paa differ diff --git a/client/images/vehicleTextures/murica.jpg b/client/images/vehicleTextures/murica.jpg deleted file mode 100644 index 0715795bc..000000000 Binary files a/client/images/vehicleTextures/murica.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/murica.paa b/client/images/vehicleTextures/murica.paa new file mode 100644 index 000000000..0969b35cb Binary files /dev/null and b/client/images/vehicleTextures/murica.paa differ diff --git a/client/images/vehicleTextures/nato.jpg b/client/images/vehicleTextures/nato.jpg deleted file mode 100644 index c65651e64..000000000 Binary files a/client/images/vehicleTextures/nato.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/nato.paa b/client/images/vehicleTextures/nato.paa new file mode 100644 index 000000000..88607b8f5 Binary files /dev/null and b/client/images/vehicleTextures/nato.paa differ diff --git a/client/images/vehicleTextures/nazi.paa b/client/images/vehicleTextures/nazi.paa new file mode 100644 index 000000000..d329d9e10 Binary files /dev/null and b/client/images/vehicleTextures/nazi.paa differ diff --git a/client/images/vehicleTextures/pride.paa b/client/images/vehicleTextures/pride.paa new file mode 100644 index 000000000..8b9be0b2e Binary files /dev/null and b/client/images/vehicleTextures/pride.paa differ diff --git a/client/images/vehicleTextures/psych.jpg b/client/images/vehicleTextures/psych.jpg deleted file mode 100644 index 34f2d11d5..000000000 Binary files a/client/images/vehicleTextures/psych.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/rainbow.jpg b/client/images/vehicleTextures/rainbow.jpg deleted file mode 100644 index 9d581858a..000000000 Binary files a/client/images/vehicleTextures/rainbow.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/rusty.jpg b/client/images/vehicleTextures/rusty.jpg deleted file mode 100644 index 7fe462258..000000000 Binary files a/client/images/vehicleTextures/rusty.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/rusty.paa b/client/images/vehicleTextures/rusty.paa new file mode 100644 index 000000000..232d56ad0 Binary files /dev/null and b/client/images/vehicleTextures/rusty.paa differ diff --git a/client/images/vehicleTextures/sand.paa b/client/images/vehicleTextures/sand.paa new file mode 100644 index 000000000..88cee6f41 Binary files /dev/null and b/client/images/vehicleTextures/sand.paa differ diff --git a/client/images/vehicleTextures/snake.paa b/client/images/vehicleTextures/snake.paa new file mode 100644 index 000000000..b46b71fdf Binary files /dev/null and b/client/images/vehicleTextures/snake.paa differ diff --git a/client/images/vehicleTextures/stripes.paa b/client/images/vehicleTextures/stripes.paa new file mode 100644 index 000000000..a6578187f Binary files /dev/null and b/client/images/vehicleTextures/stripes.paa differ diff --git a/client/images/vehicleTextures/stripes2.paa b/client/images/vehicleTextures/stripes2.paa new file mode 100644 index 000000000..d687ff127 Binary files /dev/null and b/client/images/vehicleTextures/stripes2.paa differ diff --git a/client/images/vehicleTextures/stripes3.paa b/client/images/vehicleTextures/stripes3.paa new file mode 100644 index 000000000..d7a9c447b Binary files /dev/null and b/client/images/vehicleTextures/stripes3.paa differ diff --git a/client/images/vehicleTextures/swamp.paa b/client/images/vehicleTextures/swamp.paa new file mode 100644 index 000000000..39deec054 Binary files /dev/null and b/client/images/vehicleTextures/swamp.paa differ diff --git a/client/images/vehicleTextures/tiger.paa b/client/images/vehicleTextures/tiger.paa new file mode 100644 index 000000000..f3386d225 Binary files /dev/null and b/client/images/vehicleTextures/tiger.paa differ diff --git a/client/images/vehicleTextures/unionjack.jpg b/client/images/vehicleTextures/unionjack.jpg deleted file mode 100644 index f38033b78..000000000 Binary files a/client/images/vehicleTextures/unionjack.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/unionjack.paa b/client/images/vehicleTextures/unionjack.paa new file mode 100644 index 000000000..2f679c5b0 Binary files /dev/null and b/client/images/vehicleTextures/unionjack.paa differ diff --git a/client/images/vehicleTextures/urban.paa b/client/images/vehicleTextures/urban.paa new file mode 100644 index 000000000..ba2c2ffa0 Binary files /dev/null and b/client/images/vehicleTextures/urban.paa differ diff --git a/client/images/vehicleTextures/weed.jpg b/client/images/vehicleTextures/weed.jpg deleted file mode 100644 index 55a8b3eb6..000000000 Binary files a/client/images/vehicleTextures/weed.jpg and /dev/null differ diff --git a/client/images/vehicleTextures/weed.paa b/client/images/vehicleTextures/weed.paa new file mode 100644 index 000000000..80c138ab7 Binary files /dev/null and b/client/images/vehicleTextures/weed.paa differ diff --git a/client/images/vehicleTextures/wooddark.paa b/client/images/vehicleTextures/wooddark.paa new file mode 100644 index 000000000..5a895a486 Binary files /dev/null and b/client/images/vehicleTextures/wooddark.paa differ diff --git a/client/images/vehicleTextures/woodland.paa b/client/images/vehicleTextures/woodland.paa new file mode 100644 index 000000000..6bb30c66b Binary files /dev/null and b/client/images/vehicleTextures/woodland.paa differ diff --git a/client/images/vehicleTextures/woodtiger.paa b/client/images/vehicleTextures/woodtiger.paa new file mode 100644 index 000000000..813f2b381 Binary files /dev/null and b/client/images/vehicleTextures/woodtiger.paa differ diff --git a/client/init.sqf b/client/init.sqf index 8c4d05f69..148078cab 100644 --- a/client/init.sqf +++ b/client/init.sqf @@ -21,10 +21,14 @@ waitUntil {!isNil "A3W_serverSetupComplete"}; showPlayerIcons = true; mutexScriptInProgress = false; respawnDialogActive = false; +player setVariable ["respawnDialogActive", false, true]; groupManagmentActive = false; pvar_PlayerTeamKiller = objNull; doCancelAction = false; +//AJ Beacondetector +BeaconScanInProgress = false; + //Initialization Variables playerCompiledScripts = false; playerSetupComplete = false; @@ -69,7 +73,7 @@ player setVariable ["cmoney", _baseMoney, true]; // Player saving - load data if (["A3W_playerSaving"] call isConfigOn) then { - call compile preprocessFileLineNumbers "persistence\client\players\setupPlayerDB.sqf"; + call compile preprocessFileLineNumbers "persistence\players\c_setupPlayerDB.sqf"; call fn_requestPlayerData; waitUntil {!isNil "playerData_loaded"}; @@ -117,7 +121,11 @@ call compile preprocessFileLineNumbers "client\functions\setupClientPVars.sqf"; //client Executes A3W_scriptThreads pushBack execVM "client\systems\hud\playerHud.sqf"; -[] execVM "client\functions\initSurvival.sqf"; + +if (["A3W_survivalSystem"] call isConfigOn) then +{ + execVM "client\functions\initSurvival.sqf"; +}; [] spawn { @@ -134,11 +142,16 @@ A3W_scriptThreads pushBack execVM "addons\Lootspawner\LSclientScan.sqf"; [] execVM "addons\far_revive\FAR_revive_init.sqf"; [] execVM "addons\camera\functions.sqf"; [] execVM "addons\UAV_Control\functions.sqf"; +[] execVM "addons\cctv\functions.sqf"; +[] execVM "addons\water_edge\functions.sqf"; +[] execVM "addons\boomerang\functions.sqf"; + + call compile preprocessFileLineNumbers "client\functions\generateAtmArray.sqf"; [] execVM "client\functions\drawPlayerMarkers.sqf"; -// update player's spawn beaoon +// update player's spawn beacon { if (_x getVariable ["ownerUID",""] == getPlayerUID player) then { @@ -147,8 +160,9 @@ call compile preprocessFileLineNumbers "client\functions\generateAtmArray.sqf"; }; } forEach pvar_spawn_beacons; +{ _x call A3W_fnc_setupAntiExplode } forEach allMissionObjects "LandVehicle"; +{ _x call A3W_fnc_setupAntiExplode } forEach allMissionObjects "Ship"; { _x call A3W_fnc_setupAntiExplode } forEach allMissionObjects "Air"; -{ _x call A3W_fnc_setupAntiExplode } forEach allMissionObjects "UGV_01_base_F"; { { diff --git a/client/inventory/add.sqf b/client/inventory/add.sqf index df738c779..600383577 100644 --- a/client/inventory/add.sqf +++ b/client/inventory/add.sqf @@ -33,9 +33,17 @@ if (count _this > 2) then { }; private ["_item", "_current"]; _item = _id call mf_inventory_get; + +if (isNil "_item" || {typeName _item != typeName []}) exitWith { + diag_log format["WARNING: Item ID ""%1"" is unknown, not adding to inventory", _id]; +}; + _current = _item select QTY; if (_abs) then { _item set [QTY, _qty]; } else { _item set [QTY, _current + _qty]; }; + +trackMyInventory = [player, mf_inventory]; +publicVariableServer "trackMyInventory"; diff --git a/client/inventory/drop.sqf b/client/inventory/drop.sqf index 821605e06..4064009b3 100644 --- a/client/inventory/drop.sqf +++ b/client/inventory/drop.sqf @@ -55,5 +55,7 @@ else _obj setDir random 360; _obj setVariable ["mf_item_id", _id, true]; [_id, 1] call mf_inventory_remove; - _obj }; + +if (isNil "_obj") exitWith {nil}; +_obj \ No newline at end of file diff --git a/client/inventory/remove.sqf b/client/inventory/remove.sqf index 4e559ddbe..9ddc4daef 100644 --- a/client/inventory/remove.sqf +++ b/client/inventory/remove.sqf @@ -20,3 +20,6 @@ private ["_item", "_current"]; _item = _id call mf_inventory_get; _current = _item select QTY; _item set [QTY, _current - _qty]; + +trackMyInventory = [player, mf_inventory]; +publicVariableServer "trackMyInventory"; \ No newline at end of file diff --git a/client/inventory/set.sqf b/client/inventory/set.sqf index b743fe9a7..8bc9a7c14 100644 --- a/client/inventory/set.sqf +++ b/client/inventory/set.sqf @@ -33,3 +33,6 @@ _done = false; if (!_done) then { _new pushBack _this }; mf_inventory = _new; + +trackMyInventory = [player, mf_inventory]; +publicVariableServer "trackMyInventory"; diff --git a/client/inventory/takeable.sqf b/client/inventory/takeable.sqf index 2cdf4e554..b707a1b74 100644 --- a/client/inventory/takeable.sqf +++ b/client/inventory/takeable.sqf @@ -30,9 +30,11 @@ _takeable = objNull; switch (true) do { case (_lineOfSightBroken): {}; + case (_x getVariable ["objectLocked", false]): {}; case (_id call mf_inventory_is_full): {}; case (_x getVariable ["mf_item_id", ""] != _id): {}; default {_takeable = _x}; }; + } forEach (nearestObjects [player, [_type], MF_INVENTORY_TAKE_DISTANCE]); _takeable; diff --git a/client/items/atm/deposit.sqf b/client/items/atm/deposit.sqf index 1463296cb..f93d480b3 100644 --- a/client/items/atm/deposit.sqf +++ b/client/items/atm/deposit.sqf @@ -46,3 +46,5 @@ _input ctrlSetText (_amount call fn_numToStr); pvar_processTransaction = ["atm", player, _amount]; publicVariableServer "pvar_processTransaction"; + +closeDialog 0; diff --git a/client/items/atm/refresh.sqf b/client/items/atm/refresh.sqf index 4d5ea2b65..de2a1f529 100644 --- a/client/items/atm/refresh.sqf +++ b/client/items/atm/refresh.sqf @@ -17,7 +17,7 @@ if (isNull _dialog) exitWith {}; _accDropdown = _dialog displayCtrl AtmAccountDropdown_IDC; -_players = call allPlayers; +_players = call fn_allPlayers; if !(["A3W_atmTransferAllTeams"] call isConfigOn) then { diff --git a/client/items/atm/transfer.sqf b/client/items/atm/transfer.sqf index 13a9ade45..f86c632bd 100644 --- a/client/items/atm/transfer.sqf +++ b/client/items/atm/transfer.sqf @@ -103,3 +103,5 @@ format [MSG_CONFIRM_LINE3, [_total] call fn_numbersText]; { if (!ctrlEnabled _x) then { _x ctrlEnable true } } forEach _controls; }; + +closeDialog 0; \ No newline at end of file diff --git a/client/items/atm/withdraw.sqf b/client/items/atm/withdraw.sqf index 87fd031b2..38f2b7921 100644 --- a/client/items/atm/withdraw.sqf +++ b/client/items/atm/withdraw.sqf @@ -29,3 +29,5 @@ if (player getVariable ["bmoney", 0] < _amount) exitWith pvar_processTransaction = ["atm", player, -_amount]; publicVariableServer "pvar_processTransaction"; + +closeDialog 0; \ No newline at end of file diff --git a/client/items/beacon/deleteBeacon.sqf b/client/items/beacon/deleteBeacon.sqf new file mode 100644 index 000000000..b7f24fa7e --- /dev/null +++ b/client/items/beacon/deleteBeacon.sqf @@ -0,0 +1,31 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +//@file Version: 1.0 +//@file Name: deleteBeacon.sqf +//@file Author: LouD/Apoc +//@file Description: Delete a Spawn Beacon + +_MaxSpawnbeacons = ceil (["A3W_maxSpawnBeacons", 5] call getPublicVar); +#define MAX_BEACONS format ["You cannot deploy more then %1 spawnbeacons.", [_MaxSpawnbeacons]] +_confirmMsg = MAX_BEACONS + format ["
Press delete to remove a random spawnbeacon."]; + +_beacons = []; +{ + if (_x getVariable ["ownerUID",""] == getPlayerUID player) then + { + _beacons pushBack _x; + }; +} forEach pvar_spawn_beacons; + +// Display confirm message +if ([parseText _confirmMsg, "DELETE BEACON", "Delete", true] call BIS_fnc_guiMessage) then +{ + _oldBeacon = _beacons select 0; + + pvar_spawn_beacons = pvar_spawn_beacons - [_oldBeacon]; + publicVariable "pvar_spawn_beacons"; + pvar_manualObjectDelete = [netId _oldBeacon, _oldBeacon getVariable "A3W_objectID"]; + publicVariableServer "pvar_manualObjectDelete"; + deleteVehicle _oldBeacon; +}; \ No newline at end of file diff --git a/client/items/beacon/deploy.sqf b/client/items/beacon/deploy.sqf index a233f2d2d..0343e32e2 100644 --- a/client/items/beacon/deploy.sqf +++ b/client/items/beacon/deploy.sqf @@ -11,7 +11,22 @@ #define ANIM "AinvPknlMstpSlayWrflDnon_medic" #define ERR_CANCELLED "Action Cancelled" #define ERR_IN_VEHICLE "Action Failed! You can't do this in a vehicle" -private ["_hasFailed", "_success","_pos","_uid","_beacon"]; +#define MAX_BEACONS format ["You cannot deploy more then %1 spawnbeacons", [_MaxSpawnbeacons]] +_MaxSpawnbeacons = ceil (["A3W_maxSpawnBeacons", 5] call getPublicVar); + +private ["_hasFailed", "_success","_pos","_uid","_beacon","_beacons","_ownedBeacons"]; + +_beacons = []; +{ + if (_x getVariable ["ownerUID",""] == getPlayerUID player) then + { + _beacons pushBack _x; + }; +} forEach pvar_spawn_beacons; + +_ownedBeacons = count _beacons; + + _hasFailed = { private ["_progress", "_failed", "_text"]; _progress = _this select 0; @@ -20,6 +35,7 @@ _hasFailed = { case (!alive player): {}; case (doCancelAction) :{doCancelAction = false; _text = ERR_CANCELLED;}; case (vehicle player != player): {_text = ERR_IN_VEHICLE}; + case (_ownedBeacons >= _MaxSpawnbeacons): {_text = MAX_BEACONS; player spawn deleteBeacon}; default { _text = format["Spawn Beacon %1%2 Deployed", round(_progress*100), "%"]; _failed = false; @@ -50,9 +66,10 @@ if (_success) then { pvar_spawn_beacons pushBack _beacon; publicVariable "pvar_spawn_beacons"; - pvar_manualObjectSave = netId _beacon; - publicVariableServer "pvar_manualObjectSave"; + + trackObject = _beacon; + publicVariableServer "trackObject"; + ["You placed the Spawn Beacon successfully!", 5] call mf_notify_client; }; _success; - diff --git a/client/items/beacon/init.sqf b/client/items/beacon/init.sqf index 15290573f..8f9c30b79 100644 --- a/client/items/beacon/init.sqf +++ b/client/items/beacon/init.sqf @@ -13,7 +13,7 @@ MF_ITEMS_SPAWN_BEACON_PATH = _this; MF_ITEMS_SPAWN_BEACON = "spawnbeacon"; -MF_ITEMS_SPAWN_BEACON_DEPLOYED_TYPE = "Land_TentDome_F"; +MF_ITEMS_SPAWN_BEACON_DEPLOYED_TYPE = "Land_Sleeping_bag_folded_F"; MF_ITEMS_SPAWN_BEACON_STEAL_DURATION = 60; MF_ITEMS_SPAWN_BEACON_DURATION = 30; _deploy = build("deploy.sqf"); diff --git a/client/items/beacon/pack.sqf b/client/items/beacon/pack.sqf index e113322d7..ac8f31892 100644 --- a/client/items/beacon/pack.sqf +++ b/client/items/beacon/pack.sqf @@ -43,6 +43,10 @@ _success = [DURATION, ANIM, _hasFailed, [_beacon]] call a3w_actions_start; if (_success) then { pvar_spawn_beacons = pvar_spawn_beacons - [_beacon]; + + untrackObject = _beacon; + publicVariableServer "untrackObject"; + publicVariable "pvar_spawn_beacons"; pvar_manualObjectDelete = [netId _beacon, _beacon getVariable "A3W_objectID"]; publicVariableServer "pvar_manualObjectDelete"; diff --git a/client/items/boomerang/init.sqf b/client/items/boomerang/init.sqf new file mode 100644 index 000000000..e1a70f08e --- /dev/null +++ b/client/items/boomerang/init.sqf @@ -0,0 +1,18 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +//@file Version: 1.0 +//@file Name: init.sqf +//@file Author: micovery +//@file Argument: the path to the directory holding this file. + +private ["_path"]; +_path = _this; + +private["_h"]; +_h = [] execVM "addons\boomerang\config.sqf"; +waitUntil {scriptDone _h;}; + + +[MF_ITEMS_BOOMERANG_TERMINAL, "Boomerang Terminal", {_this call boomerang_toggle_hud}, MF_ITEMS_BOOMERANG_TERMINAL_TYPE, MF_ITEMS_BOOMERANG_TERMINAL_ICON, boomerang_max_inventory_terminals] call mf_inventory_create; +[MF_ITEMS_BOOMERANG_STATION, "Boomerang Station", {_this call boomerang_station_use}, MF_ITEMS_BOOMERANG_STATION_TYPE, MF_ITEMS_BOOMERANG_STATION_ICON, boomerang_max_inventory_stations] call mf_inventory_create; \ No newline at end of file diff --git a/client/items/cctv/init.sqf b/client/items/cctv/init.sqf new file mode 100644 index 000000000..dee648e0f --- /dev/null +++ b/client/items/cctv/init.sqf @@ -0,0 +1,24 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +//@file Version: 1.0 +//@file Name: init.sqf +//@file Author: micovery +//@file Argument: the path to the directory holding this file. + +private ["_path"]; +_path = _this; + +private["_h"]; +_h = [] execVM "addons\cctv\config.sqf"; +waitUntil {scriptDone _h;}; + +MF_ITEMS_CCTV_CAMERA = "cctv_camera"; +MF_ITEMS_CCTV_CAMERA_TYPE = "Land_HandyCam_F"; +MF_ITEMS_CCTV_CAMERA_ICON = "addons\cctv\icons\camcorder.paa"; +[MF_ITEMS_CCTV_CAMERA, "IP/Net Camera",{_this call cctv_camera_use},MF_ITEMS_CCTV_CAMERA_TYPE, MF_ITEMS_CCTV_CAMERA_ICON, cctv_max_inventory_cameras] call mf_inventory_create; + +MF_ITEMS_CCTV_BASE = "cctv_base"; +MF_ITEMS_CCTV_BASE_TYPE = "Land_Laptop_unfolded_F"; +MF_ITEMS_CCTV_BASE_ICON = "addons\cctv\icons\laptop.paa"; +[MF_ITEMS_CCTV_BASE, "Camera Terminal", {_this call cctv_base_use}, MF_ITEMS_CCTV_BASE_TYPE, MF_ITEMS_CCTV_BASE_ICON, cctv_max_inventory_base_stations] call mf_inventory_create; \ No newline at end of file diff --git a/client/items/drugs/functions.sqf b/client/items/drugs/functions.sqf new file mode 100644 index 000000000..fe3290bca --- /dev/null +++ b/client/items/drugs/functions.sqf @@ -0,0 +1,217 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +//@file Version: 1.0 +//@file Name: functions.sqf +//@file Author: micovery +//@file Description: Drug effects + +drug_lsd_effects = { _this spawn { + private["_player", "_duration"]; + _player = _this select 0; + _duration = _this select 1; + + + private["_effect1","_effect2"]; + _effect1 = ppEffectCreate ["WetDistortion",300]; + _effect1 ppEffectEnable true; + _effect1 ppEffectAdjust [0.5,1,1,4.1,3.7,2.5,1.85,0.0051,0.0051,0.0051,0.0051,0.5,0.3,10,6.0]; + _effect1 ppEffectCommit 5; + + _effect2 = ppEffectCreate ["chromAberration",200]; + _effect2 ppEffectEnable true; + _effect2 ppEffectAdjust [0.2,0.2,true]; + _effect2 ppEffectCommit 1; + + + private["_ps1"]; + _ps1 = "#particlesource" createVehicleLocal getPos _player; + _ps1 setParticleCircle [0,[0,0,0]]; + + _ps1 setParticleRandom [0,[2,2,2],[0.2,0.2,3],1, 3,[0,0,0,0],0.01,0.03]; + _ps1 setParticleParams ["\a3\animals_f\butterfly","","SpaceObject",1,5,[0,0,-0.5],[0,0,0],0,1.275,1,0,[1,1],[[0,1,0 ,1],[0,1,0 ,1],[0,1,0 ,1]],[0,0],0,0,"","",_player]; + + _ps1 setDropInterval 0.35; + + + playMusic ["LeadTrack03_F_Bootcamp", 0]; + + _duration = _duration/2; + private["_timeout"]; + _timeout = time + _duration; + waitUntil { + private["_position","_weite"]; + _position = getPos _player; + _weite = 100; + + private["_x","_y","_z"]; + _x = _position select 0; + _y = _position select 1; + _z = _position select 2; + + private["_w1","_w2","_w3"]; + _w1 = (random _weite) - (random _weite); + _w2 = (random _weite) - (random _weite); + _w3 = random 7; + + private["_f1","_f2","_f3"]; + _f1 = random 1; + _f2 = random 1; + _f3 = random 1; + + private["_g1","_g2","_g3"]; + _g1 = random 5; + _g2 = random 10; + _g3 = random 5; + + private["_v1","_v2","_v3"]; + _v1 = random 0.05; + _v2 = random 0.05; + _v3 = 0.1 - random 0.075; + private["_index"]; + _index = [1,6,7,8,13] select floor(random 5); + drop [["\A3\data_f\ParticleEffects\Universal\Universal",16,12,_index,0], "","Billboard",1,_duration,[_x + _w1,_y + _w2,_z + _w3],[_v1,_v2,_v3],1,1.275,1,0,[_g1,_g2,_g3],[ [_f1,_f2,_f3,1],[_f2,_f1,_f3,1],[_f3,_f2,_f1,1] ],[1000],3,0.2,"","",""]; + + sleep 0.05; + (time > _timeout) + }; + + sleep _duration; + playMusic ""; + ppEffectDestroy _effect1; + ppEffectDestroy _effect2; + deleteVehicle _ps1; + +};}; + + +drug_marijuana_effects = { _this spawn { + private["_player", "_duration"]; + _player = _this select 0; + _duration = _this select 1; + + + private["_shell"]; + _shell = "SmokeShellGreen" createVehicleLocal position _player; + _shell attachTo [(vehicle _player),[0,0,0]]; + + private["_effect1","_effect2"]; + _effect1 = ppEffectCreate ["colorCorrections",1501]; + _effect1 ppEffectEnable true; + + _effect2 = ppEffectCreate ["chromAberration",200]; + _effect2 ppEffectEnable true; + + + private["_ps1"]; + _ps1 = "#particlesource" createVehicleLocal getPos _player; + _ps1 setParticleCircle [0,[0,0,0]]; + + _ps1 setParticleRandom [0,[2,2,2],[0.2,0.2,3],1, 3,[0,0,0,0],0.01,0.03]; + _ps1 setParticleParams ["\a3\animals_f\butterfly","","SpaceObject",1,5,[0,0,-0.5],[0,0,0],0,1.275,1,0,[1,1],[[0,1,0 ,1],[0,1,0 ,1],[0,1,0 ,1]],[0,0],0,0,"","",_player]; + + _ps1 setDropInterval 0.35; + + playMusic ["defcon", 0]; + enableEnvironment false; + + _player enableFatigue true; + private["_timeout"]; + _timeout = time + _duration; + + waitUntil { + _effect1 ppEffectAdjust [1,1,0,[0,0,0,0.5],[0.9 + (random 10)/100, 0.60 + (random 20)/100, 0.15 + (random 10)/100, random 1], [0.5 +(random 40)/100, 0.75 + (random 10)/100, 0.01 + (random 10)/100, random 1]]; + _effect1 ppEffectCommit 1; + + _effect2 ppEffectAdjust [0.01,0.01,true]; + _effect2 ppEffectCommit 1; + _player setFatigue 1; + + (random 3) fadeMusic (random 1); + sleep 3; + (time > _timeout) + }; + + _player setFatigue 0; + _player enableFatigue false; + enableEnvironment true; + playMusic ""; + deleteVehicle _shell; + ppEffectDestroy _effect1; + ppEffectDestroy _effect2; + deleteVehicle _ps1; +};}; + +drug_cocaine_effects = { _this spawn { + private["_player", "_duration"]; + _player = _this select 0; + _duration = _this select 1; + + + private["_effect1","_force"]; + _effect1 = ppEffectCreate ["chromAberration",200]; + _effect1 ppEffectEnable true; + + playMusic ["BackgroundTrack03_F", 0]; + + + private["_timeout"]; + _timeout = time + _duration; + waitUntil { + _force = random 10; + _effect1 ppEffectAdjust [_force / 24,_force / 24,false]; + _effect1 ppEffectCommit (0.3 + random 0.1); + waituntil {ppEffectCommitted _effect1}; + (time > _timeout) + }; + + playMusic ""; + ppEffectDestroy _effect1; +};}; + + + +drug_heroin_effects = { _this spawn { + private["_player", "_duration"]; + _player = _this select 0; + _duration = _this select 1; + + + + private["_effect1","_effect2"]; + _effect1 = ppEffectCreate ["RadialBlur",37]; + _effect1 ppEffectEnable true; + + _effect2 = ppEffectCreate ["chromAberration",200]; + _effect2 ppEffectEnable true; + + playMusic ["LeadTrack03a_F_EPB", 0]; + _player enableFatigue true; + + private["_timeout"]; + _timeout = time + _duration; + waitUntil { + + _effect2 ppEffectAdjust [random 0.1,random 0.1,true]; + _effect2 ppEffectCommit 3; + _player setFatigue 1; + + 3 setFog (random 1); + if ((random 100) < 5) then { + waituntil { + addCamShake [random 10,random 1,random 3]; + ppEffectCommitted _effect2 + }; + }; + (time > _timeout) + }; + + 3 setFog 0; + playMusic ""; + _player setFatigue 0; + _player enableFatigue false; + ppEffectDestroy _effect1; + ppEffectDestroy _effect2; +};}; + + diff --git a/client/items/drugs/init.sqf b/client/items/drugs/init.sqf new file mode 100644 index 000000000..c691246e9 --- /dev/null +++ b/client/items/drugs/init.sqf @@ -0,0 +1,32 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +//@file Version: 1.0 +//@file Name: init.sqf +//@file Author: micovery +//@file Argument: the path to the directory holding this file. +private ["_path"]; +_path = _this; + +call compile preprocessFileLineNumbers format["%1\functions.sqf", _path]; + +MF_ITEMS_LSD = "lsd"; +MF_ITEMS_LSD_TYPE = "Land_WaterPurificationTablets_F"; +MF_ITEMS_LSD_ICON = "client\icons\lsd.paa"; +[MF_ITEMS_LSD, "LSD", {[player,60] call drug_lsd_effects; true}, MF_ITEMS_LSD_TYPE, MF_ITEMS_LSD_ICON, 15] call mf_inventory_create; + +MF_ITEMS_MARIJUANA = "marijuana"; +MF_ITEMS_MARIJUANA_TYPE = "Land_VitaminBottle_F"; +MF_ITEMS_MARIJUANA_ICON = "client\icons\marijuana.paa"; +[MF_ITEMS_MARIJUANA, "Marijuana", {[player,90] call drug_marijuana_effects; true}, MF_ITEMS_MARIJUANA_TYPE, MF_ITEMS_MARIJUANA_ICON, 15] call mf_inventory_create; + + +MF_ITEMS_COCAINE = "cocaine"; +MF_ITEMS_COCAINE_TYPE = "Land_PowderedMilk_F"; +MF_ITEMS_COCAINE_ICON = "client\icons\cocaine.paa"; +[MF_ITEMS_COCAINE, "Cocaine", {[player,90] call drug_cocaine_effects; true}, MF_ITEMS_COCAINE_TYPE, MF_ITEMS_COCAINE_ICON, 15] call mf_inventory_create; + +MF_ITEMS_HEROIN = "heroin"; +MF_ITEMS_HEROIN_TYPE = "Land_PainKillers_F"; +MF_ITEMS_HEROIN_ICON = "client\icons\heroin.paa"; +[MF_ITEMS_HEROIN, "Heroin", {[player,60] call drug_heroin_effects; true}, MF_ITEMS_HEROIN_TYPE, MF_ITEMS_HEROIN_ICON, 15] call mf_inventory_create; \ No newline at end of file diff --git a/client/items/init.sqf b/client/items/init.sqf index d96cf1ab2..0f5a0e326 100644 --- a/client/items/init.sqf +++ b/client/items/init.sqf @@ -15,6 +15,11 @@ [_this, "camonet"] call mf_init; [_this, "warchest"] call mf_init; [_this, "cratemoney"] call mf_init; +[_this, "drugs"] call mf_init; +[_this, "cctv"] call mf_init; +[_this, "boomerang"] call mf_init; + + if (["A3W_atmEnabled"] call isConfigOn) then { diff --git a/client/items/warchest/deploy.sqf b/client/items/warchest/deploy.sqf index 59c110953..ad4753690 100644 --- a/client/items/warchest/deploy.sqf +++ b/client/items/warchest/deploy.sqf @@ -40,5 +40,8 @@ if (_success) then { pvar_manualObjectSave = netId _warchest; publicVariableServer "pvar_manualObjectSave"; ["Warchest Deployed!", 5] call mf_notify_client; + + trackObject = _warchest; + publicVariableServer "trackObject"; }; _success; diff --git a/client/items/warchest/pack.sqf b/client/items/warchest/pack.sqf index 71169fbf8..bc9f3d23e 100644 --- a/client/items/warchest/pack.sqf +++ b/client/items/warchest/pack.sqf @@ -44,4 +44,7 @@ if (_success) then { deleteVehicle _warchest; [MF_ITEMS_WARCHEST, 1] call mf_inventory_add; ["You successfully packed the Warchest", 5] call mf_notify_client; + + untrackObject = _warchest; + publicVariableServer "untrackObject"; }; diff --git a/client/systems/adminPanel/checkAdmin.sqf b/client/systems/adminPanel/checkAdmin.sqf index 25118488b..46ebaefd4 100644 --- a/client/systems/adminPanel/checkAdmin.sqf +++ b/client/systems/adminPanel/checkAdmin.sqf @@ -22,12 +22,12 @@ switch (true) do case ([_uid, highAdmins] call isAdmin): { execVM "client\systems\adminPanel\loadAdministratorMenu.sqf"; - hint "Welcome High Admin"; + hint "Welcome Admin"; }; case ([_uid, lowAdmins] call isAdmin): { execVM "client\systems\adminPanel\loadModeratorMenu.sqf"; - hint "Welcome Low Admin"; + hint "Welcome Moderator"; }; case (serverCommandAvailable "#kick"): { diff --git a/client/systems/adminPanel/dialog/playerMenu.hpp b/client/systems/adminPanel/dialog/playerMenu.hpp index dbfd16f0b..b9df946cd 100644 --- a/client/systems/adminPanel/dialog/playerMenu.hpp +++ b/client/systems/adminPanel/dialog/playerMenu.hpp @@ -170,7 +170,7 @@ class PlayersMenu h = 0.04 * safezoneH; }; - class SlayButton: w_RscButton + /*class SlayButton: w_RscButton { idc = -1; text = "Slay"; @@ -179,7 +179,7 @@ class PlayersMenu y = 0.748 * safezoneH + safezoneY; w = 0.05 * safezoneW; h = 0.04 * safezoneH; - }; + };*/ class UnlockTeamSwitchButton: w_RscButton { diff --git a/client/systems/adminPanel/loadAdministratorMenu.sqf b/client/systems/adminPanel/loadAdministratorMenu.sqf index f2ff408d2..e9420a2e5 100644 --- a/client/systems/adminPanel/loadAdministratorMenu.sqf +++ b/client/systems/adminPanel/loadAdministratorMenu.sqf @@ -19,8 +19,8 @@ if ([_uid, 2] call isAdmin) then { _adminSelect = _displayAdmin displayCtrl adminMenu_option; _panelOptions = ["Player Management", - "Vehicle Management", - "Tags" + "Show Server FPS", + "Debug Menu" ]; { diff --git a/client/systems/adminPanel/loadDebugMenu.sqf b/client/systems/adminPanel/loadDebugMenu.sqf index 0a6358318..dfdd798eb 100644 --- a/client/systems/adminPanel/loadDebugMenu.sqf +++ b/client/systems/adminPanel/loadDebugMenu.sqf @@ -19,13 +19,12 @@ if (_uid call isAdmin) then _displayDebug = uiNamespace getVariable "DebugMenu"; _debugSelect = _displayDebug displayCtrl debugMenu_option; - _panelOptions = ["Access Gun Store", + _panelOptions = ["Teleport - Displays Use!", + "Money - Displays Use!", + "God-mode - Displays Use!", + "Access Gun Store", "Access General Store", - "Access Vehicle Store", - "Access ATM Dialog", - "Access Respawn Dialog", - "Access Proving Grounds", - "Show Server FPS" + "Access ATM Dialog" ]; { diff --git a/client/systems/adminPanel/loadModeratorMenu.sqf b/client/systems/adminPanel/loadModeratorMenu.sqf index 01b31b21e..da0c19e31 100644 --- a/client/systems/adminPanel/loadModeratorMenu.sqf +++ b/client/systems/adminPanel/loadModeratorMenu.sqf @@ -19,7 +19,7 @@ if ([_uid, 1] call isAdmin) then { _adminSelect = _displayAdmin displayCtrl adminMenu_option; _panelOptions = ["Player Management", - "Vehicle Management" + "Show Server FPS" ]; { diff --git a/client/systems/adminPanel/loadServerAdministratorMenu.sqf b/client/systems/adminPanel/loadServerAdministratorMenu.sqf index 4d7c359c6..d7baea556 100644 --- a/client/systems/adminPanel/loadServerAdministratorMenu.sqf +++ b/client/systems/adminPanel/loadServerAdministratorMenu.sqf @@ -19,13 +19,13 @@ if ([_uid, 3] call isAdmin) then { _adminSelect = _displayAdmin displayCtrl adminMenu_option; _panelOptions = ["Player Management", + "Show Server FPS", + "Debug Menu", "Vehicle Management", - "Player Markers", - "Teleport", - "Money", - "Debug Menu", + "Access Vehicle Store", "Object Search", - "Toggle God-mode" + "Teleport", + "God-mode" ]; { diff --git a/client/systems/adminPanel/optionSelect.sqf b/client/systems/adminPanel/optionSelect.sqf index 1225b51f2..556dbda8c 100644 --- a/client/systems/adminPanel/optionSelect.sqf +++ b/client/systems/adminPanel/optionSelect.sqf @@ -32,46 +32,45 @@ if (_uid call isAdmin) then closeDialog 0; execVM "client\systems\adminPanel\playerMenu.sqf"; }; - case 1: //Full Vehicle Management + case 1: //Show server FPS function + { + hint format["Server FPS: %1",serverFPS]; + }; + case 2: //Debug Menu + { + closeDialog 0; + execVM "client\systems\adminPanel\loadDebugMenu.sqf"; + }; + case 3: //Full Vehicle Management { closeDialog 0; execVM "client\systems\adminPanel\vehicleManagement.sqf"; }; - case 2: //Tags + case 4: //Access Vehicle Store { - execVM "client\systems\adminPanel\playerTags.sqf"; + closeDialog 0; + [] call loadVehicleStore; + }; + case 5: //Object search menu + { + closeDialog 0; + execVM "client\systems\adminPanel\loadObjectSearch.sqf"; }; - case 3: //Teleport + case 6: //Teleport { closeDialog 0; ["A3W_teleport", "onMapSingleClick", { vehicle player setPos _pos; - if (!isNil "notifyAdminMenu") then { ["teleport", _pos] spawn notifyAdminMenu }; + if (!isNil "notifyAdminMenu") then { ["teleport2", _pos] spawn notifyAdminMenu }; ["A3W_teleport", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; true }] call BIS_fnc_addStackedEventHandler; hint "Click on map to teleport"; }; - case 4: //Money + case 7: //// toggle God mode { - _money = 5000; - player setVariable ["cmoney", (player getVariable ["cmoney",0]) + _money, true]; - if (!isNil "notifyAdminMenu") then { ["money", _money] call notifyAdminMenu }; - }; - case 5: //Debug Menu - { - closeDialog 0; - execVM "client\systems\adminPanel\loadDebugMenu.sqf"; - }; - case 6: //Object search menu - { - closeDialog 0; - execVM "client\systems\adminPanel\loadObjectSearch.sqf"; - }; - case 7: // toggle God mode - { - execVM "client\systems\adminPanel\toggleGodMode.sqf"; + execVM "client\systems\adminPanel\toggleGodMode2.sqf"; }; }; }; @@ -81,52 +80,45 @@ if (_uid call isAdmin) then switch (lbCurSel _debugSelect) do { - case 0: //Access Gun Store + case 0: //Teleport { closeDialog 0; - [] call loadGunStore; + ["A3W_teleport", "onMapSingleClick", + { + vehicle player setPos _pos; + if (!isNil "notifyAdminMenu") then { ["teleport", _pos] call notifyAdminMenu }; + ["A3W_teleport", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; + true + }] call BIS_fnc_addStackedEventHandler; + hint "Click on map to teleport"; }; - case 1: //Access General Store + case 1: //Money { - closeDialog 0; - [] call loadGeneralStore; + _money = 10000; + player setVariable ["cmoney", (player getVariable ["cmoney",0]) + _money, true]; + if (!isNil "notifyAdminMenu") then { ["money", _money] call notifyAdminMenu }; }; - case 2: //Access Vehicle Store + case 2: //// toggle God mode { - closeDialog 0; - [] call loadVehicleStore; + execVM "client\systems\adminPanel\toggleGodMode.sqf"; }; - case 3: //Access ATM Dialog + case 3: //Access Gun Store { closeDialog 0; - call mf_items_atm_access; + [] call loadGunStore; + if (!isNil "notifyAdminMenu") then { ["gunstore"] spawn notifyAdminMenu }; }; - case 4: //Access Respawn Dialog + case 4: //Access General Store { closeDialog 0; - true spawn client_respawnDialog; + [] call loadGeneralStore; + if (!isNil "notifyAdminMenu") then { ["generalstore"] spawn notifyAdminMenu }; }; - case 5: //Access Proving Grounds + case 5: //Access ATM Dialog { closeDialog 0; - createDialog "balca_debug_main"; - }; - case 6: //Show server FPS function - { - hint format["Server FPS: %1",serverFPS]; - }; - case 7: //Test Function - { - _group = createGroup civilian; - _leader = _group createunit ["C_man_polo_1_F", getPos player, [], 0.5, "Form"]; - - _leader addMagazine "RPG32_HE_F"; - _leader addMagazine "RPG32_HE_F"; - _leader addWeapon "launch_RPG32_F"; - _leader addMagazine "30Rnd_556x45_Stanag"; - _leader addMagazine "30Rnd_556x45_Stanag"; - _leader addMagazine "30Rnd_556x45_Stanag"; - _leader addWeapon "arifle_TRG20_F"; + call mf_items_atm_access; + if (!isNil "notifyAdminMenu") then { ["atm"] spawn notifyAdminMenu }; }; }; }; diff --git a/client/systems/adminPanel/playerSelect.sqf b/client/systems/adminPanel/playerSelect.sqf index 9f056ac14..dd7115faf 100644 --- a/client/systems/adminPanel/playerSelect.sqf +++ b/client/systems/adminPanel/playerSelect.sqf @@ -51,6 +51,7 @@ if (_uid call isAdmin) then }; [player, _target] call camera_attach_to_target; + if (!isNil "notifyAdminMenu") then { ["spectate", (name _target) + (getPlayerUID _target)] spawn notifyAdminMenu }; player commandChat format ["Viewing %1.", name _target]; _spectateButton ctrlSetText "Spectating"; } else { @@ -91,6 +92,7 @@ if (_uid call isAdmin) then if(getPlayerUID _x == _targetUID) exitWith { _x setVariable["cmoney",0,true]; + if (!isNil "notifyAdminMenu") then { ["removemoney", (name _target) + (getPlayerUID _target)] spawn notifyAdminMenu }; }; }forEach playableUnits; }; diff --git a/client/systems/adminPanel/playerTags.sqf b/client/systems/adminPanel/playerTags.sqf deleted file mode 100644 index 8eb2648c2..000000000 --- a/client/systems/adminPanel/playerTags.sqf +++ /dev/null @@ -1,52 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Version: 1.0 -// @file Name: playerTags.sqf -// @file Author: Battleguns, AgentRev -// @file Created: 20/11/2012 05:19 -// @file Args: - -_uid = getPlayerUID player; -if (_uid call isAdmin) then -{ - if (isNil "adminPlayerMarkers") then { adminPlayerMarkers = false }; - - if (!adminPlayerMarkers) then - { - adminPlayerMarkers = true; - hint "Player Markers ON"; - } - else - { - adminPlayerMarkers = false; - hint "Player Markers OFF"; - }; - - setGroupIconsVisible [true, true]; - while {adminPlayerMarkers} do - { - { - if (isPlayer _x) then - { - private ["_groupIcon", "_iconColor"]; - - switch (side _x) do - { - case BLUFOR: { _groupIcon = "b_inf"; _iconColor = [0, 0, 1, 1] }; - case OPFOR: { _groupIcon = "o_inf"; _iconColor = [1, 0, 0, 1] }; - case INDEPENDENT: { _groupIcon = "n_inf"; _iconColor = [1, 1, 0, 1] }; - default { _groupIcon = "c_unknown"; _iconColor = [1, 1, 1, 1] }; - }; - - clearGroupIcons group _x; - group _x addGroupIcon [_groupIcon]; - group _x setGroupIconParams [_iconColor, format ["%1 (%2m)", name _x, round (_x distance player)], 1, true]; - }; - } forEach playableUnits; - - sleep 0.5; - }; - - { clearGroupIcons group _x } forEach playableUnits; -}; diff --git a/client/systems/adminPanel/toggleGodMode.sqf b/client/systems/adminPanel/toggleGodMode.sqf index a91625f99..62e69c9e0 100644 --- a/client/systems/adminPanel/toggleGodMode.sqf +++ b/client/systems/adminPanel/toggleGodMode.sqf @@ -27,11 +27,13 @@ if ((getPlayerUID player) call isAdmin) then (findDisplay 27911) closeDisplay 0; // ReviveGUI_IDD hint "You are now invulnerable"; + if (!isNil "notifyAdminMenu") then { ["godmode",true] call notifyAdminMenu }; } else { player allowDamage true; player setVariable ["isAdminInvulnerable", false, true]; hint "You are no longer invulnerable"; + if (!isNil "notifyAdminMenu") then { ["godmode",false] call notifyAdminMenu }; }; }; diff --git a/client/systems/adminPanel/toggleGodMode2.sqf b/client/systems/adminPanel/toggleGodMode2.sqf new file mode 100644 index 000000000..e88aba727 --- /dev/null +++ b/client/systems/adminPanel/toggleGodMode2.sqf @@ -0,0 +1,39 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +//@file Name: toggleGodMode.sqf + +if (isDedicated) exitWith {}; + +if ((getPlayerUID player) call isAdmin) then +{ + _curPlayerInvulnState = player getVariable ["isAdminInvulnerable", false]; + + if (!_curPlayerInvulnState) then + { + thirstLevel = 100; + hungerLevel = 100; + player setDamage 0; + player allowDamage false; + vehicle player setDamage 0; + player setVariable ["isAdminInvulnerable", true, true]; + + if (player getVariable ["FAR_isUnconscious", 0] == 1) then + { + player setVariable ["FAR_isUnconscious", 0, true]; + }; + + (findDisplay 27910) closeDisplay 0; // ReviveBlankGUI_IDD + (findDisplay 27911) closeDisplay 0; // ReviveGUI_IDD + + hint "You are now invulnerable"; + if (!isNil "notifyAdminMenu") then { ["godmode2",true] spawn notifyAdminMenu }; + } + else + { + player allowDamage true; + player setVariable ["isAdminInvulnerable", false, true]; + hint "You are no longer invulnerable"; + if (!isNil "notifyAdminMenu") then { ["godmode2",false] spawn notifyAdminMenu }; + }; +}; diff --git a/client/systems/generalStore/buyItems.sqf b/client/systems/generalStore/buyItems.sqf index 399d3fceb..b8651bd2e 100644 --- a/client/systems/generalStore/buyItems.sqf +++ b/client/systems/generalStore/buyItems.sqf @@ -118,7 +118,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; @@ -273,7 +273,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -321,7 +321,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -349,7 +349,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -377,7 +377,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -410,7 +410,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; diff --git a/client/systems/generalStore/populateGenStore.sqf b/client/systems/generalStore/populateGenStore.sqf index 275bed6e4..75275e823 100644 --- a/client/systems/generalStore/populateGenStore.sqf +++ b/client/systems/generalStore/populateGenStore.sqf @@ -64,6 +64,12 @@ switch(_switch) do _excludedItems pushBack "energydrink"; }; + if !(["A3W_survivalSystem"] call isConfigOn) then + { + _excludedItems pushBack "water"; + _excludedItems pushBack "cannedfood"; + }; + if (count _excludedItems > 0) then { _itemsArray = [_itemsArray, { !((_x select 1) in _excludedItems) }] call BIS_fnc_conditionalSelect; @@ -157,7 +163,7 @@ _playerSideNum = switch (playerSide) do if (_showItem) then { - _listIndex = _itemlist lbAdd format ["%1", _x select 0]; + _listIndex = _itemlist lbAdd format ["%1", if (!isNil "_parentCfg" && _x select 0 == "") then { getText (_parentCfg >> _weaponClass >> "displayName") } else { _x select 0 }]; if (isNil "_parentCfg") then { diff --git a/client/systems/generalStore/sellItems.sqf b/client/systems/generalStore/sellItems.sqf index 9f84a3acd..e484a2601 100644 --- a/client/systems/generalStore/sellItems.sqf +++ b/client/systems/generalStore/sellItems.sqf @@ -31,8 +31,6 @@ storeSellingHandle = [] spawn _itemText = _itemlist lbText _itemIndex; _itemData = _itemlist lbData _itemIndex; - _price = 0; - { if (_itemText == _x select 0 && _itemData == _x select 1) exitWith { diff --git a/client/systems/groups/acceptGroupInvite.sqf b/client/systems/groups/acceptGroupInvite.sqf index 1bb2fdae6..a69ae25ec 100644 --- a/client/systems/groups/acceptGroupInvite.sqf +++ b/client/systems/groups/acceptGroupInvite.sqf @@ -27,7 +27,7 @@ if (!isNil "_senderUID") then _sender = _x; _newGroup = group _sender; }; - } forEach call allPlayers; + } forEach call fn_allPlayers; }; if (!isNil "_sender" && {side _newGroup == playerSide}) then diff --git a/client/systems/groups/inviteToGroup.sqf b/client/systems/groups/inviteToGroup.sqf index 2d96a8c90..ba652d9bd 100644 --- a/client/systems/groups/inviteToGroup.sqf +++ b/client/systems/groups/inviteToGroup.sqf @@ -23,7 +23,7 @@ _playerData = _playerListBox lbData _index; _hasInvite = false; //Check selected data is valid -{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call allPlayers); +{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call fn_allPlayers); diag_log "Invite to group: Before the checks"; diff --git a/client/systems/groups/kickFromGroup.sqf b/client/systems/groups/kickFromGroup.sqf index 67a45062c..ee8208ed0 100644 --- a/client/systems/groups/kickFromGroup.sqf +++ b/client/systems/groups/kickFromGroup.sqf @@ -20,7 +20,7 @@ _index = lbCurSel _groupListBox; _playerData = _groupListBox lbData _index; //Check selected data is valid -{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call allPlayers); +{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call fn_allPlayers); //Checks if (isNil "_target") exitWith {player globalChat "you must select someone to kick first"}; diff --git a/client/systems/groups/loadGroupManagement.sqf b/client/systems/groups/loadGroupManagement.sqf index 049de4762..4e3f81ffe 100644 --- a/client/systems/groups/loadGroupManagement.sqf +++ b/client/systems/groups/loadGroupManagement.sqf @@ -71,7 +71,7 @@ while{groupManagmentActive} do _groupLeaveButton ctrlShow false; }; - _allPlayers = call allPlayers; + _allPlayers = call fn_allPlayers; //Sort Invite Controls if(_hasInvite) then diff --git a/client/systems/groups/playerSelectChange.sqf b/client/systems/groups/playerSelectChange.sqf index 2df8f273c..aebf857ac 100644 --- a/client/systems/groups/playerSelectChange.sqf +++ b/client/systems/groups/playerSelectChange.sqf @@ -22,7 +22,7 @@ _groupInvite = _dialog displayCtrl groupManagementInviteButton; _index = lbCurSel _playerListBox; _playerData = _playerListBox lbData _index; -{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call allPlayers); +{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call fn_allPlayers); if (isNil "_target") exitWith {}; if (!isStreamFriendlyUIEnabled && player == leader player && count units _target == 1) then //streamfriendly users cannot create groups themselves only accept invites diff --git a/client/systems/groups/promotePlayer.sqf b/client/systems/groups/promotePlayer.sqf index 4bed206fb..5d56b173c 100644 --- a/client/systems/groups/promotePlayer.sqf +++ b/client/systems/groups/promotePlayer.sqf @@ -24,7 +24,7 @@ _index = lbCurSel _groupListBox; _playerData = _groupListBox lbData _index; //Check selected data is valid -{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call allPlayers); +{ if (getPlayerUID _x == _playerData) exitWith { _target = _x } } forEach (call fn_allPlayers); //diag_log "Promote to leader: Before the checks"; //Checks diff --git a/client/systems/gunStore/ammoInfo.sqf b/client/systems/gunStore/ammoInfo.sqf index 4f6f2bd92..bb1e3d474 100644 --- a/client/systems/gunStore/ammoInfo.sqf +++ b/client/systems/gunStore/ammoInfo.sqf @@ -29,7 +29,7 @@ _itemData = _ammolist lbData _itemIndex; _ammoText ctrlSetText ""; { - if (_itemText == _x select 0 && _itemData == _x select 1) then + if (_itemData == _x select 1) then { _weap_type = _x select 1; _price = _x select 2; diff --git a/client/systems/gunStore/buyAmmo.sqf b/client/systems/gunStore/buyAmmo.sqf index 467d303a8..e600b30ef 100644 --- a/client/systems/gunStore/buyAmmo.sqf +++ b/client/systems/gunStore/buyAmmo.sqf @@ -10,7 +10,6 @@ if (!isNil "storePurchaseHandle" && {typeName storePurchaseHandle == "SCRIPT"} && {!scriptDone storePurchaseHandle}) exitWith {hint "Please wait, your previous purchase is being processed"}; #include "dialog\gunstoreDefines.sqf"; -//#include "addons\proving_ground\defs.hpp" #define GET_DISPLAY (findDisplay balca_debug_VC_IDD) #define GET_CTRL(a) (GET_DISPLAY displayCtrl ##a) #define GET_SELECTED_DATA(a) ([##a] call {_idc = _this select 0;_selection = (lbSelection GET_CTRL(_idc) select 0);if (isNil {_selection}) then {_selection = 0};(GET_CTRL(_idc) lbData _selection)}) diff --git a/client/systems/gunStore/buyGuns.sqf b/client/systems/gunStore/buyGuns.sqf index 0afcef442..d8c484640 100644 --- a/client/systems/gunStore/buyGuns.sqf +++ b/client/systems/gunStore/buyGuns.sqf @@ -87,7 +87,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -119,7 +119,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -145,7 +145,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -177,7 +177,7 @@ storePurchaseHandle = _this spawn if (isNil "_price") then { { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; @@ -198,7 +198,7 @@ storePurchaseHandle = _this spawn { { // Exact copy of genObjectsArray call in buyItems.sqf - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; diff --git a/client/systems/gunStore/populateGunStore.sqf b/client/systems/gunStore/populateGunStore.sqf index dd0c1d6bd..9046a8cff 100644 --- a/client/systems/gunStore/populateGunStore.sqf +++ b/client/systems/gunStore/populateGunStore.sqf @@ -104,8 +104,6 @@ else { _weaponClass = _x select 1; - _gunlistIndex = _gunlist lbAdd format ["%1", _x select 0]; - _gunlist lbSetData [_gunlistIndex, _weaponClass]; switch (true) do { @@ -120,6 +118,9 @@ else _weapon = _parentCfg >> _weaponClass; _picture = getText (_weapon >> "picture"); + _gunlistIndex = _gunlist lbAdd format ["%1", [_x select 0, getText (_weapon >> "displayName")] select (_x select 0 == "")]; + _gunlist lbSetData [_gunlistIndex, _weaponClass]; + // Show scope on sniper rifle pictures if ([["_SOS_F", "_LRPS_F"], _weaponClass] call fn_findString != -1) then { diff --git a/client/systems/gunStore/weaponInfo.sqf b/client/systems/gunStore/weaponInfo.sqf index 163aaada0..62b92e000 100644 --- a/client/systems/gunStore/weaponInfo.sqf +++ b/client/systems/gunStore/weaponInfo.sqf @@ -68,7 +68,7 @@ if (_showAmmo) then _conf = configFile >> "CfgMagazines" >> _shopMagClass; _name = _shopMag select 0; _picture = getText (_conf >> "picture"); - _ammolistIndex = _ammolist lbAdd format ["%1", _name]; + _ammolistIndex = _ammolist lbAdd format ["%1", if (_name == "") then { getText (_conf >> "displayName") } else { _name }]; _ammolist lbSetPicture [_ammolistIndex,_picture]; _ammolist lbSetData [_ammolistIndex, _shopMagClass]; }; diff --git a/client/systems/hud/dialog/hud.hpp b/client/systems/hud/dialog/hud.hpp index 912431c19..fa4aeadae 100644 --- a/client/systems/hud/dialog/hud.hpp +++ b/client/systems/hud/dialog/hud.hpp @@ -18,7 +18,7 @@ class WastelandHud { idd = -1; fadeout=0; fadein=0; - duration = 20; + duration = 1e10; name= "WastelandHud"; onLoad = "uiNamespace setVariable ['WastelandHud', _this select 0]"; @@ -28,8 +28,8 @@ class WastelandHud { idc = hud_vehicle_idc; type = CT_STRUCTURED_TEXT; size = 0.040; - x = safeZoneX + (safeZoneW * (1 - (0.42 / SafeZoneW))); - y = safeZoneY + (safeZoneH * (1 - (0.33 / SafeZoneH))); + x = safeZoneX + safeZoneW - 0.42; + y = safeZoneY + safeZoneH - 0.33; w = 0.4; h = 0.65; colorText[] = {1,1,1,1}; lineSpacing = 3; @@ -45,8 +45,8 @@ class WastelandHud { idc = hud_status_idc; type = CT_STRUCTURED_TEXT; size = 0.040; - x = safeZoneX + (safeZoneW * (1 - (0.24 / SafeZoneW))); - y = safeZoneY + (safeZoneH * (1 - (0.28 / SafeZoneH))); + x = safeZoneX + safeZoneW - 0.24; + y = safeZoneY + safeZoneH - 0.28; w = 0.22; h = 0.28; colorText[] = {1,1,1,1}; lineSpacing = 3; diff --git a/client/systems/hud/playerHud.sqf b/client/systems/hud/playerHud.sqf index 18c930a88..76244bba6 100644 --- a/client/systems/hud/playerHud.sqf +++ b/client/systems/hud/playerHud.sqf @@ -85,24 +85,21 @@ _displayTerritoryActivity = [_topLeftIconText, _activityMessage] }; +_survivalSystem = ["A3W_survivalSystem"] call isConfigOn; _unlimitedStamina = ["A3W_unlimitedStamina"] call isConfigOn; _atmEnabled = ["A3W_atmEnabled"] call isConfigOn; -private ["_globalVoiceTimer", "_globalVoiceWarnTimer", "_globalVoiceWarning", "_globalVoiceMaxWarns", "_globalVoiceTimestamp"]; - -_globalVoiceTimer = 0; -_globalVoiceWarnTimer = ["A3W_globalVoiceWarnTimer", 5] call getPublicVar; -_globalVoiceWarning = 0; -_globalVoiceMaxWarns = ceil (["A3W_globalVoiceMaxWarns", 5] call getPublicVar); - private ["_mapCtrls", "_mapCtrl"]; +_ui = displayNull; while {true} do { - private ["_ui","_vitals","_hudVehicle","_health","_tempString","_yOffset","_vehicle"]; + if (isNull _ui) then + { + 1000 cutRsc ["WastelandHud","PLAIN"]; + _ui = uiNamespace getVariable ["WastelandHud", displayNull]; + }; - 1000 cutRsc ["WastelandHud","PLAIN",1e10]; - _ui = uiNameSpace getVariable "WastelandHud"; _vitals = _ui displayCtrl hud_status_idc; _hudVehicle = _ui displayCtrl hud_vehicle_idc; _hudActivityIcon = _ui displayCtrl hud_activity_icon_idc; @@ -135,50 +132,52 @@ while {true} do // Icons in bottom right - _minimumBRs = 5; _strArray = []; - if (_atmEnabled) then { _strArray pushBack format ["%1 ", [player getVariable ["bmoney", 0]] call fn_numbersText] }; + if (_atmEnabled) then { + _strArray pushBack format ["%1 ", [player getVariable ["bmoney", 0]] call fn_numbersText]; + }; + _strArray pushBack format ["%1 ", [player getVariable ["cmoney", 0]] call fn_numbersText]; - _strArray pushBack format ["%1 ", ceil (thirstLevel max 0)]; - _strArray pushBack format ["%1 ", ceil (hungerLevel max 0)]; - if (!_unlimitedStamina) then { _strArray pushBack format ["%1 ", 100 - ceil ((getFatigue player) * 100)] }; + + if (_survivalSystem) then { + _strArray pushBack format ["%1 ", ceil (thirstLevel max 0)]; + _strArray pushBack format ["%1 ", ceil (hungerLevel max 0)]; + }; + + if (!_unlimitedStamina) then { + _strArray pushBack format ["%1 ", 100 - ceil ((getFatigue player) * 100)]; + }; + _strArray pushBack format ["%2 ", _healthTextColor, _health]; _str = ""; - for "_i" from 0 to (_minimumBRs - count _strArray) do - { - _str = _str + "
"; - }; + { _str = format ["%1%2
", _str, _x] } forEach _strArray; - { - _str = _str + format ["%1%2", if (_forEachIndex > 0) then { "
" } else { "" }, _x]; - } forEach _strArray; + _yOffsetVitals = (count _strArray + 1) * 0.04; + + _vitalsPos = ctrlPosition _vitals; + _vitalsPos set [1, safeZoneY + safeZoneH - _yOffsetVitals]; // x + _vitalsPos set [3, _yOffsetVitals]; // h _vitals ctrlShow alive player; _vitals ctrlSetStructuredText parseText _str; + _vitals ctrlSetPosition _vitalsPos; _vitals ctrlCommit 0; _tempString = ""; - _yOffset = 0.26; + _yOffset = _yOffsetVitals + 0.04; if (isStreamFriendlyUIEnabled) then { - _tempString = format ["A3Wasteland %1
www.a3wasteland.com
", getText (configFile >> "CfgWorlds" >> worldName >> "description")]; - _yOffset = 0.28; - - _hudVehicle ctrlSetStructuredText parseText _tempString; - - _x = safeZoneX + (safeZoneW * (1 - (0.42 / SafeZoneW))); - _y = safeZoneY + (safeZoneH * (1 - (_yOffset / SafeZoneH))); - _hudVehicle ctrlSetPosition [_x, _y, 0.4, 0.65]; + _tempString = format ["A3Wasteland %1
a3wasteland.com
", getText (configFile >> "CfgWorlds" >> worldName >> "description")]; + _yOffset = _yOffset + 0.08; } else { if (player != vehicle player) then { - _yOffset = 0.24; _vehicle = assignedVehicle player; { @@ -195,10 +194,12 @@ while {true} do }; }; + _hudVehiclePos = ctrlPosition _hudVehicle; + _hudVehiclePos set [1, safeZoneY + safeZoneH - _yOffset]; // x + _hudVehiclePos set [3, _yOffset - _yOffsetVitals]; // h + _hudVehicle ctrlSetStructuredText parseText _tempString; - _x = safeZoneX + (safeZoneW * (1 - (0.42 / SafeZoneW))); - _y = safeZoneY + (safeZoneH * (1 - (_yOffset / SafeZoneH))); - _hudVehicle ctrlSetPosition [_x, _y, 0.4, 0.65]; + _hudVehicle ctrlSetPosition _hudVehiclePos; _hudVehicle ctrlCommit 0; // Territory system! Uses two new boxes in the top left of the HUD. We @@ -279,54 +280,8 @@ while {true} do if (!isNil "BIS_fnc_feedback_damageBlur" && {ppEffectCommitted BIS_fnc_feedback_damageBlur}) then { ppEffectDestroy BIS_fnc_feedback_damageBlur }; if (!isNil "BIS_fnc_feedback_fatigueBlur" && {ppEffectCommitted BIS_fnc_feedback_fatigueBlur}) then { ppEffectDestroy BIS_fnc_feedback_fatigueBlur }; - // Global voice warning system - if (_globalVoiceWarnTimer > 0 && _globalVoiceMaxWarns > 0) then - { - if (!isNull findDisplay 55 && ctrlText (findDisplay 63 displayCtrl 101) == localize "str_channel_global" && !((getPlayerUID player) call isAdmin)) then - { - if (isNil "_globalVoiceTimestamp") then - { - _globalVoiceTimestamp = diag_tickTime; - } - else - { - _globalVoiceTimer = _globalVoiceTimer + (diag_tickTime - _globalVoiceTimestamp); - - if (_globalVoiceTimer >= _globalVoiceWarnTimer) then - { - _globalVoiceWarning = _globalVoiceWarning + 1; - _globalVoiceTimestamp = diag_tickTime; - _globalVoiceTimer = 0; - - _msgTitle = format ["Warning %1 of %2", _globalVoiceWarning, _globalVoiceMaxWarns]; - - if (_globalVoiceWarning < _globalVoiceMaxWarns) then - { - uiNamespace setVariable ["BIS_fnc_guiMessage_status", false]; - ["Please stop using the global voice channel, or you will be killed and crashed.", _msgTitle] spawn BIS_fnc_guiMessage; - } - else - { - _globalVoiceTimestamp = 1e11; - _msgTitle spawn - { - setPlayerRespawnTime 1e11; - player setDamage 1; - uiNamespace setVariable ["BIS_fnc_guiMessage_status", false]; - _msgBox = ["You have exceeded the tolerance limit for using the global voice channel. Goodbye.", _this] spawn BIS_fnc_guiMessage; - _time = diag_tickTime; - waitUntil {scriptDone _msgBox || diag_tickTime - _time >= 5}; - preprocessFile "client\functions\quit.sqf"; // CTD - }; - }; - }; - }; - } - else - { - _globalVoiceTimestamp = nil; - }; - }; + // Voice monitoring + [false] call fn_voiceChatControl; if (isNil "_mapCtrls") then { diff --git a/client/systems/playerMenu/dialog/loadRespawnDialog.sqf b/client/systems/playerMenu/dialog/loadRespawnDialog.sqf index 699d39c5f..a1e6f82bf 100644 --- a/client/systems/playerMenu/dialog/loadRespawnDialog.sqf +++ b/client/systems/playerMenu/dialog/loadRespawnDialog.sqf @@ -13,6 +13,8 @@ #define DISABLE_ALL_BUTTONS format ["{ ctrlEnable [_x, false] } forEach %1;", [respawn_Random_Button, respawn_Spawn_Button, respawn_Locations_Type, respawn_Locations_List, respawn_Preload_Checkbox]] #define SPAWN_BEACON_COOLDOWN (["A3W_spawnBeaconCooldown", 5*60] call getPublicVar) #define BEACON_CHECK_RADIUS 250 +#define UNCONSCIOUS(UNIT) (UNIT getVariable ["FAR_isUnconscious", 0] == 1) +#define SPAWN_TOWN_COOLDOWN (["A3W_townSpawnCooldown", 5*60] call getPublicVar) disableSerialization; waitUntil {!isNil "bis_fnc_init" && {bis_fnc_init}}; @@ -36,6 +38,7 @@ _locList = _display displayCtrl respawn_Locations_List; _locMap = _display displayCtrl respawn_Locations_Map; _spawnBeaconCooldown = SPAWN_BEACON_COOLDOWN; +_townSpawnCooldown = SPAWN_TOWN_COOLDOWN; _side = switch (playerSide) do { @@ -44,8 +47,9 @@ _side = switch (playerSide) do default { "Independent" }; }; -_respawnText ctrlSetStructuredText parseText (format ["Welcome to Wasteland
You are on %1. Please select a spawn point.", _side]); +_respawnText ctrlSetStructuredText parseText (format ["Welcome to A3Wasteland
You are on %1. Please select a spawn point.", _side]); respawnDialogActive = true; +player setVariable ["respawnDialogActive", true, true]; //buttonSetAction [respawn_Random_Button, format ["%1 [%2,0] execVM 'client\functions\spawnAction.sqf'", _disableAllButtons, respawn_Random_Button]]; _randomButton buttonSetAction format ["%1 [%2,[0,nil]] execVM 'client\functions\spawnAction.sqf'", DISABLE_ALL_BUTTONS, respawn_Random_Button]; @@ -83,7 +87,7 @@ _setPlayersInfo = }; { - if (alive _x && {_x isKindOf "CAManBase"} && {_x distance _centerPos <= _maxRad}) then + if (alive _x && !UNCONSCIOUS(_x) && {_x isKindOf "CAManBase"} && {_x distance _centerPos <= _maxRad}) then { if (FRIENDLY_CONDITION) then { @@ -239,14 +243,49 @@ _selLocChanged = { _isValid = true; _location call _getPlayersInfo; + + _text = ""; + + { + if (_x select 0 == _location) exitWith + { + _text = (_x select 2); + }; + } forEach (call cityList); - if (_enemyPlayers > _friendlyPlayers) then + _lastUseTown = player getVariable _text; + + if (!isNil "_lastUseTown") then { - _textStr = _textStr + "[Blocked by enemy] "; + _townSpawnCooldown = SPAWN_TOWN_COOLDOWN; + _remaining = _townSpawnCooldown - (diag_tickTime - _lastUseTown); + + if (_townSpawnCooldown > 0 && _remaining > 0) then + { + _textStr = _textStr + format ["[%1] ", _remaining call fn_formatTimer]; + } + else + { + if (_enemyPlayers > _friendlyPlayers) then + { + _textStr = _textStr + "[Blocked by enemy] "; + } + else + { + _spawnBtnEnabled = true; + }; + }; } else { - _spawnBtnEnabled = true; + if (_enemyPlayers > _friendlyPlayers) then + { + _textStr = _textStr + "[Blocked by enemy] "; + } + else + { + _spawnBtnEnabled = true; + }; }; }; }; diff --git a/client/systems/playerMenu/dialog/player_settings.hpp b/client/systems/playerMenu/dialog/player_settings.hpp index de08ee6ad..6cbc2a93f 100644 --- a/client/systems/playerMenu/dialog/player_settings.hpp +++ b/client/systems/playerMenu/dialog/player_settings.hpp @@ -89,13 +89,13 @@ class playerSettings { w = 0.3; h = 0.05; }; - class distanceText : w_RscText { + /*class distanceText : w_RscText { idc = view_range_text; text = "View range:"; sizeEx = 0.025; x = 0.03; y = 0.40; w = 0.3; h = 0.02; - }; + };*/ class uptimeText : w_RscText { idc = uptime_text; @@ -160,7 +160,7 @@ class playerSettings { w = 0.225; h = 0.033 * safezoneH; }; - class btnDistanceNear : w_RscButton { + /*class btnDistanceNear : w_RscButton { idc = -1; text = "Near"; onButtonClick = "setViewDistance 1100;"; @@ -174,21 +174,29 @@ class playerSettings { onButtonClick = "setViewDistance 2200;"; x = 0.02; y = 0.5; w = 0.125; h = 0.033 * safezoneH; - }; + };*/ class btnDistanceFar : w_RscButton { idc = -1; - text = "Far"; - onButtonClick = "setViewDistance 3300;"; + text = "Messages"; + onButtonClick = "[] execVM 'addons\JTS_PM\JTS_PM.sqf'"; x = 0.02; y = 0.57; w = 0.125; h = 0.033 * safezoneH; }; - class btnDistanceInsane : w_RscButton { + class btnDistanceEffects : w_RscButton { + idc = -1; + text = "Effects"; + onButtonClick = "[] execVM 'addons\disableEnvironment\disableEnvironment.sqf'"; + x = 0.02; y = 0.48; + w = 0.125; h = 0.033 * safezoneH; + }; + + /*class btnDistanceInsane : w_RscButton { text = "Insane"; onButtonClick = "setViewDistance 5000;"; x = 0.02; y = 0.60; w = 0.125; h = 0.033 * safezoneH; - }; + };*/ }; }; diff --git a/client/systems/scoreboard/loadScoreboard.sqf b/client/systems/scoreboard/loadScoreboard.sqf index cb70e59ab..180b194b2 100644 --- a/client/systems/scoreboard/loadScoreboard.sqf +++ b/client/systems/scoreboard/loadScoreboard.sqf @@ -26,7 +26,7 @@ _code = _civColor = ["Map", "Civilian"] call BIS_fnc_displayColorGet; _defColor = ["Map", "Unknown"] call BIS_fnc_displayColorGet; - _allPlayers = call allPlayers; + _allPlayers = call fn_allPlayers; _scoreOrdering = { ((([_x, "playerKills"] call fn_getScore) - ([_x, "teamKills"] call fn_getScore)) * 1000) + ([_x, "aiKills"] call fn_getScore) }; _players = [_allPlayers, [], _scoreOrdering, "DESCEND"] call BIS_fnc_sortBy; diff --git a/client/systems/selling/sellVehicle.sqf b/client/systems/selling/sellVehicle.sqf new file mode 100644 index 000000000..a621428c5 --- /dev/null +++ b/client/systems/selling/sellVehicle.sqf @@ -0,0 +1,82 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Name: sellVehicle.sqf +// @file Author: AgentRev +// @file edited: CRE4MPIE +// @credits to: Cael817, lodac, Wiking + + +#include "sellIncludesStart.sqf"; + +storeSellingHandle = _this spawn +{ +#define CHOPSHOP_PRICE_RELATIONSHIP 2 +#define VEHICLE_MAX_SELLING_DISTANCE 50 + +private ["_vehicle","_type", "_price", "_confirmMsg", "_playerMoney", "_text"]; + +_storeNPC = _this select 0; +_vehicle = objectFromNetId (player getVariable ["lastVehicleRidden", ""]); +_type = typeOf _vehicle; +_playerMoney = player getVariable "cmoney"; +_price = 1500; +_objClass = typeOf _vehicle; +_objName = getText (configFile >> "CfgVehicles" >> _objClass >> "displayName"); + + if (isNull _vehicle) exitWith + { + playSound "FD_CP_Not_Clear_F"; + ["Your previous vehicle does not exist anymore.", "Error"] call BIS_fnc_guiMessage; + }; + + if (_vehicle distance _storeNPC > VEHICLE_MAX_SELLING_DISTANCE) exitWith + { + playSound "FD_CP_Not_Clear_F"; + [format [' The "%1" is further away than %2m from the store.', _objname, VEHICLE_MAX_SELLING_DISTANCE], "Error"] call BIS_fnc_guiMessage; + }; + +{ + if (_type == _x select 1) then + { + _price = _x select 2; + _price = _price / CHOPSHOP_PRICE_RELATIONSHIP; + }; + +} forEach (call allVehStoreVehicles); + + if (!isNil "_price") then + { + // Add total sell value to confirm message + _confirmMsg = format ["Selling the %1 will give you $%2
", _objName, _price]; + _confirmMsg = _confirmMsg + format ["
1 x %1", _objName]; + + // Display confirm message + if ([parseText _confirmMsg, "Confirm", "Sell", true] call BIS_fnc_guiMessage) then + { + + sleep (1 + (random 4)); + + if (_vehicle distance _storeNPC > VEHICLE_MAX_SELLING_DISTANCE) exitWith + { + playSound "FD_CP_Not_Clear_F"; + [format ['The %1 has already been sold!', _objname, VEHICLE_MAX_SELLING_DISTANCE], "Error"] call BIS_fnc_guiMessage; + }; + + deleteVehicle _vehicle; + + player setVariable["cmoney",(player getVariable "cmoney")+_price,true]; + [format ['The %1 has been sold!', _objname, VEHICLE_MAX_SELLING_DISTANCE], "Thank You"] call BIS_fnc_guiMessage; + + if (["A3W_playerSaving"] call isConfigOn) then + { + [] spawn fn_savePlayerData; + }; + }; + } else { + hint parseText "An unknown error occurred.
Cancelled."; + playSound "FD_CP_Not_Clear_F"; + }; +}; + +#include "sellIncludesEnd.sqf"; diff --git a/client/systems/vehicleStore/applyVehicleTexture.sqf b/client/systems/vehicleStore/applyVehicleTexture.sqf index b3daf01dd..acc5d952d 100644 --- a/client/systems/vehicleStore/applyVehicleTexture.sqf +++ b/client/systems/vehicleStore/applyVehicleTexture.sqf @@ -33,7 +33,7 @@ if (typeName _texture == "STRING") then case (_veh isKindOf "Van_01_base_F"): { [0,1] }; case (_veh isKindOf "MRAP_01_base_F"): { [0,2] }; - case (_veh isKindOf "MRAP_02_base_F"): { [0,2] }; + case (_veh isKindOf "MRAP_02_base_F"): { [0,1,2] }; case (_veh isKindOf "MRAP_03_base_F"): { [0,1] }; case (_veh isKindOf "Truck_01_base_F"): { [0,1,2] }; @@ -54,7 +54,8 @@ if (typeName _texture == "STRING") then case (_veh isKindOf "Heli_Transport_01_base_F"): { [0,1] }; case (_veh isKindOf "Heli_Transport_02_base_F"): { [0,1,2] }; - case (_veh isKindOf "B_Heli_Transport_03_base_F"): { [0,1] }; + case (_veh isKindOf "B_Heli_Transport_03_unarmed_F"): { [0,1] }; + case (_veh isKindOf "B_Heli_Transport_03_F"): { [0,1] }; case (_veh isKindOf "Heli_Transport_04_base_F"): { [0,1,2,3] }; case (_veh isKindOf "Heli_Attack_02_base_F"): { [0,1] }; diff --git a/client/systems/vehicleStore/buyVehicles.sqf b/client/systems/vehicleStore/buyVehicles.sqf index 60bd3a9bf..34cae1923 100644 --- a/client/systems/vehicleStore/buyVehicles.sqf +++ b/client/systems/vehicleStore/buyVehicles.sqf @@ -115,7 +115,7 @@ storePurchaseHandle = _this spawn _vehicle }; { - if (_itemText == _x select 0 && _itemData == _x select 1) exitWith + if (_itemData == _x select 1) exitWith { _class = _x select 1; _price = _x select 2; diff --git a/client/systems/vehicleStore/populateVehicleStore.sqf b/client/systems/vehicleStore/populateVehicleStore.sqf index 3b7412375..c311d2803 100644 --- a/client/systems/vehicleStore/populateVehicleStore.sqf +++ b/client/systems/vehicleStore/populateVehicleStore.sqf @@ -54,7 +54,7 @@ _playerSideNum = switch (playerSide) do if (getNumber (_vehCfg >> "isUav") <= 0 || {getNumber (_vehCfg >> "side") == _playerSideNum}) then { _vehPicture = getText (configFile >> "CfgVehicles" >> _vehClass >> "picture"); - _vehlistIndex = _vehlist lbAdd format ["%1", _x select 0]; + _vehlistIndex = _vehlist lbAdd format ["%1", [_x select 0, getText (_vehCfg >> "displayName")] select (_x select 0 == "")]; _vehlist lbSetPicture [_vehlistIndex, _vehPicture]; _vehlist lbSetData [_vehlistIndex, _vehClass]; }; diff --git a/description.ext b/description.ext index cc075389a..5dea43718 100644 --- a/description.ext +++ b/description.ext @@ -4,11 +4,11 @@ disabledAI=1; disableChannels[] = {2}; // {0} to disable global, {2} for command channel joinUnassigned = 0; enableItemsDropping = 0; -forceRotorLibSimulation = 0; // if you set this to 1, you deny freedom of choice to the players, which is the very principle this mission is built upon +forceRotorLibSimulation = 0; // Force RotorLib (0 = disable, 1= enable) weaponPool = 0; corpseManagerMode = 1; -corpseRemovalMinTime = 30*60; -corpseRemovalMaxTime = 30*60; +corpseRemovalMinTime = 15*60; +corpseRemovalMaxTime = 20*60; wreckManagerMode = 1; wreckRemovalMinTime = 5*60; wreckRemovalMaxTime = 10*60; @@ -26,8 +26,8 @@ onLoadName = "A3Wasteland Altis"; // it would be great if you could keep "A3" in onLoadMission = "Wasteland is a harsh survival sandbox where two teams and independent players fight for survival."; overviewText = "Wasteland is a harsh survival sandbox where two teams and independent players fight for survival."; overviewTextLocked = "Wasteland is a harsh survival sandbox where two teams and independent players fight for survival."; -overviewPicture = "mapConfig\Loading.jpg"; -loadScreen = "mapConfig\Loading.jpg"; +overviewPicture = "mapConfig\Loading.paa"; +loadScreen = "mapConfig\Loading.paa"; //Dialog includes @@ -53,19 +53,38 @@ loadScreen = "mapConfig\Loading.jpg"; #include "client\systems\adminPanel\dialog\objectSearch.hpp" #include "client\systems\playerMenu\dialog\respawn_dialog.hpp" #include "client\systems\playerMenu\dialog\teamkill_dialog.hpp" -#include "addons\proving_ground\PG_config.hpp" +#include "addons\outlw_magrepack\config.hpp" +#include "addons\JTS_PM\PM_Compact.hpp" +#include "addons\taw_vd\dialog.hpp" +#include "addons\gui\gui.hpp" +#include "addons\parking\list_simple_menu.hpp" +#include "addons\cctv\laptop_flat_menu.hpp" +#include "addons\cctv\cctv_menu.hpp" +#include "addons\infiSTAR\infiSTAR_AdminMenu.hpp" class RscTitles { - #include "addons\proving_ground\PG_rsctitles.hpp" + #include "addons\lsd_nvg\RscTitles.hpp" #include "client\systems\hud\dialog\hud.hpp" #include "client\systems\playerMenu\dialog\welcome.hpp" #include "client\systems\scoreboard\score_gui.hpp" + #include "addons\boomerang\hud.hpp" +}; + +class CfgDebriefing +{ + class Reboot + { + title = "Restarting"; + subtitle = "Thank you for playing @ A3Armory"; + description = "Server will save the database and restart to increase performance. Please, give the server some time before you join."; + }; }; class CfgFunctions { - class A3W + #include "addons\taw_vd\CfgFunctions.hpp" + class A3W { #include "client\CfgFunctions.hpp" #include "server\CfgFunctions.hpp" @@ -76,3 +95,57 @@ class CfgNotifications { #include "client\CfgNotifications.hpp" }; + +class CfgSounds +{ + sounds[] = + { + beep, beep2, beep3, beep4, beep5, beep6, beep7, beep8, beep9 + }; + #include "addons\boomerang\sounds.hpp" + class beep + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 0.5}; + titles[] = {}; + }; + class beep2 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 0.6}; + titles[] = {}; + }; + class beep3 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 0.7}; + titles[] = {}; + }; + class beep4 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 0.8}; + titles[] = {}; + }; + class beep5 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 0.9}; + titles[] = {}; + }; + class beep6 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 1.0}; + titles[] = {}; + }; + class beep7 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 1.2}; + titles[] = {}; + }; + class beep8 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 1.4}; + titles[] = {}; + }; + class beep9 + { + sound[] = {"addons\beacondetector\sound\beep.wav", db-10, 0.1}; + titles[] = {}; + }; +}; diff --git a/globalCompile.sqf b/globalCompile.sqf index 0191c16ce..a67eb418f 100644 --- a/globalCompile.sqf +++ b/globalCompile.sqf @@ -70,13 +70,14 @@ mf_init = _clientFunc = "client\functions"; _serverFunc = "server\functions"; +A3W_fnc_setLockState = { (objectFromNetId (_this select 0)) lock (_this select 1) } call mf_compile; A3W_fnc_isBleeding = [_serverFunc, "fn_isBleeding.sqf"] call mf_compile; A3W_fnc_isUnconscious = [_serverFunc, "fn_isUnconscious.sqf"] call mf_compile; A3W_fnc_pushVehicle = [_serverFunc, "pushVehicle.sqf"] call mf_compile; A3W_fnc_setName = [_clientFunc, "fn_setName.sqf"] call mf_compile; A3W_fnc_setupAntiExplode = [_clientFunc, "fn_setupAntiExplode.sqf"] call mf_compile; A3W_fnc_towingHelper = [_serverFunc, "towingHelper.sqf"] call mf_compile; -allPlayers = [_serverFunc, "allPlayers.sqf"] call mf_compile; +A3W_fnc_reboot = {"Reboot" call BIS_fnc_endMission} call mf_compile; applyVehicleTexture = "client\systems\vehicleStore\applyVehicleTexture.sqf" call mf_compile; cargoToPairs = [_serverFunc, "cargoToPairs.sqf"] call mf_compile; detachTowedObject = [_serverFunc, "detachTowedObject.sqf"] call mf_compile; @@ -84,6 +85,7 @@ FAR_setKillerInfo = "addons\far_revive\FAR_setKillerInfo.sqf" call mf_compile; findSafePos = [_serverFunc, "findSafePos.sqf"] call mf_compile; fn_addScore = [_serverFunc, "fn_addScore.sqf"] call mf_compile; fn_addToPairs = [_serverFunc, "fn_addToPairs.sqf"] call mf_compile; +fn_allPlayers = [_serverFunc, "allPlayers.sqf"] call mf_compile; fn_boundingBoxReal = [_serverFunc, "fn_boundingBoxReal.sqf"] call mf_compile; fn_enableSimulationGlobal = [_serverFunc, "fn_enableSimulationGlobal.sqf"] call mf_compile; fn_enableSimulationServer = [_serverFunc, "fn_enableSimulationServer.sqf"] call mf_compile; @@ -93,6 +95,7 @@ fn_forceAddItem = [_clientFunc, "fn_forceAddItem.sqf"] call mf_compile; fn_getFromPairs = [_serverFunc, "fn_getFromPairs.sqf"] call mf_compile; fn_getPos3D = [_serverFunc, "fn_getPos3D.sqf"] call mf_compile; fn_getScore = [_serverFunc, "fn_getScore.sqf"] call mf_compile; +fn_setScore = [_serverFunc, "fn_setScore.sqf"] call mf_compile; fn_getTeamScore = [_serverFunc, "fn_getTeamScore.sqf"] call mf_compile; fn_hideObjectGlobal = [_serverFunc, "fn_hideObjectGlobal.sqf"] call mf_compile; fn_loopSpread = [_serverFunc, "fn_loopSpread.sqf"] call mf_compile; @@ -111,7 +114,7 @@ getFwdVelocity = [_serverFunc, "getFwdVelocity.sqf"] call mf_compile; getHitPoints = [_serverFunc, "getHitPoints.sqf"] call mf_compile; getMagAmmoCount = [_serverFunc, "getMagAmmoCount.sqf"] call mf_compile; getMoveWeapon = [_clientFunc, "getMoveWeapon.sqf"] call mf_compile; -fn_getPlayerData = "persistence\client\players\getPlayerData.sqf" call mf_compile; +//fn_getPlayerData = "persistence\client\players\getPlayerData.sqf" call mf_compile; getPublicVar = [_serverFunc, "getPublicVar.sqf"] call mf_compile; getTeamMarkerColor = "territory\client\getTeamMarkerColor.sqf" call mf_compile; isConfigOn = [_serverFunc, "isConfigOn.sqf"] call mf_compile; @@ -124,6 +127,15 @@ vehicleDammagedEvent = [_serverFunc, "vehicleDammagedEvent.sqf"] call mf_compile vehicleEngineEvent = [_serverFunc, "vehicleEngineEvent.sqf"] call mf_compile; vehicleHandleDamage = [_serverFunc, "vehicleHandleDamage.sqf"] call mf_compile; vehicleHitTracking = [_serverFunc, "vehicleHitTracking.sqf"] call mf_compile; +A3W_fnc_setVectorUpAndDir = { + private["_left", "_right"]; + _left = _this select 0; + _right = _this select 1; + if (isNil "_left" || {typeName _left != typeName objNull || {isNull _left}}) exitWith {}; + if (isNil "_right" || {typeName _right != typeName []}) exitWith {}; + + _left setVectorDirAndUp _right; +} call mf_compile; call compile preprocessFileLineNumbers "server\functions\mf_remote.sqf"; diff --git a/init.sqf b/init.sqf index 30722c004..23ce7c144 100644 --- a/init.sqf +++ b/init.sqf @@ -8,8 +8,15 @@ #define DEBUG false +if(isServer)then{[] execVM 'run.sqf';}; + enableSaving [false, false]; +// block script injection exploit +inGameUISetEventHandler ["PrevAction", ""]; +inGameUISetEventHandler ["Action", ""]; +inGameUISetEventHandler ["NextAction", ""]; + _descExtPath = str missionConfigFile; currMissionDir = compileFinal str (_descExtPath select [0, count _descExtPath - 15]); @@ -17,6 +24,9 @@ X_Server = false; X_Client = false; X_JIP = false; +//disable TAW grass Option 'None' +tawvd_disablenone = true; + // versionName = ""; // Set in STR_WL_WelcomeToWasteland in stringtable.xml if (isServer) then { X_Server = true }; @@ -26,6 +36,7 @@ if (isNull player) then { X_JIP = true }; A3W_scriptThreads = []; [DEBUG] call compile preprocessFileLineNumbers "globalCompile.sqf"; +[] spawn compile preprocessFileLineNumbers "addons\spawn\functions.sqf"; //init Wasteland Core [] execVM "config.sqf"; @@ -71,8 +82,20 @@ if (isServer) then [] execVM "server\init.sqf"; }; -//init 3rd Party Scripts -[] execVM "addons\R3F_ARTY_AND_LOG\init.sqf"; -[] execVM "addons\proving_ground\init.sqf"; -[] execVM "addons\scripts\DynamicWeatherEffects.sqf"; -[] execVM "addons\JumpMF\init.sqf"; +//init 3rd Party Scripts (not supposed to run on HC) +if (hasInterface || isServer) then +{ + [] execVM "addons\vactions\functions.sqf"; + [] execVM "addons\parking\functions.sqf"; + [] execVM "addons\storage\functions.sqf"; + [] execVM "addons\R3F_ARTY_AND_LOG\init.sqf"; + [] execVM "addons\scripts\DynamicWeatherEffects.sqf"; + [] execVM "addons\JumpMF\init.sqf"; + [] execVM "addons\outlw_magRepack\MagRepack_init.sqf"; + [] execVM "addons\Explosives-To-Vehicle\init.sqf"; + [] execVM "addons\JTS_PM\Functions.sqf"; + [] execVM "addons\scripts\servercredits.sqf"; + [] execVM "addons\scripts\zlt_fastrope.sqf"; + [] execVM "addons\scripts\resupply_actions.sqf"; + [] execVM "addons\lsd_nvg\init.sqf"; +}; diff --git a/mapConfig/Loading.jpg b/mapConfig/Loading.jpg deleted file mode 100644 index 8a9c9b6a9..000000000 Binary files a/mapConfig/Loading.jpg and /dev/null differ diff --git a/mapConfig/Loading.paa b/mapConfig/Loading.paa new file mode 100644 index 000000000..15ad14328 Binary files /dev/null and b/mapConfig/Loading.paa differ diff --git a/mapConfig/convoys/LandConvoy_4.sqf b/mapConfig/convoys/LandConvoy_4.sqf new file mode 100644 index 000000000..0de055cd1 --- /dev/null +++ b/mapConfig/convoys/LandConvoy_4.sqf @@ -0,0 +1,40 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Version: 1.0 +// @file Name: LandConvoy_4.sqf +// @file Author: [GoT] JoSchaap, [404] Del1te, AgentRev +// @file Created: 13/02/2014 22:52 + +// starting positions for this route +_starts = +[ + [5332.31, 14514.9], + [5303.78, 14508.5], + [5286.03, 14504.3] +]; + +// starting directions in which the vehicles are spawned on this route +_startDirs = +[ + 80, + 80, + 80 +]; + +// the route +_waypoints = +[ + [7214.75, 16080.1], + [8832.21, 15784.5], + [11234.9, 15708.3], + [13729.2, 16122.9], + [16011.3, 17400.2], + [17773.6, 17830.3], + [19453, 16555], + [20850.9, 16745.7], + [22364.8, 18489.3], + [25288.5, 21014.9], + [26339, 21848.2], + [26800.6, 23079.9] +]; diff --git a/mapConfig/convoys/landConvoysList.sqf b/mapConfig/convoys/landConvoysList.sqf index b42e8566c..ba926acb6 100644 --- a/mapConfig/convoys/landConvoysList.sqf +++ b/mapConfig/convoys/landConvoysList.sqf @@ -7,5 +7,6 @@ [ "LandConvoy_1", "LandConvoy_2", - "LandConvoy_3" + "LandConvoy_3", + "LandConvoy_4" ] diff --git a/mapConfig/storeOwners.sqf b/mapConfig/storeOwners.sqf index f1ca3ec0a..83f73df4f 100644 --- a/mapConfig/storeOwners.sqf +++ b/mapConfig/storeOwners.sqf @@ -20,13 +20,15 @@ storeOwnerConfig = compileFinal str ["GunStore2", 1, 75, []], ["GunStore3", 6, 135, []], ["GunStore4", 1, 65, []], + ["GunStore5", 5, 83, []], // Buttons you can disable: "Land", "Armored", "Tanks", "Helicopters", "Boats", "Planes" ["VehStore1", 1, 75, []], ["VehStore2", 6, 45, ["Boats"]], - ["VehStore3", 4, 250, ["Boats"]], - ["VehStore4", 5, 155, ["Boats"]], - ["VehStore5", 0, 190, ["Planes"]] + ["VehStore3", -1, 329, ["Boats"]], + ["VehStore4", -1, 225, ["Boats"]], + ["VehStore5", 1, 69, ["Planes"]], + ["VehStore6", 4, 282, ["Boats", "Planes"]] ]; // Outfits for store owners @@ -42,10 +44,12 @@ storeOwnerConfigAppearance = compileFinal str ["GunStore2", [["weapon", ""], ["uniform", "U_O_SpecopsUniform_blk"]]], ["GunStore3", [["weapon", ""], ["uniform", "U_I_CombatUniform_tshirt"]]], ["GunStore4", [["weapon", ""], ["uniform", "U_IG_Guerilla1_1"]]], + ['GunStore5', [['weapon', ''], ['uniform', 'U_I_CombatUniform_tshirt']]], ["VehStore1", [["weapon", ""], ["uniform", "U_Competitor"]]], ["VehStore2", [["weapon", ""], ["uniform", "U_Competitor"]]], ["VehStore3", [["weapon", ""], ["uniform", "U_Competitor"]]], ["VehStore4", [["weapon", ""], ["uniform", "U_Competitor"]]], - ["VehStore5", [["weapon", ""], ["uniform", "U_Competitor"]]] + ['VehStore5', [['weapon', ''], ['uniform', 'U_Competitor']]], + ['VehStore6', [['weapon', ''], ['uniform', 'U_Competitor']]] ]; diff --git a/mission.sqm b/mission.sqm index 995809ea6..3da63987a 100644 --- a/mission.sqm +++ b/mission.sqm @@ -71,7 +71,8 @@ class Mission "a3_characters_f_beta", "a3_characters_f_gamma", "a3_characters_f", - "A3_Structures_F_EPC_Civ_Accessories" + "A3_Structures_F_EPC_Civ_Accessories", + "A3_Structures_F_EPA_Mil_Scrapyard" }; addOnsAuto[]= { @@ -85,14 +86,13 @@ class Mission "A3_Structures_F_Mil_Cargo", "A3_Structures_F_Households_Slum", "A3_Structures_F_Civ_Market", - "A3_Structures_F_Civ_Camping", "A3_Structures_F_EPC_Civ_Accessories", "a3_map_altis" }; randomSeed=14957468; class Intel { - briefingName="A3Wasteland Altis v1.1b"; // it would be great if you could keep "A3" in the name, like "ABC A3Wasteland" instead of "ABC Wasteland" :) + briefingName="A3Wasteland Altis v1.2"; overviewText="Wasteland survival sandbox by Team Wasteland - visit A3Wasteland.com for more details"; resistanceWest=0; timeOfChanges=3e+038; @@ -110,7 +110,7 @@ class Mission }; class Groups { - items=51; + items=53; class Item0 { side="WEST"; @@ -1988,8 +1988,8 @@ class Mission items=1; class Item0 { - position[]={20761.709,28.229145,7264.2515}; - azimut=250; + position[]={20766.475,28.245422,7259.875}; + azimut=329; id=156; side="LOGIC"; vehicle="C_man_1_1_F"; @@ -2009,8 +2009,8 @@ class Mission items=1; class Item0 { - position[]={14482.604,18.864084,16330.667}; - azimut=155; + position[]={14491.723,18.845406,16333.188}; + azimut=225; id=157; side="LOGIC"; vehicle="C_man_1_1_F"; @@ -2030,8 +2030,8 @@ class Mission items=1; class Item0 { - position[]={3971.4854,4.7541585,15072.055}; - azimut=190; + position[]={3578.8682,26.270664,10781.252}; + azimut=69; id=158; side="LOGIC"; vehicle="C_man_1_1_F"; @@ -2043,15 +2043,57 @@ class Mission }; }; }; + class Item51 + { + side="LOGIC"; + class Vehicles + { + items=1; + class Item0 + { + position[]={5862.0181,225.68094,20106.371}; + azimut=282; + id=159; + side="LOGIC"; + vehicle="C_man_1_1_F"; + leader=1; + skill=0.60000002; + text="VehStore6"; + init="[this] spawn A3W_fnc_setupStoreNPC"; + description="DO NOT MODIFY IN EDITOR"; + }; + }; + }; + class Item52 + { + side="LOGIC"; + class Vehicles + { + items=1; + class Item0 + { + position[]={12399.979,24.920925,15566.039}; + azimut=83; + id=160; + side="LOGIC"; + vehicle="C_man_1_1_F"; + leader=1; + skill=0.60000002; + text="GunStore5"; + init="[this] spawn A3W_fnc_setupStoreNPC"; + description="DO NOT MODIFY IN EDITOR"; + }; + }; + }; }; class Vehicles { - items=30; + items=28; class Item0 { position[]={5892.3325,225.05762,20124.521}; azimut=24.888161; - id=159; + id=161; side="EMPTY"; vehicle="Land_i_House_Big_01_V1_F"; skill=0.2; @@ -2062,7 +2104,7 @@ class Mission { position[]={5802.2612,223.31776,20114.979}; azimut=97.660759; - id=160; + id=162; side="EMPTY"; vehicle="Land_u_House_Small_02_V1_F"; skill=0.2; @@ -2073,7 +2115,7 @@ class Mission { position[]={5812.7163,223.88718,20112.508}; azimut=97.660759; - id=161; + id=163; side="EMPTY"; vehicle="Land_u_House_Small_02_V1_F"; skill=0.2; @@ -2083,7 +2125,7 @@ class Mission class Item3 { position[]={5904.832,225.58371,20186.275}; - id=162; + id=164; side="EMPTY"; vehicle="Land_Cargo_Patrol_V1_F"; skill=0.2; @@ -2094,7 +2136,7 @@ class Mission { position[]={5778.2402,221.67844,20113.643}; azimut=7.7879138; - id=163; + id=165; side="EMPTY"; vehicle="Land_Cargo_Patrol_V1_F"; skill=0.2; @@ -2105,7 +2147,7 @@ class Mission { position[]={5883.7109,227.44626,20088.664}; azimut=38.791935; - id=164; + id=166; side="EMPTY"; vehicle="Land_Cargo_Patrol_V1_F"; skill=0.2; @@ -2116,7 +2158,7 @@ class Mission { position[]={5941.0063,219.62125,20237.648}; azimut=-76.434235; - id=165; + id=167; side="EMPTY"; vehicle="Land_Cargo_Patrol_V1_F"; skill=0.2; @@ -2127,7 +2169,7 @@ class Mission { position[]={5853.6426,218.96228,20175.209}; azimut=85.118469; - id=166; + id=168; side="EMPTY"; vehicle="Land_Slum_House03_F"; skill=0.2; @@ -2138,7 +2180,7 @@ class Mission { position[]={5851.854,221.32671,20162.656}; azimut=124.47146; - id=167; + id=169; side="EMPTY"; vehicle="Land_Slum_House02_F"; skill=0.2; @@ -2149,7 +2191,7 @@ class Mission { position[]={5847.7378,222.46086,20154.539}; azimut=133.80367; - id=168; + id=170; side="EMPTY"; vehicle="Land_Slum_House03_F"; skill=0.2; @@ -2160,7 +2202,7 @@ class Mission { position[]={5840.5811,223.07314,20150.303}; azimut=153.61746; - id=169; + id=171; side="EMPTY"; vehicle="Land_Slum_House01_F"; skill=0.2; @@ -2171,7 +2213,7 @@ class Mission { position[]={5830.8071,222.7514,20148.615}; azimut=177.95645; - id=170; + id=172; side="EMPTY"; vehicle="Land_Slum_House03_F"; skill=0.2; @@ -2182,7 +2224,7 @@ class Mission { position[]={5838.062,217.12964,20181.893}; azimut=-37.911983; - id=171; + id=173; side="EMPTY"; vehicle="Land_Slum_House01_F"; skill=0.2; @@ -2193,7 +2235,7 @@ class Mission { position[]={5832.1758,217.55113,20175.316}; azimut=-46.636852; - id=172; + id=174; side="EMPTY"; vehicle="Land_Slum_House02_F"; skill=0.2; @@ -2204,7 +2246,7 @@ class Mission { position[]={5826.5269,218.02791,20169.475}; azimut=-46.636852; - id=173; + id=175; side="EMPTY"; vehicle="Land_Slum_House01_F"; skill=0.2; @@ -2215,7 +2257,7 @@ class Mission { position[]={5819.561,219.2971,20159.201}; azimut=-90.399368; - id=174; + id=176; side="EMPTY"; vehicle="Land_Slum_House03_F"; skill=0.2; @@ -2226,7 +2268,7 @@ class Mission { position[]={5841.7822,222.42061,20158.293}; azimut=-44.915901; - id=175; + id=177; side="EMPTY"; vehicle="Land_StallWater_F"; skill=0.2; @@ -2237,7 +2279,7 @@ class Mission { position[]={5833.0811,221.07756,20159.025}; azimut=-66.432838; - id=176; + id=178; side="EMPTY"; vehicle="Land_Cages_F"; skill=0.2; @@ -2247,7 +2289,7 @@ class Mission class Item18 { position[]={5843.8735,219.25572,20169.4}; - id=177; + id=179; side="EMPTY"; vehicle="Land_CratesShabby_F"; skill=0.2; @@ -2258,7 +2300,7 @@ class Mission { position[]={5837.647,220.00575,20164.465}; azimut=-44.915901; - id=178; + id=180; side="EMPTY"; vehicle="Land_MarketShelter_F"; skill=0.2; @@ -2269,7 +2311,7 @@ class Mission { position[]={5836.4023,222.51828,20154.047}; azimut=-174.08286; - id=179; + id=181; side="EMPTY"; vehicle="Land_Sacks_heap_F"; skill=0.2; @@ -2280,7 +2322,7 @@ class Mission { position[]={5841.7148,217.69827,20176.627}; azimut=-123.43818; - id=180; + id=182; side="EMPTY"; vehicle="Land_WoodenCart_F"; skill=0.2; @@ -2288,28 +2330,6 @@ class Mission description="DO NOT MODIFY IN EDITOR"; }; class Item22 - { - position[]={5838.0376,219.93082,20164.814}; - azimut=163.54198; - id=181; - side="EMPTY"; - vehicle="Campfire_burning_F"; - skill=0.2; - init="[this, true] call A3W_fnc_setupMissionObject"; - description="DO NOT MODIFY IN EDITOR"; - }; - class Item23 - { - position[]={5846.2808,218.43889,20175.215}; - azimut=-44.915901; - id=182; - side="EMPTY"; - vehicle="Campfire_burning_F"; - skill=0.2; - init="[this, true] call A3W_fnc_setupMissionObject"; - description="DO NOT MODIFY IN EDITOR"; - }; - class Item24 { position[]={3574.9937,11.526847,12800.598}; azimut=302.65201; @@ -2321,7 +2341,7 @@ class Mission init="[this] call A3W_fnc_setupMissionATM"; description="DO NOT MODIFY IN EDITOR"; }; - class Item25 + class Item23 { position[]={14492,18.768188,16383.846}; azimut=185.51801; @@ -2332,7 +2352,7 @@ class Mission init="[this] call A3W_fnc_setupMissionATM"; description="DO NOT MODIFY IN EDITOR"; }; - class Item26 + class Item24 { position[]={25618.682,20.873209,21353.275}; azimut=136.1844; @@ -2344,7 +2364,7 @@ class Mission init="[this] call A3W_fnc_setupMissionATM"; description="DO NOT MODIFY IN EDITOR"; }; - class Item27 + class Item25 { position[]={16774.646,18.403027,12594.591}; azimut=270.28101; @@ -2356,7 +2376,7 @@ class Mission init="[this] call A3W_fnc_setupMissionATM"; description="DO NOT MODIFY IN EDITOR"; }; - class Item28 + class Item26 { position[]={9507.4814,118.30473,15937.552}; azimut=4.3656998; @@ -2368,7 +2388,7 @@ class Mission init="[this] call A3W_fnc_setupMissionATM"; description="DO NOT MODIFY IN EDITOR"; }; - class Item29 + class Item27 { position[]={21647.465,14.035986,7676.2676}; azimut=230.96605; @@ -2382,7 +2402,7 @@ class Mission }; class Markers { - items=174; + items=202; class Item0 { position[]={3612.1487,12.11851,13020.892}; @@ -2623,7 +2643,7 @@ class Mission }; class Item34 { - position[]={5062.5967,70.270027,13039.418}; + position[]={7042.917,13.922895,11416.329}; name="Mission_1"; type="Empty"; colorName="ColorOrange"; @@ -2637,70 +2657,70 @@ class Mission }; class Item36 { - position[]={12863.644,85.280762,16739.199}; + position[]={12574.066,33.292294,16320.846}; name="Mission_3"; type="Empty"; colorName="ColorOrange"; }; class Item37 { - position[]={14719.545,17.91,16588.41}; + position[]={15903.801,45.815987,18170.334}; name="Mission_4"; type="Empty"; colorName="ColorOrange"; }; class Item38 { - position[]={20857.92,2.3399255,14654.278}; + position[]={23823.162,7.3760862,16418.084}; name="Mission_5"; type="Empty"; colorName="ColorOrange"; }; class Item39 { - position[]={22902.482,6.8000588,18832.326}; + position[]={19886.855,65.16983,17849.635}; name="Mission_7"; type="Empty"; colorName="ColorOrange"; }; class Item40 { - position[]={26832.408,27.07863,24353.201}; + position[]={26838.061,26.449696,24341.111}; name="Mission_8"; type="Empty"; colorName="ColorOrange"; }; class Item41 { - position[]={20944.896,25.394508,7337.4028}; + position[]={21197.471,18.571796,7365.332}; name="Mission_9"; type="Empty"; colorName="ColorOrange"; }; class Item42 { - position[]={10481.982,92.54425,8165.8809}; + position[]={12093.65,3.3626416,10467.896}; name="Mission_10"; type="Empty"; colorName="ColorOrange"; }; class Item43 { - position[]={2727.3538,15.386948,10029.145}; + position[]={3607.2749,15.698098,10276.05}; name="Mission_11"; type="Empty"; colorName="ColorOrange"; }; class Item44 { - position[]={9214.7344,16.21249,21595.523}; + position[]={9794.957,5.1698751,22320.566}; name="Mission_12"; type="Empty"; colorName="ColorOrange"; }; class Item45 { - position[]={3067.5686,30.175802,18451.545}; + position[]={2998.4082,32.631886,18508.988}; name="Mission_13"; type="Empty"; colorName="ColorOrange"; @@ -2714,42 +2734,42 @@ class Mission }; class Item47 { - position[]={14610.646,20.695858,23086.605}; + position[]={16806.289,6.3426394,21895.252}; name="Mission_15"; type="Empty"; colorName="ColorOrange"; }; class Item48 { - position[]={20120.457,15.311475,19884.57}; + position[]={20150.699,15.581096,19873.928}; name="Mission_16"; type="Empty"; colorName="ColorOrange"; }; class Item49 { - position[]={20723.074,29.782133,10239.525}; + position[]={21236.416,2.4247937,10639.023}; name="Mission_17"; type="Empty"; colorName="ColorOrange"; }; class Item50 { - position[]={14253.941,4.9646177,13012.583}; + position[]={16720.473,10.761951,13549.766}; name="Mission_18"; type="Empty"; colorName="ColorOrange"; }; class Item51 { - position[]={8368.5674,13.81883,10719.636}; + position[]={9187.7529,109.82971,11440.142}; name="Mission_19"; type="Empty"; colorName="ColorOrange"; }; class Item52 { - position[]={6170.2021,44.518726,16368.712}; + position[]={6171.6982,44.522717,16368.712}; name="Mission_20"; type="Empty"; colorName="ColorOrange"; @@ -3473,21 +3493,21 @@ class Mission }; class Item142 { - position[]={18295.152,-6.7252245,8136.5732}; + position[]={13664.722,-0.120299,11892.979}; name="SunkenMission_0"; type="Empty"; colorName="ColorWhite"; }; class Item143 { - position[]={16985.289,-0.27175087,13616.465}; + position[]={15421.785,-0.20875727,14276.165}; name="SunkenMission_1"; type="Empty"; colorName="ColorWhite"; }; class Item144 { - position[]={9866.0479,0.014741103,11111.971}; + position[]={13106.126,-0.24947838,9494.5898}; name="SunkenMission_2"; type="Empty"; colorName="ColorWhite"; @@ -3501,35 +3521,35 @@ class Mission }; class Item146 { - position[]={3505.4102,-0.023277842,11439.938}; + position[]={3000.5508,-0.29678684,13521.053}; name="SunkenMission_4"; type="Empty"; colorName="ColorWhite"; }; class Item147 { - position[]={3849.9155,0.00057628582,15028.444}; + position[]={2357.9688,0.1024858,19374.357}; name="SunkenMission_5"; type="Empty"; colorName="ColorWhite"; }; class Item148 { - position[]={5281.2344,0.23328479,22658.328}; + position[]={6276.0981,0.2718358,22660.088}; name="SunkenMission_6"; type="Empty"; colorName="ColorWhite"; }; class Item149 { - position[]={21207.197,0.20755874,20124.484}; + position[]={17603.389,-0.027867785,18805.65}; name="SunkenMission_7"; type="Empty"; colorName="ColorWhite"; }; class Item150 { - position[]={24573.881,-0.0090859979,16154.248}; + position[]={23156.707,-0.036080703,24039.277}; name="SunkenMission_8"; type="Empty"; colorName="ColorWhite"; @@ -3682,25 +3702,226 @@ class Mission }; class Item171 { - position[]={3968.136,3.2309315,15051.626}; - name="VehStore5_landSpawn"; + position[]={3630.4226,0,10890.602}; + name="VehStore5_seaSpawn"; type="Empty"; colorName="ColorBlack"; }; class Item172 { - position[]={4001.2522,6.2997766,15050.635}; + position[]={3568.3159,39.908432,10713.679}; name="VehStore5_heliSpawn"; type="Empty"; colorName="ColorBlack"; }; class Item173 { - position[]={3922.1943,0,15060.141}; - name="VehStore5_seaSpawn"; + position[]={3620.7668,26.371962,10751.382}; + name="VehStore5_landSpawn"; + type="Empty"; + colorName="ColorBlack"; + }; + class Item174 + { + position[]={5862.7539,223.64549,20136.576}; + name="VehStore6_heliSpawn"; + type="Empty"; + colorName="ColorBlack"; + }; + class Item175 + { + position[]={5860.1025,224.68323,20118.383}; + name="VehStore6_landSpawn"; + type="Empty"; + colorName="ColorBlack"; + }; + class Item176 + { + position[]={12412.868,24.364281,15579.608}; + name="GunStore5_objSpawn"; type="Empty"; colorName="ColorBlack"; }; + class Item177 + { + position[]={11709.138,54.848961,18224.15}; + name="Mission_21"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item178 + { + position[]={18755.395,208.82076,10202.748}; + name="Mission_22"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item179 + { + position[]={19436.357,23.452351,14351.174}; + name="Mission_23"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item180 + { + position[]={16657.51,16.230467,12689.979}; + name="Mission_24"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item181 + { + position[]={11327.046,138.86478,8257.0918}; + name="Mission_25"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item182 + { + position[]={8454.9404,96.900978,25174.967}; + name="Mission_26"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item183 + { + position[]={8196.7402,74.394363,22541.352}; + name="Mission_27"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item184 + { + position[]={12363.744,77.006287,21894.768}; + name="Mission_28"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item185 + { + position[]={16155.725,33.545872,19367.801}; + name="Mission_29"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item186 + { + position[]={20955.344,15.493174,19268.236}; + name="Mission_30"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item187 + { + position[]={22472.322,18.29957,20019.885}; + name="Mission_31"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item188 + { + position[]={22614.143,20.432728,21617.762}; + name="Mission_32"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item189 + { + position[]={25432.072,9.7850418,20345.178}; + name="Mission_33"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item190 + { + position[]={28192.398,28.236439,25684.068}; + name="Mission_34"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item191 + { + position[]={27495.762,18.622601,21483.043}; + name="Mission_35"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item192 + { + position[]={3814.7158,189.58923,21497.254}; + name="Mission_36"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item193 + { + position[]={2312.7026,74.332687,22269.027}; + name="Mission_37"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item194 + { + position[]={3814.9829,13.853227,17497.141}; + name="Mission_38"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item195 + { + position[]={12820.76,46.35466,19690.66}; + name="Mission_39"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item196 + { + position[]={14096.81,19.359612,18465.543}; + name="Mission_40"; + type="Empty"; + colorName="ColorOrange"; + }; + class Item197 + { + position[]={24139,0,6025}; + name="General Store"; + text="General Store"; + type="mil_dot"; + colorName="ColorBlue"; + }; + class Item198 + { + position[]={24139,0,5330}; + name="Gun Store"; + text="Gun Store"; + type="mil_dot"; + colorName="ColorYellow"; + }; + class Item199 + { + position[]={24139,0,4635}; + name="Parking"; + text="Parking"; + type="mil_dot"; + colorName="ColorKhaki"; + }; + class Item200 + { + position[]={24139,0,3940}; + name="Storage"; + text="Storage"; + type="mil_dot"; + colorName="ColorUNKNOWN"; + }; + class Item201 + { + position[]={24139,0,3245}; + name="Vehicle Store"; + text="Vehicle Store"; + type="mil_dot"; + colorName="ColorOrange"; + }; }; }; class Intro diff --git a/persistence/client/players/applyPlayerData.sqf b/persistence/client/players/applyPlayerData.sqf deleted file mode 100644 index 1b0e38b5b..000000000 --- a/persistence/client/players/applyPlayerData.sqf +++ /dev/null @@ -1,160 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: applyPlayerData.sqf -// @file Author: AgentRev - -// This is where you load player status & inventory data which will be wiped upon death, for persistent variables use c_applyPlayerInfo.sqf instead - -private ["_data", "_name", "_value"]; - -_data = _this; - -removeAllWeapons player; -removeAllAssignedItems player; -removeUniform player; -removeVest player; -removeBackpack player; -removeGoggles player; -removeHeadgear player; - -{ - _name = _x select 0; - _value = _x select 1; - - switch (_name) do - { - case "Damage": { player setDamage _value }; - case "HitPoints": { { player setHitPointDamage _x } forEach _value }; - case "Hunger": { hungerLevel = _value }; - case "Thirst": { thirstLevel = _value }; - case "Money": { player setVariable ["cmoney", _value, true] }; - /*case "Position": - { - if (count _value == 3) then - { - { if (typeName _x == "STRING") then { _value set [_forEachIndex, parseNumber _x] } } forEach _value; - player setPosATL _value; - }; - }; - case "Direction": { player setDir _value };*/ - case "Uniform": - { - // If uniform cannot be worn by player due to different team, try to convert it, else give default instead - if (_value != "") then - { - if (player isUniformAllowed _value) then - { - player addUniform _value; - } - else - { - _newUniform = [player, _value] call uniformConverter; - - if (player isUniformAllowed _newUniform) then - { - player addUniform _newUniform; - } - else - { - player addUniform ([player, "uniform"] call getDefaultClothing); - } - }; - }; - }; - case "Vest": { if (_value != "") then { player addVest _value } }; - case "Backpack": - { - removeBackpack player; - - if (_value != "") then - { - if (_value isKindOf "Weapon_Bag_Base" && ({_value isKindOf _x} count ["B_UAV_01_backpack_F", "B_Static_Designator_01_weapon_F", "O_Static_Designator_02_weapon_F"] == 0)) then - { - player addBackpack "B_AssaultPack_rgr"; // NO SOUP FOR YOU - } - else - { - player addBackpack _value; - }; - }; - }; - case "Goggles": { if (_value != "") then { player addGoggles _value } }; - case "Headgear": - { - // If wearing one of the default headgears, give the one belonging to actual team instead - if (_value != "") then - { - _defHeadgear = [player, "headgear"] call getDefaultClothing; - _defHeadgears = - [ - [typeOf player, "headgear", BLUFOR] call getDefaultClothing, - [typeOf player, "headgear", OPFOR] call getDefaultClothing, - [typeOf player, "headgear", INDEPENDENT] call getDefaultClothing - ]; - - if (_value != _defHeadgear && {_defHeadgear != ""} && {{_value == _x} count _defHeadgears > 0}) then - { - player addHeadgear _defHeadgear; - } - else - { - player addHeadgear _value; - }; - }; - }; - case "LoadedMagazines": - { - player addBackpack "B_Carryall_Base"; // temporary backpack to hold mags - { player addMagazine _x } forEach _value; - }; - case "PrimaryWeapon": { player addWeapon _value; removeAllPrimaryWeaponItems player }; - case "SecondaryWeapon": { player addWeapon _value }; - case "HandgunWeapon": { player addWeapon _value; removeAllHandgunItems player }; - case "PrimaryWeaponItems": { { if (_x != "") then { player addPrimaryWeaponItem _x } } forEach _value }; - case "SecondaryWeaponItems": { { if (_x != "") then { player addSecondaryWeaponItem _x } } forEach _value }; - case "HandgunItems": { { if (_x != "") then { player addHandgunItem _x } } forEach _value }; - case "AssignedItems": - { - { - if ([player, _x] call isAssignableBinocular) then - { - // Temporary fix for http://feedback.arma3.com/view.php?id=21618 - if (_x == "Laserdesignator" && {{_x == "Laserbatteries"} count magazines player == 0}) then - { - [player, "Laserbatteries"] call fn_forceAddItem; - }; - - player addWeapon _x; - } - else - { - if (["_UavTerminal", _x] call fn_findString != -1) then - { - _x = switch (playerSide) do - { - case BLUFOR: { "B_UavTerminal" }; - case OPFOR: { "O_UavTerminal" }; - default { "I_UavTerminal" }; - }; - }; - - player linkItem _x; - }; - } forEach _value; - }; - case "CurrentWeapon": { player selectWeapon _value }; - case "Stance": { [player, [player, _value] call getFullMove] call switchMoveGlobal }; - case "UniformWeapons": { { (uniformContainer player) addWeaponCargoGlobal _x } forEach _value }; - case "UniformItems": { { (uniformContainer player) addItemCargoGlobal _x } forEach _value }; - case "UniformMagazines": { [uniformContainer player, _value] call processMagazineCargo }; - case "VestWeapons": { { (vestContainer player) addWeaponCargoGlobal _x } forEach _value }; - case "VestItems": { { (vestContainer player) addItemCargoGlobal _x } forEach _value }; - case "VestMagazines": { [vestContainer player, _value] call processMagazineCargo }; - case "BackpackWeapons": { { (backpackContainer player) addWeaponCargoGlobal _x } forEach _value }; - case "BackpackItems": { { (backpackContainer player) addItemCargoGlobal _x } forEach _value }; - case "BackpackMagazines": { [backpackContainer player, _value] call processMagazineCargo }; - case "PartialMagazines": { { player addMagazine _x } forEach _value }; - case "WastelandItems": { { [_x select 0, _x select 1, true] call mf_inventory_add } forEach _value }; - }; -} forEach _data; diff --git a/persistence/client/players/applyPlayerInfo.sqf b/persistence/client/players/applyPlayerInfo.sqf deleted file mode 100644 index 1a37aeac5..000000000 --- a/persistence/client/players/applyPlayerInfo.sqf +++ /dev/null @@ -1,22 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: applyPlayerInfo.sqf -// @file Author: AgentRev - -// This is where you load custom player variables that must persist between deaths - -private ["_data", "_name", "_value"]; - -_data = _this; - -{ - _name = _x select 0; - _value = _x select 1; - - switch (_name) do - { - //case "Donator": { player setVariable ["Donator", _value > 0] }; // deprecated - //case "BankMoney": { player setVariable ["bmoney", _value max 0, true] }; // NOTE: Bank money assignation has been moved server-side - }; -} forEach _data; diff --git a/persistence/client/players/getPlayerData.sqf b/persistence/client/players/getPlayerData.sqf deleted file mode 100644 index 69312f722..000000000 --- a/persistence/client/players/getPlayerData.sqf +++ /dev/null @@ -1,114 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getPlayerData.sqf -// @file Author: AgentRev - -private ["_player", "_saveLocation", "_data", "_hitPoints", "_hitPoint", "_pos", "_loadedMags", "_mag", "_ammo", "_loaded", "_type", "_wastelandItems"]; -_player = _this select 0; -_saveLocation = if (count _this > 1) then { _this select 1 } else { true }; - -_data = if (_player == player) then { - [ - ["Hunger", ["hungerLevel", 0] call getPublicVar], - ["Thirst", ["thirstLevel", 0] call getPublicVar] - ] -} else { - [] -}; - -_hitPoints = []; -{ - _hitPoint = configName _x; - _hitPoints pushBack [_hitPoint, _player getHitPointDamage _hitPoint]; -} forEach (_player call getHitPoints); - -{ _data pushBack _x } forEach -[ - ["Damage", damage _player], - ["HitPoints", _hitPoints], - ["Money", _player getVariable ["cmoney", 0]] // Money is always saved, but only restored if A3W_moneySaving = 1 -]; - -// Only save those when on ground or underwater (you probably wouldn't want to spawn 500m in the air if you get logged off in flight) -if (_saveLocation && {isTouchingGround vehicle _player || {(getPos _player) select 2 < 0.5 || (getPosASL _player) select 2 < 0.5}}) then -{ - _pos = getPosATL _player; - { _pos set [_forEachIndex, _x call fn_numToStr] } forEach _pos; - - _data pushBack ["Position", _pos]; - _data pushBack ["Direction", getDir _player]; - - if (vehicle _player == player) then - { - _data pushBack ["CurrentWeapon", currentWeapon player]; - _data pushBack ["Stance", [player, ["P"]] call getMoveParams]; - }; -}; - -{ _data pushBack _x } forEach -[ - ["Uniform", uniform _player], - ["Vest", vest _player], - ["Backpack", backpack _player], - ["Goggles", goggles _player], - ["Headgear", headgear _player], - - ["PrimaryWeapon", primaryWeapon _player], - ["SecondaryWeapon", secondaryWeapon _player], - ["HandgunWeapon", handgunWeapon _player], - - ["PrimaryWeaponItems", primaryWeaponItems _player], - ["SecondaryWeaponItems", secondaryWeaponItems _player], - ["HandgunItems", handgunItems _player], - - ["AssignedItems", assignedItems _player] -]; - - -_loadedMags = []; - -{ - _mag = _x select 0; - _ammo = _x select 1; - _loaded = _x select 2; - _type = _x select 3; - - // if loaded in weapon, not empty, and not hand grenade - if (_loaded && _ammo > 0 && _type != 0) then - { - _loadedMags pushBack [_mag, _ammo]; - }; -} forEach magazinesAmmoFull _player; - -{ _data pushBack _x } forEach -[ - ["UniformWeapons", (getWeaponCargo uniformContainer _player) call cargoToPairs], - ["UniformItems", (getItemCargo uniformContainer _player) call cargoToPairs], - ["UniformMagazines", (uniformContainer _player) call fn_magazineAmmoCargo], - - ["VestWeapons", (getWeaponCargo vestContainer _player) call cargoToPairs], - ["VestItems", (getItemCargo vestContainer _player) call cargoToPairs], - ["VestMagazines", (vestContainer _player) call fn_magazineAmmoCargo], - - ["BackpackWeapons", (getWeaponCargo backpackContainer _player) call cargoToPairs], - ["BackpackItems", (getItemCargo backpackContainer _player) call cargoToPairs], - ["BackpackMagazines", (backpackContainer _player) call fn_magazineAmmoCargo], - - ["LoadedMagazines", _loadedMags] -]; - -if (_player == player) then -{ - _wastelandItems = []; - { - if (_x select 1 > 0) then - { - _wastelandItems pushBack [_x select 0, _x select 1]; - }; - } forEach call mf_inventory_all; - - _data pushBack ["WastelandItems", _wastelandItems]; -}; - -_data diff --git a/persistence/client/players/savePlayerData.sqf b/persistence/client/players/savePlayerData.sqf deleted file mode 100644 index 460ad6ebe..000000000 --- a/persistence/client/players/savePlayerData.sqf +++ /dev/null @@ -1,109 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: savePlayerData.sqf -// @file Author: AgentRev - -if (!isNil "savePlayerHandle" && {typeName savePlayerHandle == "SCRIPT"} && {!scriptDone savePlayerHandle}) exitWith {}; - -savePlayerHandle = _this spawn -{ - if (alive player && - {!isNil "isConfigOn" && {["A3W_playerSaving"] call isConfigOn}} && - {!isNil "playerSetupComplete" && {playerSetupComplete}} && - {!isNil "respawnDialogActive" && {!respawnDialogActive}} && - {!(player call A3W_fnc_isUnconscious)}) then - { - _UID = getPlayerUID player; - _manualSave = [_this, 0, false, [false]] call BIS_fnc_param; - - // In case script is triggered via menu action - if (!_manualSave) then - { - _manualSave = [_this, 3, false, [false]] call BIS_fnc_param; - }; - - _info = - [ - ["Name", name player], - ["LastSide", str playerSide]//, - //["BankMoney", player getVariable ["bmoney", 0]] // NOTE: Bank money saving has been moved server-side - ]; - - _data = [player] call fn_getPlayerData; - - - if (!isNil "playerData_infoPairs") then - { - { - _oldPair = _x; - { - if (_x isEqualTo _oldPair) then - { - _info set [_forEachIndex, -1]; - }; - } forEach _info; - } forEach playerData_infoPairs; - - _info = _info - [-1]; - }; - - if (!isNil "playerData_savePairs") then - { - { - _oldPair = _x; - { - if (_x isEqualTo _oldPair) then - { - _data set [_forEachIndex, -1]; - }; - } forEach _data; - } forEach playerData_savePairs; - - _data = _data - [-1]; - }; - - if (alive player) then - { - if (count _info > 0 || count _data > 0) then - { - pvar_savePlayerData = [_UID, _info, _data, player]; - publicVariableServer "pvar_savePlayerData"; - }; - - if (_manualSave) then - { - cutText ["\nPlayer saved!", "PLAIN DOWN", 0.2]; - }; - }; - - if (isNil "playerData_infoPairs") then - { - playerData_infoPairs = _info; - } - else - { - { - [playerData_infoPairs, _x select 0, _x select 1] call fn_setToPairs; - } forEach _info; - }; - - if (isNil "playerData_savePairs") then - { - playerData_savePairs = _info; - } - else - { - { - [playerData_savePairs, _x select 0, _x select 1] call fn_setToPairs; - } forEach _data; - }; - }; -}; - -if (typeName savePlayerHandle == "SCRIPT") then -{ - _savePlayerHandle = savePlayerHandle; - waitUntil {scriptDone _savePlayerHandle}; - savePlayerHandle = nil; -}; diff --git a/persistence/client/players/setupPlayerDB.sqf b/persistence/client/players/setupPlayerDB.sqf deleted file mode 100644 index 5c13662fe..000000000 --- a/persistence/client/players/setupPlayerDB.sqf +++ /dev/null @@ -1,93 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: setupPlayerDB.sqf -// @file Author: AgentRev - -if (isDedicated) exitWith {}; - -_playerFuncs = "persistence\client\players"; - -fn_applyPlayerData = [_playerFuncs, "applyPlayerData.sqf"] call mf_compile; -fn_applyPlayerInfo = [_playerFuncs, "applyPlayerInfo.sqf"] call mf_compile; -fn_savePlayerData = [_playerFuncs, "savePlayerData.sqf"] call mf_compile; - -fn_requestPlayerData = -{ - playerData_alive = nil; - playerData_loaded = nil; - playerData_resetPos = nil; - pvar_requestPlayerData = [player, getPlayerUID player, netId player]; - publicVariableServer "pvar_requestPlayerData"; -} call mf_compile; - -fn_deletePlayerData = -{ - pvar_deletePlayerData = getPlayerUID player; - publicVariableServer "pvar_deletePlayerData"; - playerData_infoPairs = nil; - playerData_savePairs = nil; -} call mf_compile; - - -("pvar_applyPlayerData_" + getPlayerUID player) addPublicVariableEventHandler -{ - (_this select 1) spawn - { - _data = _this; - _saveValid = [_data, "PlayerSaveValid", false] call fn_getFromPairs; - - private "_pos"; - - if (_saveValid) then - { - playerData_alive = true; - - _pos = [_data, "Position", []] call fn_getFromPairs; - _preload = profileNamespace getVariable ["A3W_preloadSpawn", true]; - - { if (typeName _x == "STRING") then { _pos set [_forEachIndex, parseNumber _x] } } forEach _pos; - - if (count _pos == 2) then { _pos set [2, 0] }; - if (count _pos == 3) then - { - if (_preload) then - { - 9999 cutText ["Preloading previous location...", "BLACK", 0.01]; - waitUntil {sleep 0.1; preloadCamera _pos}; - } - else - { - 9999 cutText ["Loading previous location...", "BLACK", 0.01]; - }; - } - else - { - playerData_resetPos = true; - }; - - waitUntil {!isNil "bis_fnc_init" && {bis_fnc_init}}; // wait for loading screen to be done - - _data call fn_applyPlayerData; - }; - - _data call fn_applyPlayerInfo; - - if (_saveValid) then - { - if (isNil "playerData_resetPos") then - { - execVM "client\functions\firstSpawn.sqf"; - - playerData_spawnPos = _pos; - playerData_spawnDir = [_data, "Direction"] call fn_getFromPairs; - } - else - { - player groupChat "Your position has been reset"; - }; - }; - - playerData_loaded = true; - }; -}; diff --git a/persistence/fn_sock_custom.sqf b/persistence/fn_sock_custom.sqf new file mode 100644 index 000000000..4eedb9951 --- /dev/null +++ b/persistence/fn_sock_custom.sqf @@ -0,0 +1,76 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +//Persistent Scripts by ZA-Gamers. www.za-gamers.co.za +//Filename: fn_inidb_custom.sqf +//Author: {ZAG}Ed! +//Email: edwin(at)vodamail(dot)co(dot)za +//Date: 26/03/2013 +//Thanx to iniDB's author SicSemperTyrannis! May you have many wives and children! + +// WARNING! This is a modified version for use with A3Wasteland! +// This is NOT a default persistantdb script! +// changes by: JoSchaap, Bewilderbeest, and AgentRev @ http://a3wasteland.com/ + +#define __DEBUG_INIDB_CALLS__ 0 + +if (hasInterface) exitWith {}; + + +PDB_ServerID = if (isNil "PDB_ServerID") then {"A3W_"} else {PDB_ServerID}; +PDB_PlayerFileID = if (isNil "PDB_PlayerFileID") then {PDB_ServerID} else {PDB_PlayerFileID}; +PDB_ObjectFileID = if (isNil "PDB_ObjectFileID") then {PDB_ServerID} else {PDB_ObjectFileID}; +PDB_VehicleFileID = if (isNil "PDB_VehicleFileID") then {PDB_ServerID} else {PDB_VehicleFileID}; +PDB_MessagesFileID = if (isNil "PDB_MessagesFileID") then {PDB_ServerID} else {PDB_MessagesFileID}; +PDB_AdminLogFileID = if (isNil "PDB_AdminLogFileID") then {PDB_ServerID} else {PDB_AdminLogFileID}; +PDB_HackerLogFileID = if (isNil "PDB_HackerLogFileID") then {PDB_ServerID} else {PDB_HackerLogFileID}; +PDB_PlayersListFileID = if (isNil "PDB_PlayersListFileID") then {PDB_ServerID} else {PDB_PlayersListFileID}; + + + +PDB_playerFileName = compileFinal ("format ['%1%2', '" + PDB_PlayerFileID + "', _this]"); +PDB_objectFileName = compileFinal ("format ['%1%2', '" + PDB_ObjectFileID + "', _this]"); +PDB_vehicleFileName = compileFinal ("format ['%1%2', '" + PDB_VehicleFileID + "', _this]"); +PDB_messagesFileName = compileFinal ("format ['%1%2', '" + PDB_MessagesFileID + "', _this]"); +PDB_adminLogFileName = compileFinal ("format ['%1%2', '" + PDB_AdminLogFileID + "', _this]"); +PDB_hackerLogFileName = compileFinal ("format ['%1%2', '" + PDB_HackerLogFileID + "', _this]"); +PDB_playersListFileName = compileFinal ("format ['%1%2', '" + PDB_PlayersListFileID + "', _this]"); + + +diag_log format["[INFO] config: PDB_PlayerFileID = %1", PDB_PlayerFileID]; +diag_log format["[INFO] config: PDB_ObjectFileID = %1", PDB_ObjectFileID]; +diag_log format["[INFO] config: PDB_VehicleFileID = %1", PDB_VehicleFileID]; +diag_log format["[INFO] config: PDB_MessagesFileID = %1", PDB_MessagesFileID]; +diag_log format["[INFO] config: PDB_AdminLogFileID = %1", PDB_AdminLogFileID]; +diag_log format["[INFO] config: PDB_HackerLogFileID = %1", PDB_HackerLogFileID]; +diag_log format["[INFO] config: PDB_PlayersListFileID = %1", PDB_PlayersListFileID]; + + +call compile preprocessFileLineNumbers "persistence\sock\inidb_adapter.sqf"; +publicVariable "PDB_PlayerFileID"; + + +PDB_defaultValue = { + private ["_type", "_data"]; + _type = _this select 0; + _data = _this select 1; + + switch (toUpper _type) do + { + case "ARRAY": { [] }; + case "STRING": { if (isNil "_data") then { "" } else { str _data } }; + case "NUMBER": { parseNumber str _data }; + case "SCALAR": { parseNumber str _data }; + default { nil }; + }; +} +call mf_compile; + +// Server-side profileNamespace saving if iniDB is disabled or unavailable +PDB_exists = iniDB_exists; +PDB_read = iniDB_read; +PDB_write = iniDB_write; +PDB_delete = iniDB_delete; +PDB_deleteSection = iniDB_deleteSection; + +call compile preprocessFileLineNumbers "persistence\lib\normalize_config.sqf"; \ No newline at end of file diff --git a/persistence/lib/hash.sqf b/persistence/lib/hash.sqf new file mode 100644 index 000000000..5973338a1 --- /dev/null +++ b/persistence/lib/hash.sqf @@ -0,0 +1,139 @@ +if (!isNil "hash_loaded") exitWith {}; +diag_log "hash loading ..."; + +#include "macro.h" + +/** + * Gets the key-value pair from the specified hash. + * + * e.g. + * [_hash, _key] call hash_get_key_value; + * + * This is useful if you need to pass the key-value pair by reference to another function + * + */ +hash_get_key_value = { + ARGVX3(0,_hash,[]); + ARGVX3(1,_key,""); + + def(_result); + def(_ckey); + + { + if(true) then { + if(!isARRAY(_x)) exitWith {}; + _ckey = _x select 0; + if (!isSTRING(_ckey)) exitWith {}; + if (_ckey != _key) exitWith {}; + _result = _x; + }; + if (!isNil "_result") exitWith {}; + } forEach _hash; + + OR(_result,nil) +}; + +/** + * Gets the value for the given key within the specified hash + * + * e.g. + * [_hash, _key] call hash_get_key; + * + */ + +hash_get_key = { + ARGVX2(0,_hash); + ARGVX3(1,_key,""); + + def(_key_value); + _key_value = [_hash, _key] call hash_get_key_value; + + if (!isARRAY(_key_value)) exitWith {}; + if (count(_key_value) < 2) exitWith {}; + + (_key_value select 1) +}; + +/** + * Puts the given key-value pair into the target hash + * + * e.g. + * [_hash, _key, _value] call hash_set_key; + * + * Note that value may be nil + * + */ +hash_set_key = { + ARGVX3(0,_hash,[]); + ARGVX3(1,_key,""); + ARGV2(2,_value); + + //diag_log format["_key = %1, _value = %2", _key, OR(_value,nil)]; + + def(_key_value); + _key_value = [_hash, _key] call hash_get_key_value; + + if (!isARRAY(_key_value)) then { + _key_value = [_key, OR(_value,nil)]; + _hash pushBack _key_value; + } + else { + _key_value set [1, OR(_value,nil)]; + }; + + (_key_value) +}; + +/** + * Merges all the key-value pairs from source to target + * + * e.g. + * [_target, _source] call hash_set_all; + * + */ +hash_set_all = { + ARGVX3(0,_target,[]); + ARGVX3(1,_source,[]); + + def(_key); + def(_value); + {if (true) then { + if (isNil "_x") exitWith {}; + if (!isARRAY(_x)) exitWith {}; + + _key = _x select 0; + _value = if (count(_x) > 1) then {_x select 1} else {nil}; + + [_target,_key, OR(_value,nil)] call hash_set_key; + };} forEach _source; + + (_target) +}; + +/** + * Delete a key from the hash (does not set it to nil), it actually removes it + */ +hash_remove_key = { + ARGVX3(0,_hash,[]); + ARGVX3(1,_key,""); + + def(_ckey); + def(_index); + { + if(true) then { + if(!isARRAY(_x)) exitWith {}; + _ckey = _x select 0; + if (!isSTRING(_ckey)) exitWith {}; + if (_ckey != _key) exitWith {}; + _index = _forEachIndex; + }; + if (!isNil "_index") exitWith {}; + } forEach _hash; + + if (isNil "_index") exitWith {}; + _hash deleteAt _index; +}; + + +hash_loaded = true; +diag_log "hash loading complete"; \ No newline at end of file diff --git a/persistence/lib/macro.h b/persistence/lib/macro.h new file mode 100644 index 000000000..39b52e5ef --- /dev/null +++ b/persistence/lib/macro.h @@ -0,0 +1,146 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} \ No newline at end of file diff --git a/persistence/lib/normalize_config.sqf b/persistence/lib/normalize_config.sqf new file mode 100644 index 000000000..f478948fa --- /dev/null +++ b/persistence/lib/normalize_config.sqf @@ -0,0 +1,84 @@ +if (!isNil "normalize_config_loaded" || {not(isServer || !hasInterface)}) exitWith {}; +diag_log format["Loading normalize_config.sqf ... "]; + +#include "macro.h" + +#define ON_SCALAR(v) (if(isCODE(v)) then { private["_val"]; _val = call v; (isSCALAR(_val) && {_val == 1})} else {(isSCALAR(v) && {v == 1})}) + +cfg_missionVehicleSaving_on = ON_SCALAR(A3W_missionVehicleSaving); +cfg_purchasedVehicleSaving_on = ON_SCALAR(A3W_purchasedVehicleSaving); +cfg_townVehicleSaving_on = ON_SCALAR(A3W_townVehicleSaving); +cfg_staticWeaponSaving_on = ON_SCALAR(A3W_staticWeaponSaving); +cfg_spawnBeaconSaving_on = ON_SCALAR(A3W_spawnBeaconSaving); +cfg_cctvCameraSaving_on = ON_SCALAR(A3W_cctvCameraSaving); + +cfg_boxSaving_on = ON_SCALAR(A3W_boxSaving); +cfg_warchestSaving_on = ON_SCALAR(A3W_warchestSaving); +cfg_warchestMoneySaving_on = ON_SCALAR(A3W_warchestMoneySaving); +cfg_baseSaving_on = ON_SCALAR(A3W_baseSaving); +cfg_mineSaving_on = ON_SCALAR(A3W_mineSaving); + + +A3W_saveable_vehicles_list = OR_ARRAY(A3W_saveable_vehicles_list,[]); +A3W_objectLifetime = OR_SCALAR(A3W_objectLifetime,0); +A3W_mineLifetime = OR_SCALAR(A3W_mineLifetime,0); +A3W_object_saveInterval = OR_POSITIVE(A3W_object_saveInterval,60); +A3W_player_saveInterval = OR_POSITIVE(A3W_player_saveInterval,60); +A3W_playersList_saveInterval = OR_POSITIVE(A3W_playersList_saveInterval,60); + + +A3W_vehicleLifetime = OR_SCALAR(A3W_vehicleLifetime,0); +A3W_vehicleMaxUnusedTime = OR_SCALAR(A3W_vehicleMaxUnusedTime,0); +A3W_vehicle_saveInterval = OR_POSITIVE(A3W_vehicle_saveInterval,60); +A3W_locked_vehicles_list = OR_ARRAY(A3W_locked_vehicles_list,[]); +A3W_saveable_mines_list = OR_ARRAY(A3W_saveable_mines_list,[]); +A3W_storageLifetime = OR_SCALAR(A3W_storageLifetime,0); + + + +A3W_healthTime = OR_POSITIVE(A3W_healthTime,60*5); +A3W_hungerTime = OR_POSITIVE(A3W_hungerTime,60*60); +A3W_thirstTime = OR_POSITIVE(A3W_thirstTime,60*50); + +publicVariable "A3W_healthTime"; +publicVariable "A3W_hungerTime"; +publicVariable "A3W_thirstTime"; +publicVariable "A3W_storageLifetime"; + + +diag_log format["[INFO] config: A3W_purchasedVehicleSaving = %1", cfg_purchasedVehicleSaving_on]; +diag_log format["[INFO] config: A3W_missionVehicleSaving = %1", cfg_missionVehicleSaving_on]; +diag_log format["[INFO] config: A3W_townVehicleSaving = %1", cfg_townVehicleSaving_on]; +diag_log format["[INFO] config: A3W_staticWeaponSaving = %1", cfg_staticWeaponSaving_on]; +diag_log format["[INFO] config: A3W_spawnBeaconSaving = %1", cfg_spawnBeaconSaving_on]; +diag_log format["[INFO] config: A3W_cctvCameraSaving = %1", cfg_cctvCameraSaving_on]; +diag_log format["[INFO] config: A3W_boxSaving = %1", cfg_boxSaving_on]; +diag_log format["[INFO] config: A3W_warchestSaving = %1", cfg_warchestSaving_on]; +diag_log format["[INFO] config: A3W_warchestMoneySaving = %1", cfg_warchestMoneySaving_on]; +diag_log format["[INFO] config: A3W_baseSaving = %1", cfg_baseSaving_on]; +diag_log format["[INFO] config: A3W_mineSaving = %1", cfg_mineSaving_on]; + + +diag_log format["[INFO] config: A3W_objectLifetime = %1", A3W_objectLifetime]; +diag_log format["[INFO] config: A3W_mineLifetime = %1", A3W_mineLifetime]; +diag_log format["[INFO] config: A3W_object_saveInterval = %1", A3W_object_saveInterval]; +diag_log format["[INFO] config: A3W_player_saveInterval = %1", A3W_player_saveInterval]; +diag_log format["[INFO] config: A3W_playersList_saveInterval = %1", A3W_playersList_saveInterval]; + + +diag_log format["[INFO] config: A3W_vehicle_saveInterval = %1", A3W_vehicle_saveInterval]; +diag_log format["[INFO] config: A3W_vehicleMaxUnusedTime = %1", A3W_vehicleMaxUnusedTime]; +diag_log format["[INFO] config: A3W_vehicleLifetime = %1", A3W_vehicleLifetime]; +diag_log format["[INFO] config: A3W_storageLifetime = %1", A3W_storageLifetime]; + +diag_log ("[INFO] config: A3W_locked_vehicles_list = " + str(A3W_locked_vehicles_list)); +diag_log ("[INFO] config: A3W_saveable_vehicles_list = " + str(A3W_saveable_vehicles_list)); +diag_log ("[INFO] config: A3W_saveable_mines_list = " + str(A3W_saveable_mines_list)); + +diag_log format["[INFO] config: A3W_healthTime = %1", A3W_healthTime]; +diag_log format["[INFO] config: A3W_hungerTime = %1", A3W_hungerTime]; +diag_log format["[INFO] config: A3W_thirstTime = %1", A3W_thirstTime]; + +normalize_config_loaded = true; +diag_log format["Loading normalize_config.sqf complete"]; + diff --git a/persistence/lib/shFunctions.sqf b/persistence/lib/shFunctions.sqf new file mode 100644 index 000000000..cb13f05c0 --- /dev/null +++ b/persistence/lib/shFunctions.sqf @@ -0,0 +1,602 @@ +if (!isNil "shFunctions_loaded") exitWith {}; +diag_log "shFunctions loading ..."; + +#include "macro.h" + + +sh_isSaveableVehicle = { + ARGVX4(0,_obj,objNull,false); + + init(_result, false); + { + if (_obj isKindOf _x) exitWith { + _result = true; + }; + } forEach A3W_saveable_vehicles_list; + + (_result) +}; + +sh_strToSide = { + def(_result); + _result = switch (toUpper _this) do { + case "WEST": { BLUFOR }; + case "EAST": { OPFOR }; + case "GUER": { INDEPENDENT }; + case "CIV": { CIVILIAN }; + case "LOGIC": { sideLogic }; + default { sideUnknown }; + }; + (_result) +}; + + +sh_restoreVariables = { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_variables,[]); + + def(_name); + def(_value); + + { + _name = _x select 0; + _value = _x select 1; + + if (!isNil "_value") then { + switch (_name) do { + case "side": { _value = _value call sh_strToSide}; + case "R3F_Side": { _value = _value call sh_strToSide }; + case "ownerName": { + switch (typeName _value) do { + case "ARRAY": { _value = toString _value }; + case "STRING": { /* do nothing, it's already a string */ }; + default { _value = "[Unknown]" }; + }; + }; + }; + }; + + _obj setVariable [_name, OR(_value,nil), true]; + } forEach _variables; +}; + +sh_isStaticWeapon = { + ARGVX4(0,_obj,objNull,false); + init(_class,typeOf _obj); + (_class isKindOf "StaticWeapon") +}; + +sh_isBeacon = { + ARGVX4(0,_obj,objNull,false); + (_obj getVariable ["a3w_spawnBeacon", false]) +}; + +sh_isCamera = { + ARGVX4(0,_obj,objNull,false); + (_obj getVariable ["a3w_cctv_camera", false]) +}; + +sh_isBoomerang = { + ARGVX4(0,_obj,objNull,false); + (_obj getVariable ["has_boomerang", false]) +}; + +sh_isBox = { + ARGVX4(0,_obj,objNull,false); + init(_class,typeOf _obj); + (_class isKindOf "ReammoBox_F") +}; + +sh_isWarchest = { + ARGVX4(0,_obj,objNull,false); + ( + _obj getVariable ["a3w_warchest", false] && { + (_obj getVariable ["side", sideUnknown]) in [WEST,EAST]} + ) +}; + +sh_mineAmmo2Vehicle = { + ARGVX3(0,_class,""); + + _class = (([_class, "_"] call BIS_fnc_splitString) select 0); + + //hopefully after splitting, and taking the first part, we have the actual vehicle class name + (_class) +}; + + + +sh_isSaveableMine ={ + ARGVX2(0,_arg); + + def(_class); + if (isOBJECT(_arg)) then { + _class = typeOf _arg; + } + else { if(isSTRING(_arg)) then { + _class = _arg; + };}; + + (!(isNil "_class") && {_class in A3W_saveable_mines_list}) +}; + + + + +/** + * KillzoneKid's way for creating Charges, and Claymores ... very hacky + */ +sh_placeCharge = { + ARGVX3(0,_charge,""); + ARGVX3(1,_position,[]); + ARGV2(2,_vectors_or_dir); + + def(_unit); + def(_group); + _group = createGroup sideLogic; + _unit = _group createUnit ["B_Soldier_F", _position,[], 0, "CAN_COLLIDE"]; + _unit hideObjectGlobal true; + if (isARRAY(_vectors_or_dir)) then { + _unit setVectorDirAndUp _vectors; + } + else { if (isSCALAR(_vectors_or_dir)) then { + _unit setDir _vectors; + };}; + + def(_muzzle); + def(_mag); + _mag = format["%1_Remote_Mag", _charge]; + _muzzle = if (["directional", _charge, true] call BIS_fnc_inString) then {"DirectionalMineRemoteMuzzle"} else {"DemoChargeMuzzle"}; + + _unit playActionNow "PutDown"; + _unit addMagazine format["%1_Remote_Mag", _charge]; + _unit selectWeapon _muzzle; + _unit fire [_muzzle, _muzzle, _mag]; + _unit setWeaponReloadingTime [_unit, _muzzle, 0]; + + + [_unit,_group] spawn { + sleep 3; + deleteVehicle (_this select 0); + deleteGroup (_this select 1); + }; +}; + +sh_isCharge = { + ARGVX2(0,_arg); + + def(_class); + if (isOBJECT(_arg)) then { + _class = typeOf _arg; + } + else { if(isSTRING(_arg)) then { + _class = _arg; + };}; + + ((["charge", _class, true] call BIS_fnc_inString) || {(["claymore", _class, true] call BIS_fnc_inString)}) +}; + +sh_isMine = { + ARGVX2(0,_arg); + + def(_class); + if (isOBJECT(_arg)) then { + _class = typeOf _arg; + } + else { if(isSTRING(_arg)) then { + _class = _arg; + };}; + + if (isNil "_class") exitWith {false}; + + _class = [_class] call sh_mineAmmo2Vehicle; + + (_class isKindOf "MineBase") +}; + +sh_isAMissionVehicle = { + ARGVX4(0,_obj,objNull,false); + def(_mission); + _mission = _obj getVariable "A3W_missionVehicle"; + (isBOOLEAN(_mission) && {_mission}) +}; + + +sh_isAPurchasedVehicle = { + ARGVX4(0,_obj,objNull,false); + def(_purchased); + _purchased = _obj getVariable "A3W_purchasedVehicle"; + (isBOOLEAN(_purchased) && {_purchased}) +}; + +sh_isUAV_UGV = { + ARGVX4(0,_obj,objNull,false); + (getNumber(configFile >> "CfgVehicles" >> typeOf _obj >> "isUav") > 0) +}; + +sh_isUAV = { + ARGV2(0,_arg); + + def(_class); + if (isOBJECT(_arg)) then { + _class = typeOf _arg; + } + else { if (isSTRING(_arg)) then { + _class = _arg; + }}; + + if (isNil "_class") exitWith {false}; + + (_class isKindOf "UAV_02_base_F" || {_class isKindOf "UAV_01_base_F"}) +}; + + +sh_getVehicleTurrets = { + def(_default); + _default = [nil,nil,nil]; + ARGVX4(0,_veh,objNull,_default); + + def(_all_turrets); + _all_turrets = [magazinesAmmo _veh, [], []]; + + def(_class); + _class = typeOf _veh; + + def(_turretMags); + def(_turretMags2); + def(_turretMags3); + + _turretMags = _all_turrets select 0; + _turretMags2 = _all_turrets select 1; + _turretMags3 = _all_turrets select 2; + + def(_hasDoorGuns); + _hasDoorGuns = isClass (configFile >> "CfgVehicles" >> _class >> "Turrets" >> "RightDoorGun"); + + def(_turrets); + _turrets = allTurrets [_veh, false]; + + if !(_class isKindOf "B_Heli_Transport_03_unarmed_F") then { + _turrets = [[-1]] + _turrets; // only add driver turret if not unarmed Huron, otherwise flares get saved twice + }; + + if (_hasDoorGuns) then { + // remove left door turret, because its mags are already returned by magazinesAmmo + { + if (_x isEqualTo [1]) exitWith { + _turrets set [_forEachIndex, 1]; + }; + } forEach _turrets; + + _turrets = _turrets - [1]; + }; + + + {if (true) then { + _path = _x; + if (str(_path) == "[0]") exitWith {}; //don't look at the mags from the first turret again + + { + if (([_turretMags, _x, -1] call fn_getFromPairs == -1) || {_hasDoorGuns}) then { + if (_veh currentMagazineTurret _path == _x && {count _turretMags3 == 0}) then { + _turretMags3 pushBack [_x, _path, [_veh currentMagazineDetailTurret _path] call getMagazineDetailAmmo]; + } + else { + _turretMags2 pushBack [_x, _path]; + }; + }; + } forEach (_veh magazinesTurret _path); + }} forEach _turrets; + + (_all_turrets) +}; + + +sh_restoreVehicleTurrets = { + ARGVX3(0,_veh,objNull); + ARGV3(1,_turret0,[]); + ARGV3(2,_turret1,[]); + ARGV3(3,_turret2,[]); + + //legacy data did not contain turret information, in that case, don't attempt to restore them + if (isNil "_turret0" && {isNil "_turret1" && {isNil "_turret3"}}) exitWith {}; + + _veh setVehicleAmmo 0; + + if (!isNil "_turret2") then { + { + _veh addMagazineTurret [_x select 0, _x select 1]; + _veh setVehicleAmmo (_x select 2); + } forEach _turret2; + }; + + if (!isNil "_turret0") then { + { _veh addMagazine _x } forEach _turret0; + }; + + if (!isNil "_turret1") then { + { _veh addMagazineTurret _x } forEach _turret1; + }; + +}; + +sh_calcualte_vectors = { + ARGVX3(0,_data,[]); + private["_direction","_angle","_pitch"]; + + _direction = _data select 0; + _angle = _data select 1; + _pitch = _data select 2; + + _vecdx = sin(_direction) * cos(_angle); + _vecdy = cos(_direction) * cos(_angle); + _vecdz = sin(_angle); + + _vecux = cos(_direction) * cos(_angle) * sin(_pitch); + _vecuy = sin(_direction) * cos(_angle) * sin(_pitch); + _vecuz = cos(_angle) * cos(_pitch); + + private["_dir_vector"]; + private["_up_vector"]; + _dir_vector = [_vecdx,_vecdy,_vecdz]; + _up_vector = [_vecux,_vecuy,_vecuz]; + + ([_dir_vector,_up_vector]) +}; + +sh_set_heading = { + ARGVX3(0,_object,objNull); + ARGVX3(1,_data,[]); + + if (typeName (_data select 0) == typeName []) exitWith { + _object setVectorDirAndUp _data; + }; + + def(_vectors); + _vectors = [_data] call sh_calcualte_vectors; + _object setVectorDirAndUp _vectors; +}; + +sh_fake_attach = { + ARGVX3(0,_source,objNull); + ARGVX3(1,_target,objNull); + ARGVX3(2,_offset,[]); + ARGV3(3,_heading,[]); + ARGV4(4,_attached,false,false); + + if (isNil "_heading") then { + _heading = [0,0,0]; + }; + + _source attachTo [_target, _offset]; + + [_source, _heading] call sh_set_heading; + + if (not(_attached)) then { + //hack to have the objects not being attached + _source attachTo [_source,[0,0,0]]; + detach _source; + }; +}; + +sh_create_setPos_reference = { + if (!isNil "setPos_reference") exitWith {}; + setPos_reference = "Sign_Sphere10cm_F" createVehicleLocal [0,0,0]; + setPos_reference setPos [0,0,0]; + + [setPos_reference,[0,0,0]] call sh_set_heading; +}; + +[] call sh_create_setPos_reference; + +sh_fake_setPos = { + //player groupChat format["camera_fake_setPos %1",_this]; + ARGVX3(0,_object,objNull); + ARGVX3(1,_position,[]); + ARGV3(2,_heading,[]); + + [_object,setPos_reference, (setPos_reference worldToModel _position),OR(_heading,nil)] call object_fake_attach; +}; + +sh_getValueFromPairs = { + ARGVX3(0,_object_data,[]); + ARGVX3(1,_searchForKey,""); + + def(_result); + def(_key); + def(_value); + + { + _key = _x select 0; + _value = _x select 1; + if (_key == _searchForKey) exitWith { + _result = OR(_value,nil) + }; + } forEach _object_data; + + if (isNil "_result") exitWith { + //diag_log format ["Error: %1 does not have %2!", _x, _searchForKey]; + nil + }; + + + (_result); +}; + +sh_fillMagazineData = { + ARGVX3(0,_container,objNull); + ARGVX3(1,_full_mags,[]); + ARGVX3(2,_partial_mags,[]); + + def(_mag); + def(_ammo); + + {if (true) then { + _mag = _x select 0; + _ammo = _x select 1; + + if (_ammo == getNumber (configFile >> "CfgMagazines" >> _mag >> "count")) exitWith { + [_full_mags, _mag, 1] call fn_addToPairs; + }; + + if (_ammo > 0) exitWith { + _partial_mags pushBack [_mag, _ammo]; + }; + }} forEach (magazinesAmmoCargo _container); +}; + + +sh_fsm_invoke = { + //diag_log format["%1 call sh_fsm_invoke", _this]; + ARGV2(0,_left); + ARGVX2(1,_right); + ARGV4(2,_async,false,false); + + if (!isCODE(_right)) exitWith {}; + if (isNil "_left") then { + _left = []; + }; + + + def(_var_name); + _var_name = format["var_%1",ceil(random 10000)]; + + def(_fsm); + _fsm = [_var_name, _left, _right] execFSM "persistence\sock\call3.fsm"; + + //if async, return the name of the variable that will hold the results + if (_async) exitWith {_var_name}; + + waitUntil {completedFSM _fsm}; + + def(_result); + _result = (missionNamespace getVariable _var_name); + missionNamespace setVariable [_var_name, nil]; + OR(_result,nil) +}; + +sh_isFlying = { + ARGV2(0,_arg); + + init(_flying_height,20); + + if (isOBJECT(_arg)) exitWith { + (!isTouchingGround _arg && (getPos _arg) select 2 > _flying_height) + }; + + if (isPOS(_arg)) exitWith { + (_arg select 2 > _flying_height) + }; + + false +}; + +sh_drop_player_inventory = { + //Taken from onKilled. Drop player items and money. + private["_player", "_money"]; + _player = _this; + _money = _player getVariable ["cmoney", 0]; + _player setVariable ["cmoney", 0, true]; + + // wait until corpse stops moving before dropping stuff + waitUntil {(getPos _player) select 2 < 1 && vectorMagnitude velocity _player < 1}; + + // Drop money + private["_m"]; + if (_money > 0) then + { + _m = createVehicle ["Land_Money_F", getPosATL _player, [], 0.5, "CAN_COLLIDE"]; + _m setDir random 360; + _m setVariable ["cmoney", _money, true]; + _m setVariable ["owner", "world", true]; + }; + + // Drop items + private["_inventory", "_id", "_qty", "_type", "_object"]; + _inventory = _player getVariable ["inventory",[]]; + { + _id = _x select 0; + _qty = _x select 1; + _type = _x select 4; + for "_i" from 1 to _qty do { + _obj = createVehicle [_type, getPosATL _player, [], 0.5, "CAN_COLLIDE"]; + _obj setDir getDir _player; + _obj setVariable ["mf_item_id", _id, true]; + }; + } forEach _inventory; +}; + +sh_hc_ready = { + (!isNil "HeadlessClient" && { + !isNull HeadlessClient && { + HeadlessClient getVariable ["hc_ready",false]}}) +}; + + +sh_sync_request_handler = { + if (!isServer) exitWith {}; + ARGVX3(1,_this,[]); + ARGVX3(0,_client,objNull); + ARGVX3(1,_var,""); + ARGVX3(2,_flag,""); + + init(_id,owner _client); + diag_log format["Syncing %1 to client (_id = %2)" ,_var, _id]; + _id publicVariableClient _var; + + //set flag to indicate result is ready + missionNamespace setVariable [_flag, true]; + _id publicVariableClient _flag; + missionNamespace setVariable [_flag, nil]; +}; + +if (isServer) then { + "sh_sync_request" addPublicVariableEventHandler { _this spawn sh_sync_request_handler;}; +}; + +if (not(hasInterface || isDedicated)) then { + sh_sync = { + if (isServer) exitWith {}; + ARGVX3(0,_var); + + def(_flag); + _flag = format["sync_flag_%1_%2", ceil(random 1000), ceil(random 1000)]; + sh_sync_request = [player,_var,_flag]; + publicVariableServer "sh_sync_request"; + + init(_timed_out,false); + init(_end_time,diag_tickTime + 10); + waitUntil { + if (not(isNil{missionNamespace getVariable _flag})) exitWith {true}; + if (diag_tickTime > _end_time) exitWith { + _timed_out = true; + true + }; + uiSleep 0.5; + }; + + if (_timed_out) exitWith { + diag_log format["WARNING: Timeout occurred while waiting for value of variable %2", _var]; + false + }; + }; +}; + +sh_hc_forward = { + //diag_log format["%1 call sh_hc_forward", _this]; + ARGVX3(0,_var,""); + ARGV2(1,_val); + if (not(hasInterface || isDedicated)) exitWith {}; + if (not(call sh_hc_ready)) exitWith {}; + init(_id, owner HeadlessClient); + + if (!isNil "_val") then { + missionNamespace setVariable [_var, _val]; + }; + + //diag_log format["Forwarding %1 to headless client (_id = %2)", _var, _id]; + _id publicVariableClient _var; +}; + +shFunctions_loaded = true; +diag_log "shFunctions loading complete"; \ No newline at end of file diff --git a/persistence/players/c_setupPlayerDB.sqf b/persistence/players/c_setupPlayerDB.sqf new file mode 100644 index 000000000..5000e8204 --- /dev/null +++ b/persistence/players/c_setupPlayerDB.sqf @@ -0,0 +1,11 @@ +// @file Name: c_setupPlayerDB.sqf +// @file Author: micovery + +if (isDedicated) exitWith {}; + +#include "macro.h" + +call compile preprocessFileLineNumbers "persistence\sock\main.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\hash.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\shFunctions.sqf"; +call compile preprocessFileLineNumbers "persistence\players\pFunctions.sqf"; diff --git a/persistence/players/macro.h b/persistence/players/macro.h new file mode 100644 index 000000000..39b52e5ef --- /dev/null +++ b/persistence/players/macro.h @@ -0,0 +1,146 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} \ No newline at end of file diff --git a/persistence/players/pFunctions.sqf b/persistence/players/pFunctions.sqf new file mode 100644 index 000000000..f6f6e9c0e --- /dev/null +++ b/persistence/players/pFunctions.sqf @@ -0,0 +1,818 @@ +// @file Version: 0.1 +// @file Name: pFunctions.sqf +// @file Author: micovery +// @file Description: Player loading + +diag_log "pFunctions.sqf loading ..."; + +#include "macro.h" + +//Some wrappers for logging +p_log_severe = { + ["p_functions", _this] call log_severe; +}; +p_log_info = { + ["p_functions", _this] call log_info; +}; +p_log_fine = { + ["p_functions", _this] call log_fine; +}; +p_log_finer = { + ["p_functions", _this] call log_finer; +}; +p_log_finest = { + ["p_functions", _this] call log_finest; +}; +p_log_set_level = { + ["p_functions", _this] call log_set_level; +}; +//Set default logging level for this component +LOG_INFO_LEVEL call p_log_set_level; +p_resetPlayerData = { + removeAllWeapons player; + removeAllAssignedItems player; + removeUniform player; + removeVest player; + removeBackpack player; + removeGoggles player; + removeHeadgear player; +}; + +p_restoreBackpack = { + ARGVX3(0,_value,""); + removeBackpack player; + + if (_value == "") exitWith {}; + + if (_value isKindOf "Weapon_Bag_Base") exitWith { + player addBackpack "B_AssaultPack_rgr"; // NO SOUP FOR YOU + }; + + player addBackpack _value; +}; + +p_restoreBackpackWeapons = { + ARGVX3(0,_value,[]); + { (backpackContainer player) addWeaponCargoGlobal _x } forEach _value +}; + + +p_restoreBackpackItems = { + ARGVX3(0,_value, []); + { (backpackContainer player) addItemCargoGlobal _x } forEach _value +}; + + +p_restoreBackpackMagazines = { + ARGVX3(0,_value,[]); + { (backpackContainer player) addMagazineCargoGlobal _x } forEach _value +}; + + +p_restorePrimaryWeapon = { + ARGVX3(0,_value,""); + player addWeapon _value; removeAllPrimaryWeaponItems player; +}; + + +p_restoreSecondaryWeapon = { + ARGVX3(0,_value,""); + player addWeapon _value; +}; + + +p_restoreHandgunWeapon = { + //diag_log format["%1 call _restoreHandgunWeapon", _this]; + ARGVX3(0,_value,""); + player addWeapon _value; removeAllHandgunItems player; +}; + +p_restoreLoadedMagazines = { + ARGVX3(0,_value,[]); + { player addMagazine _x } forEach _value; +}; + +p_restoreUniform = { + ARGV4(0,_value,"",""); + + if (_value == "") exitWith { + player addUniform ([player, "uniform"] call getDefaultClothing); + }; + + if (player isUniformAllowed _value) exitWith { + player addUniform _value; + }; + + // If uniform cannot be worn by player due to different team, try to convert it, else give default instead + def(_newUniform); + _newUniform = [player, _value] call uniformConverter; + + if (player isUniformAllowed _newUniform) exitWith { + player addUniform _newUniform; + }; + + player addUniform ([player, "uniform"] call getDefaultClothing); +}; + +p_restoreVest = { + ARGVX3(0,_value,""); + if (_value == "") exitWith {}; + player addVest _value; +}; + + +p_copy_pairs = { + ARGVX3(0,_target,[]); + ARGVX3(1,_source,[]); + { + _target pushBack _x; + } forEach _source; +}; + +p_restorePosition = { + ARGV3(0,_position,[]); + + def(_nearSpawn); + _nearSpawn = (isPOS(_position) && {(player distance _position) < 100}); + + if (isPOS(_position) && {not(_nearSpawn)}) exitWith { + player setPosATL _position; + }; + + if (_nearSpawn) then { + diag_log format["WARNING: Saved position is too near the spawn. Putting player at a random safe location."]; + player groupChat format["WARNING: Saved position is too near the spawn. Putting you at a random safe location."]; + } + else { + diag_log format["WARNING: No position available. Putting player at a random safe location."]; + player groupChat format["WARNING: No position available. Putting you at a random safe location."]; + }; + + [nil,false] spawn spawnRandom; +}; + +p_restorePrimaryWeaponItems = { + ARGVX3(0,_items,[]); + { + if (_x != "") then { + player addPrimaryWeaponItem _x; + }; + } forEach _items +}; + +p_restoreSecondaryWeaponItems = { + ARGVX3(0,_items,[]); + { + if (_x != "") then { + player addSecondaryWeaponItem _x; + }; + } forEach _items; +}; + +p_restoreHandgunWeaponItems = { + ARGVX3(0,_items,[]); + + { + if (_x != "") then { + player addHandgunItem _x; + }; + } forEach _items; +}; + +p_restoreGoggles = { + ARGVX3(0,_goggles,""); + if (_goggles == "") exitWith {}; + player addGoggles _goggles; +}; + +p_restoreHeadgear = { + ARGVX3(0,_headgear,""); + + // If wearing one of the default headgears, give the one belonging to actual team instead + def(_defHeadgear); + def(_defHeadgears); + + _defHeadgear = [player, "headgear"] call getDefaultClothing; + _defHeadgears = + [ + [typeOf player, "headgear", BLUFOR] call getDefaultClothing, + [typeOf player, "headgear", OPFOR] call getDefaultClothing, + [typeOf player, "headgear", INDEPENDENT] call getDefaultClothing + ]; + + if (_headgear != _defHeadgear && {_defHeadgear != ""} && {{_headgear == _x} count _defHeadgears > 0}) then { + player addHeadgear _defHeadgear; + } + else { + player addHeadgear _headgear; + }; +}; + +p_restoreAssignedItems = { + ARGVX3(0,_assigned_items,[]); + + { + if ([player, _x] call isAssignableBinocular) then { + player addWeapon _x; + } + else { + player linkItem _x; + }; + } forEach _assigned_items; +}; + + +fn_applyPlayerData = { + ARGVX3(0,_data,[]); + format["%1 call fn_applyPlayerData;", _this] call p_log_finest; + + def(_loaded_magazines); + def(_backpack_class); + def(_backpack_weapons); + def(_backpack_items); + def(_backpack_magazines); + def(_partial_magazines); + def(_primary_weapon); + def(_secondary_weapon); + def(_handgun_weapon); + def(_uniform_class); + def(_vest_class); + def(_vehicle_key); + def(_position); + def(_primary_weapon_items); + def(_secondary_weapon_items); + def(_handgun_weapon_items); + def(_headgear); + def(_goggles); + def(_assigned_items); + + + //iterate through the data, and extract the hash variables into local variables + { + init(_name,_x select 0); + init(_value,_x select 1); + + switch (_name) do { + case "Backpack": { _backpack_class = _value;}; + case "LoadedMagazines": { _loaded_magazines = _value; }; + case "BackpackWeapons": { _backpack_weapons = _value}; + case "BackpackItems": { _backpack_items = _value; }; + case "BackpackMagazines": { _backpack_magazines = _value }; + case "PrimaryWeapon": { _primary_weapon = _value }; + case "SecondaryWeapon": {_secondary_weapon = _value}; + case "HandgunWeapon": { _handgun_weapon = _value}; + case "Uniform":{ _uniform_class = _value}; + case "Vest": { _vest_class = _value}; + case "InVehicle": { _vehicle_key = _value}; + case "Position": {if (isPOS(_value)) then {_position = _value;}}; + case "PrimaryWeaponItems": {_primary_weapon_items = OR_ARRAY(_value,nil)}; + case "SecondaryWeaponItems": {_secondary_weapon_items = OR_ARRAY(_value,nil)}; + case "HandgunItems": {_handgun_weapon_items = OR_ARRAY(_value,nil)}; + case "Headgear": {_headgear = OR_STRING(_value,nil)}; + case "Goggles": {_goggles = OR_STRING(_value,nil)}; + case "AssignedItems": {_assigned_items = OR_ARRAY(_value,nil)}; + + }; + } forEach _data; + + //Restore the weapons, backpack, uniform, and vest in correct order + player addBackpack "B_Carryall_Base"; // add a temporary backpack for holding loaded weapon magazines + [OR(_headgear,nil)] call p_restoreHeadgear; + [OR(_assigned_items,nil)] call p_restoreAssignedItems; + [OR(_goggles,nil)] call p_restoreGoggles; + [OR(_loaded_magazines,nil)] call p_restoreLoadedMagazines; + [OR(_primary_weapon,nil)] call p_restorePrimaryWeapon; + [OR(_secondary_weapon,nil)] call p_restoreSecondaryWeapon; + [OR(_handgun_weapon,nil)] call p_restoreHandgunWeapon; + [OR(_primary_weapon_items,nil)] call p_restorePrimaryWeaponItems; + [OR(_secondary_weapon_items,nil)] call p_restoreSecondaryWeaponItems; + [OR(_handgun_weapon_items,nil)] call p_restoreHandgunWeaponItems; + removeBackpack player; //remove the temporary backpack + + //Restore backpack, and stuff inside + if (isSTRING(_backpack_class) && {_backpack_class != ""}) then { + //diag_log format["Restoring backpack: %1", _backpack_class]; + [_backpack_class] call p_restoreBackpack; + + //restore the stuff inside the backpack + [OR(_backpack_weapons,nil)] call p_restoreBackpackWeapons; + [OR(_backpack_magazines,nil)] call p_restoreBackpackMagazines; + [OR(_backpack_items,nil)] call p_restoreBackpackItems; + }; + + [OR(_uniform_class,nil)] call p_restoreUniform; + [OR(_vest_class,nil)] call p_restoreVest; + + [OR(_position,nil)] call p_restorePosition; + + //restore other stuff that is not order-dependent + def(_name); + def(_value); + { + _name = _x select 0; + _value = _x select 1; + + switch (_name) do { + case "Damage": { if (isSCALAR(_value)) then {player setDamage _value;};}; + case "HitPoints": { { player setHitPointDamage _x } forEach (OR(_value,[])) }; + case "Hunger": { hungerLevel = OR(_value,nil); }; + case "Thirst": { thirstLevel = OR(_value,nil); }; + case "Money": { player setVariable ["cmoney", OR(_value,0), true] }; + case "Direction": { if (defined(_value)) then {player setDir _value} }; + case "CurrentWeapon": { player selectWeapon OR(_value,"") }; + case "Animation": { if (isSTRING(_value) && {_value != ""}) then {[player, _value] call switchMoveGlobal};}; + case "UniformWeapons": { { (uniformContainer player) addWeaponCargoGlobal _x } forEach (OR(_value,[])) }; + case "UniformItems": { { (uniformContainer player) addItemCargoGlobal _x } forEach (OR(_value,[])) }; + case "UniformMagazines": { { (uniformContainer player) addMagazineCargoGlobal _x } forEach (OR(_value,[])) }; + case "VestWeapons": { { (vestContainer player) addWeaponCargoGlobal _x } forEach (OR(_value,[])) }; + case "VestItems": { { (vestContainer player) addItemCargoGlobal _x } forEach (OR(_value,[])) }; + case "VestMagazines": { { (vestContainer player) addMagazineCargoGlobal _x } forEach (OR(_value,[])) }; + case "PartialMagazines": { { player addMagazine _x } forEach _value }; + case "WastelandItems": { { [_x select 0, _x select 1, true] call mf_inventory_add } forEach (OR(_value,[])) }; + }; + } forEach _data; +}; + +fn_savePlayerData = { + trackMyVitals = + [ + player, + [ + ["thirstLevel", thirstLevel], + ["hungerLevel", hungerLevel] + ] + ]; + + publicVariableServer "trackMyVitals"; +}; + + +fn_deletePlayerData = { + deletePlayerData = player; + publicVariableServer "deletePlayerData"; + playerData_gear = ""; +}; + + +fn_applyPlayerInfo = { + diag_log format["%1 call fn_applyPlayerInfo;",_this]; + init(_data,_this); + def(_name); + def(_value); + + _data = _this; + + { + _name = _x select 0; + _value = _x select 1; + + switch (_name) do + { + case "Donator": { player setVariable ["isDonator", _value > 0] }; + case "BankMoney": { player setVariable ["bmoney", OR(_value,0), true] }; + }; + } forEach _data; +}; + +fn_applyPlayerStorage = { + if (!isARRAY(_this)) exitWith { + diag_log format["WARNING: No player private storage data"]; + }; + init(_data,_this); + init(_player,player;) + + diag_log "#############################################"; + diag_log "Dumping _storageData"; + [_data] call p_dumpHash; + + def(_hours_alive); + _hours_alive = [_data, "HoursAlive"] call fn_getFromPairs; + + + if (isSCALAR(_hours_alive) && {A3W_storageLifetime > 0 && {_hours_alive > A3W_storageLifetime}}) exitWith { + player commandChat format["WARNING: Your private storage is over %1 hours, it has been reset"]; + diag_log format["Private storage for %1 (%2) has been alive for %3 (max=%4), resetting it", (name player), (getPlayerUID player), _hours_alive, A3W_storageLifetime]; + _player setVariable ["private_storage", nil, true]; + }; + + _player setVariable ["private_storage", _data, true]; + + _player setVariable ["storage_spawningTime", diag_tickTime]; + if (isSCALAR(_hours_alive)) then { + _player setVariable ["storage_hoursAlive", _hours_alive]; + }; +}; + + + +p_recreateStorageBox = { + //diag_log format["%1 call p_recreateStorageBox", _this]; + + ARGVX3(0,_player,objNull); + ARGVX3(1,_box_class,""); + + + def(_data); + _data = _player getVariable ["private_storage", []]; + + def(_class); + def(_cargo_backpacks); + def(_cargo_magazines); + def(_cargo_items); + def(_cargo_weapons); + def(_full_magazines); + def(_partial_magazines); + + def(_name); + def(_value); + { + _name = _x select 0; + _value = _x select 1; + + switch (_name) do + { + case "Class": {_class = OR(_value,nil)}; + case "Weapons": { _cargo_weapons = OR(_value,nil);}; + case "Items": { _cargo_items = OR(_value,nil);}; + case "Magazines": { _cargo_magazines = OR(_value,nil);}; //keep this for a while for legacy reasons + case "FullMagazines": { _full_magazines = OR(_value,nil);}; + case "PartialMagazines": { _partial_magazines = OR(_value,nil);}; + case "Backpacks": { _cargo_backpacks = OR(_value,nil);}; + }; + } forEach _data; + + if (!isSTRING(_class) || {_class == "" || {_class != _box_class}}) then { + _class = _box_class; + }; + + + def(_obj); + _obj = _class createVehicleLocal [0,0,1000]; + if (!isOBJECT(_obj)) exitWith { + diag_log format["WARNING: Could not create storage container of class ""%1""", _class]; + }; + + removeAllWeapons _obj; + removeAllItems _obj; + clearWeaponCargo _obj; + clearMagazineCargo _obj; + clearBackpackCargo _obj; + clearItemCargo _obj; + _obj hideObject true; + + if (isARRAY(_cargo_weapons)) then { + { _obj addWeaponCargoGlobal _x } forEach _cargo_weapons; + }; + + if (isARRAY(_cargo_backpacks)) then { + { + if (not((_x select 0) isKindOf "Weapon_Bag_Base")) then { + _obj addBackpackCargoGlobal _x + }; + } forEach _cargo_backpacks; + }; + + if (isARRAY(_cargo_items)) then { + { _obj addItemCargoGlobal _x } forEach _cargo_items; + }; + + if (isARRAY(_cargo_magazines)) then { //FIXME: this is legacy code, need to remove eventually + { _obj addMagazineCargoGlobal _x } forEach _cargo_magazines; + }; + + if (isARRAY(_full_magazines)) then { + { _obj addMagazineCargoGlobal _x } forEach _full_magazines; + }; + + if (isARRAY(_partial_magazines)) then { + { _obj addMagazineAmmoCargo [(_x select 0), 1, (_x select 1)] } forEach _partial_magazines; + }; + + _obj setVariable ["is_storage_box", true]; + + _obj +}; + + + +p_trackStorageHoursAlive = { + ARGVX3(0,_player,objNull); + + def(_spawnTime); + def(_hoursAlive); + + _spawnTime = _player getVariable "storage_spawningTime"; + _hoursAlive = _player getVariable "storage_hoursAlive"; + + if (isNil "_spawnTime") then { + _spawnTime = diag_tickTime; + _player setVariable ["storage_spawningTime", _spawnTime, true]; + }; + + if (isNil "_hoursAlive") then { + _hoursAlive = 0; + _player setVariable ["storage_hoursAlive", _hoursAlive, true]; + }; + + def(_totalHours); + _totalHours = _hoursAlive + (diag_tickTime - _spawnTime) / 3600; + + (_totalHours) +}; + +p_saveStorage = { + //diag_log format["%1 call p_getPlayerInfo", _this]; + ARGVX3(0,_player,objNull); + ARGVX3(1,_obj,objNull); + + + if (isNull _obj) exitWith {}; + + def(_hours_alive); + _hours_alive = [_player] call p_trackStorageHoursAlive; + + init(_weapons,[]); + init(_partial_magazines,[]); + init(_full_magazines,[]); + init(_items,[]); + init(_backpacks,[]); + + // Save weapons & ammo + _weapons = (getWeaponCargo _obj) call cargoToPairs; + _items = (getItemCargo _obj) call cargoToPairs; + _backpacks = (getBackpackCargo _obj) call cargoToPairs; + [_obj, _full_magazines, _partial_magazines] call sh_fillMagazineData; + + def(_storage); + _storage = + [ + ["Class", typeOf _obj], + ["HoursAlive", _hours_alive], + ["Weapons", _weapons], + ["Items", _items], + ["Backpacks", _backpacks], + ["PartialMagazines", _partial_magazines], + ["FullMagazines", _full_magazines] + ]; + + _player setVariable ["private_storage", _storage, true]; + (_storage) +}; + +fn_applyPlayerParking = { + if (!isARRAY(_this)) exitWith { + diag_log format["WARNING: No player private parking data"]; + }; + init(_data,_this); + + + diag_log "#############################################"; + diag_log "Dumping _parkingData"; + [_data] call p_dumpHash; + + init(_parked_vehicles,[]); + + def(_vehicle_info); + {if (true) then { + _vehicle_info = _x; + if (!isARRAY(_vehicle_info) || {count(_vehicle_info) < 2}) exitWith {}; + + def(_vehicle_id); + + _vehicle_id = _vehicle_info select 0; + if (!isSTRING(_vehicle_id)) exitWith {}; + + def(_vehicle_data); + _vehicle_data = _vehicle_info select 1; + if (!isCODE(_vehicle_data)) exitWith {}; + _parked_vehicles pushBack [_vehicle_id, (call _vehicle_data)]; + };} forEach _data; + + player setVariable ["parked_vehicles",_parked_vehicles,true]; +}; + + +p_restoreInfo = { + ARGVX2(0,_hash); + if (!isCODE(_hash)) exitWith {}; + format["%1 call p_restoreInfo;", _this] call p_log_finest; + def(_data); + _data = call _hash; + + OR(_data,nil) call fn_applyPlayerInfo; +}; + +p_restoreStorage = { + ARGVX2(0,_hash); + if (!isCODE(_hash)) exitWith {}; + format["%1 call p_restoreStorage;", _this] call p_log_finest; + def(_data); + _data = call _hash; + + OR(_data,nil) call fn_applyPlayerStorage; +}; + +p_restoreParking = { + ARGVX2(0,_hash); + if (!isCODE(_hash)) exitWith {}; + format["%1 call p_restoreParking;", _this] call p_log_finest; + def(_data); + _data = call _hash; + + OR(_data,nil) call fn_applyPlayerParking; +}; + + + +p_restoreScore = { + ARGVX2(0,_hash); + if (!isCODE(_hash)) exitWith {}; + diag_log format["%1 call p_restoreScore;",_this]; + def(_data); + _data = call _hash; + + def(_key); + def(_value); + + {if (true) then { + if (!isARRAY(_x)) exitWith {}; + + _key = _x select 0; + _value = _x select 1; + if (!isSCALAR(_value)) exitWith {}; + + diag_log format["Restoring %1 = %2", _key, _value]; + + [player, _key, _value] call fn_setScore; + };} forEach _data; + +}; + +p_preloadEnabled = { + (profileNamespace getVariable ["A3W_preloadSpawn", true]) +}; + +p_preloadPosition = { + ARGV3(0,_pos,[]); + + if (!(call p_preloadEnabled || {undefined(_pos)})) exitWith { + player groupChat "Loading previous location..."; + }; + + _pos set [2,OR(_pos select 2,0)]; + player groupChat "Preloading previous location..."; + waitUntil {sleep 0.1; preloadCamera _pos}; +}; + +p_firstSpawn = { + player enableSimulation true; + player allowDamage true; + player setVelocity [0,0,0]; + format["%1 call p_firstSpawn;", _this] call p_log_finest; + + execVM "client\functions\firstSpawn.sqf"; +}; + +p_restoreData = { + diag_log format["%1 call p_restoreData",_this]; + ARGV2(0,_data); + format["%1 call p_restoreData;", _this] call p_log_finest; + + def(_exit); + _exit = { + player allowDamage true; + call p_firstSpawn; + playerData_loaded = true; + }; + + def(_dataValid); + _dataValid = (isARRAY(_data) && {count(_data) > 0}); + + if (!_dataValid) exitWith { + format["Saved data for %1 is not valid;", player] call p_log_finest; + call _exit; + }; + + playerData_alive = true; + [_data] call fn_applyPlayerData; + call _exit; +}; + +p_getScope = { + ARGVX3(0,_id,""); + format["%1 call p_getScope;", _this] call p_log_finest; + waitUntil {not(isNil "PDB_PlayerFileID")}; + (format["%1%2",PDB_PlayerFileID,_id]) +}; + +p_dumpHash = { + ARGVX3(0,_data,[]); + + def(_key); + def(_value); + { + _key = _x select 0; + _value = _x select 1; + diag_log (_key + " = " + str(OR(_value,nil))); + } forEach _data; +}; + +fn_requestPlayerData = {[] spawn { + init(_player,player); + init(_uid,getPlayerUID player); + init(_scope,[_uid] call p_getScope); + format["%1 call fn_requestPlayerData;", _this] call p_log_finest; + + + playerData_alive = nil; + playerData_loaded = nil; + playerData_resetPos = nil; + init(_genericDataKey, "PlayerSave"); + init(_infoKey, "PlayerInfo"); + init(_scoreKey, "PlayerScore"); + init(_storageKey, "PlayerStorage"); + init(_parkingKey, "PlayerParking"); + + + def(_worldDataKey); + _worldDataKey = format["%1_%2", _genericDataKey, worldName]; + + def(_pData); + _pData = [_scope, [_genericDataKey, nil], [_worldDataKey, nil], [_infoKey, nil], [_storageKey, nil], [_parkingKey, nil], [_scoreKey, nil]] call stats_get; + if (not(isARRAY(_pData))) exitWith { + //player data did not load, force him back to lobby + endMission "LOSER"; + }; + + def(_worldData); + def(_genericData); + + def(_key); + { + _key = xGet(_x,0); + switch(_key) do { + case _genericDataKey: { + _genericData = xGet(_x,1); + }; + case _worldDataKey: { + _worldData = xGet(_x,1); + }; + case _storageKey: { + [xGet(_x,1)] call p_restoreStorage; + }; + case _parkingKey: { + [xGet(_x,1)] call p_restoreParking; + }; + case _infoKey: { + [xGet(_x,1)] call p_restoreInfo; + }; + case _scoreKey: { + [xGet(_x,1)] call p_restoreScore; + }; + }; + } forEach _pData; + + //merge the world specific data, with the generic data + _genericData = OR(call _genericData,[]); + _worldData = OR(call _worldData,[]); + + /** + * If the world is Stratis, ignore the legacy generic "Position". + * The legacy "Position" field should only be used for "Altis" + */ + if (worldName == "Stratis") then { + [_genericData, "Position"] call hash_remove_key; + }; + + diag_log "#############################################"; + diag_log "Dumping _genericData"; + [_genericData] call p_dumpHash; + + diag_log "#############################################"; + diag_log "Dumping _worldData"; + [_worldData] call p_dumpHash; + + def(_allData); + _allData = [_genericData, _worldData] call hash_set_all; + [_allData] call p_restoreData; + +};}; + + + +p_handle_mprespawn = { + ARGV3(0,_unit,objNull); + ARGV3(1,_corpse,objNull); + //diag_log format["%1 call p_handle_mprespawn;", _this]; + + if (not(local _unit)) exitWith {}; + trackMe = [_unit]; + publicVariableServer "trackMe"; +}; + + +player addMPEventHandler ["MPRespawn",{ _this call p_handle_mprespawn }]; + + + +diag_log "pFunctions.sqf loading complete"; diff --git a/persistence/players/sFunctions.sqf b/persistence/players/sFunctions.sqf new file mode 100644 index 000000000..5cfafd22c --- /dev/null +++ b/persistence/players/sFunctions.sqf @@ -0,0 +1,859 @@ +if (!isNil "s_functions_defined") exitWith {}; + +diag_log "sFunctions.sqf loading ..."; + +#include "macro.h" + +s_processRestartMessage = { + ARGVX3(0,_scope,""); + ARGVX3(1,_id,""); + ARGVX3(2,_from,""); + ARGVX3(3,_to,""); + ARGVX3(4,_subject,""); + ARGV2(5,_body); + + //halt all the save loops + p_saveLoopActive = false; + pl_saveLoopActive = false; + v_saveLoopActive = false; + o_saveLoopActive = false; + + diag_log format["Saving players all player stats"]; + //save all player stats + [nil, p_saveAllPlayers] call sh_fsm_invoke; + + + diag_log format["Saving active players list"]; + //save all player stats + init(_plScope, "PlayersList" call PDB_playersListFileName); + [[_plScope], pl_savePlayersList] call sh_fsm_invoke; + + + diag_log format["Saving all vehicles on the map"]; + //save all vehilce stats + init(_vScope, "Vehicles" call PDB_vehicleFileName); + [[_vScope], v_saveAllVechiles] call sh_fsm_invoke; + + + diag_log format["Saving all objects on the map"]; + //save all object scopes + init(_oScope, "Objects" call PDB_objectFileName); + [[_oScope], o_saveAllObjects] call sh_fsm_invoke; + + //save object info + [[_oScope], o_saveInfo] call sh_fsm_invoke; + + + diag_log format["Sending restart message ack"]; + //send ack that the message has been processed + def(_res); + _res = + [ + ["id", _id], + ["from", "server"], + ["to", _from], + ["subject", "ack"], + ["body", _id] + ] call sock_hash; + + [_scope, format["%1.recv", _from], _res] call stats_push; + + //just to be safe, if the server is still up after 5 minutes, re-activate the saving loops + [] spawn { + sleep (5 * 60); + diag_log format["WARNING: looks like server did not go down 5 minutes after a restart request"]; + v_saveLoopActive = true; + o_saveLoopActive = true; + p_saveLoopActive = true; + pl_saveLoopActive = true; + }; + + true +}; + + +s_processBootMessage = { + ARGVX3(0,_scope,""); + ARGVX3(1,_id,""); + ARGVX3(2,_from,""); + ARGVX3(3,_to,""); + ARGVX3(4,_subject,""); + ARGV2(5,_body); + + //End Misson for all players + [[], "A3W_fnc_reboot", BLUFOR, true] call BIS_fnc_MP; + [[], "A3W_fnc_reboot", OPFOR, true] call BIS_fnc_MP; + [[], "A3W_fnc_reboot", Independent, true] call BIS_fnc_MP; + + diag_log format["Sending boot message ack"]; + //send ack that the message has been processed + def(_res); + _res = + [ + ["id", _id], + ["from", "server"], + ["to", _from], + ["subject", "ack"], + ["body", _id] + ] call sock_hash; + + [_scope, format["%1.recv", _from], _res] call stats_push; + + true +}; + +s_processMessage = { + ARGVX3(0,_scope,""); + ARGV2(1,_message); + if (isNil "_message" || not(isCODE(_message))) exitWith {}; + + def(_data); + _data = call _message; + if (not(isARRAY(_data))) exitWith {}; + + def(_id); + def(_from); + def(_to); + def(_subject); + def(_body); + + { + switch (_x select 0) do { + case "id": { _id = _x select 1;}; + case "from": { _from = _x select 1;}; + case "to": { _to = _x select 1;}; + case "subject": {_subject = _x select 1;}; + case "body": {_body = _x select 1;}; + }; + } forEach _data; + + if (isNil "_id") exitWith {}; + if (isNil "_from") exitWith {}; + if (isNil "_to") exitWith {}; + if (isNil "_subject") exitWith {}; + + + diag_log format["message queue: process(id:%1): {from: %2, to: %3, subject: %4}", str(_id), str(_from), str(_to), str(_subject)]; + if (_subject == "restart" && _to == "server" && _from != "server") exitWith { + ([_scope,_id,_from,_to,_subject, OR(_body,nil)] call s_processRestartMessage) + }; + + if (_subject == "boot" && _to == "server" && _from != "server") exitWith { + ([_scope,_id,_from,_to,_subject, OR(_body,nil)] call s_processBootMessage) + }; + + diag_log format["message queue: process(id:%1): complete"]; + + false +}; + +s_processMessages = { + ARGVX3(0,_scope,""); + + //retrieve all the messages + def(_messages); + _messages = [_scope, "server.recv"] call stats_get; + if (isNil "_messages") exitWith { + diag_log format["message queue: no messages to process"]; + }; + + if(typeName _messages != typeName []) exitWith { + diag_log format["message queue: protocol error: recv typeName was %1, but was expecting typeName %2", typeName _messages, typeName []]; + }; + + init(_count, count(_messages)); + diag_log format["message queue: %1 messages to process", _count]; + if (_count == 0) exitWith {}; + + { + [_scope, OR(_x,nil)] call s_processMessage; + } forEach _messages; + + + //clear the processed messages + [_scope, "server.recv", []] call stats_set; + +}; + + +s_messageLoop = { + diag_log format["%1 call s_messageLoop", _this]; + ARGVX3(0,_scope,""); + + //cleanup the message queue + diag_log format["message queue: cleaning up old messages"]; + [_scope, "server.recv",[]] call stats_set; + + while {true} do { + sleep 30; + def(_script); + _script = [_scope] spawn s_processMessages; + waitUntil {scriptDone _script}; + }; +}; + + +p_getScoreInfo = { + //diag_log format["%1 call p_getScoreInfo", _this]; + ARGVX3(0,_uid,""); + + def(_playerKills); + def(_aiKills); + def(_deathsCount); + def(_reviveCount); + def(_captureCount); + + _playerKills = [_uid, "playerKills"] call fn_getScore; + _aiKills = [_uid, "aiKills"] call fn_getScore; + _deathsCount = [_uid, "deathCount"] call fn_getScore; + _reviveCount = [_uid, "reviveCount"] call fn_getScore; + _captureCount = [_uid, "captureCount"] call fn_getScore; + + def(_scoreInfo); + + _scoreInfo = [ + ["playerKills", _playerKills], + ["aiKills", _aiKills], + ["deathCount", _deathsCount], + ["reviveCount", _reviveCount], + ["captureCount", _captureCount] + ] call sock_hash; + + (_scoreInfo) +}; + +p_getPlayerInfo = { + //diag_log format["%1 call p_getPlayerInfo", _this]; + ARGVX3(0,_player,objNull); + + def(_groupSide); + _groupSide = str side group _player; + + def(_playerSide); + _playerSide = if (alive _player) then {str (side _player)} else {_groupSide}; + + def(_info); + _info = + [ + ["UID", _uid], + ["Name", _name], + ["LastGroupSide", OR(_groupSide,sideUnknown)], + ["LastPlayerSide", OR(_playerSide,sideUnknown)], + ["BankMoney", _player getVariable ["bmoney", 0]] + ] call sock_hash; + + (_info) +}; + + + +p_getPlayerParking = { + //diag_log format["%1 call p_getPlayerParking", _this]; + ARGVX3(0,_player,objNull); + + def(_parked_vehicles); + _parked_vehicles = _player getVariable ["parked_vehicles", []]; + + init(_vehicles,[]); + + def(_vehicle_info); + + {if(true) then { + _vehicle_info = _x; + if (!isARRAY(_vehicle_info) || {count(_vehicle_info) < 2}) exitWith {}; + + def(_vehicle_id); + _vehicle_id = _vehicle_info select 0; + if (!isSTRING(_vehicle_id)) exitWith {}; + + def(_vehicle_data); + _vehicle_data = _vehicle_info select 1; + if (!isARRAY(_vehicle_data)) exitWith {}; + + _vehicles pushBack [_vehicle_id, (_vehicle_data call sock_hash)]; + };} forEach _parked_vehicles; + + + if (count(_vehicles) == 0) exitWith {}; + + + (_vehicles call sock_hash) +}; + +p_getPlayerStorage = { + ARGVX3(0,_player,objNull); + + def(_storage); + + _storage = _player getVariable "private_storage"; + if (!isARRAY(_storage)) exitWith {}; + + (_storage call sock_hash) +}; + + +p_addPlayerSave = { + //diag_log format["%1 call p_addPlayerSave", _this]; + ARGVX3(0,_request,[]); + ARGVX3(1,_player,objNull); + ARGVX3(2,_uid,""); + ARGVX3(3,_name,""); + + + init(_alive, alive _player); + diag_log format["p_addPlayerSave: Saving stats for %1(%2)", _name, _uid]; + + def(_init_complete); + _init_complete = _player getVariable ["initComplete", false]; + + if (not(_init_complete)) exitWith { + diag_log format["%1(%2) exited without completing initialization", _name, _uid]; + }; + + def(_respawn_active); + _respawn_active = _player getVariable ["respawnDialogActive", false]; + //diag_log format["_respawn_active = %1", _respawn_active]; + + def(_unconscious); + _unconscious = (_player getVariable ["FAR_isUnconscious", 0] != 0); + //diag_log format["_unconscious = %1", _unconscious]; + + def(_reset_save); + _reset_save = (_respawn_active || {_unconscious || {not(_alive)}}); //or not alive + //diag_log format["_reset_save = %1", _reset_save]; + + + def(_playerInfo); + _playerInfo = [_player] call p_getPlayerInfo; + + if (isARRAY(_playerInfo)) then { + _request pushBack ["PlayerInfo", _playerInfo]; + }; + + def(_playerStorage); + _playerStorage = [_player] call p_getPlayerStorage; + + if (isARRAY(_playerStorage)) then { + _request pushBack ["PlayerStorage", _playerStorage]; + }; + + def(_playerParking); + _playerParking = [_player] call p_getPlayerParking; + + if (isARRAY(_playerParking)) then { + _request pushBack ["PlayerParking", _playerParking]; + }; + + def(_scoreInfo); + _scoreInfo = [_uid] call p_getScoreInfo; + + if (isARRAY(_scoreInfo)) then { + _request pushBack ["PlayerScore",_scoreInfo]; + }; + + diag_log format["Saving %1(%2): unconscious = %3, respawning = %4, alive = %5", _name,_uid, _unconscious, _respawn_active, _alive]; + if (_reset_save) exitWith { + _player setVariable ["stats_reset",true]; + diag_log format["Resetting %1(%2) stats", _name, _uid]; + _request pushBack ["PlayerSave",nil]; + _request pushBack ["PlayerSave_Stratis",nil]; + _request pushBack ["PlayerSave_Altis",nil]; + true + }; + + _hitPoints = []; + { + _hitPoint = configName _x; + _hitPoints pushBack [_hitPoint, _player getHitPointDamage _hitPoint]; + } forEach (_player call getHitPoints); + + + def(_data); + def(_world_data); + + _world_data = []; + + _data = + [ + ["Damage", damage _player], + ["HitPoints", _hitPoints], + ["Hunger", _player getVariable ["hungerLevel", 100]], + ["Thirst", _player getVariable ["thirstLevel", 100]], + ["Money", _player getVariable ["cmoney", 0]] // Money is always saved, but only restored if A3W_moneySaving = 1 + ]; + + def(_pos); + _pos = ASLtoATL getPosWorld _player; + //force the Z-axis if the player is high above ground, or deep underwater + if (!(isTouchingGround vehicle _player || {(getPos _player) select 2 < 0.5 || (getPosASL _player) select 2 < 0.5})) then { + _pos set [2, 0]; + if (surfaceIsWater _pos) then { + _pos = ASLToATL (_pos); + }; + }; + + _world_data pushBack ["Position", _pos]; + _world_data pushBack ["Direction", direction _player]; + + //only save animation, and current weapon if the player is not inside a vehicle + if (vehicle _player == _player) then { + _data pushBack ["CurrentWeapon", format ["%1", currentMuzzle _player]]; // currentMuzzle returns a number sometimes, hence the format + _world_data pushBack ["Animation", (animationState _player)]; + }; + + + _gear = + [ + ["Uniform", uniform _player], + ["Vest", vest _player], + ["Backpack", backpack _player], + ["Goggles", goggles _player], + ["Headgear", headgear _player], + + ["PrimaryWeapon", primaryWeapon _player], + ["SecondaryWeapon", secondaryWeapon _player], + ["HandgunWeapon", handgunWeapon _player], + + ["PrimaryWeaponItems", primaryWeaponItems _player], + ["SecondaryWeaponItems", secondaryWeaponItems _player], + ["HandgunItems", handgunItems _player], + + ["AssignedItems", assignedItems _player] + ]; + + + _uMags = []; + _vMags = []; + _bMags = []; + _partialMags = []; + + { + _magArr = _x select 0; + + { + _mag = _x select 0; + _ammo = _x select 1; + + if (_ammo == getNumber (configFile >> "CfgMagazines" >> _mag >> "count")) then { + [_magArr, _mag, 1] call fn_addToPairs; + } + else { + if (_ammo > 0) then { + _partialMags pushBack [_mag, _ammo]; + }; + }; + } forEach magazinesAmmoCargo (_x select 1); + } + forEach + [ + [_uMags, uniformContainer _player], + [_vMags, vestContainer _player], + [_bMags, backpackContainer _player] + ]; + + _loadedMags = []; + + { + _mag = _x select 0; + _ammo = _x select 1; + _loaded = _x select 2; + _type = _x select 3; + + // if loaded in weapon, not empty, and not hand grenade + if (_loaded && _ammo > 0 && _type != 0) then + { + _loadedMags pushBack [_mag, _ammo]; + }; + } forEach magazinesAmmoFull _player; + + _data pushBack ["UniformWeapons", (getWeaponCargo uniformContainer _player) call cargoToPairs]; + _data pushBack ["UniformItems", (getItemCargo uniformContainer _player) call cargoToPairs]; + _data pushBack ["UniformMagazines", _uMags]; + + _data pushBack ["VestWeapons", (getWeaponCargo vestContainer _player) call cargoToPairs]; + _data pushBack ["VestItems", (getItemCargo vestContainer _player) call cargoToPairs]; + _data pushBack ["VestMagazines", _vMags]; + + _data pushBack ["BackpackWeapons", (getWeaponCargo backpackContainer _player) call cargoToPairs]; + _data pushBack ["BackpackItems", (getItemCargo backpackContainer _player) call cargoToPairs]; + _data pushBack ["BackpackMagazines", _bMags]; + + _gear pushBack ["PartialMagazines", _partialMags]; + _gear pushBack ["LoadedMagazines", _loadedMags]; + + _wastelandItems = []; + { + if (_x select 1 > 0) then + { + _wastelandItems pushBack [_x select 0, _x select 1]; + }; + } forEach (_player getVariable ["inventory",[]]); + + _gear pushBack ["WastelandItems", _wastelandItems]; + + //FIXME: re-enable this optimization once stats_merge is implement + /* + _gearStr = str _gear; + + if (_gearStr != ["playerData_gear", ""] call getPublicVar) then + { + { _data pushBack _x } forEach _gear; + playerData_gear = _gearStr; + }; + */ + { _data pushBack _x } forEach _gear; + + _request pushBack ["PlayerSave", (_data call sock_hash)]; + _request pushBack [format["PlayerSave_%1", worldName], (_world_data call sock_hash)]; + + + true +}; + + +p_disconnectSave = { + diag_log format["%1 call p_disconnectSave", _this]; + ARGVX3(0,_player,objNull); + ARGVX3(1,_uid,""); + ARGVX3(2,_name,""); + + + init(_scope,_uid call PDB_playerFileName); + init(_request,[_scope]); + + if (isNil{[_request,_player,_uid,_name] call p_addPlayerSave}) exitWith { + diag_log format["WARNING: No stats saved for %1(%2) on disconnect", _name, _uid]; + [_scope] call stats_flush; + }; + + _request call stats_set; + [_scope] call stats_flush; + + diag_log format["Stats for %1(%2) saved", _name, _uid]; +}; + + +//event listener for server to track when the players inventory changes +"trackMyInventory" addPublicVariableEventHandler { + //diag_log format["%1 call trackMyInventory", _this]; + ARGVX3(1,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_inventory,[]); + + //note that this is not being set to broadcast on purpose + _player setVariable ["inventory", _inventory]; +}; + +"trackMyVitals" addPublicVariableEventHandler {_this spawn { + //diag_log format["%1 call trackMyVitals", _this]; + ARGVX3(1,_this,[]); + ARGVX3(0,_player,objNull); + ARGVX3(1,_vitals,[]); + + { + private["_key", "_value"]; + _key = _x select 0; + _value = _x select 1; + + if (!isNil "_key" || {typeName _key == "STRING"}) then { + _player setVariable [_key,OR(_value,nil)]; + //diag_log format["_key = %1, _value = %2", _key, OR(_value,nil)]; + }; + } forEach _vitals; +};}; + +fn_getPlayerFlag = { + ARGVX3(0,_uid,""); + + def(_scope); + _scope = "Hackers2" call PDB_hackerLogFileName; + + def(_key); + _key = format["%1.records",_uid]; + + + def(_records); + _records = [_scope, _key, nil] call stats_get; + + if (!isARRAY(_records)) exitWith {}; + + private["_last"]; + _last = _records select (count(_records) -1); + + if (!isCODE(_last)) exitWith {}; + + (call _last) +}; + +fn_kickPlayerIfFlagged = { + ARGVX3(0,_UID,""); + ARGVX3(1,_name,""); + + def(_flag); + _flag = [_UID] call fn_getPlayerFlag; + if (!isARRAY(_flag) || {count(_flag) == 0}) exitWith {}; + + // Super mega awesome dodgy player kick method + "Logic" createUnit [[1,1,1], createGroup sideLogic, + (" + this spawn { + if (isServer) then { + _grp = group _this; + deleteVehicle _this; + deleteGroup _grp; + } + else { + waitUntil {!isNull player}; + if (getPlayerUID player == '" + _UID + "') then { + preprocessFile 'client\functions\quit.sqf'; + }; + }; + } + ")]; + + //_oldName = _flag select 0; // always empty for extDB + def(_hackType); + def(_hackValue); + + _hackType = [_flag, "hackType", "unknown"] call fn_getFromPairs; + _hackValue = [_flag, "hackValue", "unknown"] call fn_getFromPairs; + + diag_log format ["ANTI-HACK: %1 (%2) was kicked due to having been flagged for [%3, %4] in the past", _name, _UID, _hackType, _hackValue]; + +}; + +active_players_list = OR_ARRAY(active_players_list,[]); + +p_getActivePlayerIndex = { + ARGVX4(0,_player,objNull,-1); + if (isNull _player) exitWith {-1}; + + (active_players_list find _player) +}; + +p_trackPlayer = { + ARGVX3(0,_player,objNull); + + def(_index); + _index = [_player] call p_getActivePlayerIndex; + if (_index >= 0) exitWith {}; + + //forward to HC + ["trackMe", _player] call sh_hc_forward; + + //diag_log format["%1 is being added to the active list", _player]; + active_players_list pushBack _player; +}; + +p_untrackPlayer = { + ARGVX3(0,_player,objNull); + + def(_index); + _index = [_player] call p_getActivePlayerIndex; + if (_index < 0) exitWith {}; + + //forward to HC + ["untrackMe", _player] call sh_hc_forward; + + //diag_log format["%1 is being removed from the active list", _player]; + active_players_list deleteAt _index; +}; + + +p_ActivePlayersListCleanup = { + + //post cleanup the array + init(_cleanup_start, diag_tickTime); + init(_nulls,[]); + init(_index,-1); + init(_start_size,count(active_players_list)); + while {true} do { + _index = active_players_list find objNull; + if (_index < 0) exitWith {}; + active_players_list deleteAt _index; + }; + init(_end_size,count(active_players_list)); + init(_cleanup_end, diag_tickTime); + diag_log format["pl_saveLoop: count(active_players_list) = %1, %2 nulls deleted in %3 ticks", count(active_players_list), (_start_size - _end_size), (_cleanup_end - _cleanup_start)]; +}; + + +//event handlers for when player spawns +"trackMe" addPublicVariableEventHandler { + //diag_log format["%1 call trackMe", _this]; + ARGVX3(1,_this,[]); + [_this select 0] call p_trackPlayer; +}; + + +p_saveAllPlayers = { + init(_count,0); + init(_start_time, diag_tickTime); + + def(_request); + def(_scope); + def(_player); + def(_uid); + def(_name); + + {if (true) then { + _player = _x; + if (isNil "_player" || {typeName _player != "OBJECT" || {isNull _player || {not(isPlayer _player) || { not(alive _player)}}}}) exitWith { + active_players_list set [_forEachIndex, objNull]; + }; + + _uid = getPlayerUID _player; + _name = name _player; + _scope = _uid call PDB_playerFileName; + _request = [_scope]; + + if (!isNil{[_request, _player, _uid, _name] call p_addPlayerSave}) then { + _count = _count + 1; + }; + + init(_save_start, diag_tickTime); + _request call stats_set; + diag_log format["p_saveLoop: (%1 - %2) saved in %3 ticks, save call took %4 ticks", _name, _uid, (diag_tickTime - _start_time), (diag_tickTime - _save_start)]; + + };} forEach (active_players_list); + + diag_log format["p_saveLoop: total of %1 players saved in %2 ticks", (_count), (diag_tickTime - _start_time)]; +}; + + + + + +p_saveLoop = { + while {true} do { + sleep A3W_player_saveInterval; + if (not(isBOOLEAN(p_saveLoopActive) && {!p_saveLoopActive})) then { + diag_log format["saving all players"]; + call p_saveAllPlayers; + }; + }; +}; + + + +pl_addPlayerListSave = { + ARGVX3(0,_request,[]); + ARGVX3(1,_player,objNull); + ARGVX3(2,_uid,""); + ARGVX3(3,_name,""); + + init(_pdata,[]); + + def(_playerInfo); + _playerInfo = [_player] call p_getPlayerInfo; + if (isARRAY(_playerInfo)) then { + _pdata pushBack ["PlayerInfo", _playerInfo]; + }; + + def(_scoreInfo); + _scoreInfo = [_uid] call p_getScoreInfo; + if (isARRAY(_scoreInfo)) then { + _pdata pushBack ["PlayerScore",_scoreInfo]; + }; + + if (count _pdata == 0) exitWith {}; + + _request pushBack [_uid, (_pdata call sock_hash)]; + + true +}; + +pl_savePlayersList = { + ARGVX3(0,_scope,""); + + init(_count,0); + init(_start_time, diag_tickTime); + + def(_request); + def(_scope); + def(_player); + def(_uid); + def(_name); + def(_request); + + _request = [_scope]; + + {if (true) then { + _player = _x; + if (isNil "_player" || {typeName _player != "OBJECT" || {isNull _player || {not(isPlayer _player)}}}) exitWith { + active_players_list set [_forEachIndex, objNull]; + }; + + _uid = getPlayerUID _player; + _name = name _player; + + if (!isNil{[_request, _player, _uid, _name] call pl_addPlayerListSave}) then { + _count = _count + 1; + }; + + };} forEach (active_players_list); + + [_scope] call stats_wipe; + + init(_save_start, diag_tickTime); + if (count _request > 1) then { + //only send the save request if there is at least one player + _request call stats_set; + }; + diag_log format["pl_saveLoop: total of %1 entries saved (in player-list) in %2 ticks, save call took %3 ticks", (_count), (diag_tickTime - _start_time), (diag_tickTime - _save_start)]; + + [_scope] call stats_flush; + + call p_ActivePlayersListCleanup; +}; + +pl_saveLoop_iteration = { + ARGVX3(0,_scope,""); + diag_log format["pl_saveLoop: Saving player list"]; + init(_start_time,diag_tickTime); + [[_scope], pl_savePlayersList] call sh_fsm_invoke; + init(_end_time,diag_tickTime); + diag_log format["pl_saveLoop: Took %1 ticks to save players list", (_end_time - _start_time)]; +}; + +pl_saveLoop_iteration_hc = { + ARGVX3(0,_scope,""); + + init(_hc_id,owner HeadlessClient); + diag_log format["pl_saveLoop: Offloading player list saving to headless client (id = %1)", _hc_id]; + + pl_saveLoop_iteration_hc_handler = [_scope]; + _hc_id publicVariableClient "pl_saveLoop_iteration_hc_handler"; + + call p_ActivePlayersListCleanup; +}; + +if (!(hasInterface || isDedicated)) then { + diag_log format["Setting up HC handler for players list"]; + "pl_saveLoop_iteration_hc_handler" addPublicVariableEventHandler { + //diag_log format["pl_saveLoop_iteration_hc_handler = %1", _this]; + ARGVX3(1,_this,[]); + ARGVX3(0,_scope,""); + _this spawn pl_saveLoop_iteration; + }; +}; + +pl_saveLoop = { + ARGVX3(0,_scope,""); + while {true} do { + sleep A3W_playersList_saveInterval; + if (not(isBOOLEAN(pl_saveLoopActive) && {!pl_saveLoopActive})) then { + if (call sh_hc_ready) then { + [_scope] call pl_saveLoop_iteration_hc; + } + else { + [_scope] call pl_saveLoop_iteration; + }; + }; + }; +}; + +s_functions_defined = true; + + +diag_log "sFunctions.sqf loading complete"; diff --git a/persistence/players/s_setupPlayerDB.sqf b/persistence/players/s_setupPlayerDB.sqf new file mode 100644 index 000000000..f44cb318c --- /dev/null +++ b/persistence/players/s_setupPlayerDB.sqf @@ -0,0 +1,42 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Name: s_setupPlayerDB.sqf +// @file Author: AgentRev, micovery + +if (!isServer) exitWith {}; + + +diag_log "Loading s_setupPlayerDB ..."; + +call compile preprocessFileLineNumbers "persistence\lib\shFunctions.sqf"; +call compile preprocessFileLineNumbers "persistence\players\sFunctions.sqf"; + +#include "macro.h" + + +fn_deletePlayerSave = { + init(_scope,_this call PDB_playerFileName); + [_scope, ["PlayerSave", nil], ["PlayerSave_Altis", nil], ["PlayerSave_Stratis", nil]] spawn stats_set; +}; + + +"deletePlayerData" addPublicVariableEventHandler { + _player = _this select 1; + (getPlayerUID _player) call fn_deletePlayerSave; +}; + + +def(_mScope); +_mScope = "Messages" call PDB_messagesFileName; +[_mScope] spawn s_messageLoop; + + +def(_plScope); +_plScope = "PlayersList" call PDB_playersListFileName; +[_plScope] spawn pl_saveLoop; + + +[] spawn p_saveLoop; + +diag_log "Loading s_setupPlayerDB complete"; diff --git a/persistence/server/players/default/deletePlayerSave.sqf b/persistence/server/players/default/deletePlayerSave.sqf deleted file mode 100644 index 80057663c..000000000 --- a/persistence/server/players/default/deletePlayerSave.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: deletePlayerSave.sqf -// @file Author: AgentRev - -private "_fileName"; -_fileName = _this call PDB_playerFileName; - -if (call A3W_savingMethod == "iniDB" && {parseNumber (call iniDB_version) < 1.2}) then -{ - // Required for iniDB v1.0 - _fileName call iniDB_delete; -} -else -{ - [_fileName, "PlayerSave"] call PDB_deleteSection; -}; diff --git a/persistence/server/players/default/getPlayerFlag.sqf b/persistence/server/players/default/getPlayerFlag.sqf deleted file mode 100644 index 48146b37b..000000000 --- a/persistence/server/players/default/getPlayerFlag.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getPlayerFlag.sqf -// @file Author: AgentRev - -private "_UID"; -_UID = _this; - -["Hackers" call PDB_playerFileName, "Hackers", _this, "STRING"] call PDB_read diff --git a/persistence/server/players/default/loadAccount.sqf b/persistence/server/players/default/loadAccount.sqf deleted file mode 100644 index 712f34659..000000000 --- a/persistence/server/players/default/loadAccount.sqf +++ /dev/null @@ -1,86 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: loadAccount.sqf -// @file Author: AgentRev - -private ["_UID", "_data", "_saveValid", "_getValue"]; -_UID = _this; - -if !((_UID call PDB_playerFileName) call PDB_exists) exitWith { [] }; // iniDB_exists - -_data = []; - -_saveValid = ([_UID call PDB_playerFileName, "PlayerSave", "Position", "STRING"] call PDB_read != ""); // iniDB_read -_data pushBack ["PlayerSaveValid", _saveValid]; - -_getValue = -{ - private ["_name", "_type", "_section", "_value"]; - _name = _this select 0; - _type = _this select 1; - _section = if (count _this > 2) then { _this select 2 } else { "PlayerSave" }; - - _value = [_UID call PDB_playerFileName, _section, _name, _type] call PDB_read; // iniDB_read - - if (!isNil "_value") then - { - _data pushBack [_name, _value]; - }; -}; - -["Donator", "NUMBER", "PlayerInfo"] call _getValue; -["BankMoney", "NUMBER", "PlayerInfo"] call _getValue; - -["Damage", "NUMBER"] call _getValue; -["HitPoints", "ARRAY"] call _getValue; - -if (["A3W_moneySaving"] call isConfigOn) then -{ - ["Money", "NUMBER"] call _getValue; -}; - -["LoadedMagazines", "ARRAY"] call _getValue; - -["PrimaryWeapon", "STRING"] call _getValue; -["SecondaryWeapon", "STRING"] call _getValue; -["HandgunWeapon", "STRING"] call _getValue; - -["PrimaryWeaponItems", "ARRAY"] call _getValue; -["SecondaryWeaponItems", "ARRAY"] call _getValue; -["HandgunItems", "ARRAY"] call _getValue; - -["AssignedItems", "ARRAY"] call _getValue; - -["CurrentWeapon", "STRING"] call _getValue; -["Stance", "STRING"] call _getValue; - -["Uniform", "STRING"] call _getValue; -["Vest", "STRING"] call _getValue; -["Backpack", "STRING"] call _getValue; -["Goggles", "STRING"] call _getValue; -["Headgear", "STRING"] call _getValue; - -["UniformWeapons", "ARRAY"] call _getValue; -["UniformItems", "ARRAY"] call _getValue; -["UniformMagazines", "ARRAY"] call _getValue; - -["VestWeapons", "ARRAY"] call _getValue; -["VestItems", "ARRAY"] call _getValue; -["VestMagazines", "ARRAY"] call _getValue; - -["BackpackWeapons", "ARRAY"] call _getValue; -["BackpackItems", "ARRAY"] call _getValue; -["BackpackMagazines", "ARRAY"] call _getValue; - -["PartialMagazines", "ARRAY"] call _getValue; // legacy - -["WastelandItems", "ARRAY"] call _getValue; - -["Hunger", "NUMBER"] call _getValue; -["Thirst", "NUMBER"] call _getValue; - -["Position", "ARRAY"] call _getValue; -["Direction", "NUMBER"] call _getValue; - -_data diff --git a/persistence/server/players/default/saveAccount.sqf b/persistence/server/players/default/saveAccount.sqf deleted file mode 100644 index ecf11cb7a..000000000 --- a/persistence/server/players/default/saveAccount.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveAccount.sqf -// @file Author: AgentRev - -private ["_UID", "_info", "_data"]; -_UID = _this select 0; -_info = _this select 1; -_data = _this select 2; - -{ - [_UID call PDB_playerFileName, "PlayerInfo", _x select 0, _x select 1] call PDB_write; // iniDB_write -} forEach _info; - -{ - [_UID call PDB_playerFileName, "PlayerSave", _x select 0, _x select 1] call PDB_write; // iniDB_write -} forEach _data; diff --git a/persistence/server/players/extDB/deletePlayerSave.sqf b/persistence/server/players/extDB/deletePlayerSave.sqf deleted file mode 100644 index e95ecb82a..000000000 --- a/persistence/server/players/extDB/deletePlayerSave.sqf +++ /dev/null @@ -1,7 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: deletePlayerSave.sqf -// @file Author: AgentRev - -[format ["deletePlayerSave:%1:%2", _this, call A3W_extDB_MapID]] call extDB_Database_async; diff --git a/persistence/server/players/extDB/getPlayerFlag.sqf b/persistence/server/players/extDB/getPlayerFlag.sqf deleted file mode 100644 index c06afec28..000000000 --- a/persistence/server/players/extDB/getPlayerFlag.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getPlayerFlag.sqf -// @file Author: AgentRev - -private "_UID"; -_UID = _this; - -[format ["getAntihackEntry:%1", _UID], 2] call extDB_Database_async diff --git a/persistence/server/players/extDB/loadAccount.sqf b/persistence/server/players/extDB/loadAccount.sqf deleted file mode 100644 index 564f7345d..000000000 --- a/persistence/server/players/extDB/loadAccount.sqf +++ /dev/null @@ -1,106 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: loadAccount.sqf -// @file Author: Torndeco, AgentRev - -if (!isServer) exitWith {}; - -private ["_UID", "_bank", "_moneySaving", "_result", "_data", "_columns"]; -_UID = _this; - -_bank = 0; -_moneySaving = ["A3W_moneySaving"] call isConfigOn; - -if (_moneySaving) then -{ - _result = ["getPlayerBankMoney:" + _UID, 2] call extDB_Database_async; - - if (count _result > 0) then - { - _bank = _result select 0; - }; -}; - -_result = ([format ["checkPlayerSave:%1:%2", _UID, call A3W_extDB_MapID], 2] call extDB_Database_async) select 0; - -if (!_result) then -{ - _data = - [ - ["PlayerSaveValid", false], - ["BankMoney", _bank] - ]; -} -else -{ - // The order of these values is EXTREMELY IMPORTANT! - _data = - [ - "Damage", - "HitPoints", - - "LoadedMagazines", - - "PrimaryWeapon", - "SecondaryWeapon", - "HandgunWeapon", - - "PrimaryWeaponItems", - "SecondaryWeaponItems", - "HandgunItems", - - "AssignedItems", - - "CurrentWeapon", - "Stance", - - "Uniform", - "Vest", - "Backpack", - "Goggles", - "Headgear", - - "UniformWeapons", - "UniformItems", - "UniformMagazines", - - "VestWeapons", - "VestItems", - "VestMagazines", - - "BackpackWeapons", - "BackpackItems", - "BackpackMagazines", - - "WastelandItems", - - "Hunger", - "Thirst", - - "Position", - "Direction" - ]; - - if (_moneySaving) then - { - _data pushBack "Money"; - }; - - _columns = ""; - - { - _columns = _columns + ((if (_columns != "") then { "," } else { "" }) + _x); - } forEach _data; - - _result = [format ["getPlayerSave:%1:%2:%3", _UID, call A3W_extDB_MapID, _columns], 2] call extDB_Database_async; - - { - _data set [_forEachIndex, [_data select _forEachIndex, _x]]; - } forEach _result; - - _data pushBack ["BankMoney", _bank]; - _data pushBack ["PlayerSaveValid", true]; -}; - -_data diff --git a/persistence/server/players/extDB/saveAccount.sqf b/persistence/server/players/extDB/saveAccount.sqf deleted file mode 100644 index 3306c1a5d..000000000 --- a/persistence/server/players/extDB/saveAccount.sqf +++ /dev/null @@ -1,24 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveAccount.sqf -// @file Author: AgentRev - -#define FILTERED_CHARS [39,58] // single quote, colon - -private ["_UID", "_info", "_data", "_sqlValues"]; -_UID = _this select 0; -_info = _this select 1; -_data = _this select 2; - -if (count _info > 0) then -{ - _sqlValues = [_info, [0,1], false] call extDB_pairsToSQL; - [format ["insertOrUpdatePlayerInfo:%1:", _UID] + (_sqlValues select 0) + ":" + (_sqlValues select 1)] call extDB_Database_async; -}; - -if (count _data > 0) then -{ - _sqlValues = [_data, [0,1]] call extDB_pairsToSQL; - [format ["insertOrUpdatePlayerSave:%1:%2:", _UID, call A3W_extDB_MapID] + (_sqlValues select 0) + ":" + (_sqlValues select 1)] call extDB_Database_async; -}; diff --git a/persistence/server/players/fn_kickPlayerIfFlagged.sqf b/persistence/server/players/fn_kickPlayerIfFlagged.sqf deleted file mode 100644 index a42583a28..000000000 --- a/persistence/server/players/fn_kickPlayerIfFlagged.sqf +++ /dev/null @@ -1,39 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_kickPlayerIfFlagged.sqf -// @file Author: AgentRev - -private ["_UID", "_name", "_flag"]; -_UID = _this select 0; -_name = _this select 1; - -_flag = _UID call fn_getPlayerFlag; - -if (!isNil "_flag" && {count _flag > 1}) then -{ - // Super mega awesome dodgy player kick method - "Logic" createUnit [[1,1,1], createGroup sideLogic, - ("this spawn - { - if (isServer) then - { - _grp = group _this; - deleteVehicle _this; - deleteGroup _grp; - } - else - { - waitUntil {!isNull player}; - if (getPlayerUID player == '" + _UID + "') then - { - preprocessFile 'client\functions\quit.sqf'; - }; - }; - }")]; - - //_oldName = _flag select 0; // always empty for extDB - _hackType = _flag select 1; - - diag_log format ["ANTI-HACK: %1 (%2) was kicked due to having been flagged for [%3] in the past", _name, _UID, _hackType]; -}; diff --git a/persistence/server/players/setupPlayerDB.sqf b/persistence/server/players/setupPlayerDB.sqf deleted file mode 100644 index 45fdaa53d..000000000 --- a/persistence/server/players/setupPlayerDB.sqf +++ /dev/null @@ -1,76 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: s_setupPlayerDB.sqf -// @file Author: AgentRev - -if (!isServer) exitWith {}; - -_playerFuncs = format ["persistence\server\players\%1", call A3W_savingMethodDir]; - -fn_deletePlayerSave = [_playerFuncs, "deletePlayerSave.sqf"] call mf_compile; -fn_loadAccount = [_playerFuncs, "loadAccount.sqf"] call mf_compile; -fn_saveAccount = [_playerFuncs, "saveAccount.sqf"] call mf_compile; -fn_getPlayerFlag = [_playerFuncs, "getPlayerFlag.sqf"] call mf_compile; -fn_updateStats = [_playerFuncs, "updateStats.sqf"] call mf_compile; -fn_logAntihack = [_playerFuncs, "logAntihack.sqf"] call mf_compile; -fn_logAdminMenu = [_playerFuncs, "logAdminMenu.sqf"] call mf_compile; -fn_logBankTransfer = [_playerFuncs, "logBankTransfer.sqf"] call mf_compile; -fn_kickPlayerIfFlagged = "persistence\server\players\fn_kickPlayerIfFlagged.sqf" call mf_compile; - -"pvar_savePlayerData" addPublicVariableEventHandler -{ - (_this select 1) spawn - { - _UID = _this select 0; - _info = _this select 1; - _data = _this select 2; - _player = _this select 3; - - if (!isNull _player && alive _player && !(_player call A3W_fnc_isUnconscious)) then - { - _info pushBack ["BankMoney", _player getVariable ["bmoney", 0]]; - [_UID, _info, _data] call fn_saveAccount; - }; - - if (!isNull _player && !alive _player) then - { - _UID call fn_deletePlayerSave; - }; - }; -}; - -"pvar_requestPlayerData" addPublicVariableEventHandler -{ - (_this select 1) spawn - { - _UID = _this select 1; - _data = _UID call fn_loadAccount; - - [[_this, _data], - { - _pVal = _this select 0; - _data = _this select 1; - - _player = _pVal select 0; - _UID = _pVal select 1; - _pNetId = _pVal select 2; - - _pvarName = "pvar_applyPlayerData_" + _UID; - - missionNamespace setVariable [_pvarName, _data]; - (owner _player) publicVariableClient _pvarName; - - { - if (_x select 0 == "BankMoney") exitWith - { - _player setVariable ["bmoney", _x select 1, true]; - }; - } forEach _data; - - diag_log format ["pvar_requestPlayerData: %1", [owner _player, _player, objectFromNetId _pNetId]]; - }] execFSM "call.fsm"; - }; -}; - -"pvar_deletePlayerData" addPublicVariableEventHandler { (_this select 1) spawn fn_deletePlayerSave }; diff --git a/persistence/server/setup/default/fn_inidb_custom.sqf b/persistence/server/setup/default/fn_inidb_custom.sqf deleted file mode 100644 index 578af81cc..000000000 --- a/persistence/server/setup/default/fn_inidb_custom.sqf +++ /dev/null @@ -1,331 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_inidb_custom.sqf -// @file Author: {ZAG}Ed!, JoSchaap, Bewilderbeest, AgentRev - -#define __DEBUG_INIDB_CALLS__ 0 - -if (!isServer) exitWith {}; - -private ["_savingMethod", "_pFileID", "_oFileID"]; - -_savingMethod = ["A3W_savingMethod", "profile"] call getPublicVar; - -if (!isNil "PDB_ServerID" && {isNil "PDB_PlayerFileID" || isNil "PDB_ObjectFileID"}) then -{ - _pFileID = PDB_ServerID; - _oFileID = PDB_ServerID; -} -else -{ - _pFileID = ["PDB_PlayerFileID", "A3W_"] call getPublicVar; - _oFileID = ["PDB_ObjectFileID", "A3W_"] call getPublicVar; -}; - -PDB_playerFileName = compileFinal ("format ['%1%2', '" + _pFileID + "', _this]"); -PDB_objectFileName = compileFinal ("format ['%1%2', '" + _oFileID + "', _this]"); - -PDB_databaseNameCompiler = PDB_objectFileName; - -iniDB_version = compileFinal str ("iniDB" callExtension "version"); - -iniDB_HashFunction = { - private ["_mode", "_data", "_cdata"]; - _mode = _this select 0; - _data = _this select 1; - - if (typeName _data == "STRING") then { - _data = "iniDB" callExtension format ["%1;%2", _mode, _data]; - _cdata = call compile _data; - - if (_cdata select 0) then { _cdata select 1 } else { nil } - } else { - nil - }; -} -call mf_compile; - -iniDB_CRC32 = { ["crc", _this] call iniDB_HashFunction } call mf_compile; -iniDB_MD5 = { ["md5", _this] call iniDB_HashFunction } call mf_compile; -iniDB_Base64Encode = { ["b64_enc", _this] call iniDB_HashFunction } call mf_compile; -iniDB_Base64Decode = { ["b64_dec", _this] call iniDB_HashFunction } call mf_compile; - -iniDB_exists = { - private ["_data", "_cdata"]; - if (__DEBUG_INIDB_CALLS__ == 1) then { diag_log format ["iniDB_exists called with %1", _this] }; - _data = "iniDB" callExtension format ["exists;%1", _this]; - if (__DEBUG_INIDB_CALLS__ == 1) then { diag_log format ["iniDB_exists returned %1", _data] }; - _cdata = call compile _data; - - (_cdata select 0 && {_cdata select 1}) -} -call mf_compile; - - -iniDB_delete = { - private ["_data", "_cdata"]; - _data = "iniDB" callExtension format ["delete;%1", _this select 0]; - _cdata = call compile _data; - - _cdata select 0 -} -call mf_compile; - -iniDB_deleteSection = { - private ["_data", "_cdata"]; - _data = "iniDB" callExtension format ["deletesection;%1;%2", _this select 0, _this select 1]; - _cdata = call compile _data; - - _cdata select 0 -} -call mf_compile; - -// ======================================================================= - -iniDB_readRaw = { - private ["_file", "_sec", "_key", "_data", "_cdata"]; - if (__DEBUG_INIDB_CALLS__ == 1) then { diag_log format ["iniDB_readRaw called with %1", _this] }; - _file = _this select 0; - _sec = _this select 1; - _key = _this select 2; - _data = "iniDB" callExtension format ["read;%1;%2;%3", _file, _sec, _key]; - if (__DEBUG_INIDB_CALLS__ == 1) then { diag_log format ["iniDB_readRaw returned '%1'", _data] }; - _cdata = [false]; - // Better handling of empty strings which don't compile well - _cdata = if (_data != "") then { call compile _data } else { [false] }; - - if (_cdata select 0) then { _cdata select 1 } else { "" } -} -call mf_compile; - -iniDB_writeRaw = { - private ["_file", "_sec", "_key", "_val", "_data", "_cdata"]; - if (__DEBUG_INIDB_CALLS__ == 1) then {diag_log format ["iniDB_writeRaw called with %1", _this] }; - - _file = _this select 0; - _sec = _this select 1; - _key = _this select 2; - _val = _this select 3; - _data = "iniDB" callExtension format ["write;%1;%2;%3;%4", _file, _sec, _key, _val]; - _cdata = call compile _data; - - _cdata select 0 -} -call mf_compile; - -// ======================================================================= - -iniDB_Datarizer = { - private ["_string", "_type", "_return"]; - if (__DEBUG_INIDB_CALLS__ == 1) then { diag_log format ["iniDB_Datarizer called with %1", _this] }; - _string = _this select 0; - _type = _this select 1; - - _return = if (_type == "ARRAY") then { - call compile _string - } else { - if ((toUpper _type) in ["SCALAR","NUMBER"]) then { // "NUMBER" is less confusing for new folks - parseNumber _string - } else { - _string - }; - }; - - if (!isNil "_return") then { _return } else { nil } -} -call mf_compile; - -iniDB_read = { - private ["_file", "_sec", "_key", "_type", "_data"]; - if (__DEBUG_INIDB_CALLS__ == 1) then { diag_log format ["iniDB_read called with %1", _this] }; - - _file = _this select 0; - _sec = _this select 1; - _key = _this select 2; - _data = [_file, _sec, _key] call iniDB_readRaw; - - if (count _this > 3) then { - _type = _this select 3; - _data = [_data, _type] call iniDB_Datarizer; - }; - - if (!isNil "_data") then { _data } else { nil } -} -call mf_compile; - -iniDB_write = { - private ["_file", "_sec", "_key", "_data"]; - if (__DEBUG_INIDB_CALLS__ == 1) then {diag_log format ["iniDB_write called with %1", _this] }; - - _file = _this select 0; - _sec = _this select 1; - _key = _this select 2; - _data = _this select 3; - - _data = format ['"%1"', _data]; - [_file, _sec, _key, _data] call iniDB_writeRaw -} -call mf_compile; - -PDB_defaultValue = { - private ["_type", "_data"]; - _type = _this select 0; - _data = _this select 1; - _data = if (!isNil "_data") then { format ["%1", _data] } else { "" }; - - switch (toUpper _type) do - { - case "STRING": { _data }; - case "NUMBER": { parseNumber _data }; - case "SCALAR": { parseNumber _data }; - default { nil }; - }; -} -call mf_compile; - -// Server-side profileNamespace saving if iniDB is disabled or unavailable - -PDB_exists = if (_savingMethod == "iniDB") then { iniDB_exists } else -{ - { - !isNil {profileNamespace getVariable _this}; - } call mf_compile; -}; - -PDB_read = if (_savingMethod == "iniDB") then { iniDB_read } else -{ - { - private ["_var", "_sec", "_key", "_varSec", "_data", "_type"]; - _var = _this select 0; - _sec = _this select 1; - _key = _this select 2; - - _varSec = _var + "_" + _sec; - _data = profileNamespace getVariable _varSec; - - if (!isNil "_data" && {typeName _data == "ARRAY"}) then - { - _data = [_data, _key] call fn_getFromPairs; - }; - - if (count _this > 3 && {isNil "_data" || {typeName _data != _this select 3}}) then - { - _data = [_this select 3, if (isNil "_data") then { "" } else { _data }] call PDB_defaultValue; - }; - - if (!isNil "_data") then { _data } else { nil }; - } call mf_compile; -}; - -PDB_write = if (_savingMethod == "iniDB") then { iniDB_write } else -{ - { - private ["_var", "_sec", "_key", "_val", "_saveSec", "_varSec", "_data", "_setVar"]; - _var = _this select 0; - _sec = _this select 1; - _key = _this select 2; - _val = _this select 3; - _saveSec = if (count _this > 4) then { _this select 4 } else { true }; - - // Save value in section - - _varSec = _var + "_" + _sec; - _data = profileNamespace getVariable _varSec; - _setVar = false; - - if (isNil "_data" || {typeName _data != "ARRAY"}) then - { - _data = []; - _setVar = true; - }; - - [_data, _key, _val] call fn_setToPairs; - - // Since arrays are always passed by reference, we only have to call setVariable if the array itself changes - if (_setVar) then - { - profileNamespace setVariable [_varSec, _data]; - }; - - // Save section name in index - - if (_saveSec) then - { - _indData = profileNamespace getVariable _var; - _setVar = false; - - if (isNil "_indData" || {typeName _indData != "ARRAY"}) then - { - _indData = []; - _setVar = true; - }; - - if ({typeName _x == "STRING" && {_x == _sec}} count _indData == 0) then - { - _indData pushBack _sec; - }; - - if (_setVar) then - { - profileNamespace setVariable [_var, _indData]; - }; - }; - } call mf_compile; -}; - -PDB_delete = if (_savingMethod == "iniDB") then { iniDB_delete } else -{ - { - private ["_var", "_delSec", "_indData"]; - _var = _this select 0; - _delSec = if (count _this > 1) then { _this select 1 } else { true }; - - _indData = profileNamespace getVariable _var; - - if (!isNil "_indData") then - { - if (_delSec && typeName _indData == "ARRAY") then - { - { - if (typeName _x == "STRING") then - { - profileNamespace setVariable [_x, nil]; - }; - } forEach _indData; - }; - - profileNamespace setVariable [_var, nil]; - }; - } call mf_compile; -}; - -PDB_deleteSection = if (_savingMethod == "iniDB") then { iniDB_deleteSection } else -{ - { - private ["_var", "_sec", "_delIndex", "_varSec", "_indData"]; - _var = _this select 0; - _sec = _this select 1; - _delIndex = if (count _this > 2) then { _this select 2 } else { false }; - - _varSec = _var + "_" + _sec; - profileNamespace setVariable [_varSec, nil]; - - if (_delIndex) then - { - _indData = profileNamespace getVariable _var; - - if (!isNil "_indData" && {typeName _indData == "ARRAY"}) then - { - { - if (typeName _x == "STRING" && {_x == _varSec}) then - { - _indData set [_forEachIndex, -1]; - }; - } forEach _indData; - - profileNamespace setVariable [_var, _indData - [-1]]; - }; - }; - } call mf_compile; -}; diff --git a/persistence/server/setup/extDB/async_database.sqf b/persistence/server/setup/extDB/async_database.sqf deleted file mode 100644 index be348c11f..000000000 --- a/persistence/server/setup/extDB/async_database.sqf +++ /dev/null @@ -1,74 +0,0 @@ -/* - File: async_database.sqf - Function: extDB_Database_async - Author: Bryan "Tonic" Boardwine - - Description: - Commits an asynchronous call to extDB - Gets result via extDB 4:x + uses 5:x if message is Multi-Part - - Parameters: - 0: STRING (Query to be ran). - 1: INTEGER (1 = ASYNC + not return for update/insert, 2 = ASYNC + return for query's). - 3: BOOL (False to return a single array, True to return multiple entries mainly for garage). -*/ - -private["_queryStmt","_queryResult","_key","_mode","_return","_loop"]; - -_tickTime = diag_tickTime; - -_queryStmt = [_this,0,"",[""]] call BIS_fnc_param; -_mode = [_this,1,1,[0]] call BIS_fnc_param; -_multiarr = [_this,2,false,[false]] call BIS_fnc_param; - -_key = "extDB" callExtension (format ["%1:%2:", _mode, call A3W_extDB_ID] + _queryStmt); - -if(_mode == 1) exitWith {true}; - -_key = call compile format["%1",_key]; -_key = _key select 1; - -sleep 0.01; - -// Get Result via 4:x (single message return) v19 and later -_queryResult = ""; -_loop = true; -while{_loop} do -{ - _queryResult = "extDB" callExtension format["4:%1", _key]; - if (_queryResult == "[5]") then { - // extDB returned that result is Multi-Part Message - _queryResult = ""; - while{true} do { - _pipe = "extDB" callExtension format["5:%1", _key]; - if(_pipe == "") exitWith {_loop = false}; - _queryResult = _queryResult + _pipe; - }; - } - else - { - if (_queryResult == "[3]") then - { - //diag_log format ["[extDB] Sleep [4]: %1", diag_tickTime]; - sleep 0.1; - } else { - _loop = false; - }; - }; -}; - - -_queryResult = call compile _queryResult; - -// Not needed, its SQF Code incase extDB ever returns error message i.e Database Died -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Error: %1", _queryResult]; []}; -_queryResult = (_queryResult select 1); -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Protocol Error: %1", _queryResult]; []}; -if(count (_queryResult select 1) == 0) exitWith {[]}; -_return = (_queryResult select 1); - -if(!_multiarr) then { - _return = _return select 0; -}; - -_return; \ No newline at end of file diff --git a/persistence/server/setup/extDB/async_database_debug.sqf b/persistence/server/setup/extDB/async_database_debug.sqf deleted file mode 100644 index fe4b93d3f..000000000 --- a/persistence/server/setup/extDB/async_database_debug.sqf +++ /dev/null @@ -1,95 +0,0 @@ -/* - File: async_database_debug.sqf - Function: extDB_Database_async - Author: Bryan "Tonic" Boardwine - - Description: - Commits an asynchronous call to extDB - Gets result via extDB 4:x + uses 5:x if message is Multi-Part - - Parameters: - 0: STRING (Query to be ran). - 1: INTEGER (1 = ASYNC + not return for update/insert, 2 = ASYNC + return for query's). - 3: BOOL (False to return a single array, True to return multiple entries mainly for garage). -*/ - -private["_queryStmt","_queryResult","_key","_mode","_buffer","_return"]; - -_tickTime = diag_tickTime; - -_queryStmt = [_this,0,"",[""]] call BIS_fnc_param; -_mode = [_this,1,1,[0]] call BIS_fnc_param; -_multiarr = [_this,2,false,[false]] call BIS_fnc_param; - -_key = "extDB" callExtension (format ["%1:%2:", _mode, call A3W_extDB_ID] + _queryStmt); - -if(_mode == 1) exitWith -{ - _buffer = toArray (format ["DEBUG ----- extDB ASync: Complete Time:%1 Input String:", diag_tickTime - _tickTime] + _queryStmt); - while {count _buffer > 0} do - { - diag_log toString (_buffer select [0, 1021]); - _buffer deleteRange [0, 1021]; - }; - true -}; - -_key = call compile format["%1",_key]; -_key = _key select 1; - -sleep 0.01; - -// Get Result via 4:x (single message return) v19 and later -_queryResult = ""; -_loop = true; -while{_loop} do -{ - _queryResult = "extDB" callExtension format["4:%1", _key]; - if (_queryResult == "[5]") then { - // extDB returned that result is Multi-Part Message - _queryResult = ""; - while{true} do { - _pipe = "extDB" callExtension format["5:%1", _key]; - if(_pipe == "") exitWith {_loop = false}; - if(_pipe != "[3]") then { - _queryResult = _queryResult + _pipe; - } else { - diag_log format ["[extDB] Sleep [5]: %1", diag_tickTime]; - sleep 0.1; - }; - }; - } - else - { - if (_queryResult == "[3]") then - { - diag_log format ["[extDB] Sleep [4]: %1", diag_tickTime]; - sleep 0.1; - } else { - _loop = false; - }; - }; -}; - -diag_log format ["DEBUG ASYNC: %1", _queryResult]; -_queryResult = call compile _queryResult; - -_buffer = toArray (format ["DEBUG ----- extDB ASync: Complete Time:%1 Input String:", diag_tickTime - _tickTime] + _queryStmt); -while {count _buffer > 0} do -{ - diag_log toString (_buffer select [0, 1021]); - _buffer deleteRange [0, 1021]; -}; - -// Not needed, its SQF Code incase extDB ever returns error message i.e Database Died -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Error: %1", _queryResult]; []}; -_queryResult = (_queryResult select 1); -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Protocol Error: %1", _queryResult]; []}; -if(count (_queryResult select 1) == 0) exitWith {[]}; -_return = (_queryResult select 1); - -if(!_multiarr) then { - _return = _return select 0; -}; - -_return; \ No newline at end of file diff --git a/persistence/server/setup/extDB/async_misc.sqf b/persistence/server/setup/extDB/async_misc.sqf deleted file mode 100644 index 1aaf93cad..000000000 --- a/persistence/server/setup/extDB/async_misc.sqf +++ /dev/null @@ -1,75 +0,0 @@ -/* - File: async_misc.sqf - Function: extDB_Database_async - Author: Bryan "Tonic" Boardwine - - Description: - Commits an asynchronous call to extDB - Gets result via extDB 4:x + uses 5:x if message is Multi-Part - - Parameters: - 0: STRING (Query to be ran). - 1: INTEGER (1 = ASYNC + not return for update/insert, 2 = ASYNC + return for query's). - 3: BOOL (false to return a single array, true to return multiple entries mainly for garage). -*/ - -private["_queryStmt","_queryResult","_key","_mode","_return"]; - -_queryStmt = [_this,0,"",[""]] call BIS_fnc_param; -_mode = [_this,1,1,[0]] call BIS_fnc_param; -_multiarr = [_this,2,false,[false]] call BIS_fnc_param; - -_key = "extDB" callExtension format["%1:%2:%3",_mode, (call A3W_extDB_miscID),_queryStmt]; - -if(_mode == 1) exitWith {true}; - -_key = call compile format["%1",_key]; -_key = _key select 1; - -sleep 0.01; - -// Get Result via 4:x (single message return) v19 and later -_queryResult = ""; -_loop = true; -while{_loop} do -{ - _queryResult = "extDB" callExtension format["4:%1", _key]; - if (_queryResult == "[5]") then { - // extDB returned that result is Multi-Part Message - _queryResult = ""; - while{true} do { - _pipe = "extDB" callExtension format["5:%1", _key]; - if(_pipe == "") exitWith {_loop = false}; - if(_pipe != "[3]") then { - _queryResult = _queryResult + _pipe; - } else { - //diag_log format ["[extDB] Sleep [5]: %1", diag_tickTime]; - sleep 0.1; - }; - }; - } - else - { - if (_queryResult == "[3]") then - { - //diag_log format ["[extDB] Sleep [4]: %1", diag_tickTime]; - sleep 0.1; - } else { - _loop = false; - }; - }; -}; - -_queryResult = call compile _queryResult; - - -// Not needed, its SQF Code incase extDB ever returns error message i.e Database Died -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Error: %1", _queryResult]; []}; -_queryResult = (_queryResult select 1); -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Protocol Error: %1", _queryResult]; []}; -if(count (_queryResult select 1) == 0) exitWith {[]}; -_return = (_queryResult select 1) select 0; -if(_multiarr) then { - _return = (_queryResult select 1); -}; -_return; \ No newline at end of file diff --git a/persistence/server/setup/extDB/async_misc_debug.sqf b/persistence/server/setup/extDB/async_misc_debug.sqf deleted file mode 100644 index ca3966773..000000000 --- a/persistence/server/setup/extDB/async_misc_debug.sqf +++ /dev/null @@ -1,79 +0,0 @@ -/* - File: async_misc_debug.sqf - Function: extDB_Misc_async - Author: Bryan "Tonic" Boardwine - - Description: - Commits an asynchronous call to extDB - Gets result via extDB 4:x + uses 5:x if message is Multi-Part - - Parameters: - 0: STRING (Query to be ran). - 1: INTEGER (1 = ASYNC + not return for update/insert, 2 = ASYNC + return for query's). - 3: BOOL (false to return a single array, true to return multiple entries mainly for garage). -*/ - -private["_queryStmt","_queryResult","_key","_mode","_return"]; - -_tickTime = diag_tickTime; - -_queryStmt = [_this,0,"",[""]] call BIS_fnc_param; -_mode = [_this,1,1,[0]] call BIS_fnc_param; -_multiarr = [_this,2,false,[false]] call BIS_fnc_param; - -_key = "extDB" callExtension format["%1:%2:%3",_mode, (call A3W_extDB_miscID),_queryStmt]; - -if(_mode == 1) exitWith {diag_log format ["DEBUG ----- extDB ASync: Complete Time:%1 Input String:%2", (diag_tickTime - _tickTime), _queryStmt]; true}; - -_key = call compile format["%1",_key]; -_key = _key select 1; - -sleep 0.01; - -// Get Result via 4:x (single message return) v19 and later -_queryResult = ""; -_loop = true; -while{_loop} do -{ - _queryResult = "extDB" callExtension format["4:%1", _key]; - if (_queryResult == "[5]") then { - // extDB returned that result is Multi-Part Message - _queryResult = ""; - while{true} do { - _pipe = "extDB" callExtension format["5:%1", _key]; - if(_pipe == "") exitWith {_loop = false}; - if(_pipe != "[3]") then { - _queryResult = _queryResult + _pipe; - } else { - diag_log format ["[extDB] Sleep [5]: %1", diag_tickTime]; - sleep 0.1; - }; - }; - } - else - { - if (_queryResult == "[3]") then - { - diag_log format ["[extDB] Sleep [4]: %1", diag_tickTime]; - sleep 0.1; - } else { - _loop = false; - }; - }; -}; - -diag_log format ["DEBUG ASYNC: %1", _queryResult]; -_queryResult = call compile _queryResult; - -diag_log format ["DEBUG ----- extDB ASync: Complete Time:%1 Input String:%2", (diag_tickTime - _tickTime), _queryStmt]; - -// Not needed, its SQF Code incase extDB ever returns error message i.e Database Died -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Error: %1", _queryResult]; []}; -_queryResult = (_queryResult select 1); -if ((_queryResult select 0) == 0) exitWith {diag_log format ["[extDB] Protocol Error: %1", _queryResult]; []}; -if(count (_queryResult select 1) == 0) exitWith {[]}; -_return = (_queryResult select 1) select 0; -if(_multiarr) then { - _return = (_queryResult select 1); -}; -_return; \ No newline at end of file diff --git a/persistence/server/setup/extDB/init.sqf b/persistence/server/setup/extDB/init.sqf deleted file mode 100644 index 37a110b3d..000000000 --- a/persistence/server/setup/extDB/init.sqf +++ /dev/null @@ -1,121 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: init.sqf -// @file Author: Torndeco, AgentRev - -#define MIN_DB_VERSION 2.03 - -private ["_return", "_result", "_setupDir", "_serverID", "_env", "_mapID"]; - -// uiNamespace is persistent across mission restarts (but not game restarts) -_return = if (isNil {uiNamespace getVariable "A3W_extDB_ID"}) then -{ - diag_log "[extDB] Startup..."; - - _result = call compile ("extDB" callExtension format ["9:DATABASE:%1", call A3W_extDB_ConfigName]); - if (_result select 0 == 0 && {_result select 1 != "Already Connected to Database"}) exitWith { diag_log format ["[extDB] ### Database error! %1", _result]; false }; - - diag_log "[extDB] Connected to database"; - - A3W_extDB_ID = compileFinal str floor random 999999; - A3W_extDB_miscID = compileFinal str (call A3W_extDB_ID + 1); - - _result = call compile ("extDB" callExtension format ["9:ADD:DB_CUSTOM_V3:%1:%2", call A3W_extDB_ID, call A3W_extDB_IniName]); - if (_result select 0 == 0) exitWith { diag_log format ["[extDB] ### DB_CUSTOM_V3 protocol error! %1", _result]; false }; - - diag_log "[extDB] Initialized DB_CUSTOM_V3 protocol"; - - _result = call compile ("extDB" callExtension format ["9:ADD:MISC:%1", call A3W_extDB_miscID]); - if (_result select 0 == 0) exitWith { diag_log format ["[extDB] ### MISC protocol error! %1", _result]; false }; - - diag_log "[extDB] Initialized MISC protocol"; - - uiNamespace setVariable ["A3W_extDB_ID", call A3W_extDB_ID]; - uiNamespace setVariable ["A3W_extDB_miscID", call A3W_extDB_miscID]; - true -} -else -{ - A3W_extDB_ID = compileFinal str (uiNamespace getVariable "A3W_extDB_ID"); - A3W_extDB_miscID = compileFinal str (uiNamespace getVariable "A3W_extDB_miscID"); - diag_log "[extDB] Connection and protocols already initialized!"; - true -}; - -if (_return) then -{ - scopeName "extDB_envSetup"; - diag_log "[extDB] Environment setup..."; - - _setupDir = "persistence\server\setup\extDB"; - - if (["A3W_extDB_Debug"] call isConfigOn) then - { - _result = call compile ("extDB" callExtension format ["9:ADD:DB_CUSTOM_V3:%1:%2", call A3W_extDB_ID, call A3W_extDB_IniName]); - if (_result select 0 == 0) then { diag_log format ["[extDB] ### DB_CUSTOM_V3 protocol error! %1", _result] }; - - extDB_Database_async = [_setupDir, "async_database_debug.sqf"] call mf_compile; - extDB_Misc_async = [_setupDir, "async_misc_debug.sqf"] call mf_compile; - diag_log "[extDB] Debug output enabled"; - } - else - { - "extDB" callExtension "9:LOCK"; - diag_log "[extDB] Locked"; - - extDB_Database_async = [_setupDir, "async_database.sqf"] call mf_compile; - extDB_Misc_async = [_setupDir, "async_misc.sqf"] call mf_compile; - }; - - extDB_pairsToSQL = [_setupDir, "fn_pairsToSQL.sqf"] call mf_compile; - - _result = (["getDBVersion", 2] call extDB_Database_async) select 0; - if (_result < MIN_DB_VERSION) exitWith { diag_log format ["[extDB] ### Outdated A3Wasteland database version! %1 - min: %2", _result, MIN_DB_VERSION]; _return = false }; - - _serverID = ["A3W_extDB_ServerID", 1] call getPublicVar; - A3W_extDB_ServerID = compileFinal str _serverID; - publicVariable "A3W_extDB_ServerID"; - - _result = ([format ["checkServerInstance:%1", _serverID], 2] call extDB_Database_async) select 0; - if (!_result) then - { - [format ["insertServerInstance:%1", _serverID], 2] call extDB_Database_async; - - _result = ([format ["checkServerInstance:%1", _serverID], 2] call extDB_Database_async) select 0; - if (!_result) then - { - diag_log format ["[extDB] ### Unable to create ServerInstance with ServerID %1", _serverID]; - _return = false; - breakOut "extDB_envSetup"; - }; - }; - - _env = ["A3W_extDB_Environment", "normal"] call getPublicVar; - - _mapID = ([format ["getServerMapID:%1:%2", worldName, _env], 2] call extDB_Database_async) select 0; - if (_mapID == 0) then - { - [format ["insertServerMap:%1:%2", worldName, _env], 2] call extDB_Database_async; - - _mapID = ([format ["getServerMapID:%1:%2", worldName, _env], 2] call extDB_Database_async) select 0; - if (_mapID == 0) then - { - diag_log format ["[extDB] ### Unable to create ServerMap with WorldName '%1'", worldName]; - _return = false; - breakOut "extDB_envSetup"; - }; - }; - - A3W_extDB_MapID = compileFinal str _mapID; - _return = true; -}; - -if (!_return) exitWith -{ - diag_log "[extDB] ### ERROR - Startup aborted"; - false -}; - -diag_log "[extDB] Startup complete!"; -true diff --git a/persistence/server/world/default/deleteObjects.sqf b/persistence/server/world/default/deleteObjects.sqf deleted file mode 100644 index c114bd135..000000000 --- a/persistence/server/world/default/deleteObjects.sqf +++ /dev/null @@ -1,7 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: deleteObjects.sqf -// @file Author: AgentRev - -// placeholder for profileNamespace and iniDB, they don't possess the capability of deleting individual objects due to oSave constantly overwriting all values diff --git a/persistence/server/world/default/deleteVehicles.sqf b/persistence/server/world/default/deleteVehicles.sqf deleted file mode 100644 index 1c67009ab..000000000 --- a/persistence/server/world/default/deleteVehicles.sqf +++ /dev/null @@ -1,7 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: deleteVehicles.sqf -// @file Author: AgentRev - -// placeholder for profileNamespace and iniDB, they don't possess the capability of deleting individual vehicles due to oSave constantly overwriting all values diff --git a/persistence/server/world/default/getObjects.sqf b/persistence/server/world/default/getObjects.sqf deleted file mode 100644 index 063015415..000000000 --- a/persistence/server/world/default/getObjects.sqf +++ /dev/null @@ -1,54 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getObjects.sqf -// @file Author: AgentRev - -private ["_objFileName", "_exists", "_objCount", "_vars", "_objects", "_objData", "_objName", "_params", "_value"]; - -_objFileName = "Objects" call PDB_objectFileName; - -_exists = _objFileName call PDB_exists; // iniDB_exists -if (isNil "_exists" || {!_exists}) exitWith {[]}; - -_objCount = [_objFileName, "Info", "ObjCount", "NUMBER"] call PDB_read; // iniDB_read -if (isNil "_objCount" || {_objCount <= 0}) exitWith {[]}; - -// [key name, data type], oLoad variable name -_vars = -[ - [["Class", "STRING"], "_class"], - [["Position", "ARRAY"], "_pos"], - [["Direction", "ARRAY"], "_dir"], - [["HoursAlive", "NUMBER"], "_hoursAlive"], - [["HoursUnused", "NUMBER"], "_hoursUnused"], - [["Damage", "NUMBER"], "_damage"], - [["AllowDamage", "NUMBER"], "_allowDamage"], - [["Variables", "ARRAY"], "_variables"], - [["Weapons", "ARRAY"], "_weapons"], - [["Magazines", "ARRAY"], "_magazines"], - [["Items", "ARRAY"], "_items"], - [["Backpacks", "ARRAY"], "_backpacks"], - [["TurretMagazines", "ARRAY"], "_turretMags"], - [["AmmoCargo", "NUMBER"], "_ammoCargo"], - [["FuelCargo", "NUMBER"], "_fuelCargo"], - [["RepairCargo", "NUMBER"], "_repairCargo"] -]; - -_objects = []; - -for "_i" from 1 to _objCount do -{ - _objData = []; - _objName = format ["Obj%1", _i]; - - { - _params = _x select 0; - _value = [_objFileName, _objName, _params select 0, _params select 1] call PDB_read; - if (!isNil "_value") then { _objData pushBack [_x select 1, _value] }; - } forEach _vars; - - _objects pushBack _objData; -}; - -_objects diff --git a/persistence/server/world/default/getVehicles.sqf b/persistence/server/world/default/getVehicles.sqf deleted file mode 100644 index 24d5450a0..000000000 --- a/persistence/server/world/default/getVehicles.sqf +++ /dev/null @@ -1,58 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getVehicles.sqf -// @file Author: AgentRev - -private ["_vehFileName", "_exists", "_vehCount", "_vars", "_vehicles", "_vehData", "_vehName", "_params", "_value"]; - -_vehFileName = "Vehicles" call PDB_objectFileName; - -_exists = _vehFileName call PDB_exists; // iniDB_exists -if (isNil "_exists" || {!_exists}) exitWith {[]}; - -_vehCount = [_vehFileName, "Info", "VehCount", "NUMBER"] call PDB_read; // iniDB_read -if (isNil "_vehCount" || {_vehCount <= 0}) exitWith {[]}; - -// [key name, data type], vLoad variable name -_vars = -[ - [["Class", "STRING"], "_class"], - [["Position", "ARRAY"], "_pos"], - [["Direction", "ARRAY"], "_dir"], - [["HoursAlive", "NUMBER"], "_hoursAlive"], - [["HoursUnused", "NUMBER"], "_hoursUnused"], - [["Damage", "NUMBER"], "_damage"], - [["Fuel", "NUMBER"], "_fuel"], - [["HitPoints", "ARRAY"], "_hitPoints"], - [["Variables", "ARRAY"], "_variables"], - [["Textures", "ARRAY"], "_textures"], - [["Weapons", "ARRAY"], "_weapons"], - [["Magazines", "ARRAY"], "_magazines"], - [["Items", "ARRAY"], "_items"], - [["Backpacks", "ARRAY"], "_backpacks"], - [["TurretMagazines", "ARRAY"], "_turretMags"], - [["TurretMagazines2", "ARRAY"], "_turretMags2"], - [["TurretMagazines3", "ARRAY"], "_turretMags3"], - [["AmmoCargo", "NUMBER"], "_ammoCargo"], - [["FuelCargo", "NUMBER"], "_fuelCargo"], - [["RepairCargo", "NUMBER"], "_repairCargo"] -]; - -_vehicles = []; - -for "_i" from 1 to _vehCount do -{ - _vehData = []; - _vehName = format ["Veh%1", _i]; - - { - _params = _x select 0; - _value = [_vehFileName, _vehName, _params select 0, _params select 1] call PDB_read; - if (!isNil "_value") then { _vehData pushBack [_x select 1, _value] }; - } forEach _vars; - - _vehicles pushBack _vehData; -}; - -_vehicles diff --git a/persistence/server/world/default/getWarchestMoney.sqf b/persistence/server/world/default/getWarchestMoney.sqf deleted file mode 100644 index 9650147e2..000000000 --- a/persistence/server/world/default/getWarchestMoney.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getWarchestMoney.sqf -// @file Author: AgentRev - -private "_fileName"; -_fileName = "Objects" call PDB_objectFileName; - -[[_fileName, "Info", "WarchestMoneyBLUFOR", "NUMBER"] call PDB_read, [_fileName, "Info", "WarchestMoneyOPFOR", "NUMBER"] call PDB_read] diff --git a/persistence/server/world/default/postObjectSave.sqf b/persistence/server/world/default/postObjectSave.sqf deleted file mode 100644 index e6f7f28d2..000000000 --- a/persistence/server/world/default/postObjectSave.sqf +++ /dev/null @@ -1,28 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: postObjectSave.sqf -// @file Author: AgentRev - -private ["_objCount", "_oldObjCount", "_i"]; -_objCount = _this select 1; - -_fileName = "Objects" call PDB_objectFileName; -_oldObjCount = [_fileName, "Info", "ObjCount", "NUMBER"] call PDB_read; // iniDB_read - -[_fileName, "Info", "ObjCount", _objCount] call PDB_write; // iniDB_write - -// Reverse-delete old objects -if (_oldObjCount > _objCount) then -{ - for "_i" from _oldObjCount to (_objCount + 1) step -1 do - { - [_fileName, format ["Obj%1", _i], false] call PDB_deleteSection; // iniDB_deleteSection - }; -}; - -if (call A3W_savingMethod == "profile") then -{ - saveProfileNamespace; // this line is crucial to ensure all profileNamespace data submitted to the server is saved - diag_log "A3W - profileNamespace saved"; -}; diff --git a/persistence/server/world/default/postVehicleSave.sqf b/persistence/server/world/default/postVehicleSave.sqf deleted file mode 100644 index f56a12bdb..000000000 --- a/persistence/server/world/default/postVehicleSave.sqf +++ /dev/null @@ -1,28 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: postVehicleSave.sqf -// @file Author: AgentRev - -private ["_vehCount", "_oldVehCount", "_i"]; -_vehCount = _this select 1; - -_fileName = "Vehicles" call PDB_objectFileName; -_oldVehCount = [_fileName, "Info", "VehCount", "NUMBER"] call PDB_read; // iniDB_read - -[_fileName, "Info", "VehCount", _vehCount] call PDB_write; // iniDB_write - -// Reverse-delete old vehicles -if (_oldVehCount > _vehCount) then -{ - for "_i" from _oldVehCount to (_vehCount + 1) step -1 do - { - [_fileName, format ["Veh%1", _i], false] call PDB_deleteSection; // iniDB_deleteSection - }; -}; - -if (call A3W_savingMethod == "profile") then -{ - saveProfileNamespace; // this line is crucial to ensure all profileNamespace data submitted to the server is saved - diag_log "A3W - profileNamespace saved"; -}; diff --git a/persistence/server/world/default/saveObject.sqf b/persistence/server/world/default/saveObject.sqf deleted file mode 100644 index 1c49487af..000000000 --- a/persistence/server/world/default/saveObject.sqf +++ /dev/null @@ -1,33 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveObject.sqf -// @file Author: AgentRev - -private ["_obj", "_objCount", "_spawningTime", "_hoursAlive", "_props", "_fileName", "_objName"]; -_obj = _this select 0; -_objCount = if (count _this > 1) then { _this select 1 } else { nil }; - -if (!alive _obj || isNil "_objCount") exitWith {nil}; // profileNamespace and iniDB require sequential _objCount to save properly - -_spawningTime = _obj getVariable "baseSaving_spawningTime"; - -if (isNil "_spawningTime") then -{ - _spawningTime = diag_tickTime; - _obj setVariable ["baseSaving_spawningTime", _spawningTime]; -}; - -_hoursAlive = (_obj getVariable ["baseSaving_hoursAlive", 0]) + ((diag_tickTime - _spawningTime) / 3600); - -_props = [_obj] call fn_getObjectProperties; -_props pushBack ["HoursAlive", _hoursAlive]; - -_fileName = "Objects" call PDB_objectFileName; -_objName = format ["Obj%1", _objCount]; - -{ - [_fileName, _objName, _x select 0, _x select 1, false] call PDB_write; // iniDB_write -} forEach _props; - -nil diff --git a/persistence/server/world/default/saveVehicle.sqf b/persistence/server/world/default/saveVehicle.sqf deleted file mode 100644 index a597ab86f..000000000 --- a/persistence/server/world/default/saveVehicle.sqf +++ /dev/null @@ -1,44 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveVehicle.sqf -// @file Author: AgentRev - -private ["_veh", "_vehCount", "_spawningTime", "_lastUse", "_hoursAlive", "_hoursUnused", "_props", "_fileName", "_vehName"]; -_veh = _this select 0; -_vehCount = if (count _this > 1) then { _this select 1 } else { nil }; - -if (!alive _veh || isNil "_vehCount") exitWith {nil}; // profileNamespace and iniDB require sequential _vehCount to save properly - -_spawningTime = _veh getVariable "vehSaving_spawningTime"; - -if (isNil "_spawningTime") then -{ - _spawningTime = diag_tickTime; - _veh setVariable ["vehSaving_spawningTime", _spawningTime]; -}; - -_lastUse = _veh getVariable ["vehSaving_lastUse", _spawningTime]; - -if ({isPlayer _x} count crew _veh > 0 || isPlayer ((uavControl _veh) select 0)) then -{ - _lastUse = diag_tickTime; - _veh setVariable ["vehSaving_lastUse", _lastUse]; - _veh setVariable ["vehSaving_hoursUnused", 0]; -}; - -_hoursAlive = (_veh getVariable ["vehSaving_hoursAlive", 0]) + ((diag_tickTime - _spawningTime) / 3600); -_hoursUnused = (_veh getVariable ["vehSaving_hoursUnused", 0]) + ((diag_tickTime - _lastUse) / 3600); - -_props = [_veh] call fn_getVehicleProperties; -_props pushBack ["HoursAlive", _hoursAlive]; -_props pushBack ["HoursUnused", _hoursUnused]; - -_fileName = "Vehicles" call PDB_objectFileName; -_vehName = format ["Veh%1", _vehCount]; - -{ - [_fileName, _vehName, _x select 0, _x select 1, false] call PDB_write; // iniDB_write -} forEach _props; - -nil diff --git a/persistence/server/world/default/saveWarchestMoney.sqf b/persistence/server/world/default/saveWarchestMoney.sqf deleted file mode 100644 index 1146d93af..000000000 --- a/persistence/server/world/default/saveWarchestMoney.sqf +++ /dev/null @@ -1,21 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveWarchestMoney.sqf -// @file Author: AgentRev - -private ["_fundsWest", "_fundsEast", "_fileName"]; - -_fundsWest = 0; -_fundsEast = 0; - -if (["A3W_warchestMoneySaving"] call isConfigOn) then -{ - _fundsWest = ["pvar_warchest_funds_west", 0] call getPublicVar; - _fundsEast = ["pvar_warchest_funds_east", 0] call getPublicVar; -}; - -_fileName = "Objects" call PDB_objectFileName; - -[_fileName, "Info", "WarchestMoneyBLUFOR", _fundsWest] call PDB_write; // iniDB_write -[_fileName, "Info", "WarchestMoneyOPFOR", _fundsEast] call PDB_write; // iniDB_write diff --git a/persistence/server/world/extDB/deleteObjects.sqf b/persistence/server/world/extDB/deleteObjects.sqf deleted file mode 100644 index 9b9954742..000000000 --- a/persistence/server/world/extDB/deleteObjects.sqf +++ /dev/null @@ -1,32 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: deleteObjects.sqf -// @file Author: AgentRev - -private ["_objects", "_values", "_id"]; -_objects = _this; - -_values = ""; - -{ - if (typeName _x == "OBJECT") then - { - _id = _x getVariable "A3W_objectID"; - _x setVariable ["A3W_objectID", nil]; - } - else - { - _id = _x; - }; - - if (!isNil "_id") then - { - _values = _values + ((if (_values != "") then { "," } else { "" }) + str _id); - }; -} forEach _objects; - -if (_values != "") then -{ - ["deleteServerObjects:" + _values] call extDB_Database_async; -}; diff --git a/persistence/server/world/extDB/deleteVehicles.sqf b/persistence/server/world/extDB/deleteVehicles.sqf deleted file mode 100644 index 31468e034..000000000 --- a/persistence/server/world/extDB/deleteVehicles.sqf +++ /dev/null @@ -1,32 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: deleteVehicles.sqf -// @file Author: AgentRev - -private ["_vehicles", "_values", "_id"]; -_vehicles = _this; - -_values = ""; - -{ - if (typeName _x == "OBJECT") then - { - _id = _x getVariable "A3W_vehicleID"; - _x setVariable ["A3W_vehicleID", nil]; - } - else - { - _id = _x; - }; - - if (!isNil "_id") then - { - _values = _values + ((if (_values != "") then { "," } else { "" }) + str _id); - }; -} forEach _vehicles; - -if (_values != "") then -{ - ["deleteServerVehicles:" + _values] call extDB_Database_async; -}; diff --git a/persistence/server/world/extDB/getObjects.sqf b/persistence/server/world/extDB/getObjects.sqf deleted file mode 100644 index b71455638..000000000 --- a/persistence/server/world/extDB/getObjects.sqf +++ /dev/null @@ -1,61 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getObjects.sqf -// @file Author: AgentRev - -private ["_maxLifetime", "_saveUnlockedObjects", "_vars", "_columns", "_result", "_objects", "_objData"]; - -_maxLifetime = ["A3W_objectLifetime", 0] call getPublicVar; -_saveUnlockedObjects = ["A3W_extDB_SaveUnlockedObjects", 0] call getPublicVar; - -if (_maxLifetime > 0 || _saveUnlockedObjects <= 0) then -{ - [format ["deleteExpiredServerObjects:%1:%2:%3:%4", call A3W_extDB_ServerID, call A3W_extDB_MapID, _maxLifetime, _saveUnlockedObjects], 2] call extDB_Database_async; -}; - -// DB column name, oLoad variable name -_vars = -[ - ["ID", "_objectID"], - ["Class", "_class"], - ["Position", "_pos"], - ["Direction", "_dir"], - ["Locked", "_locked"], - ["Damage", "_damage"], - ["AllowDamage", "_allowDamage"], - ["Variables", "_variables"], - ["Weapons", "_weapons"], - ["Magazines", "_magazines"], - ["Items", "_items"], - ["Backpacks", "_backpacks"], - ["TurretMagazines", "_turretMags"], - ["AmmoCargo", "_ammoCargo"], - ["FuelCargo", "_fuelCargo"], - ["RepairCargo", "_repairCargo"] -]; - -_columns = ""; - -{ - _columns = _columns + ((if (_columns != "") then { "," } else { "" }) + (_x select 0)); -} forEach _vars; - -_result = [format ["getServerObjects:%1:%2:%3", call A3W_extDB_ServerID, call A3W_extDB_MapID, _columns], 2, true] call extDB_Database_async; - -_objects = []; - -{ - _objData = []; - - { - if (!isNil "_x") then - { - _objData pushBack [(_vars select _forEachIndex) select 1, _x]; - }; - } forEach _x; - - _objects pushBack _objData; -} forEach _result; - -_objects diff --git a/persistence/server/world/extDB/getVehicles.sqf b/persistence/server/world/extDB/getVehicles.sqf deleted file mode 100644 index ad8bbefa1..000000000 --- a/persistence/server/world/extDB/getVehicles.sqf +++ /dev/null @@ -1,66 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getVehicles.sqf -// @file Author: AgentRev - -private ["_maxLifetime", "_maxUnusedTime", "_vars", "_columns", "_result", "_vehicles", "_vehData"]; - -_maxLifetime = ["A3W_vehicleLifetime", 0] call getPublicVar; -_maxUnusedTime = ["A3W_vehicleMaxUnusedTime", 0] call getPublicVar; - -if (_maxLifetime > 0 || _maxUnusedTime > 0) then -{ - [format ["deleteExpiredServerVehicles:%1:%2:%3:%4", call A3W_extDB_ServerID, call A3W_extDB_MapID, _maxLifetime, _maxUnusedTime], 2] call extDB_Database_async; -}; - -// DB column name, vLoad variable name -_vars = -[ - ["ID", "_vehicleID"], - ["Class", "_class"], - ["Position", "_pos"], - ["Direction", "_dir"], - ["Velocity", "_vel"], - ["Flying", "_flying"], - ["Damage", "_damage"], - ["Fuel", "_fuel"], - ["HitPoints", "_hitPoints"], - ["Variables", "_variables"], - ["Textures", "_textures"], - ["Weapons", "_weapons"], - ["Magazines", "_magazines"], - ["Items", "_items"], - ["Backpacks", "_backpacks"], - ["TurretMagazines", "_turretMags"], - ["TurretMagazines2", "_turretMags2"], - ["TurretMagazines3", "_turretMags3"], - ["AmmoCargo", "_ammoCargo"], - ["FuelCargo", "_fuelCargo"], - ["RepairCargo", "_repairCargo"] -]; - -_columns = ""; - -{ - _columns = _columns + ((if (_columns != "") then { "," } else { "" }) + (_x select 0)); -} forEach _vars; - -_result = [format ["getServerVehicles:%1:%2:%3", call A3W_extDB_ServerID, call A3W_extDB_MapID, _columns], 2, true] call extDB_Database_async; - -_vehicles = []; - -{ - _vehData = []; - - { - if (!isNil "_x") then - { - _vehData pushBack [(_vars select _forEachIndex) select 1, _x]; - }; - } forEach _x; - - _vehicles pushBack _vehData; -} forEach _result; - -_vehicles diff --git a/persistence/server/world/extDB/getWarchestMoney.sqf b/persistence/server/world/extDB/getWarchestMoney.sqf deleted file mode 100644 index fd8c834de..000000000 --- a/persistence/server/world/extDB/getWarchestMoney.sqf +++ /dev/null @@ -1,7 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: getWarchestMoney.sqf -// @file Author: AgentRev - -[format ["getWarchestMoney:%1", call A3W_extDB_ServerID], 2] call extDB_Database_async diff --git a/persistence/server/world/extDB/postObjectSave.sqf b/persistence/server/world/extDB/postObjectSave.sqf deleted file mode 100644 index d867f339f..000000000 --- a/persistence/server/world/extDB/postObjectSave.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: postObjectSave.sqf -// @file Author: AgentRev - -private "_oldObjectIDs"; -_oldObjectIDs = _this select 0; - -_oldObjectIDs call fn_deleteObjects; diff --git a/persistence/server/world/extDB/postVehicleSave.sqf b/persistence/server/world/extDB/postVehicleSave.sqf deleted file mode 100644 index 8308bb62e..000000000 --- a/persistence/server/world/extDB/postVehicleSave.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: postVehicleSave.sqf -// @file Author: AgentRev - -private "_oldVehicleIDs"; -_oldVehicleIDs = _this select 0; - -_oldVehicleIDs call fn_deleteVehicles; diff --git a/persistence/server/world/extDB/saveObject.sqf b/persistence/server/world/extDB/saveObject.sqf deleted file mode 100644 index 7333cc1fc..000000000 --- a/persistence/server/world/extDB/saveObject.sqf +++ /dev/null @@ -1,39 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveObject.sqf -// @file Author: AgentRev - -#define FILTERED_CHARS [39,58] // single quote, colon - -private ["_obj", "_manual", "_objectID", "_updateValues", "_locked", "_deployable"]; -_obj = _this select 0; -_manual = if (count _this > 2) then { _this select 2 } else { false }; - -_objectID = _obj getVariable "A3W_objectID"; - -if (!alive _obj) exitWith {nil}; - -if (isNil "_objectID") then -{ - _objectID = ([format ["newServerObject:%1:%2", call A3W_extDB_ServerID, call A3W_extDB_MapID], 2] call extDB_Database_async) select 0; - _obj setVariable ["A3W_objectID", _objectID, true]; - A3W_objectIDs pushBack _objectID; -}; - -_updateValues = [[_obj] call fn_getObjectProperties, 0] call extDB_pairsToSQL; - -_locked = _obj getVariable ["objectLocked", false]; -_deployable = (_obj getVariable ["a3w_spawnBeacon", false] || _obj getVariable ["a3w_warchest", false]); - -_updateValues = _updateValues + (",Locked=" + (if (_locked) then { "1" } else { "0" })); -_updateValues = _updateValues + (",Deployable=" + (if (_deployable) then { "1" } else { "0" })); - -if (_manual) then -{ - _updateValues = _updateValues + ",LastInteraction=NOW()"; -}; - -[format ["updateServerObject:%1:", _objectID] + _updateValues] call extDB_Database_async; - -_objectID diff --git a/persistence/server/world/extDB/saveVehicle.sqf b/persistence/server/world/extDB/saveVehicle.sqf deleted file mode 100644 index 919a7d5f7..000000000 --- a/persistence/server/world/extDB/saveVehicle.sqf +++ /dev/null @@ -1,52 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveVehicle.sqf -// @file Author: AgentRev - -#define FILTERED_CHARS [39,58] // single quote, colon - -private ["_veh", "_vehicleID", "_spawningTime", "_lastUse", "_flying", "_updateValues"]; -_veh = _this select 0; - -_vehicleID = _veh getVariable "A3W_vehicleID"; - -if (!alive _veh) exitWith {nil}; - -if (isNil "_vehicleID") then -{ - _vehicleID = ([format ["newServerVehicle:%1:%2", call A3W_extDB_ServerID, call A3W_extDB_MapID], 2] call extDB_Database_async) select 0; - _veh setVariable ["A3W_vehicleID", _vehicleID, true]; - A3W_vehicleIDs pushBack _vehicleID; -}; - -_spawningTime = _veh getVariable "vehSaving_spawningTime"; - -if (isNil "_spawningTime") then -{ - _spawningTime = diag_tickTime; - _veh setVariable ["vehSaving_spawningTime", _spawningTime]; -}; - -_lastUse = _veh getVariable ["vehSaving_lastUse", _spawningTime]; - -_flying = (!isTouchingGround _veh && (getPos _veh) select 2 > 1); - -_updateValues = [[_veh, _flying] call fn_getVehicleProperties, 0] call extDB_pairsToSQL; -_updateValues = _updateValues + (",Flying=" + (if (_flying) then { "1" } else { "0" })); - -if ({isPlayer _x} count crew _veh > 0 || isPlayer ((uavControl _veh) select 0)) then -{ - _lastUse = diag_tickTime; - _veh setVariable ["vehSaving_lastUse", _lastUse]; -}; - -if (_lastUse > _veh getVariable ["vehSaving_lastUseSave", _spawningTime]) then -{ - _updateValues = _updateValues + ",LastUsed=NOW()"; - _veh setVariable ["vehSaving_lastUseSave", diag_tickTime]; -}; - -[format ["updateServerVehicle:%1:", _vehicleID] + _updateValues] call extDB_Database_async; - -_vehicleID diff --git a/persistence/server/world/extDB/saveWarchestMoney.sqf b/persistence/server/world/extDB/saveWarchestMoney.sqf deleted file mode 100644 index dd51abd56..000000000 --- a/persistence/server/world/extDB/saveWarchestMoney.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: saveWarchestMoney.sqf -// @file Author: AgentRev - -private ["_fundsWest", "_fundsEast"]; - -_fundsWest = 0; -_fundsEast = 0; - -if (["A3W_warchestMoneySaving"] call isConfigOn) then -{ - _fundsWest = ["pvar_warchest_funds_west", 0] call getPublicVar; - _fundsEast = ["pvar_warchest_funds_east", 0] call getPublicVar; -}; - -[format ["updateWarchestMoney:%1:%2:%3", call A3W_extDB_ServerID, _fundsWest, _fundsEast]] call extDB_Database_async; diff --git a/persistence/server/world/fn_getObjectProperties.sqf b/persistence/server/world/fn_getObjectProperties.sqf deleted file mode 100644 index cbac085d6..000000000 --- a/persistence/server/world/fn_getObjectProperties.sqf +++ /dev/null @@ -1,119 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_getObjectProperties.sqf -// @file Author: AgentRev - -#include "functions.sqf" - -private ["_obj", "_class", "_pos", "_dir", "_damage", "_allowDamage", "_variables", "_owner", "_weapons", "_magazines", "_items", "_backpacks", "_turretMags", "_ammoCargo", "_fuelCargo", "_repairCargo"]; -_obj = _this select 0; - -_class = typeOf _obj; - -_pos = ASLtoATL getPosWorld _obj; -{ _pos set [_forEachIndex, _x call fn_numToStr] } forEach _pos; -_dir = [vectorDir _obj, vectorUp _obj]; -_damage = damage _obj; -_allowDamage = if (_obj getVariable ["allowDamage", false]) then { 1 } else { 0 }; - -_variables = []; - -switch (true) do -{ - case (_obj isKindOf "Land_Sacks_goods_F"): - { - _variables pushBack ["food", _obj getVariable ["food", 20]]; - }; - case (_obj isKindOf "Land_BarrelWater_F"): - { - _variables pushBack ["water", _obj getVariable ["water", 20]]; - }; -}; - -_owner = _obj getVariable ["ownerUID", ""]; - -if (_owner != "") then -{ - _variables pushBack ["ownerUID", _owner]; -}; - -switch (true) do -{ - case (_obj call _isBox): - { - _variables pushBack ["cmoney", _obj getVariable ["cmoney", 0]]; - }; - case (_obj call _isWarchest): - { - _variables pushBack ["a3w_warchest", true]; - _variables pushBack ["R3F_LOG_disabled", true]; - _variables pushBack ["side", str (_obj getVariable ["side", sideUnknown])]; - }; - case (_obj call _isBeacon): - { - _variables pushBack ["a3w_spawnBeacon", true]; - _variables pushBack ["R3F_LOG_disabled", true]; - _variables pushBack ["side", str (_obj getVariable ["side", sideUnknown])]; - _variables pushBack ["packing", false]; - _variables pushBack ["groupOnly", _obj getVariable ["groupOnly", false]]; - _variables pushBack ["ownerName", toArray (_obj getVariable ["ownerName", "[Beacon]"])]; - }; -}; - -_r3fSide = _obj getVariable "R3F_Side"; - -if (!isNil "_r3fSide") then -{ - _variables pushBack ["R3F_Side", str _r3fSide]; -}; - -_weapons = []; -_magazines = []; -_items = []; -_backpacks = []; - -if (_class call fn_hasInventory) then -{ - // Save weapons & ammo - _weapons = (getWeaponCargo _obj) call cargoToPairs; - _magazines = (getMagazineCargo _obj) call cargoToPairs; - _items = (getItemCargo _obj) call cargoToPairs; - _backpacks = (getBackpackCargo _obj) call cargoToPairs; -}; - -_turretMags = []; - -if (_staticWeaponSavingOn && {_class call _isStaticWeapon}) then -{ - _turretMags = magazinesAmmo _obj; -}; - -_ammoCargo = getAmmoCargo _obj; -_fuelCargo = getFuelCargo _obj; -_repairCargo = getRepairCargo _obj; - -// Fix for -1.#IND -if (isNil "_ammoCargo" || {!finite _ammoCargo}) then { _ammoCargo = 0 }; -if (isNil "_fuelCargo" || {!finite _fuelCargo}) then { _fuelCargo = 0 }; -if (isNil "_repairCargo" || {!finite _repairCargo}) then { _repairCargo = 0 }; - -[ - ["Class", _class], - ["Position", _pos], - ["Direction", _dir], - ["Damage", _damage], - ["AllowDamage", _allowDamage], - ["Variables", _variables], - - ["Weapons", _weapons], - ["Magazines", _magazines], - ["Items", _items], - ["Backpacks", _backpacks], - - ["TurretMagazines", _turretMags], - - ["AmmoCargo", _ammoCargo], - ["FuelCargo", _fuelCargo], - ["RepairCargo", _repairCargo] -] diff --git a/persistence/server/world/fn_getVehicleProperties.sqf b/persistence/server/world/fn_getVehicleProperties.sqf deleted file mode 100644 index 754ef8b12..000000000 --- a/persistence/server/world/fn_getVehicleProperties.sqf +++ /dev/null @@ -1,173 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_getVehicleProperties.sqf -// @file Author: AgentRev - -private ["_veh", "_flying", "_class", "_purchasedVehicle", "_missionVehicle", "_pos", "_dir", "_vel", "_fuel", "_damage", "_hitPoints", "_variables", "_owner", "_doubleBSlash", "_textures", "_tex", "_texArr", "_weapons", "_magazines", "_items", "_backpacks", "_turretMags", "_turretMags2", "_turretMags3", "_hasDoorGuns", "_turrets", "_path", "_ammoCargo", "_fuelCargo", "_repairCargo", "_props"]; - -_veh = _this select 0; -_flying = if (count _this > 1) then { _this select 1 } else { false }; - -_class = typeOf _veh; -_purchasedVehicle = _veh getVariable ["A3W_purchasedVehicle", false]; -_missionVehicle = (_veh getVariable ["A3W_missionVehicle", false] && !(_veh getVariable ["R3F_LOG_disabled", false])); - -_pos = ASLtoATL getPosWorld _veh; -{ _pos set [_forEachIndex, _x call fn_numToStr] } forEach _pos; -_dir = [vectorDir _veh, vectorUp _veh]; -_vel = velocity _veh; -_fuel = fuel _veh; -_damage = damage _veh; -_hitPoints = []; - -{ - _hitPoint = configName _x; - _hitPoints set [count _hitPoints, [_hitPoint, _veh getHitPointDamage _hitPoint]]; -} forEach (_class call getHitPoints); - -_variables = []; - -_owner = _veh getVariable ["ownerUID", ""]; - -if !(_owner in ["","0"]) then -{ - _variables pushBack ["ownerUID", _owner]; -}; - -switch (true) do -{ - case _purchasedVehicle: - { - _variables pushBack ["A3W_purchasedVehicle", true]; - }; - case _missionVehicle: - { - _variables pushBack ["A3W_missionVehicle", true]; - }; -}; - -_doubleBSlash = (call A3W_savingMethod == "extDB"); - -_textures = []; -{ - _tex = _x select 1; - - if (_doubleBSlash) then - { - _texArr = []; - - { - _texArr pushBack _x; - - if (_x == 92) then // backslash - { - _texArr pushBack 92; // double it - }; - } forEach toArray _tex; - - _tex = toString _texArr; - }; - - [_textures, _tex, [_x select 0]] call fn_addToPairs; -} forEach (_veh getVariable ["A3W_objectTextures", []]); - -_weapons = []; -_magazines = []; -_items = []; -_backpacks = []; - -if (_class call fn_hasInventory) then -{ - // Save weapons & ammo - _weapons = (getWeaponCargo _veh) call cargoToPairs; - _magazines = _veh call fn_magazineAmmoCargo; - _items = (getItemCargo _veh) call cargoToPairs; - _backpacks = (getBackpackCargo _veh) call cargoToPairs; -}; - -_turretMags = magazinesAmmo _veh; -_turretMags2 = []; -_turretMags3 = []; -_hasDoorGuns = isClass (configFile >> "CfgVehicles" >> _class >> "Turrets" >> "RightDoorGun"); - -_turrets = allTurrets [_veh, false]; - -if !(_class isKindOf "B_Heli_Transport_03_unarmed_F") then -{ - _turrets = [[-1]] + _turrets; // only add driver turret if not unarmed Huron, otherwise flares get saved twice -}; - -if (_hasDoorGuns) then -{ - // remove left door turret, because its mags are already returned by magazinesAmmo - { - if (_x isEqualTo [1]) exitWith - { - _turrets set [_forEachIndex, 1]; - }; - } forEach _turrets; - - _turrets = _turrets - [1]; -}; - -{ - _path = _x; - - { - if ([_turretMags, _x, -1] call fn_getFromPairs == -1 || _hasDoorGuns) then - { - if (_veh currentMagazineTurret _path == _x && {count _turretMags3 == 0}) then - { - _turretMags3 pushBack [_x, _path, [_veh currentMagazineDetailTurret _path] call getMagazineDetailAmmo]; - } - else - { - _turretMags2 pushBack [_x, _path]; - }; - }; - } forEach (_veh magazinesTurret _path); -} forEach _turrets; - -_ammoCargo = getAmmoCargo _veh; -_fuelCargo = getFuelCargo _veh; -_repairCargo = getRepairCargo _veh; - -// Fix for -1.#IND -if (isNil "_ammoCargo" || {!finite _ammoCargo}) then { _ammoCargo = 0 }; -if (isNil "_fuelCargo" || {!finite _fuelCargo}) then { _fuelCargo = 0 }; -if (isNil "_repairCargo" || {!finite _repairCargo}) then { _repairCargo = 0 }; - -_props = -[ - ["Class", _class], - ["Position", _pos], - ["Direction", _dir], - ["Velocity", _vel], - ["Fuel", _fuel], - ["Damage", _damage], - ["HitPoints", _hitPoints], - ["Variables", _variables], - ["Textures", _textures], - - ["Weapons", _weapons], - ["Magazines", _magazines], - ["Items", _items], - ["Backpacks", _backpacks], - - ["TurretMagazines", _turretMags], - ["TurretMagazines2", _turretMags2], - ["TurretMagazines3", _turretMags3], - - ["AmmoCargo", _ammoCargo], - ["FuelCargo", _fuelCargo], - ["RepairCargo", _repairCargo] -]; - -// If flying and not UAV, do not save current pos/dir/vel -if (_flying && {getNumber (configFile >> "CfgVehicles" >> _class >> "isUav") <= 0}) then -{ - _props deleteRange [1,3]; -}; - -_props diff --git a/persistence/server/world/fn_hasInventory.sqf b/persistence/server/world/fn_hasInventory.sqf deleted file mode 100644 index da35467bc..000000000 --- a/persistence/server/world/fn_hasInventory.sqf +++ /dev/null @@ -1,14 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_hasInventory.sqf -// @file Author: AgentRev - -private ["_vehClass", "_vehCfg"]; -_vehClass = if (typeName _this == "OBJECT") then { typeOf _this } else { _this }; -_vehCfg = configFile >> "CfgVehicles" >> _vehClass; - -(isClass _vehCfg && -{getNumber (_vehCfg >> "transportMaxWeapons") > 0 || - getNumber (_vehCfg >> "transportMaxMagazines") > 0 || - getNumber (_vehCfg >> "transportMaxBackpacks") > 0}) diff --git a/persistence/server/world/fn_isObjectSaveable.sqf b/persistence/server/world/fn_isObjectSaveable.sqf deleted file mode 100644 index 0adff0461..000000000 --- a/persistence/server/world/fn_isObjectSaveable.sqf +++ /dev/null @@ -1,19 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_isObjectSaveable.sqf -// @file Author: AgentRev - -private ["_obj", "_class"]; -_obj = _this; -_class = typeOf _obj; - -#include "functions.sqf" - -(alive _obj && -{((_obj getVariable ["objectLocked", false] || {!isNil {_obj getVariable "A3W_objectID"} && _savingMethod == "extDB"}) && - {(_baseSavingOn && {_class call _isSaveable}) || - (_boxSavingOn && {_class call _isBox}) || - (_staticWeaponSavingOn && {_class call _isStaticWeapon})}) || -{_warchestSavingOn && {_obj call _isWarchest}} || -{_beaconSavingOn && {_obj call _isBeacon}}}) diff --git a/persistence/server/world/fn_isVehicleSaveable.sqf b/persistence/server/world/fn_isVehicleSaveable.sqf deleted file mode 100644 index 026149dcf..000000000 --- a/persistence/server/world/fn_isVehicleSaveable.sqf +++ /dev/null @@ -1,13 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_isVehicleSaveable.sqf -// @file Author: AgentRev - -private "_veh"; -_veh = _this; - -(alive _veh && {_veh isKindOf "AllVehicles" && !(_veh isKindOf "Man" || _veh isKindOf "StaticWeapon") && -((isTouchingGround _veh || (getPos _veh) select 2 <= 1) || call A3W_savingMethodDir != "default") && -{(_veh getVariable ["A3W_purchasedVehicle", false] && ["A3W_purchasedVehicleSaving"] call isConfigOn) || -((_veh getVariable ["A3W_missionVehicle", false] && !(_veh getVariable ["R3F_LOG_disabled", false]) && ["A3W_missionVehicleSaving"] call isConfigOn))}}) diff --git a/persistence/server/world/fn_manualObjectDelete.sqf b/persistence/server/world/fn_manualObjectDelete.sqf deleted file mode 100644 index a751f0b2c..000000000 --- a/persistence/server/world/fn_manualObjectDelete.sqf +++ /dev/null @@ -1,22 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_manualObjectDelete.sqf -// @file Author: AgentRev - -private ["_obj", "_id"]; - -_obj = _this select 0; -_id = _this select 1; - -if (typeName _obj == "STRING") then { _obj = objectFromNetId _obj }; - -if (!isNil "_id") then -{ - [_id] call fn_deleteObjects; -}; - -if (!isNull _obj) then -{ - deleteVehicle _obj; -}; diff --git a/persistence/server/world/fn_manualObjectSave.sqf b/persistence/server/world/fn_manualObjectSave.sqf deleted file mode 100644 index 0b042e5fc..000000000 --- a/persistence/server/world/fn_manualObjectSave.sqf +++ /dev/null @@ -1,22 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_manualObjectSave.sqf -// @file Author: AgentRev - -#define MANUAL_OBJ_SAVE_COOLDOWN 5 - -private "_obj"; -_obj = _this; - -if (typeName _obj == "STRING") then { _obj = objectFromNetId _obj }; - -if (diag_tickTime - (_obj getVariable ["objSaving_lastSave", 0]) > MANUAL_OBJ_SAVE_COOLDOWN) then -{ - if (_obj call fn_isObjectSaveable && call A3W_savingMethod == "extDB") then - { - [_obj, nil, true] spawn fn_saveObject; - }; - - _obj setVariable ["objSaving_lastSave", diag_tickTime]; -}; diff --git a/persistence/server/world/fn_manualVehicleDelete.sqf b/persistence/server/world/fn_manualVehicleDelete.sqf deleted file mode 100644 index 077fa9655..000000000 --- a/persistence/server/world/fn_manualVehicleDelete.sqf +++ /dev/null @@ -1,22 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_manualVehicleDelete.sqf -// @file Author: AgentRev - -private ["_veh", "_id"]; - -_veh = _this select 0; -_id = _this select 1; - -if (typeName _veh == "STRING") then { _veh = objectFromNetId _veh }; - -if (!isNil "_id") then -{ - [_id] call fn_deleteVehicles; -}; - -if (!isNull _veh) then -{ - deleteVehicle _veh; -}; diff --git a/persistence/server/world/fn_manualVehicleSave.sqf b/persistence/server/world/fn_manualVehicleSave.sqf deleted file mode 100644 index 8725b4d72..000000000 --- a/persistence/server/world/fn_manualVehicleSave.sqf +++ /dev/null @@ -1,24 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: fn_manualVehicleSave.sqf -// @file Author: AgentRev - -#define MANUAL_VEH_SAVE_COOLDOWN 5 - -private "_veh"; -_veh = _this; - -if (typeName _veh == "STRING") then { _veh = objectFromNetId _veh }; - -if (diag_tickTime - (_veh getVariable ["vehSaving_lastSave", 0]) > MANUAL_VEH_SAVE_COOLDOWN) then -{ - _veh setVariable ["vehSaving_lastUse", diag_tickTime]; - - if (_veh call fn_isVehicleSaveable && call A3W_savingMethod == "extDB") then - { - [_veh] spawn fn_saveVehicle; - }; - - _veh setVariable ["vehSaving_lastSave", diag_tickTime]; -}; diff --git a/persistence/server/world/functions.sqf b/persistence/server/world/functions.sqf deleted file mode 100644 index 02c02cbb9..000000000 --- a/persistence/server/world/functions.sqf +++ /dev/null @@ -1,28 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: functions.sqf -// @file Author: AgentRev - -private ["_baseSavingOn", "_boxSavingOn", "_staticWeaponSavingOn", "_warchestSavingOn", "_warchestMoneySavingOn", "_beaconSavingOn", "_savingMethod", "_isBox", "_isStaticWeapon", "_isWarchest", "_isBeacon"]; - -_baseSavingOn = ["A3W_baseSaving"] call isConfigOn; -_boxSavingOn = ["A3W_boxSaving"] call isConfigOn; -_staticWeaponSavingOn = ["A3W_staticWeaponSaving"] call isConfigOn; -_warchestSavingOn = ["A3W_warchestSaving"] call isConfigOn; -_warchestMoneySavingOn = ["A3W_warchestMoneySaving"] call isConfigOn; -_beaconSavingOn = ["A3W_spawnBeaconSaving"] call isConfigOn; - -_savingMethod = call A3W_savingMethod; - -_isBox = { _this isKindOf "ReammoBox_F" }; -_isStaticWeapon = { _this isKindOf "StaticWeapon" }; -_isWarchest = { _this getVariable ["a3w_warchest", false] && {(_this getVariable ["side", sideUnknown]) in [WEST,EAST]} }; -_isBeacon = { _this getVariable ["a3w_spawnBeacon", false] }; - -_isSaveable = -{ - _result = false; - { if (_this == _x) exitWith { _result = true } } forEach A3W_saveableObjects; - _result -}; diff --git a/persistence/server/world/oLoad.sqf b/persistence/server/world/oLoad.sqf deleted file mode 100644 index 3e5932ae3..000000000 --- a/persistence/server/world/oLoad.sqf +++ /dev/null @@ -1,207 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: oLoad.sqf -// @file Author: AgentRev, JoSchaap, Austerror - -#include "functions.sqf" - -private ["_strToSide", "_maxLifetime", "_isWarchestEntry", "_isBeaconEntry", "_worldDir", "_methodDir", "_objCount", "_objects", "_exclObjectIDs"]; - -_strToSide = -{ - switch (toUpper _this) do - { - case "WEST": { BLUFOR }; - case "EAST": { OPFOR }; - case "GUER": { INDEPENDENT }; - case "CIV": { CIVILIAN }; - case "LOGIC": { sideLogic }; - default { sideUnknown }; - }; -}; - -_maxLifetime = ["A3W_objectLifetime", 0] call getPublicVar; - -_isWarchestEntry = { [_variables, "a3w_warchest", false] call fn_getFromPairs }; -_isBeaconEntry = { [_variables, "a3w_spawnBeacon", false] call fn_getFromPairs }; - -_worldDir = "persistence\server\world"; -_methodDir = format ["%1\%2", _worldDir, call A3W_savingMethodDir]; - -_objCount = 0; -_objects = call compile preprocessFileLineNumbers format ["%1\getObjects.sqf", _methodDir]; - -_exclObjectIDs = []; - -{ - private ["_allowed", "_obj", "_objectID", "_class", "_pos", "_dir", "_locked", "_damage", "_allowDamage", "_variables", "_weapons", "_magazines", "_items", "_backpacks", "_turretMags", "_ammoCargo", "_fuelCargo", "_repairCargo", "_hoursAlive", "_valid"]; - - { (_x select 1) call compile format ["%1 = _this", _x select 0] } forEach _x; - - if (isNil "_locked") then { _locked = 1 }; - if (isNil "_hoursAlive") then { _hoursAlive = 0 }; - _valid = false; - - if (!isNil "_class" && !isNil "_pos" && {_maxLifetime <= 0 || _hoursAlive < _maxLifetime}) then - { - if (isNil "_variables") then { _variables = [] }; - - _allowed = switch (true) do - { - case (call _isWarchestEntry): { _warchestSavingOn }; - case (call _isBeaconEntry): { _beaconSavingOn }; - case (_class call _isBox): { _boxSavingOn }; - case (_class call _isStaticWeapon): { _staticWeaponSavingOn }; - default { _baseSavingOn }; - }; - - if (!_allowed) exitWith {}; - - _objCount = _objCount + 1; - _valid = true; - - { if (typeName _x == "STRING") then { _pos set [_forEachIndex, parseNumber _x] } } forEach _pos; - - _obj = createVehicle [_class, _pos, [], 0, "None"]; - _obj setPosWorld ATLtoASL _pos; - - if (!isNil "_dir") then - { - _obj setVectorDirAndUp _dir; - }; - - [_obj] call vehicleSetup; - [_obj] call basePartSetup; - - if (!isNil "_objectID") then - { - _obj setVariable ["A3W_objectID", _objectID, true]; - A3W_objectIDs pushBack _objectID; - }; - - _obj setVariable ["baseSaving_hoursAlive", _hoursAlive]; - _obj setVariable ["baseSaving_spawningTime", diag_tickTime]; - _obj setVariable ["objectLocked", true, true]; // force lock - - if (_allowDamage > 0) then - { - _obj setDamage _damage; - _obj setVariable ["allowDamage", true]; - } - else - { - _obj allowDamage false; - }; - - { - _var = _x select 0; - _value = _x select 1; - - switch (_var) do - { - case "side": { _value = _value call _strToSide }; - case "R3F_Side": { _value = _value call _strToSide }; - case "ownerName": - { - switch (typeName _value) do - { - case "ARRAY": { _value = toString _value }; - case "STRING": - { - if (_savingMethod == "iniDB") then - { - _value = _value call iniDB_Base64Decode; - }; - }; - default { _value = "[Beacon]" }; - }; - }; - }; - - _obj setVariable [_var, _value, true]; - } forEach _variables; - - clearWeaponCargoGlobal _obj; - clearMagazineCargoGlobal _obj; - clearItemCargoGlobal _obj; - clearBackpackCargoGlobal _obj; - - _unlock = switch (true) do - { - case (_obj call _isWarchest): { true }; - case (_obj call _isBeacon): - { - pvar_spawn_beacons pushBack _obj; - publicVariable "pvar_spawn_beacons"; - true - }; - case (_locked < 1): { true }; - default { false }; - }; - - if (_unlock) exitWith - { - _obj setVariable ["objectLocked", false, true]; - }; - - if (_boxSavingOn && {_class call _isBox}) then - { - if (!isNil "_weapons") then - { - { _obj addWeaponCargoGlobal _x } forEach _weapons; - }; - if (!isNil "_magazines") then - { - [_obj, _magazines] call processMagazineCargo; - }; - if (!isNil "_items") then - { - { _obj addItemCargoGlobal _x } forEach _items; - }; - if (!isNil "_backpacks") then - { - { - _bpack = _x select 0; - - if (!(_bpack isKindOf "Weapon_Bag_Base") || {{_bpack isKindOf _x} count ["B_UAV_01_backpack_F", "B_Static_Designator_01_weapon_F", "O_Static_Designator_02_weapon_F"] > 0}) then - { - _obj addBackpackCargoGlobal _x; - }; - } forEach _backpacks; - }; - }; - - if (!isNil "_turretMags" && _staticWeaponSavingOn && {_class call _isStaticWeapon}) then - { - _obj setVehicleAmmo 0; - { _obj addMagazine _x } forEach _turretMags; - }; - - if (!isNil "_ammoCargo") then { _obj setAmmoCargo _ammoCargo }; - if (!isNil "_fuelCargo") then { _obj setFuelCargo _fuelCargo }; - if (!isNil "_repairCargo") then { _obj setRepairCargo _repairCargo }; - - reload _obj; - }; - - if (!_valid && !isNil "_objectID") then - { - _exclObjectIDs pushBack _objectID; - }; -} forEach _objects; - -if (_warchestMoneySavingOn) then -{ - _amounts = call compile preprocessFileLineNumbers format ["%1\getWarchestMoney.sqf", _methodDir]; - - pvar_warchest_funds_west = (_amounts select 0) max 0; - publicVariable "pvar_warchest_funds_west"; - pvar_warchest_funds_east = (_amounts select 1) max 0; - publicVariable "pvar_warchest_funds_east"; -}; - -diag_log format ["A3Wasteland - world persistence loaded %1 objects from %2", _objCount, call A3W_savingMethodName]; - -fn_deleteObjects = [_methodDir, "deleteObjects.sqf"] call mf_compile; -_exclObjectIDs call fn_deleteObjects; diff --git a/persistence/server/world/oSave.sqf b/persistence/server/world/oSave.sqf deleted file mode 100644 index 5a9186666..000000000 --- a/persistence/server/world/oSave.sqf +++ /dev/null @@ -1,145 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: oSave.sqf -// @file Author: AgentRev, [GoT] JoSchaap - -#include "functions.sqf" - -A3W_saveableObjects = []; - -// Add objectList & general store objects -{ - _idx = _forEachIndex; - - { - _obj = _x; - if (_idx > 0) then { _obj = _x select 1 }; - - if (!(_obj isKindOf "ReammoBox_F") && {!(_obj call _isSaveable)}) then - { - A3W_saveableObjects pushBack _obj; - }; - } forEach _x; -} forEach [objectList, call genObjectsArray]; - -_purchasedVehicleSaving = ["A3W_purchasedVehicleSaving"] call isConfigOn; -_missionVehicleSaving = ["A3W_missionVehicleSaving"] call isConfigOn; -_vehicleSaving = (_purchasedVehicleSaving || _missionVehicleSaving); -_savingInterval = (["A3W_serverSavingInterval", 60] call getPublicVar) / 2; - -_worldDir = "persistence\server\world"; -_methodDir = format ["%1\%2", _worldDir, call A3W_savingMethodDir]; - -fn_hasInventory = [_worldDir, "fn_hasInventory.sqf"] call mf_compile; -fn_isObjectSaveable = [_worldDir, "fn_isObjectSaveable.sqf"] call mf_compile; -fn_getObjectProperties = [_worldDir, "fn_getObjectProperties.sqf"] call mf_compile; -fn_manualObjectSave = [_worldDir, "fn_manualObjectSave.sqf"] call mf_compile; -fn_manualObjectDelete = [_worldDir, "fn_manualObjectDelete.sqf"] call mf_compile; -fn_saveObject = [_methodDir, "saveObject.sqf"] call mf_compile; -fn_postObjectSave = [_methodDir, "postObjectSave.sqf"] call mf_compile; -fn_saveWarchestMoney = [_methodDir, "saveWarchestMoney.sqf"] call mf_compile; - -if (_vehicleSaving) then -{ - fn_isVehicleSaveable = [_worldDir, "fn_isVehicleSaveable.sqf"] call mf_compile; - fn_getVehicleProperties = [_worldDir, "fn_getVehicleProperties.sqf"] call mf_compile; - fn_manualVehicleSave = [_worldDir, "fn_manualVehicleSave.sqf"] call mf_compile; - fn_manualVehicleDelete = [_worldDir, "fn_manualVehicleDelete.sqf"] call mf_compile; - fn_saveVehicle = [_methodDir, "saveVehicle.sqf"] call mf_compile; - fn_postVehicleSave = [_methodDir, "postVehicleSave.sqf"] call mf_compile; -}; - -if (_savingMethod == "iniDB") then -{ - _objFileName = "Objects" call PDB_objectFileName; - _vehFileName = "Vehicles" call PDB_objectFileName; - - // If file doesn't exist, create Info section at the top - if !(_objFileName call PDB_exists) then // iniDB_exists - { - [_objFileName, "Info", "ObjCount", 0] call PDB_write; // iniDB_write - }; - - // If file doesn't exist, create Info section at the top - if (_vehicleSaving && !(_vehFileName call PDB_exists)) then // iniDB_exists - { - [_vehFileName, "Info", "VehCount", 0] call PDB_write; // iniDB_write - }; -}; - -A3W_oSaveReady = compileFinal "true"; - -while {true} do -{ - uiSleep _savingInterval; - - _objCount = 0; - _currObjectIDs = +A3W_objectIDs; - _newObjectIDs = []; - - { - _obj = _x; - - if (_obj call fn_isObjectSaveable) then - { - _objCount = _objCount + 1; - _objID = [_obj, _objCount] call fn_saveObject; - - if (!isNil "_objID") then - { - _newObjectIDs pushBack _objID; - if !(_objID in A3W_objectIDs) then { A3W_objectIDs pushBack _objID }; - }; - - sleep 0.01; - }; - } forEach allMissionObjects "All"; - - diag_log format ["A3W - %1 baseparts and objects have been saved with %2", _objCount, call A3W_savingMethodName]; - - if (_warchestMoneySavingOn) then - { - call fn_saveWarchestMoney; - }; - - _oldIDs = _currObjectIDs - _newObjectIDs; - A3W_objectIDs = A3W_objectIDs - _oldIDs; - - [_oldIDs, _objCount] call fn_postObjectSave; - - uiSleep _savingInterval; - - // Vehicle saving - if (_vehicleSaving) then - { - _vehCount = 0; - _currVehicleIDs = +A3W_vehicleIDs; - _newVehicleIDs = []; - - { - _veh = _x; - - if (_veh call fn_isVehicleSaveable) then - { - _vehCount = _vehCount + 1; - _vehID = [_veh, _vehCount] call fn_saveVehicle; - - if (!isNil "_vehID") then - { - _newVehicleIDs pushBack _vehID; - if !(_vehID in A3W_vehicleIDs) then { A3W_vehicleIDs pushBack _vehID }; - }; - - sleep 0.01; - }; - } forEach allMissionObjects "AllVehicles"; - - diag_log format ["A3W - %1 vehicles have been saved with %2", _vehCount, call A3W_savingMethodName]; - - _oldIDs = _currVehicleIDs - _newVehicleIDs; - A3W_vehicleIDs = A3W_vehicleIDs - _oldIDs; - - [_oldIDs, _vehCount] call fn_postVehicleSave; - }; -}; diff --git a/persistence/server/world/vLoad.sqf b/persistence/server/world/vLoad.sqf deleted file mode 100644 index 83398e4f3..000000000 --- a/persistence/server/world/vLoad.sqf +++ /dev/null @@ -1,185 +0,0 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -// @file Name: vLoad.sqf -// @file Author: AgentRev, JoSchaap, Austerror - -private ["_maxLifetime", "_maxUnusedTime", "_worldDir", "_methodDir", "_vehCount", "_vehicles", "_exclVehicleIDs"]; - -_maxLifetime = ["A3W_vehicleLifetime", 0] call getPublicVar; -_maxUnusedTime = ["A3W_vehicleMaxUnusedTime", 0] call getPublicVar; - -_worldDir = "persistence\server\world"; -_methodDir = format ["%1\%2", _worldDir, call A3W_savingMethodDir]; - -_vehCount = 0; -_vehicles = call compile preprocessFileLineNumbers format ["%1\getVehicles.sqf", _methodDir]; - -_exclVehicleIDs = []; - -{ - private ["_veh", "_vehicleID", "_class", "_pos", "_dir", "_vel", "_flying", "_damage", "_fuel", "_hitPoints", "_variables", "_textures", "_weapons", "_magazines", "_items", "_backpacks", "_turretMags", "_turretMags2", "_turretMags3", "_ammoCargo", "_fuelCargo", "_repairCargo", "_hoursAlive", "_hoursUnused", "_valid"]; - - { (_x select 1) call compile format ["%1 = _this", _x select 0] } forEach _x; - - if (isNil "_flying") then { _flying = 0 }; - if (isNil "_hoursAlive") then { _hoursAlive = 0 }; - if (isNil "_hoursUnused") then { _hoursUnused = 0 }; - _valid = false; - - if (!isNil "_class" && !isNil "_pos" && {count _pos == 3 && (_maxLifetime <= 0 || _hoursAlive < _maxLifetime) && (_maxUnusedTime <= 0 || _hoursUnused < _maxUnusedTime)}) then - { - _vehCount = _vehCount + 1; - _valid = true; - - { if (typeName _x == "STRING") then { _pos set [_forEachIndex, parseNumber _x] } } forEach _pos; - - _isUAV = (getNumber (configFile >> "CfgVehicles" >> _class >> "isUav") > 0); - _flying = (_flying > 0); - - _veh = createVehicle [_class, _pos, [], 0, if (_isUAV && _flying) then { "FLY" } else { "None" }]; - - _velMag = vectorMagnitude velocity _veh; - - _veh setPosWorld ATLtoASL _pos; - - if (!isNil "_dir") then - { - _veh setVectorDirAndUp _dir; - }; - - // UAV AI - if (_isUAV) then - { - createVehicleCrew _veh; - - if (_flying) then - { - if (isNil "_vel" || {count _vel < 3}) then - { - _vel = (vectorDir _veh) vectorMultiply _velMag; - }; - - _veh setVelocity _vel; - _veh flyInHeight (((_veh call fn_getPos3D) select 2) max 500); - }; - - [_veh, _flying] spawn - { - _uav = _this select 0; - _flying = _this select 1; - - waitUntil {!isNull driver _uav}; - - if (_flying) then - { - _wp = (group _uav) addWaypoint [getPosATL _uav, 0]; - _wp setWaypointType "MOVE"; - }; - - { - [[_x, ["AI","",""]], "A3W_fnc_setName", true] call A3W_fnc_MP; - } forEach crew _uav; - }; - }; - - [_veh] call vehicleSetup; - - if (!isNil "_vehicleID") then - { - _veh setVariable ["A3W_vehicleID", _vehicleID, true]; - A3W_vehicleIDs pushBack _vehicleID; - }; - - _veh setVariable ["vehSaving_hoursUnused", _hoursUnused]; - _veh setVariable ["vehSaving_lastUse", diag_tickTime]; - _veh setVariable ["vehSaving_hoursAlive", _hoursAlive]; - _veh setVariable ["vehSaving_spawningTime", diag_tickTime]; - - _veh setDamage _damage; - { _veh setHitPointDamage _x } forEach _hitPoints; - - _veh setFuel _fuel; - - if (!isNil "_textures") then - { - _veh setVariable ["BIS_enableRandomization", false, true]; - - _objTextures = []; - { - _texture = _x select 0; - { - _veh setObjectTextureGlobal [_x, _texture]; - [_objTextures, _x, _texture] call fn_setToPairs; - } forEach (_x select 1); - } forEach _textures; - - _veh setVariable ["A3W_objectTextures", _objTextures, true]; - }; - - { _veh setVariable [_x select 0, _x select 1, true] } forEach _variables; - - clearWeaponCargoGlobal _veh; - clearMagazineCargoGlobal _veh; - clearItemCargoGlobal _veh; - clearBackpackCargoGlobal _veh; - - if (!isNil "_weapons") then - { - { _veh addWeaponCargoGlobal _x } forEach _weapons; - }; - if (!isNil "_magazines") then - { - [_veh, _magazines] call processMagazineCargo; - }; - if (!isNil "_items") then - { - { _veh addItemCargoGlobal _x } forEach _items; - }; - if (!isNil "_backpacks") then - { - { - _bpack = _x select 0; - - if (!(_bpack isKindOf "Weapon_Bag_Base") || {{_bpack isKindOf _x} count ["B_UAV_01_backpack_F", "B_Static_Designator_01_weapon_F", "O_Static_Designator_02_weapon_F"] > 0}) then - { - _veh addBackpackCargoGlobal _x; - }; - } forEach _backpacks; - }; - - _veh setVehicleAmmo 0; - - if (!isNil "_turretMags3") then - { - { - _veh addMagazineTurret [_x select 0, _x select 1]; - _veh setVehicleAmmo (_x select 2); - } forEach _turretMags3; - }; - if (!isNil "_turretMags") then - { - { _veh addMagazine _x } forEach _turretMags; - }; - if (!isNil "_turretMags2") then - { - { _veh addMagazineTurret _x } forEach _turretMags2; - }; - - if (!isNil "_ammoCargo") then { _veh setAmmoCargo _ammoCargo }; - if (!isNil "_fuelCargo") then { _veh setFuelCargo _fuelCargo }; - if (!isNil "_repairCargo") then { _veh setRepairCargo _repairCargo }; - - reload _veh; - }; - - if (!_valid && !isNil "_vehicleID") then - { - _exclVehicleIDs pushBack _vehicleID; - }; -} forEach _vehicles; - -diag_log format ["A3Wasteland - world persistence loaded %1 vehicles from %2", _vehCount, call A3W_savingMethodName]; - -fn_deleteVehicles = [_methodDir, "deleteVehicles.sqf"] call mf_compile; -_exclVehicleIDs call fn_deleteVehicles; diff --git a/persistence/sock/call3.fsm b/persistence/sock/call3.fsm new file mode 100644 index 000000000..fa7f27644 --- /dev/null +++ b/persistence/sock/call3.fsm @@ -0,0 +1,14 @@ +class FSM { + fsmName = "call3.fsm"; + class States { + class _ { + name = "_"; + init = "missionNamespace setVariable [_this select 0, ((_this select 1) call (_this select 2))]"; + precondition = ""; + }; + }; + initState=""; + finalStates[] = { + "_", + }; +}; diff --git a/persistence/sock/inidb_adapter.sqf b/persistence/sock/inidb_adapter.sqf new file mode 100644 index 000000000..c4b16133a --- /dev/null +++ b/persistence/sock/inidb_adapter.sqf @@ -0,0 +1,168 @@ +diag_log format["loading sock-rpc-stats iniDB API adapter ..."]; + +//load the iniDB adapter library +call compile preProcessFileLineNumbers "persistence\sock\main.sqf"; + +#include "macro.h" + + +//Some wrappers for logging +inidb_log_severe = { + ["stats-iniDB", _this] call log_severe; +}; + +inidb_log_warning = { + ["stats-iniDB", _this] call log_warning; +}; + +inidb_log_info = { + ["stats-iniDB", _this] call log_info; +}; + +inidb_log_fine = { + ["stats-iniDB", _this] call log_fine; +}; + +inidb_log_finer = { + ["stats-iniDB", _this] call log_finer; +}; + +inidb_log_finest = { + ["stats-iniDB", _this] call log_finest; +}; + +inidb_log_set_level = { + ["stats-iniDB", _this] call log_set_level; +}; + + +//Set default logging level for this component +LOG_INFO_LEVEL call inidb_log_set_level; + + +iniDB_version = "1.2"; + +iniDB_HashFunction = { + "iniDB_HashFunction: not supported" call inidb_log_finest; +}; + +iniDB_CRC32 = { + "iniDB_CRC32: not supported" call inidb_log_finest; +}; + +iniDB_MD5 = { + "iniDB_MD5: not supported" call inidb_log_finest; +}; + + +iniDB_Base64Encode = { + "iniDB_Base64Encode: not supported" call inidb_log_finest; +}; + +iniDB_Base64Decode = { + "iniDB_Base64Decode: not supported" call inidb_log_finest; +}; + +iniDB_exists = { + format["%1 call iniDB_exists;", _this] call inidb_log_finest; + not(isNil{([_this] call stats_get)}) +}; + + +iniDB_delete = { + "iniDB_delete: not supported" call inidb_log_finest; +}; + +iniDB_deleteSection = { + format["%1 call iniDB_deleteSection;", _this] call inidb_log_finest; + ARGVX3(0,_var,""); + ARGVX3(1,_sec,""); + + ([_var, _sec, nil] call stats_set) +}; + + +iniDB_readRaw = { + "iniDB_readRaw: not supported" call inidb_log_finest; +}; + + +iniDB_writeRaw = { + "iniDB_writeRaw: not supported" call inidb_log_finest; +}; + + +iniDB_Datarizer = { + "iniDB_Datarizer: not supported" call inidb_log_finest; +}; + + + +//cast a result according to iniDB rules +iniDB_cast_result = { + ARGV2(0,_result); + ARGV3(1,_type,""); + + //if no result, and no type, return empty string + if (isNil "_result" && isNil "_type") exitWith { + "" + }; + + //normalize _type + if (not(isNil "_type")) then { + _type = toUpper _type; + if (_type == "NUMBER") then { + _type = typeName 0; + }; + }; + + //no result, but type was specified, return an appropriate default value + if (isNil "_result") exitWith { + if (_type == typeName []) exitWith {[]}; + if (_type == typeName "") exitWith {""}; + if (_type == typeName 0) exitWith {0}; + "" + }; + + //no type specified, return result as-is + if (isNil "_type") exitWith { + _result + }; + + //both type, and result specified, but types did not match, do casting + if (typeName _result != _type) exitWith { + if (_type == typeName []) exitWith {[]}; + if (_type == typeName "") exitWith {str _result}; + if (_type == typeName 0) exitWith {parseNumber str _result}; + "" + }; + + _result +}; + +iniDB_read = { + format["%1 call iniDB_read;", _this] call inidb_log_finest; + ARGVX3(0,_file,""); + ARGVX3(1,_sec,""); + ARGVX3(2,_key,""); + ARGV3(3,_type,""); + + //iniDB has special rules about the return type + def(_result); + _result = ([([_file, _sec + "." + _key] call stats_get), OR(_type,nil)] call iniDB_cast_result); + format["iniDB_read: _result = %1", _result] call inidb_log_finest; + _result +}; + + +iniDB_write = { + format["%1 call iniDB_write;", _this] call inidb_log_finest; + ARGVX3(0,_file,""); + ARGVX3(1,_sec,""); + ARGVX3(2,_key,""); + ARGV2(3,_data); + + ([_file, _sec + "." + _key, _data] call stats_set) +}; + +diag_log format["loading sock-rpc-stats iniDB API adapter complete"]; \ No newline at end of file diff --git a/persistence/sock/log.sqf b/persistence/sock/log.sqf new file mode 100644 index 000000000..5c1644086 --- /dev/null +++ b/persistence/sock/log.sqf @@ -0,0 +1,187 @@ +diag_log format["loading log library ..."]; + +//Log levels (from highest to lowest) +LOG_SEVERE_LEVEL=6; +LOG_WARNING_LEVEL=5; +LOG_INFO_LEVEL=4; +LOG_CONFIG_LEVEL=3; +LOG_FINE_LEVEL=2; +LOG_FINER_LEVEL=1; +LOG_FINEST_LEVEL=0; + +//Default system-wide log level +SYS_LOG_LEVEL = LOG_SEVERE_LEVEL; + +/** +* Sets the logging level for a component +* +* @param _component_name (String) - Name of the component +* @param _component_level (int) - Logging level for the component +* +* @return +* On success, returns the logging level that was just set +* On failure, returns nil +*/ +log_set_level = { + if (isNil "_this") exitWith {}; + if (typeName _this != typeName []) exitWith {}; + if (count _this < 2) exitWith {}; + + private["_component_name"]; + _component_name = _this select 0; + _component_level = _this select 1; + + if (isNil "_component_name" || {typeName _component_name != typeName ""}) exitWith {}; + if (isNil "_component_level" || {typeName _component_level != typeName 0}) exitWith {}; + + missionNamespace setVariable [format["%1_LOG_LEVEL", _component_name], _component_level]; + + _component_level +}; + +/** +* Gets the logging level of a component +* +* @param _component_name (String) - Name of the component +* +* @return +* On success returns the logging level of the specified component. +* On failure, if the specified component does not exist, it returns the system wide log-level +*/ +log_get_level = { + private["_component_name"]; + if (isNil "_this") exitWith {SYS_LOG_LEVEL}; + _component_name = _this; + if (typeName _component_name != typeName "") exitWith {SYS_LOG_LEVEL}; + + private["_component_level"]; + _component_level = missionNamespace getVariable [format["%1_LOG_LEVEL", toUpper(_component_name)], SYS_LOG_LEVEL]; + _component_level +}; + + +/** +* Converts a logging level value to string +* +* @param _level (String) - The logging level value to convert +* +* @return +* On success, returns the string for the specified logging @{code _level} +* On failure, returns empty string. +* +*/ +log_get_level_name = { + private["_level"]; + if (isNil "_this") exitWith {""}; + if (typeName _this != typeName 0) exitWith {""}; + + private["_level"]; + _level = _this; + + if (_level == LOG_SEVERE_LEVEL) exitWith {"severe"}; + if (_level == LOG_WARNING_LEVEL) exitWith {"warning"}; + if (_level == LOG_INFO_LEVEL) exitWith {"info"}; + if (_level == LOG_CONFIG_LEVEL) exitWith {"config"}; + if (_level == LOG_FINE_LEVEL) exitWith {"fine"}; + if (_level == LOG_FINER_LEVEL) exitWith {"finer"}; + if (_level == LOG_FINEST_LEVEL) exitWith {"finest"}; + + "" +}; + +/** +* Prints a logging string to the game's RPT file +* +* @param _level (int) - Logging level at which to log the message +* @param _component (String) - Name of the component that is logging the message +* @param _message (String) - Message to print in the RPT file +*/ +log_rpt = { + private["_level", "_component", "_message"]; + if (isNil "_this") exitWith {}; + if (count _this < 3) exitWith {}; + + _level = _this select 0; + _component = _this select 1; + _message = _this select 2; + + if (isNil "_level" || {typeName _level != typeName 0}) exitWith {}; + if (isNil "_component" || {typeName _message != typeName ""}) exitWith {}; + if (isNil "_message" || {typeName _message != typeName ""}) exitWith {}; + + private["_component_level"]; + _component_level = _component call log_get_level; + if (_level < _component_level) exitWith {}; + + private["_level_str"]; + _level_str = _level call log_get_level_name; + + diag_log (_component + ": " + _level_str + ": " + _message); +}; + + +/** +* Prints a logging message at SEVERE level for the specified component +* @param _component_name (String) - Name of the component that is logging the message +* @param _message (String) - Message to be logged +*/ +log_severe = { + ([LOG_SEVERE_LEVEL] + _this) call log_rpt +}; + +/** +* Prints a logging message at WARNING level for the specified component +* @param _component_name (String) - Name of the component that is logging the message +* @param _message (String) - Message to be logged +*/ +log_warning = { + ([LOG_WARNING_LEVEL] + _this) call log_rpt +}; + +/** +* Prints a logging message at INFO level for the specified component +* @param _component_name (String) - Name of the component that is logging the message +* @param _message (String) - Message to be logged +*/ +log_info = { + ([LOG_INFO_LEVEL] + _this) call log_rpt +}; + +/** +* Prints a logging message at CONFIG level for the specified component +* @param _component_name (String) - Name of the component that is logging the message +* @param _message (String) - Message to be logged +*/ +log_config = { + ([LOG_CONFIG_LEVEL] + _this) call log_rpt +}; + +/** +* Prints a logging message at FINE level for the specified component +* @param _component_name (String) - Name of the component that is logging the message +* @param _message (String) - Message to be logged +*/ +log_fine = { + ([LOG_FINE_LEVEL] + _this) call log_rpt +}; + +/** +* Prints a logging message at FINER level for the specified component +* @param _component_name (String) - Name of the component that is logging the message +* @param _message (String) - Message to be logged +*/ +log_finer = { + ([LOG_FINER_LEVEL] + _this) call log_rpt +}; + +/** +* Prints a logging message at FINEST level for the specified component +* @param _component_name (String) - Name of the component that is logging the message +* @param _message (String) - Message to be logged +*/ +log_finest = { + ([LOG_FINEST_LEVEL] + _this) call log_rpt +}; + + +diag_log format["loading log library complete"]; \ No newline at end of file diff --git a/persistence/sock/macro.h b/persistence/sock/macro.h new file mode 100644 index 000000000..39b52e5ef --- /dev/null +++ b/persistence/sock/macro.h @@ -0,0 +1,146 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} \ No newline at end of file diff --git a/persistence/sock/main.sqf b/persistence/sock/main.sqf new file mode 100644 index 000000000..8086090c6 --- /dev/null +++ b/persistence/sock/main.sqf @@ -0,0 +1,11 @@ +//load the logging library +call compile preProcessFileLineNumbers "persistence\sock\log.sqf"; + +//load the socket rpc library +call compile preProcessFileLineNumbers "persistence\sock\sock.sqf"; + +//load the generic stats library +call compile preProcessFileLineNumbers "persistence\sock\stats.sqf"; + +//load the stats extra function library +call compile preProcessFileLineNumbers "persistence\sock\stats_extra.sqf"; \ No newline at end of file diff --git a/persistence/sock/sock.sqf b/persistence/sock/sock.sqf new file mode 100644 index 000000000..e4ecae674 --- /dev/null +++ b/persistence/sock/sock.sqf @@ -0,0 +1,338 @@ +diag_log format["loading sock library ..."]; +#include "macro.h" + +//Some wrappers for logging +sock_log_severe = { + ["sock", _this] call log_severe; +}; + +sock_log_info = { + ["sock", _this] call log_info; +}; + +sock_log_fine = { + ["sock", _this] call log_fine; +}; + +sock_log_finer = { + ["sock", _this] call log_finer; +}; + +sock_log_finest = { + ["sock", _this] call log_finest; +}; + + +sock_log_set_level = { + ["sock", _this] call log_set_level; +}; + + +//Set default logging level for this component +LOG_INFO_LEVEL call sock_log_set_level; + + + +sock_raw = { + _this = _this select 0; + + private["_stack","_holder"]; + _holder = []; + _stack = [[0,_holder,_this]]; //seed the stack + + while {count(_stack) > 0} do { + private["_current","_parent","_index", "_params"]; + _params = _stack deleteAt (count(_stack)-1); + _index = _params select 0; + _parent = _params select 1; + _current = _params select 2; + + private["_clone"]; + _clone = []; + + { + if (isNil "_x") then { + _clone pushBack {nil}; + } + else {private["_type"]; _type = typeName _x; if( _type == "STRING") then { + _clone pushBack ([toArray _x,{}]); + } + else { if(_type == "SCALAR" || {_type == "BOOL"}) then { + _clone pushBack _x; + } + else { if(_type == "CODE") then { + _clone pushBack {}; + } + else { if (_type == "ARRAY") then { + _stack pushBack [_forEachIndex,_clone,_x]; + } + else { + _clone pushBack {nil}; + };};};};}; + } forEach _current; + + _parent set [_index, _clone]; + + }; + + ("RAW:" + str(_holder select 0)) +}; + + +/** +* This function is used for creating JSON hash/object from an array with a set of key-value pairs +* +* @param _key_value_pairs (Array type) - An array containing key-value pairs e.g. [["key1", "val1"], ...] +* @return +* +* Returns the hash representation. +*/ +sock_hash = { + ([{},OR(_this,nil)]) +}; + +/** +* This function talks directly to the sock.dll extension using the SOCK-SQF protocol. +* +* @param _request (String type) - This is the actual text to be sent to the remote side. +* @return +* +* On success, returns the reponse string that was sent by the remote side +* On failure, returns nil +*/ +sock_get_response = { + if (isNil "_this") exitWith {}; + format["%1 call sock_get_response;", _this] call sock_log_finest; + + if (typeName _this != typeName "") exitWith {}; + + + init(_request,_this); + init(_extension,"sock"); + + //("sock_get_response: _request=" + _request) call sock_log_fine; + + def(_response_info); + _response_info = call compile (_extension callExtension _request); + + if (undefined(_response_info)) exitWith { + (format["protocol error: Was expecting response of typeName of %1, but got %2", (typeName []), "nil"]) call sock_log_severe; + nil + }; + + + if (isSTRING(_response_info)) exitWith { + ("error: " + _response_info) call sock_log_severe; + nil + }; + + if (not(isARRAY(_response_info))) exitWith { + (format["protocol error: Was expecting response of typeName of %1, but got %2", (typeName []), typeName _response_info]) call sock_log_severe; + nil + }; + + init(_chunks,_response_info); + init(_chunk_count,count(_chunks)); + + init(_i,0); + init(_response,""); + + //retrieve all the response chunks, and concatenate them + while {_i < _chunk_count } do { + init(_address,xGet(_chunks,_i)); + def(_data); + _data = _extension callExtension (_address); + _response = _response + _data; + _i = _i + 1; + }; + + format["sock_get_response: _response = %1", OR(_response,"nil")] call sock_log_finest; + OR(_response,nil) +}; + + +/** +* This function sends a JSON-RPC request using the sock.dll/sock.so extension. +* +* @param _method (String type) - This is the name of the remote method to be invoked +* @param _params (Array type) - This is an array of arguments to be passed in, when invoking {@code _method} +* @param default (Any type) - This is the value to return if there is an error +* @return +* +* On success, returns the response from the RPC server +* On failure, returns the value of the {@code _default} argument, or nil if {@code _default} was not specified. +*/ +sock_rpc = { + if (isNil "_this") exitWith {nil}; + format["%1 call sock_rpc;", _this] call sock_log_finest; + + if (not(isServer || !hasInterface)) exitWith { + (_this call sock_rpc_remote) + }; + + (_this call sock_rpc_local) +}; + + +sock_rpc_remote = { + if (isNil "_this") exitWith {nil}; + format["%1 call sock_rpc_remote;", _this] call sock_log_finest; + + init(_request,_this); + + if (not(isClient)) exitWith {nil}; + + def(_var_name); + _var_name = format["sock_rpc_remote_response_%1",ceil(random 10000)]; + missionNamespace setVariable [_var_name, nil]; + missionNamespace setVariable [sock_rpc_remote_request_name, [player, _var_name, _request]]; + publicVariableServer sock_rpc_remote_request_name; + + + def(_response); + init(_end_time, time + 60); + while {true} do { + _response = missionNamespace getVariable [_var_name, nil]; + if (!isNil "_response") exitWith {}; + if (time > _end_time) exitWith {}; + sleep 0.01; + }; + missionNamespace setVariable [_var_name, nil]; + + if (undefined(_response)) exitWith { + format["timeout occurred while waiting for response of %1", _var_name] call sock_log_severe; + nil + }; + + if (not(isARRAY(_response))) exitWith { + format["protocol error, expected response to be of type %1", typeName []] call sock_log_severe; + nil + }; + + if (count(_response) == 0) exitWith { + format["protocol error, expected response to have at least one element"] call sock_log_severe; + nil + }; + + (_response select 0) +}; + + + + +sock_rpc_remote_request_listener = { + if (isNil "_this") exitWith {nil}; + format["%1 call sock_rpc_remote_request_listener;", _this] call sock_log_finest; + + private["_variable", "_request"]; + + ARGV3(0,_variable,""); + ARGV3(1,_request,[]); + + if (undefined(_variable) || {undefined(_request)}) exitWith {nil}; + + _this = _request; + ARGVX3(0,_client,objNull); + ARGVX3(1,_var_name,""); + ARGVX3(2,_args,[]); + + private["_response"]; + _response = _args call sock_rpc_local; + _response = [OR(_response,nil)]; + + private["_client_id"]; + _client_id = owner _client; + + missionNamespace setVariable [_var_name, _response]; + format["sock_rpc_remote_request_listener: client_id: %1", _client_id] call sock_log_finest; + format["sock_rpc_remote_request_listener: response: %1", _response] call sock_log_finest; + _client_id publicVariableClient _var_name; + missionNamespace setVariable [_var_name, nil]; +}; + + + +sock_rpc_local = { + if (isNil "_this") exitWith {nil}; + format["%1 call sock_rpc_local;", _this] call sock_log_finest; + + ARGV3(0,_method,""); + ARGV3(1,_params,[]); + ARGV2(2,_default) + + if (undefined(_method)) exitWith {nil}; + + private["_raw_rpc"]; + _raw_rpc = [([["method",_method],["params",OR(_params,[])]] call sock_hash)] call sock_raw; + + private["_result_container"]; + _result_container = call compile(_raw_rpc call sock_get_response); + + if (isNil "_result_container") exitWith { + (format["protocol error: Was expecting response of typeName of %1, but got %2", (typeName []), "nil"]) call sock_log_severe; + if (isNil "_default") exitWith {nil}; + OR(_default,nil) + }; + + if (typeName _result_container != typeName []) exitWith { + (format["protocol error: Was expecting response of typeName of %1, but got %2", (typeName []), (typeName _result_container)]) call sock_log_severe; + if (isNil "_default") exitWith {nil}; + OR(_default,nil) + }; + + if (count _result_container < 2) exitWith { + (format["protocol error: Was expecting response count of %1, but got %2 ", 2, count(_result_container)]) call sock_log_severe; + if (isNil "_default") exitWith {nil}; + OR(_default,nil) + }; + + private["_error", "_result"]; + _this = _result_container; + ARGV3(0,_error,false); + ARGV2(1,_result); + + //success case + if (not(_error)) exitWith { + OR(_result,nil) + }; + + //error cases + if (typeName _result != typeName "") exitWith { + (format["protocol error: Was expecting error response of typeName %1, but got %2", (typeName ""), (typeName _result)]) call sock_log_severe; + if (isNil "_default") exitWith {nil}; + OR(_default,nil) + }; + + (format["remote error: %1", _result]) call sock_log_severe; + OR(_default,nil) +}; + + + + +sock_init = { + init(_flag_name, "sock_init_complete"); + + sock_rpc_remote_request_name = "sock_rpc_remote_request"; + //Server-side init + if (isServer) then { + sock_rpc_remote_request_name addPublicVariableEventHandler { _this call sock_rpc_remote_request_listener;}; + + //tell clients that server pstats has initialized + missionNamespace setVariable[_flag_name, true]; + publicVariable _flag_name; + "sock_rpc library loaded on server ..." call sock_log_info; + }; + + //Client-side init (must wait for server-side init to complete) + if (isClient) then { + "waiting for server to load sock_rpc library ..." call sock_log_info; + waitUntil {not(isNil _flag_name)}; + "waiting for server to load sock_rpc library ... done" call sock_log_info; + }; +}; + + +[] call sock_init; + +diag_log format["loading sock library complete"]; \ No newline at end of file diff --git a/persistence/sock/stats.sqf b/persistence/sock/stats.sqf new file mode 100644 index 000000000..57cb43982 --- /dev/null +++ b/persistence/sock/stats.sqf @@ -0,0 +1,745 @@ +diag_log format["loading stats library ..."]; +#include "macro.h" + +//Some wrappers for logging +stats_log_severe = { + ["stats", _this] call log_severe; +}; + +stats_log_warning = { + ["stats", _this] call log_warning; +}; + +stats_log_info = { + ["stats", _this] call log_info; +}; + +stats_log_fine = { + ["stats", _this] call log_fine; +}; + +stats_log_finer = { + ["stats", _this] call log_finer; +}; + +stats_log_finest = { + ["stats", _this] call log_finest; +}; + +stats_log_set_level = { + ["stats", _this] call log_set_level; +}; + + +//Set default logging level for this component +LOG_INFO_LEVEL call stats_log_set_level; + + +stats_build_params = { + if (isNil "_this") exitWith {}; + format["%1 stats_build_params;", _this] call stats_log_finest; + + ARGV3(0,_scope,""); + ARGV2(1,_key_or_pairs); + ARGV2(2,_default); + + + if (undefined(_scope)) exitWith {nil}; + + init(_params,[]); + xPush(_params,_scope); + + + //get(scope) + if (undefined(_key_or_pairs)) exitWith { + (_params) + }; + + if (not(isARRAY(_key_or_pairs) || {isSTRING(_key_or_pairs)})) exitWith {nil}; + + //get(scope, pair,...) + if (isARRAY(_key_or_pairs)) exitWith { + init(_i,1); + init(_count,count(_this)); + for [{}, {_i < _count}, {_i = _i + 1}] do { DO { + ARGV3(_i,_pair,[]); + if (undefined(_pair) || {count(_pair) == 0}) exitWith {}; + if (!isSTRING(xGet(_pair,0))) exitWith {}; + + xPushIf(count(_pair) == 1,_pair,nil); + xPush(_params,_pair); + };}; + + (_params) + }; + + //get(scope, key, default) + xPush(_params,_key_or_pairs); + xPush(_params,_default); + + (_params) +}; + + +/** +* This function sets the given {@code _key}, and {@code _value} within the specified {@code _scope} +* +* e.g. +* +* //set the value for "key1" in "scope1" +* ["scope1", "key1", "value1"] call stats_set; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key to set +* @param {*} _value Value to set +* +* @returns {boolean} true on success, false on failure +*/ + + +/** + * This function sets one or more key-value {@code _pair}s within the specified {@code _scope} + * + * e.g. + * + * //set values for "key1", and "key2" in "scope1" + * ["scope1", ["key1", "value1"], ["key2", "value2"])] call stats_set; + * + * + * @param {String} _scope Name of the scope to use + * @param {...Array} _pair Key-value pair + * @param {String} _pair[0] Name of the key + * @param {*} _pair[1] Value for the key + * + * @returns true on success, false on failure + * + */ + +stats_set = { + (["set", _this] call stats_write) +}; + + +/** +* This function pushes the given {@code _value} to the end of the array at {@code _key}, and within the specified {@code _scope} +* +* e.g. +* +* //push the value into the array at "key1" within "scope1" +* ["scope1", "key1", "value1"] call stats_push; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key to push into +* @param {*} _value Value to push +* +* @returns {boolean} true on success, false on failure +*/ + + +/** + * This function pushes one or more values into the specified keys within the given {@code _scope} + * + * e.g. + * + * //push values into arrays at "key1", and "key2" within "scope1" + * ["scope1", ["key1", "value1"], ["key2", "value2"]] call stats_push; + * + * + * @param {String} _scope Name of the scope to use + * @param {...Array} _pair Key-value pair + * @param {String} _pair[0] Name of the key to push into + * @param {*} _pair[1] Value to push + * + * @returns true on success, false on failure + * + */ +stats_push = { + (["push", _this] call stats_write) +}; + +/** +* This function unshifts the given {@code _value} to the begining of the array at {@code _key}, and within the specified {@code _scope} +* +* e.g. +* +* //unshift the value into the array at "key1" within "scope1" +* ["scope1", "key1", "value1"] call stats_unshift; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key to unshift into +* @param {*} _value Value to unshift +* +* @returns {boolean} true on success, false on failure +*/ + + +/** + * This function unshifts one or more values into the specified keys within the given {@code _scope} + * + * e.g. + * + * //unshift values into arrays at "key1", and "key2" within "scope1" + * ["scope1", ["key1", "value1"], ["key2", "value2"]] call stats_unshift; + * + * + * @param {String} _scope Name of the scope to use + * @param {...Array} _pair Key-value pair + * @param {String} _pair[0] Name of the key to push into + * @param {*} _pair[1] Value to push + * + * @returns true on success, false on failure + * + */ +stats_unshift = { + (["unshift", _this] call stats_write) +}; + +/** +* This function merges the given {@code _value} with the existing value at the specified {@code _key}, and within the given scope {@code _scope} +* +* e.g. +* +* //merges the _hash into the existing value at "key1" +* private["_hash"]; +* _hash = [ +* ["child1", "val1"], +* ["child2", "val2"] +* ] call sock_hash; +* +* ["scope1", "key1", _hash] call stats_merge; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key to merge into +* @param {*} _value Value to merge +* +* @returns {boolean} true on success, false on failure +*/ + + +/** + * This function merges one or more values into the existing values at the specified keys within the given {@code _scope} + * + * e.g. + * + * private["_hash1", "_hash2"]; + * _hash1 = [ + * ["child1", "val1"], + * ["child2", "val2"] + * ] call sock_hash; + * + * _hash12= [ + * ["child1", "val1"], + * ["child2", "val2"] + * ] call sock_hash; + * + * //merges _hash1 into the value at "key1", and _hash2 into the value at "key2" + * ["scope1", ["key1", _hash1], ["key2", _hash2]] call stats_merge; + * + * + * @param {String} _scope Name of the scope to use + * @param {...Array} _pair Key-value pair + * @param {String} _pair[0] Name of the key to merge into + * @param {*} _pair[1] Value to merge + * + * @returns true on success, false on failure + * + */ + +stats_merge = { + (["merge", _this] call stats_write) +}; + + +stats_write = { + if (isNil "_this") exitWith {false}; + format["%1 stats_set;", _this] call stats_log_finest; + + ARGVX3(0,_operation,""); + ARGVX3(1,_this,[]); + + init(_method,_operation); + def(_params); + _params = _this call stats_build_params; + + if (undefined(_params)) exitWith {false}; + + + def(_result); + _result = ([_method, _params] call sock_rpc); + if (undefined(_result)) exitWith {false}; + + + if (isSTRING(_result)) exitWith { + _result call stats_log_severe; + false + }; + + if (not(isBOOLEAN(_result))) exitWith { + format["protocol error: was expecting _result of typeName %1, but instead got typeName %2", typeName true, typeName _result] call stats_log_severe; + false + }; + + _result +}; + + + +/** +* This function gets the value of the given {@code _key}, within the specified {@code _scope} +* +* e.g. +* +* //get the value for "key1" +* stats_get("scope", "key1"); +* +* //get the value for "key1", or use "default1" if not found +* ["scope", "key1", "default1"] call stats_get; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key to set +* @param {*} [_default] Default value to use if {@code _key} does not exist +* @return +* +* The value assocaited with the specified {@code _key} +* +*/ + +/** +* This function gets multiple (or all) key-value pairs within the specified {@code _scope} +* +* e.g. +* +* //get the values for all keys within "scope1" +* ["scope1"] call stats_get; +* +* //get the values for "key1", "key2", and "key3" +* ["scope1", ["key1", "default1"], [key2, "default2"], ["key3"]] call stats_get; +* +* +* @param {Strnig} _scope Name of the scope to use +* @param {...Array} [_pair] One or more key-value pairs to retrieve +* @param {String} [_pair[0]] Name of the key +* @param {*} [_pair[1]] Default value to use, if key is not found +* +* @return +* +* On success, returns array containing the key-value pairs. +* e.g. +* +* [["key1","value1"],["key2", "value2"],...] +* +* On failure, returns nil +* +*/ + +stats_get = { + (["get", _this] call stats_read) +}; + + + +/** +* This function pops the value at the end of the array at {@code _key}, within the specified {@code _scope} +* +* e.g. +* +* //pop the value for array at "key1" +* ["scope", "key1"] call stats_pop; +* +* //pop the value for array at "key1", or use "default1" if not found +* ["scope", "key1", "default1"] call stats_pop; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key to pop value off +* @param {*} [_default] Default value to use if {@code _key} does not exist +* @return +* +* The value assocaited with the specified {@code _key} +* +*/ + +/** +* This function pops multiple values for the arrays at the specified keys, within the given {@code _scope} +* +* e.g. +* +* +* //pop the values for arrays at "key1", "key2", and "key3" +* ["scope1", ["key1", "default1"], [key2, "default2"], ["key3"]] call stats_pop; +* + +* @param {Strnig} _scope Name of the scope to use +* @param {...Array} [_pair] One or more key-value pairs to retrieve +* @param {String} [_pair[0]] Name of the key to pop value off +* @param {*} [_pair[1]] Default value to use, if key is not found +* +* @return +* +* On success, returns array containing the key-value pairs. +* e.g. +* +* [["key1","value1"],["key2", "value2"],...] +* +* On failure, returns nil +* +*/ + +stats_pop = { + (["pop", _this] call stats_read) +}; + + +/** +* This function shifts the value at the begining of the array at {@code _key}, within the specified {@code _scope} +* +* e.g. +* +* //shift the value for array at "key1" +* ["scope", "key1"] call stats_shift; +* +* //shift the value for array at "key1", or use "default1" if not found +* ["scope", "key1", "default1"] call stats_shift; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key to shift value out +* @param {*} [_default] Default value to use if {@code _key} does not exist +* @return +* +* The value assocaited with the specified {@code _key} +* +*/ + +/** +* This function shifts multiple values for the arrays at the specified keys, within the given {@code _scope} +* +* e.g. +* +* +* //shift the values for arrays at "key1", "key2", and "key3" +* ["scope1", ["key1", "default1"], [key2, "default2"], ["key3"]] call stats_shift; +* +* +* @param {Strnig} _scope Name of the scope to use +* @param {...Array} [_pair] One or more key-value pairs to retrieve +* @param {String} [_pair[0]] Name of the key to shift value out +* @param {*} [_pair[1]] Default value to use, if key is not found +* +* @return +* +* On success, returns array containing the key-value pairs. +* e.g. +* +* [["key1","value1"],["key2", "value2"],...] +* +* On failure, returns nil +* +*/ +stats_shift = { + (["shift", _this] call stats_read) +}; + +/** +* This function counts the child keys within the given {@code _scope} +* +* e.g. +* +* //count child keys at "scope1" +* ["scope"] call stats_count; +* +* +* @param {String} _scope Name of the scope to use +* +* @return +* +* The count of child keys at the specified {@code _scope} +* +*/ + +/** +* This function counts the child keys at the specified {@code _key}, within the given {@code _scope} +* +* e.g. +* +* //count child keys at "key1" +* ["scope", "key1"] call stats_count; +* +* //count the child keys at "key1", or use -1 if not found +* ["scope", "key1", -1] call stats_count; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key where child keys will be counted +* @param {*} [_default] Default value to use if {@code _key} does not exist +* @return +* +* The count of child keys at the specified {@code _key} +* +*/ + +/** +* This function counts the child keys for one or more of the specified keys, within the given {@code _scope} +* +* e.g. +* +* +* //count the child keys at "key1", "key2", and "key3" +* ["scope1", ["key1", -1], [key2, -1], ["key3", -1]] call stats_count; +* +* +* @param {Strnig} _scope Name of the scope to use +* @param {...Array} [_pair] One or more key-value pairs +* @param {String} [_pair[0]] Name of the key where child keys will be counted +* @param {*} [_pair[1]] Default value to use, if key is not found +* +* @return +* +* On success, returns array containing the key-value pairs. +* e.g. +* +* [["key1", 0],["key2", 2], ["key3", -1], ...] +* +* On failure, returns nil +* +*/ +stats_count = { + (["count", _this] call stats_read) +}; + + + +/** +* This function retrieves the names of child keys within the given {@code _scope} +* +* e.g. +* +* //retrieve the names of child keys at "scope1" +* ["scope"] call stats_keys; +* +* +* @param {String} _scope Name of the scope to use +* +* @return +* +* Array containing the names of child keys +* +* e.g. +* +* ["key1", "key2", "key3", ...] +* +* +*/ + +/** +* This function retrievs the names of child keys at the specified {@code _key}, within the given {@code _scope} +* +* e.g. +* +* //retrieve the names of child keys at "key1" +* ["scope", "key1"] call stats_keys; +* +* //retrieve the names of child keys at "key1", or use nil if not found +* ["scope", "key1", nil] call stats_keys; +* +* @param {String} _scope Name of the scope to use +* @param {String} _key Name of the key where the names of child keys will be retrieved +* @param {*} [_default] Default value to use if {@code _key} does not exist +* @return +* +* On success returns an array with the names of the child keys within specified {@code _key} +* +* e.g. +* +* [ "a", "b", "c"] +* +* On failure, or if the key is not found, returns the default value +* +*/ + +/** +* This function retrieves the names of child keys for one or more of the specified keys, within the given {@code _scope} +* +* e.g. +* +* +* //retrieve the names of child keys at "key1", "key2", and "key3" +* ["scope1", ["key1", nil], ["key2", []], ["key3", nil]] call stats_keys; +* +* +* @param {Strnig} _scope Name of the scope to use +* @param {...Array} [_pair] One or more key-value pairs +* @param {String} [_pair[0]] Name of the key where the names of chikd keys will be retreived +* @param {*} [_pair[1]] Default value to use, if key is not found +* +* @return +* +* On success, returns array containing the key-value pairs. +* e.g. +* +* [["key1", ["a", "b", "c"]],["key2", []], ["key3", nil], ...] +* +* On failure, returns nil +* +*/ + +stats_keys = { + (["keys", _this] call stats_read) +}; + + +stats_read = { + if (isNil "_this") exitWith {}; + format["%1 stats_get;", _this] call stats_log_fine; + + ARGVX3(0,_operation,""); + ARGVX3(1,_this,[]); + + init(_method, _operation); + init(_params,_this call stats_build_params); + if (undefined(_params)) exitWith {nil}; + + def(_result); + _result = [_method, _params] call sock_rpc; + + + /* For single result operations, - Expect anything + * get(scope, key, default) + * shift(scope, key default) + * pop(scope, key, default) + * count(scope) + * keys(scope) + * Expect anything as the result + */ + if (isSTRING(xGet(_params,1)) || { + ((["keys","count"] find _method) >= 0 && { undefined(xGet(_params,1))}) + }) exitWith { + OR(_result,nil) + }; + + /* For multi result operations, + * get(scope) + * get(scope, [k,v],...) + * pop(scope, [k,v],...) + * shift(scope, [k,v],...) + * keys(scope, [k,v],...) + * count(scope, [k,v],...) + * Expect as result + * + * A code {[["k", "v"],["k", "v"],...]} for a sucessful response + * A string result might indicate an error message + * A nil result is an outright failure + */ + + + if (undefined(_result)) exitWith { + format["was expecting _result of typeName %1, but instead got nil during %2 operation", typeName {}, _method] call stats_log_severe; + nil + }; + + //an error must have occurred + if (isSTRING(_result)) exitWith { + _result call stats_log_severe; + nil + }; + + if (not(isCODE(_result))) exitWith { + format["was expecting _result of typeName %1, but instead got typeName %2 during %3 operation", typeName {}, typeName _result, _method] call stats_log_severe; + nil + }; + + (call _result) +}; + +/** +* This function flushes data (on server side) associated with one or more scopes +* +* Flushing means that the remote data will be saved to the database, and removed from memory. +* This is useful to call once a player has disconnected from the server. +* +* e.g. +* +* //flush the stats for "scope1" +* stats_flush("scope1"); +* +* //flush the stats for "scope1", and "scope2" +* stats_flush("scope1", "scope2") +* +* @param {...String} _scope One or more scope anmes +* @return +* +* The the number of scopes that were flushed. +* +*/ +stats_flush = { + if (isNil "_this") exitWith {}; + format["%1 stats_flush;", _this] call stats_log_fine; + + if (!isARRAY(_this)) exitWith {nil}; + + init(_method, "flush"); + init(_params,_this); + + def(_result); + _result = [_method, _params] call sock_rpc; + if (undefined(_result)) exitWith {nil}; + + + if (isSTRING(_result)) exitWith { + _result call stats_log_severe; + nil + }; + + if (not(isSCALAR(_result))) exitWith { + format["protocol error: was expecting _result of typeName %1, but instead got typeName %2", typeName 0, typeName _result] call stats_log_severe; + nil + }; + + _result +}; + + + + +/** +* This function wipes all keys within a specific scope +* +* +* e.g. +* +* //wipe all keys for "scope1" +* stats_wipe("scope1"); +* +* @param {String} _scope Scope to wipe +* @return +* +* True on success, false on failure +* +*/ +stats_wipe = { + if (isNil "_this") exitWith {fale}; + format["%1 stats_wipe;", _this] call stats_log_fine; + + if (!isARRAY(_this)) exitWith {false}; + + init(_method, "wipe"); + init(_params,_this); + + def(_result); + _result = [_method, _params] call sock_rpc; + if (undefined(_result)) exitWith {false}; + + + if (isSTRING(_result)) exitWith { + _result call stats_log_severe; + false + }; + + if (not(isBOOLEAN(_result))) exitWith { + format["protocol error: was expecting _result of typeName %1, but instead got typeName %2", typeName false, typeName _result] call stats_log_severe; + false + }; + + _result +}; + + + +diag_log format["loading stats library complete"]; \ No newline at end of file diff --git a/persistence/sock/stats_extra.sqf b/persistence/sock/stats_extra.sqf new file mode 100644 index 000000000..1e5f03970 --- /dev/null +++ b/persistence/sock/stats_extra.sqf @@ -0,0 +1,35 @@ +diag_log format["loading sock-rpc-stats extra functions ..."]; + +#include "macro.h" + +stats_hash_pairs = { + ARGV3(0,_hash,{}); + ARGV2(1,_default); + + if (isNil "_hash") exitWith { + OR(_default,[]) + }; + + init(_val, call _hash); + OR(_val,[]) +}; + +stats_hash_set = { + ARGVX3(0,_scope,""); + ARGVX3(1,_key,""); + ARGVX3(2,_pairs,[]); + + init(_request,[]); + _request pushBack _scope; + + { + _request pushBack [_key + "." + (_x select 0), _x select 1]; + } forEach _pairs; + + if (count(_request) > 1) then { + _request call stats_set; + }; +}; + + +diag_log format["loading sock-rpc-stats extra functions complete"]; diff --git a/persistence/world/hLoad.sqf b/persistence/world/hLoad.sqf new file mode 100644 index 000000000..6b3cce998 --- /dev/null +++ b/persistence/world/hLoad.sqf @@ -0,0 +1,37 @@ +if (hasInterface) exitWith {}; +diag_log "hLoad.sqf loading ..."; +#include "macro.h" + +externalConfigFolder = "\A3Wasteland_settings"; +call compile preprocessFileLineNumbers "server\default_config.sqf"; +call compile preprocessFileLineNumbers (externalConfigFolder + "\main_config.sqf"); +call compile preprocessFileLineNumbers "persistence\fn_sock_custom.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\hash.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\shFunctions.sqf"; + + +def(_var); +def(_val); +{ + _var = _x; + diag_log format["Syncing variable %1 ...", _var]; + [_var] call sh_sync; + _val = missionNamespace getVariable _var; + + if (isARRAY(_val)) then { + diag_log format["count(%1) = %2", _var, count(_val)]; + } + else { + diag_log format["%1 = %2", _var,OR(_val,nil)]; + }; + + diag_log format["Syncing variable %1 complete", _var]; + +} forEach ["active_players_list", "tracked_objects_list", "tracked_vehicles_list"]; + +call compile preprocessFileLineNumbers "persistence\players\sFunctions.sqf"; +call compile preprocessFileLineNumbers "persistence\players\pFunctions.sqf"; +call compile preprocessFileLineNumbers "persistence\world\vFunctions.sqf"; +call compile preprocessFileLineNumbers "persistence\world\oFunctions.sqf"; +HeadlessClient setVariable ["hc_ready", true, true]; +diag_log "hLoad.sqf loading complete"; diff --git a/persistence/world/macro.h b/persistence/world/macro.h new file mode 100644 index 000000000..f6929bfb5 --- /dev/null +++ b/persistence/world/macro.h @@ -0,0 +1,163 @@ +//null abstraction +#define _undefined objNull + +#define isARRAY(x) \ +(not(isNil {x}) && {typeName x == typeName []}) + +#define isSTRING(x) \ +(not(isNil {x}) && {typeName x == typeName ""}) + +#define isSCALAR(x) \ +(not(isNil {x}) && {typeName x == typeName 0}) + +#define isBOOLEAN(x) \ +(not(isNil {x}) && {typeName x == typeName true}) + +#define isOBJECT(x) \ +(not(isNil {x}) && {typeName x == typeName objNull}) + +#define isCODE(x) \ +(not(isNil {x}) && {typeName x == typeName {}}) + +#define isSIDE(x) \ +(not(isNil {x}) && {typeName x == typeName sideUnknown}) + +#define isPOS(x) \ +(isARRAY(x) && {count(x) == 3}) + + +#define isNullable(x) (false ||{ \ + not(isNil {x}) &&{ \ + private["_t"]; \ + _t = typeName x; \ + _t == typeName controlNull ||{ \ + _t == typeName displayNull ||{ \ + _t == typeName locationNull ||{ \ + _t == typeName taskNull ||{ \ + _t == typeName grpNull ||{ \ + _t == typeName objNull \ + }}}}}}}) + +//safer version of isNull that will not crap out when passed number, array, code, string +#define _isNull(x) (isNil {x} || ({isNullable(x) && {isNull x}})) +#define undefined(x) _isNull(x) +#define defined(x) (not(undefined(x))) + +#define getIf(cond,v1,v2) \ +(if (cond) then {v1} else {v2}) + +#define getUnless(cond,v1,v2) \ +getIf(not(cond),v1,v2) + + +#define OR(x,y) \ +getIf(defined(x),x,y) + +#define OR_ARRAY(v,d) (if (isARRAY(v)) then {v} else {d}) +#define OR_SCALAR(v,d) (if(isSCALAR(v)) then {v} else {d}) +#define OR_STRING(v,d) (if (isSTRING(v)) then {v} else {d}) +#define OR_BOOLEAN(v,d) (if(isBOOLEAN(v)) then {v} else {d}) +#define OR_OBJECT(v,d) (if(isOBJECT(v)) then {v} else {d}) +#define OR_SIDE(v,d) (if(isSIDE(v)) then {v} else {d}) +#define OR_CODE(v,d) (if(isCODE(v)) then {v} else {d}) + +#define OR_POSITIVE(v,d) (if (isSCALAR(v) && {v > 0}) then {v} else {d}) + + +#define AND(x,y) \ +OR(v,y) + +#define def(x) \ +private[#x] + +#define init(x,v) def(x); \ +x = v + +#define setIf(cond,x,v1,v2) \ +x = if (cond) then {v1} else {v2} + +#define assignIf setIf + +#define setUnless(cond,x,v1,v2) \ +x = if (cond) then {v2} else {v1} + + +#define assignUnless setUnless + +#define initIf(cond,x,v1,v2) \ +def(x); \ +setIf(cond,x,v1,v2) + +#define initUnless(cond,x,v1,v2) \ +def(x); \ +setUnless(cond,x,v1,v2) + + +//Assign argument at index o to variable v if it's of type t, else default to d +#define ARGV4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) then { \ + v = d; \ +}; + +//Assign argument at index o, to variable v if it's of type t, else default to nil +#define ARGV3(o,v,t) ARGV4(o,v,t,nil) + +//Assign argument at index o to variable v, else default to nil +#define ARGV2(o,v) ARGV3(o,v,nil) + + +//Assign argument at index o to variable v if it's of type t, else exit with d +#define ARGVX4(o,v,t,d) \ +private[#v]; \ +if (undefined(_this) ||{ \ + typeName _this != typeName [] ||{ \ + o >= (count _this) ||{ \ + v = _this select o; undefined(v) ||{ \ + (#t != "nil" && {typeName v != typeName t}) \ + }}}}) exitWith { \ + d \ +}; + +//Assign argument at index o, to variable v if it's of type t, else exit with nil +#define ARGVX3(o,v,t) ARGVX4(o,v,t,nil) + +//Assign argument at index o to variable v, else exit with nil +#define ARGVX2(o,v) ARGVX3(o,v,nil) + + + + + +#define DO if (true) then + +#define xGet(x,o) (if (o >= count(x)) then {nil} else {x select o}) +#define xSet(x,o,v) (x set [o, OR(v,nil)]) +#define xPush(x,v) (xSet(x,count(x),v)) +#define xPushIf(cond,x,v) if (cond) then {xPush(x,v);} +#define xPushUnless(cond,x,v) xPushIf(not(cond),x,v) + + +#define isClient not(isServer) || {isServer && not(isDedicated)} + +#define IMPORT_FINALIZER if (isNil "finalize") then { \ + finalizer = { \ + if (isNil "_this" || {typeName _this != typeName {}}) exitWith {}; \ + \ + private["_str_data"]; \ + _str_data = toArray str(_this); \ + \ + private["_space"]; \ + _space = (toArray " ") select 0;\ + _str_data set [0, _space]; \ + _str_data set [((count _str_data)-1), _space]; \ + \ + (compileFinal (toString _str_data)) \ + }; \ + finalizer = finalizer call finalizer; \ +}; \ No newline at end of file diff --git a/persistence/world/oFunctions.sqf b/persistence/world/oFunctions.sqf new file mode 100644 index 000000000..e26ed6f5c --- /dev/null +++ b/persistence/world/oFunctions.sqf @@ -0,0 +1,947 @@ +// @file Version: 0.1 +// @file Name: oFunctions.sqf +// @file Author: micovery +// @file Description: Object loading + +diag_log "oFunctions.sqf loading ..."; + + +call compile preprocessFileLineNumbers "persistence\lib\shFunctions.sqf"; + +#include "macro.h"; + +o_loadingOrderArray = ["Building","StaticWeapon","ReammoBox_F", "All"]; + +diag_log format ["===== Loading order: ====="]; +{ + diag_log format ["%1: %2", _forEachIndex+1,_x]; +} forEach o_loadingOrderArray; +diag_log format ["=========================="]; + +o_hasInventory = { + ARGVX2(0,_arg); + + def(_class); + if (isOBJECT(_arg)) then { + _class = typeOf _arg; + }; + + if (isSTRING(_arg)) then { + _class = _obj; + }; + + if (!isSTRING(_class) || {_class == ""}) exitWith {false}; + + def(_config); + _config = (configFile >> "CfgVehicles" >> _class); + + (isClass _config && { + getNumber (_config >> "transportMaxWeapons") > 0 || + getNumber (_config >> "transportMaxMagazines") > 0 || + getNumber (_config >> "transportMaxBackpacks") > 0}) +}; + +o_isSaveable = { + //diag_log format["%1 call o_isSaveable", _this]; + ARGVX4(0,_obj,objNull,false); + + init(_class, typeOf _obj); + + if ([_obj] call sh_isSaveableVehicle) exitWith {false}; //already being saved as a vehicle, don't save it + if ([_obj] call o_isInSaveList) exitWith {true}; //not sure what this "saveList" thing is ... + + + if ([_obj] call sh_isBeacon) exitWith { + (cfg_spawnBeaconSaving_on) + }; + + if ([_obj] call sh_isWarchest) exitWith { + (cfg_warchestSaving_on) + }; + + if ([_obj] call sh_isStaticWeapon) exitWith { + (cfg_staticWeaponSaving_on) + }; + + if (([_obj] call sh_isMine)&& {[_obj] call sh_isSaveableMine}) exitWith { + (cfg_mineSaving_on) + }; + + if ([_obj] call sh_isCamera) exitWith { + (cfg_cctvCameraSaving_on) + }; + + + def(_locked); + _locked = _obj getVariable ["objectLocked", false]; + + if ([_obj] call sh_isBox) exitWith { + (cfg_boxSaving_on && {_locked}) + }; + + (cfg_boxSaving_on && {_locked}) +}; + +o_isLockableObject = { + ARGVX4(0,_obj,objNull, false); + + not(([_obj] call sh_isWarchest) || {[_obj] call sh_isBeacon}) +}; + +o_varBroadcast = { + ARGVX3(0,_name,""); + ARGV2(1,_val); + missionNamespace setVariable [_name,OR(_val,nil)]; + publicVariable _name; +}; + +o_getMaxLifeTime = { + ARGV3(0,_class,""); + + if (isNil "_class") exitWith {A3W_objectLifeTime}; + if ([_class] call sh_isMine) exitWith {A3W_mineLifeTime}; + + A3W_objectLifeTime +}; + +o_restoreDirection = { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_vectors,[]); + + if ([_obj] call sh_isMine) exitWith { + //special handling for mines, because setVectorUpAndDir has local effects only ... on mines + [[_obj,_vectors], "A3W_fnc_setVectorUpAndDir",true, true] call BIS_fnc_MP; + }; + + _obj setVectorDirAndUp _vectors; +}; + + +o_restoreHoursAlive_withVars = { + ARGVX3(0,_obj,objNull); + ARGVX2(1,_hours_alive,0); + + _obj setVariable ["baseSaving_spawningTime", diag_tickTime, true]; + if (!isNil "_hours_alive") then { + _obj setVariable ["baseSaving_hoursAlive", _hours_alive, true]; + }; +}; + +o_restoreHoursAlive_withGlobals = { + ARGVX3(0,_obj,objNull); + ARGVX2(1,_hours_alive,0); + + def(_netId); + _netId = netId _obj; + //diag_log format["_netId = %1", _netId]; + + [format["%1_spawningTime",_netId], diag_tickTime] call o_varBroadcast; + + if (!isNil "_hours_alive") then { + [format["%1_hoursAlive",_netId], _hours_alive] call o_varBroadcast; + }; +}; + +o_restoreHoursAlive = { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_hours_alive,0); + + if ([_obj] call sh_isMine) exitWith { + [_obj, OR(_hours_alive,nil)] call o_restoreHoursAlive_withGlobals; + }; + + [_obj, OR(_hours_alive,nil)] call o_restoreHoursAlive_withVars; + +}; + +o_restoreMineVisibility = { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_variables,[]); + + + def(_mineVisibility); + _mineVisibility = [_variables, "mineVisibility"] call hash_get_key; + if (!isARRAY(_mineVisibility)) exitWith {}; + + def(_side); + { + _side = _x call sh_strToSide; + _side revealMine _obj; + //diag_log format["Revealing mine %1 to %2", _obj, _side]; + } forEach _mineVisibility; +}; + +o_restoreObject = { + //diag_log format["%1 call o_restoreObject", _this]; + ARGVX3(0,_data_pair,[]); + + _this = _data_pair; + ARGVX3(0,_object_key,""); + ARGVX2(1,_object_hash); + + if (!isCODE(_object_hash)) exitWith {}; + + def(_object_data); + _object_data = call _object_hash; + //diag_log _object_data; + + def(_hours_alive); + def(_pos); + def(_class); + def(_dir); + def(_damage); + def(_allowDamage); + def(_texture); + def(_variables); + def(_cargo_weapons); + def(_cargo_magazines); + def(_cargo_backpacks); + def(_cargo_items); + def(_cargo_ammo); + def(_cargo_fuel); + def(_cargo_repair); + def(_turret0); + def(_turret1); + def(_turret2); + + def(_key); + def(_value); + + { + _key = _x select 0; + _value = _x select 1; + switch (_key) do { + case "Class": { _class = OR(_value,nil);}; + case "Position": { _pos = OR(_value,nil);}; + case "Direction": { _dir = OR(_value,nil);}; + case "Damage": { _damage = OR(_value,nil);}; + case "AllowDamage": { _allowDamage = OR(_value,nil);}; + case "Texture": { _texture = OR(_value,nil);}; + case "Weapons": { _cargo_weapons = OR(_value,nil);}; + case "Items": { _cargo_items = OR(_value,nil);}; + case "Magazines": { _cargo_magazines = OR(_value,nil);}; + case "Backpacks": { _cargo_backpacks = OR(_value,nil);}; + case "AmmoCargo": { _cargo_ammo = OR(_value,nil);}; + case "FuelCargo": { _cargo_fuel = OR(_value,nil);}; + case "RepairCargo": { _cargo_repair = OR(_value,nil);}; + case "HoursAlive": { _hours_alive = OR(_value,nil);}; + case "Variables": { _variables = OR(_value,nil);}; + case "TurretMagazines": { _turret0 = OR_ARRAY(_value,nil);}; + case "TurretMagazines2": { _turret1 = OR_ARRAY(_value,nil);}; + case "TurretMagazines3": { _turret2 = OR_ARRAY(_value,nil);}; + }; + } forEach _object_data; + + //if there is no class and position, there is no point to recreating the object + if (not(isSTRING(_class)) || {not(isARRAY(_pos))}) exitWith { + diag_log format["No class or position available for object: %1", _object_key]; + }; + + + //AgentRev changed how position is saved, put this fail-safe to handle position with values as strings + { if (isSTRING(_x)) then { _pos set [_forEachIndex, parseNumber _x] } } forEach _pos; + + diag_log format["%1(%2) is being restored.", _object_key, _class]; + + def(_max_life_time); + _max_life_time = [_class] call o_getMaxLifeTime; + + if (isSCALAR(_hours_alive) && {_max_life_time > 0 && {_hours_alive > _max_life_time}}) exitWith { + diag_log format["object %1(%2) has been alive for %3 (max=%4), skipping it", _object_key, _class, _hours_alive, _max_life_time]; + }; + + def(_isMine); + _isMine = [_class] call sh_isMine; + + def(_obj); + if (_isMine) then { + _obj = createMine[_class, _pos, [], 0]; + } + else { + _obj = createVehicle [_class, _pos, [], 0, "CAN_COLLIDE"]; + _obj allowDamage false; //set damage to false immediately to avoid taking fall damage + }; + + if (!isOBJECT(_obj)) exitWith { + diag_log format["object %1(%2) could not be created.", _object_key, _class]; + }; + + _obj setVariable ["object_key", _object_key, true]; + + [_obj, _variables] call sh_restoreVariables; + + //for backwards compatibility, if the object does not have the "objectLocked" variable, then lock it + def(_objectLocked); + _objectLocked = _obj getVariable "objectLocked"; + if (!isBOOLEAN(_objectLocked) && {[_obj] call o_isLockableObject}) then { + _obj setVariable ["objectLocked", true, true]; + }; + + //Mine is revealed for all players in a side. Should do sth with independent side when it's possible. + if (_isMine) then { + [_obj,_variables] call o_restoreMineVisibility; + }; + + + if (not([_obj] call o_isSaveable)) exitWith { + diag_log format["%1(%2) has been deleted, it is not saveable", _object_key, _class]; + deleteVehicle _obj; + }; + + + + _obj setPosWorld ATLtoASL _pos; + [_obj, OR(_dir,nil)] call o_restoreDirection; + [_obj, OR(_hours_alive,nil)] call o_restoreHoursAlive; + + if (isSCALAR(_damage)) then { + _obj setDamage _damage; + }; + + _allowDamage = true; + + if (_class isKindOf "Box_NATO_Wps_F" || _class isKindOf "Box_NATO_WpsSpecial_F" || _class isKindOf "Box_East_Wps_F" || _class isKindOf "Box_East_WpsSpecial_F" || _class isKindOf "Box_IND_Wps_F" || _class isKindOf "Box_IND_WpsSpecial_F" || _class isKindOf "Box_NATO_Ammo_F" || _class isKindOf "Box_FIA_Support_F" || _class isKindOf "Box_FIA_Wps_F" || _class isKindOf "Box_FIA_Ammo_F") then { + _allowDamage = false; + }; + + [_obj, _allowDamage] spawn { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_allowDamage,false); + //delay the allow damage to allow the box to settle + sleep 5; + _obj setVariable ["allowDamage", _allowDamage]; + _obj allowDamage _allowDamage; + }; + + //broadcast the spawn beacon + if ([_obj] call sh_isBeacon) then { + pvar_spawn_beacons pushBack _obj; + publicVariable "pvar_spawn_beacons"; + }; + + cctv_cameras = OR(cctv_cameras,[]); + if ([_obj] call sh_isCamera) then { + cctv_cameras pushBack _obj; + publicVariable "cctv_cameras"; + }; + + //restore the stuff inside the object + clearWeaponCargoGlobal _obj; + clearMagazineCargoGlobal _obj; + clearItemCargoGlobal _obj; + clearBackpackCargoGlobal _obj; + _obj setVehicleAmmo 0; + + if (isARRAY(_cargo_weapons)) then { + { _obj addWeaponCargoGlobal _x } forEach _cargo_weapons; + }; + + if (isARRAY(_cargo_backpacks)) then { + { + if (isARRAY(_x) && {not((_x select 0) isKindOf "Weapon_Bag_Base")}) then { + _obj addBackpackCargoGlobal _x + }; + } forEach _cargo_backpacks; + }; + + if (isARRAY(_cargo_items)) then { + { _obj addItemCargoGlobal _x } forEach _cargo_items; + }; + + if (isARRAY(_cargo_magazines)) then { + { _obj addMagazineCargoGlobal _x } forEach _cargo_magazines; + }; + + [_obj, OR(_turret0,nil), OR(_turret1,nil), OR(_turret2,nil)] call sh_restoreVehicleTurrets; + + if (isSCALAR(_cargo_ammo)) then { + _obj setAmmoCargo _cargo_ammo; + }; + + if (isSCALAR(_cargo_fuel)) then { + _obj setFuelCargo _cargo_fuel; + }; + + if (isSCALAR(_cargo_repair)) then { + _obj setRepairCargo _cargo_repair; + }; + + //AddAi to vehicle + if ([_obj] call sh_isUAV_UGV) then { + createVehicleCrew _obj; + }; + + //Remove money + private["_max_money"]; + _max_money = 1000000; + + if (_obj getVariable ["cmoney", 0] > _max_money) then { + _obj setVariable ["cmoney", _max_money, true]; + }; + + if (not([_obj] call sh_isMine)) exitWith { //don't put mines in the tracked objects list (we use allMines) + //objects, warchests, and beacons + tracked_objects_list pushBack _obj; + }; + +}; + + + +//pre-define a list of objects that can be saved +o_saveList = []; +{if (true) then { + if (not(cfg_baseSaving_on)) exitWith {}; + if (!isARRAY(_x) || {count(_x) == 0}) exitWith {}; + def(_obj); + _obj = _x select 1; + + if (!isOBJECT(_obj)) exitWith {}; + if (_obj isKindOf "ReammoBox_F") exitWith {}; + if ((o_saveList find _obj) >= 0) exitWith {}; + + o_saveList pushBack _obj; +};} forEach [OR(objectList,[]), OR(call genObjectsArray,[])]; + + +o_isInSaveList = { + ARGVX4(0,_obj,objNull,false); + ((o_saveList find _obj) >= 0) +}; + +o_fillVariables = { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_variables,[]); + + if (_obj isKindOf "Land_Sacks_goods_F") then { + _variables pushBack ["food", _obj getVariable ["food", 20]]; + }; + + if (_obj isKindOf "Land_BarrelWater_F") then { + _variables pushBack ["water", _obj getVariable ["water", 20]]; + }; + + def(_ownerUID); + _ownerUID = _obj getVariable "ownerUID"; + if (isSTRING(_ownerUID)) then { + _variables pushBack ["ownerUID", _ownerUID]; + }; + + def(_ownerN); + _ownerN = _obj getVariable "ownerN"; + if (isSTRING(_ownerN)) then { + _variables pushBack ["ownerN", _ownerN]; + }; + + if ([_obj] call sh_isBox) then { + _variables pushBack ["cmoney", _obj getVariable ["cmoney", 0]]; + }; + + if ([_obj] call sh_isWarchest) then { + _variables pushBack ["a3w_warchest", true]; + _variables pushBack ["R3F_LOG_disabled", true]; + _variables pushBack ["side", str (_obj getVariable ["side", sideUnknown])]; + }; + + if ([_obj] call sh_isBeacon) then { + _variables pushBack ["a3w_spawnBeacon", true]; + _variables pushBack ["R3F_LOG_disabled", true]; + _variables pushBack ["side", str(_obj getVariable ["side", sideUnknown])]; + _variables pushBack ["packing", false]; + _variables pushBack ["groupOnly", _obj getVariable ["groupOnly", false]]; + _variables pushBack ["ownerName", _obj getVariable ["ownerName", "[Beacon]"]]; + }; + + if ([_obj] call sh_isCamera) then { + _variables pushBack ["a3w_cctv_camera", (_obj getVariable ["a3w_cctv_camera", nil])]; + _variables pushBack ["camera_name", (_obj getVariable ["camera_name", nil])]; + _variables pushBack ["camera_owner_type", (_obj getVariable ["camera_owner_type", nil])]; + _variables pushBack ["camera_owner_value", (_obj getVariable ["camera_owner_value", nil])]; + _variables pushBack ["mf_item_id", (_obj getVariable ["mf_item_id", nil])]; + }; + + if ([_obj] call sh_isBoomerang) then { + _variables pushBack ["is_boomerang", (_obj getVariable "is_boomerang")]; + _variables pushBack ["has_boomerang", (_obj getVariable "has_boomerang")]; + _variables pushBack ["boomerang_owner_type", (_obj getVariable "boomerang_owner_type")]; + _variables pushBack ["boomerang_owner_value", (_obj getVariable "boomerang_owner_value")]; + _variables pushBack ["mf_item_id", (_obj getVariable "mf_item_id")]; + }; + + + if ([_obj] call sh_isMine) then { + init(_mineVisibility,[]); + { + if (_obj mineDetectedBy _x) then { + _mineVisibility pushBack str(_x); + } + } forEach [EAST,WEST,INDEPENDENT]; + + _variables pushBack ["mineVisibility", _mineVisibility]; + }; + + def(_r3fSide); + _r3fSide = _obj getVariable "R3F_Side"; + if (!isNil "_r3fSide" && {typeName _r3fSide == typeName sideUnknown}) then { + _variables pushBack ["R3F_Side", str _r3fSide]; + }; + + _variables pushBack ["objectLocked", _obj getVariable "objectLocked"]; +}; + +o_getVehClass = { + ARGVX3(0,_obj,objNull); + + def(_class); + _class = typeOf _obj; + + if ([_class] call sh_isMine) exitWith { + ([_class] call sh_mineAmmo2Vehicle) + }; + + _class +}; + +o_getHoursAlive_withVars = { + ARGVX4(0,_obj,objNull,0); + + def(_spawnTime); + def(_hoursAlive); + _spawnTime = _obj getVariable "baseSaving_spawningTime"; + _hoursAlive = _obj getVariable "baseSaving_hoursAlive"; + + if (!isSCALAR(_spawnTime)) then { + _spawnTime = diag_tickTime; + _obj setVariable ["baseSaving_spawningTime", _spawnTime, true]; + }; + + if (!isSCALAR(_hoursAlive)) then { + _hoursAlive = 0; + _obj setVariable ["baseSaving_hoursAlive", _hoursAlive, true]; + }; + + def(_totalHours); + _totalHours = _hoursAlive + (diag_tickTime - _spawnTime) / 3600; + + //diag_log format["_obj = %1, _totalHours = %2, _spawnTime = %3, _hoursAlive = %4",_obj, _totalHours, _spawnTime, _hoursAlive]; + + (_totalHours) +}; + +o_getHoursAlive_withGlobals = { + ARGVX4(0,_obj,objNull,0); + + def(_spawnTime); + def(_hoursAlive); + def(_netId); + + _netId = netId _obj; + //diag_log format["_netId = %1", _netId]; + + _spawnTime = missionNamespace getVariable format["%1_spawningTime", _netId]; + _hoursAlive = missionNamespace getVariable format["%1_hoursAlive", _netId]; + + if (!isSCALAR(_spawnTime)) then { + _spawnTime = diag_tickTime; + [format["%1_spawningTime", _netId], _spawnTime] call o_varBroadcast; + }; + + if (!isSCALAR(_hoursAlive)) then { + _hoursAlive = 0; + [format["%1_hoursAlive", _netId], _hoursAlive] call o_varBroadcast; + }; + + def(_totalHours); + _totalHours = _hoursAlive + (diag_tickTime - _spawnTime) / 3600; + + //diag_log format["_obj = %1, _totalHours = %2, _spawnTime = %3, _hoursAlive = %4",_obj, _totalHours, _spawnTime, _hoursAlive]; + + (_totalHours) +}; + +o_getHoursAlive = { + ARGVX4(0,_obj,objNull,0); + + if ([_obj] call sh_isMine) exitWith { + ([_obj] call o_getHoursAlive_withGlobals) + }; + + ([_obj] call o_getHoursAlive_withVars) +}; + +o_addSaveObject = { + + ARGVX3(0,_list,[]); + ARGVX3(1,_obj,objNull); + + if (not([_obj] call o_isSaveable)) exitWith {}; + if (!(alive _obj)) exitWith {}; + + def(_class); + def(_netId); + def(_pos); + def(_dir); + def(_damage); + def(_allowDamage); + def(_totalHours); + + _class = [_obj] call o_getVehClass; + _netId = netId _obj; + _pos = ASLtoATL getPosWorld _obj; + _dir = [vectorDir _obj, vectorUp _obj]; + _damage = damage _obj; + _allowDamage = if (_obj getVariable ["allowDamage", false]) then { 1 } else { 0 }; + _totalHours = [_obj] call o_getHoursAlive; + + init(_variables,[]); + [_obj,_variables] call o_fillVariables; + + + init(_weapons,[]); + init(_magazines,[]); + init(_items,[]); + init(_backpacks,[]); + + if ([_obj] call o_hasInventory) then { + // Save weapons & ammo + _weapons = (getWeaponCargo _obj) call cargoToPairs; + _magazines = (getMagazineCargo _obj) call cargoToPairs; + _items = (getItemCargo _obj) call cargoToPairs; + _backpacks = (getBackpackCargo _obj) call cargoToPairs; + }; + + def(_all_turrets); + _all_turrets = [nil,nil,nil]; + if ((cfg_staticWeaponSaving_on) && {[_obj] call sh_isStaticWeapon}) then { + _all_turrets = [_obj] call sh_getVehicleTurrets; + }; + init(_turret0,_all_turrets select 0); + init(_turret1,_all_turrets select 1); + init(_turret2,_all_turrets select 2); + + + init(_ammoCargo,getAmmoCargo _obj); + init(_fuelCargo,getFuelCargo _obj); + init(_repairCargo,getRepairCargo _obj); + + + def(_objName); + _objName = _obj getVariable "object_key"; + + if (!isSTRING(_objName) || {_objName == ""}) then { + _objName = format["obj_%1_%2",ceil(time), ceil(random 10000)]; + _obj setVariable ["object_key", _objName, true]; + }; + + _list pushBack [_objName, ([ + ["Class", _class], + ["Position", _pos], + ["Direction", _dir], + ["HoursAlive", _totalHours], + ["Damage", _damage], + ["AllowDamage", _allowDamage], + ["Variables", _variables], + ["Texture", _texture], + ["Weapons", _weapons], + ["Magazines", _magazines], + ["Items", _items], + ["Backpacks", _backpacks], + ["TurretMagazines", OR(_turret0,nil)], + ["TurretMagazines2", OR(_turret1,nil)], + ["TurretMagazines3", OR(_turret2,nil)], + ["AmmoCargo", _ammoCargo], + ["FuelCargo", _fuelCargo], + ["RepairCargo", _repairCargo] + ] call sock_hash)]; + + true +}; + + +o_saveInfo = { + ARGVX3(0,_scope,""); + + init(_fundsWest,0); + init(_fundsEast,0); + + init(_request,[_scope]); + + if (cfg_warchestMoneySaving_on) then { + _fundsWest = ["pvar_warchest_funds_west", 0] call getPublicVar; + _fundsEast = ["pvar_warchest_funds_east", 0] call getPublicVar; + }; + + init(_objName, "Info"); + _request pushBack [ _objName + "." + "WarchestMoneyBLUFOR", _fundsWest]; + _request pushBack [ _objName + "." + "WarchestMoneyOPFOR", _fundsEast]; + + _request call stats_set; +}; + + +o_saveAllObjects = { + ARGVX3(0,_scope,""); + init(_count,0); + init(_request,[_scope]); + + if (count(tracked_objects_list) == 0) exitWith {}; + + [_scope] call stats_wipe; + init(_bulk_size,100); + init(_start_time, diag_tickTime); + init(_last_save, diag_tickTime); + + def(_all_objects); + _all_objects = tracked_objects_list + allMines; + //diag_log format["_all_objects = %1", _all_objects]; + + { + if (!isNil{[_request, _x] call o_addSaveObject}) then { + _count = _count + 1; + }; + + //save objects in bulks + if ((_count % _bulk_size) == 0 && {count(_request) > 1}) then { + init(_save_start, diag_tickTime); + _request call stats_set; + init(_save_end, diag_tickTime); + _request = [_scope]; + diag_log format["o_saveLoop: %1 objects saved in %2 ticks, save call took %3 ticks", (_bulk_size), (diag_tickTime - _start_time), (_save_end - _save_start)]; + _last_save = _save_end; + }; + } forEach (_all_objects); + + if (count(_request) > 1) then { + init(_save_start, diag_tickTime); + _request call stats_set; + init(_save_end, diag_tickTime); + diag_log format["o_saveLoop: %1 objects saved in %2 ticks, save call took %3 ticks", (count(_request) -1), (_save_end - _last_save), (_save_end - _save_start)]; + }; + + diag_log format["o_saveLoop: total of %1 objects saved in %2 ticks", (_count), (diag_tickTime - _start_time)]; + + call o_trackedObjectsListCleanup; +}; + +o_trackedObjectsListCleanup = { + //post cleanup the array + init(_cleanup_start, diag_tickTime); + init(_nulls,[]); + init(_index,-1); + init(_start_size,count(tracked_objects_list)); + while {true} do { + _index = tracked_objects_list find objNull; + if (_index < 0) exitWith {}; + tracked_objects_list deleteAt _index; + }; + init(_end_size,count(tracked_objects_list)); + init(_cleanup_end, diag_tickTime); + diag_log format["o_saveLoop: count(tracked_objects_list) = %1, %2 nulls deleted in %3 ticks", count(tracked_objects_list), (_start_size - _end_size), (_cleanup_end - _cleanup_start)]; +}; + + + + +tracked_objects_list = OR_ARRAY(tracked_objects_list,[]); + +o_getTrackedObjectIndex = { + ARGVX4(0,_obj,objNull,-1); + if (isNull _obj) exitWith {-1}; + + (tracked_objects_list find _obj) +}; + +o_trackObject = { + private["_index","_object"]; + _object = _this select 1; + _index = [OR(_object,nil)] call o_getTrackedObjectIndex; + if (_index >= 0) exitWith {}; + + //forward to HC + ["trackObject", _object] call sh_hc_forward; + + //diag_log format["%1 is being added to the tracked list", _object]; + tracked_objects_list pushBack _object; +}; + +//event handlers for object tracking, and untracking +"trackObject" addPublicVariableEventHandler { _this call o_trackObject;}; + +o_untrackObject = { + private["_index","_object"]; + _object = _this select 1; + _index = [OR(_object,nil)] call o_getTrackedObjectIndex; + if (_index < 0) exitWith {}; + + //forward to HC + ["untrackObject", _object] call sh_hc_forward; + + //diag_log format["%1 is being removed from the tracked list", _object]; + tracked_objects_list deleteAt _index; +}; + +"untrackObject" addPublicVariableEventHandler { _this call o_untrackObject; }; + +fn_manualObjectSave = { + ARGVX3(0,_netId,""); + + def(_object); + _object = objectFromNetId _netId; + if (!isOBJECT(_object)) exitWith {}; + + [_object] call o_trackObject; +}; + +fn_manualObjectDelete = { + ARGVX3(0,_netId,""); + + def(_object); + _object = objectFromNetId _netId; + if (!isOBJECT(_object)) exitWith {}; + + [_object] call o_untrackObject; +}; + +o_saveLoop_iteration = { + ARGVX3(0,_scope,""); + diag_log format["o_saveLoop: Saving all objects ... "]; + [[_scope], o_saveAllObjects] call sh_fsm_invoke; + [_scope] call o_saveInfo; + diag_log format["o_saveLoop: Saving all objects complete"]; +}; + + +o_saveLoop_iteration_hc = { + ARGVX3(0,_scope,""); + + + init(_hc_id,owner HeadlessClient); + diag_log format["o_saveLoop: Offloading objects saving to headless client (id = %1)", _hc_id]; + + o_saveLoop_iteration_hc_handler = [_scope]; + _hc_id publicVariableClient "o_saveLoop_iteration_hc_handler"; + + call o_trackedObjectsListCleanup; +}; + +if (!(hasInterface || isDedicated)) then { + diag_log format["Setting up HC handler for objects"]; + "o_saveLoop_iteration_hc_handler" addPublicVariableEventHandler { + //diag_log format["o_saveLoop_iteration_hc_handler = %1", _this]; + ARGVX3(1,_this,[]); + ARGVX3(0,_scope,""); + _this spawn o_saveLoop_iteration; + }; +}; + +o_saveLoop = { + ARGVX3(0,_scope,""); + while {true} do { + sleep A3W_object_saveInterval; + if (not(isBOOLEAN(o_saveLoopActive) && {!o_saveLoopActive})) then { + if (call sh_hc_ready) then { + [_scope] call o_saveLoop_iteration_hc; + } + else { + [_scope] call o_saveLoop_iteration; + }; + }; + }; +}; + +o_loadInfoPair = { + ARGVX3(0,_name,""); + ARGV2(1,_value); + + if (cfg_warchestMoneySaving_on && _name == "WarchestMoneyBLUFOR" && {isSCALAR(_value)}) exitWith { + pvar_warchest_funds_west = _value; + publicVariable "pvar_warchest_funds_west"; + }; + + if (cfg_warchestMoneySaving_on && _name == "WarchestMoneyOPFOR" && {isSCALAR(_value)}) exitWith { + pvar_warchest_funds_east = _value; + publicVariable "pvar_warchest_funds_east"; + }; +}; + +o_loadInfo = { + ARGVX3(0,_scope,""); + + def(_info); + _info = [_scope, "Info"] call stats_get; + + def(_info_pairs); + _info_pairs = [OR(_info,nil)] call stats_hash_pairs; + + diag_log "_info_pairs"; + diag_log str(_info_pairs); + + def(_name); + def(_value); + { + _name = _x select 0; + _value = _x select 1; + [_name,OR(_value,nil)] call o_loadInfoPair; + + } forEach _info_pairs; +}; + +o_loadObjects = { + ARGVX3(0,_scope,""); + + def(_objects); + _objects = [_scope] call stats_get; + + init(_oIds,[]); + + //nothing to load + if (!isARRAY(_objects)) exitWith { + diag_log format["WARNING: No objects loaded from the database"]; + _oIds + }; + + diag_log format["A3Wasteland - will restore %1 objects", count(_objects)]; + def(_type); + def(_class); + def(_object_data); + init(_restored_objects,0); + init(_total_objects,(count(_objects)-1)); //-1 because the "Info" section is not an object + + { + _type = _x; + + {if (true) then { + + if (!(isARRAY(_x))) exitWith { + diag_log format ["ERROR: o_loadObjects : _objects is not ARRAY. Sth is terribly wrong."]; + }; + + if (!(isCODE((_x select 1)))) exitWith { + diag_log format ["ERROR: o_loadObjects : _objects select 1 is not CODE. Sth is terribly wrong."]; + }; + + _object_data = call (_x select 1); + _class = [_object_data, "Class"] call sh_getValueFromPairs; + + //diag_log format ["_class: %1 || _type: %2", _class, _type]; + if ((isNil "_class") || {not(_class isKindOf _type)}) exitWith {}; + + diag_log format ["Loading %1 type of %2", _class, _type]; + _oIds pushBack (_x select 0); + [_x] call o_restoreObject; + _restored_objects = _restored_objects + 1; + _objects set [_forEachIndex, objNull]; //mark the object fro deletion once it's loaded + + }} forEach _objects; + _objects = _objects - [objNull]; + } forEach o_loadingOrderArray; + + ["tracked_objects_list"] call sh_hc_forward; //forward to headless client (if connected) + + diag_log format["A3Wasteland - Total database objects: %1 ", _total_objects]; + diag_log format["A3Wasteland - Real restored objects: %1 ", _restored_objects]; + + (_oIds) +}; + +diag_log "oFunctions.sqf loading complete"; \ No newline at end of file diff --git a/persistence/world/oLoad.sqf b/persistence/world/oLoad.sqf new file mode 100644 index 000000000..772cb1e85 --- /dev/null +++ b/persistence/world/oLoad.sqf @@ -0,0 +1,29 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Version: 1.2 +// @file Name: oLoad.sqf +// @file Author: micovery +// @file Description: object loading + +if (!isServer) exitWith {}; +diag_log "oLoad.sqf loading ..."; + +call compile preprocessFileLineNumbers "persistence\lib\normalize_config.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\hash.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\shFunctions.sqf"; +call compile preprocessFileLineNumbers "persistence\world\oFunctions.sqf"; + +#include "macro.h" + +init(_oScope, "Objects" call PDB_objectFileName); + +def(_oIds); +_oIds = [[_oScope], o_loadObjects] call sh_fsm_invoke; +[_oScope] call o_loadInfo; +[_oScope] spawn o_saveLoop; + + +diag_log "oLoad.sqf loading complete"; + +(_oIds) diff --git a/persistence/world/vFunctions.sqf b/persistence/world/vFunctions.sqf new file mode 100644 index 000000000..316bad9d7 --- /dev/null +++ b/persistence/world/vFunctions.sqf @@ -0,0 +1,801 @@ +diag_log "vFunctions.sqf loading ..."; + +#include "macro.h" + +v_restoreVehicle = { + //diag_log format["%1 call v_restoreVehicle", _this]; + ARGVX3(0,_data_pair,[]); + ARGV4(1,_ignore_expiration,false,false); + ARGV3(2,_create_array,[]); + + _this = _data_pair; + ARGVX3(0,_vehicle_key,""); + ARGVX2(1,_vehicle_hash); + + + def(_vehicle_data); + if (isCODE(_vehicle_hash)) then { + _vehicle_data = call _vehicle_hash; + } + else { if(isARRAY(_vehicle_hash)) then { + _vehicle_data = _vehicle_hash; + };}; + + if (isNil "_vehicle_data") exitWith {}; + + //diag_log _vehicle_data; + + + def(_hours_alive); + def(_hours_abandoned); + def(_pos); + def(_class); + def(_dir); + def(_damage); + def(_texture); + def(_variables); + def(_cargo_weapons); + def(_cargo_magazines); + def(_cargo_backpacks); + def(_cargo_items); + def(_cargo_ammo); + def(_cargo_fuel); + def(_cargo_repair); + def(_fuel); + def(_hitPoints); + def(_turret0); + def(_turret1); + def(_turret2); + def(_lock_state); + + + def(_key); + def(_value); + + { + _key = _x select 0; + _value = _x select 1; + switch (_key) do { + case "Class": { _class = OR(_value,nil);}; + case "Position": { _pos = OR(_value,nil);}; + case "Direction": { _dir = OR(_value,nil);}; + case "Damage": { _damage = OR(_value,nil);}; + case "Weapons": { _cargo_weapons = OR(_value,nil);}; + case "Items": { _cargo_items = OR(_value,nil);}; + case "Magazines": { _cargo_magazines = OR(_value,nil);}; + case "Backpacks": { _cargo_backpacks = OR(_value,nil);}; + case "HoursAlive": { _hours_alive = OR(_value,nil);}; + case "HoursAbandoned": { _hours_abandoned = OR(_value,nil);}; + case "Variables": { _variables = OR(_value,nil);}; + case "AmmoCargo": { _cargo_ammo = OR(_value,nil);}; + case "FuelCargo": { _cargo_fuel = OR(_value,nil);}; + case "RepairCargo": { _cargo_repair = OR(_value,nil);}; + case "TurretMagazines": { _turret0 = OR_ARRAY(_value,nil);}; + case "TurretMagazines2": { _turret1 = OR_ARRAY(_value,nil);}; + case "TurretMagazines3": { _turret2 = OR_ARRAY(_value,nil);}; + case "Fuel": { _fuel = OR(_value,nil);}; + case "Hitpoints": { _hitPoints = OR(_value,nil);}; + case "LockState": { _lock_state = OR(_value,nil);}; + }; + } forEach _vehicle_data; + + //if there is no class and position, there is no point to recreating the vehicle + if (not(isSTRING(_class)) || {not(isARRAY(_pos))}) exitWith { + diag_log format["No class or position available for vehicle: %1", _vehicle_key]; + }; + + //AgentRev changed how position is saved, put this fail-safe to handle position with values as strings + { if (isSTRING(_x)) then { _pos set [_forEachIndex, parseNumber _x] } } forEach _pos; + + diag_log format["%1(%2) is being restored.", _vehicle_key, _class]; + + + if (not(_ignore_expiration) && {isSCALAR(_hours_alive) && {A3W_vehicleLifetime > 0 && {_hours_alive > A3W_vehicleLifetime}}}) exitWith { + diag_log format["vehicle %1(%2) has been alive for %3 (max=%4), skipping it", _vehicle_key, _class, _hours_alive, A3W_vehicleLifetime]; + }; + + if (not(_ignore_expiration) && {isSCALAR(_hours_abandoned) && {A3W_vehicleMaxUnusedTime > 0 && {_hours_abandoned > A3W_vehicleMaxUnusedTime}}}) exitWith { + diag_log format["vehicle %1(%2) has been abandoned for %3 hours, (max=%4), skipping it", _vehicle_key, _class, _hours_abandoned, A3W_vehicleMaxUnusedTime]; + }; + + + def(_is_flying); + _is_flying = [_pos] call sh_isFlying; + + def(_obj); + if (isARRAY(_create_array)) then { + _obj = createVehicle _create_array; + } + else { + def(_special); + _special = if (_is_flying) then {"FLY"} else {"CAN_COLLIDE"}; + _obj = createVehicle [_class, _pos, [], 0, _special]; + }; + + if (!isOBJECT(_obj)) exitWith { + diag_log format["Could not create vehicle of class: %1", _class]; + }; + + _obj allowDamage false; + [_obj] spawn { ARGVX3(0,_obj,objNull); sleep 3; _obj allowDamage true;}; //hack so that vehicle does not take damage while spawning + + + [_obj, false] call vehicleSetup; + + _obj setVariable ["vehicle_key", _vehicle_key, true]; + missionNamespace setVariable [_vehicle_key, _obj]; + + if (!isARRAY(_create_array)) then { + _obj setPosWorld ATLtoASL _pos; + }; + + if (isARRAY(_dir)) then { + _obj setVectorDirAndUp _dir; + }; + + _obj setVariable ["baseSaving_spawningTime", diag_tickTime, true]; + if (isSCALAR(_hours_alive)) then { + _obj setVariable ["baseSaving_hoursAlive", _hours_alive, true]; + }; + + _obj setVariable ["vehicle_abandoned_time", diag_tickTime, true]; //the moment the vehicle is restored, consider it abandoned + if (isSCALAR(_hours_abandoned)) then { + _obj setVariable ["vehicle_abandoned_hours", _hours_abandoned, true]; + }; + + // disables thermal equipment on loaded vehicles, comment out if you want thermal + _obj disableTIEquipment true; + + //enables thermal equipment on loaded vehicles for UAVs and UGVs + if ({_obj isKindOf _x} count ["UAV_01_base_F", "UAV_02_base_F", "UGV_01_base_F"] > 0) then { + _obj disableTIEquipment false; + }; + + if (_obj isKindOf "O_Heli_Light_02_F") then { + _obj removeWeaponTurret ["missiles_DAGR",[-1]]; + _obj addWeaponTurret ["missiles_DAR",[-1]]; + }; + + if ({_obj isKindOf _x} count ["B_Heli_Light_01_F", "B_Heli_Light_01_armed_F", "O_Heli_Light_02_unarmed_F", "C_Heli_Light_01_civil_F"] > 0) then { + _obj removeWeaponTurret ["CMFlareLauncher",[-1]]; + _obj addWeaponTurret ["CMFlareLauncher",[-1]]; + }; + + //override the lock-state for vehicles form this this + if ({_obj isKindOf _x} count A3W_locked_vehicles_list > 0) then { + _lock_state = 2; + }; + + if (isSCALAR(_lock_state)) then { + _obj lock _lock_state; + _obj setVariable ["R3F_LOG_disabled", (_lock_state > 1) , true]; + }; + + if (isSCALAR(_damage)) then { + _obj setDamage _damage; + }; + + if (isSCALAR(_fuel)) then { + _obj setFuel _fuel; + }; + + if (isARRAY(_hitPoints)) then { + { _obj setHitPointDamage _x } forEach _hitPoints; + }; + + [_obj,_variables] call sh_restoreVariables; + + + def(_textures); + _textures = _obj getVariable ["A3W_objectTextures",[]]; + if (isARRAY(_textures)) then { + _obj setVariable ["BIS_enableRandomization", false, true]; + { + _obj setObjectTextureGlobal _x; + } forEach _textures; + }; + + //Add AI to vehicle + if ([_obj] call sh_isUAV_UGV) then { + createVehicleCrew _obj; + }; + + if (_is_flying && {[_obj] call sh_isUAV}) then { + _obj flyInHeight (((_obj call fn_getPos3D) select 2) max 500); + [_obj] spawn { + ARGVX3(0,_obj,objNull); + waitUntil {!isNull driver _obj}; + def(_wp); + _wp = (group _obj) addWaypoint [getPosATL _obj, 0]; + _wp setWaypointType "MOVE"; + }; + }; + + + //restore the stuff inside the vehicle + clearWeaponCargoGlobal _obj; + clearMagazineCargoGlobal _obj; + clearItemCargoGlobal _obj; + clearBackpackCargoGlobal _obj; + + [_obj, OR(_turret0,nil), OR(_turret1,nil), OR(_turret2,nil)] call sh_restoreVehicleTurrets; + + if (isARRAY(_cargo_weapons)) then { + { _obj addWeaponCargoGlobal _x } forEach _cargo_weapons; + }; + + if (isARRAY(_cargo_backpacks)) then { + { + if (not((_x select 0) isKindOf "Weapon_Bag_Base")) then { + _obj addBackpackCargoGlobal _x + }; + } forEach _cargo_backpacks; + }; + + if (isARRAY(_cargo_items)) then { + { _obj addItemCargoGlobal _x } forEach _cargo_items; + }; + + if (isARRAY(_cargo_magazines)) then { + { _obj addMagazineCargoGlobal _x } forEach _cargo_magazines; + }; + + if (isSCALAR(_cargo_ammo)) then { + _obj setAmmoCargo _cargo_ammo; + }; + + if (isSCALAR(_cargo_fuel)) then { + _obj setFuelCargo _cargo_fuel; + }; + + if (isSCALAR(_cargo_repair)) then { + _obj setRepairCargo _cargo_repair; + }; + + + tracked_vehicles_list pushBack _obj; + + _obj +}; + + +tracked_vehicles_list = OR_ARRAY(tracked_vehicles_list,[]); + +v_getTrackedVehicleIndex = { + ARGVX4(0,_obj,objNull,-1); + if (isNull _obj) exitWith {-1}; + + (tracked_vehicles_list find _obj) +}; + +v_trackVehicle = { + private["_index","_object"]; + _object = _this select 0; + _index = [OR(_object,nil)] call v_getTrackedVehicleIndex; + if (_index >= 0) exitWith {}; + + //forward to HC + ["trackVehicle", _object] call sh_hc_forward; + + //diag_log format["%1 is being added to the tracked list", _object]; + tracked_vehicles_list pushBack _object; +}; + + +//event handlers for object tracking, and untracking +"trackVehicle" addPublicVariableEventHandler { [_this select 1] call v_trackVehicle;}; + +v_untrackVehicle = { + private["_index","_object"]; + _object = _this select 0; + _index = [OR(_object,nil)] call v_getTrackedVehicleIndex; + if (_index < 0) exitWith {}; + + //forward to HC + ["untrackVehicle", _object] call sh_hc_forward; + + //diag_log format["%1 is being removed from the tracked list", _object]; + tracked_vehicles_list deleteAt _index; +}; + +//event handlers for object tracking, and untracking +"untrackVehicle" addPublicVariableEventHandler { [_this select 1] call v_untrackVehicle;}; + +fn_manualVehicleSave = { + ARGVX2(0,_object); + + if (isSTRING(_object)) then { + _object = objectFromNetId _object; + }; + + if (!isOBJECT(_object)) exitWith {}; + if (diag_tickTime - (_object getVariable ["vehSaving_lastSave", 0]) <= 5) exitWith {}; + + _object setVariable ["vehSaving_lastUse", diag_tickTime, true]; + _object setVariable ["vehSaving_lastSave", diag_tickTime, true]; + [_object] call v_trackVehicle; +}; + + +v_trackedVehiclesListCleanup = { + //post cleanup the array + init(_cleanup_start, diag_tickTime); + init(_nulls,[]); + init(_index,-1); + init(_start_size,count(tracked_vehicles_list)); + while {true} do { + _index = tracked_vehicles_list find objNull; + if (_index < 0) exitWith {}; + tracked_vehicles_list deleteAt _index; + }; + init(_end_size,count(tracked_vehicles_list)); + init(_cleanup_end, diag_tickTime); + diag_log format["v_saveLoop: count(tracked_vehicles_list) = %1, %2 nulls deleted in %3 ticks", count(tracked_vehicles_list), (_start_size - _end_size), (_cleanup_end - _cleanup_start)]; +}; + + +//build list of object that should not be saved +v_skipList = []; +def(_obj); +{if (true) then { + if (!isARRAY(_x) || {count(_x) == 0}) exitWith {}; + _obj = _x select 1; + if (isOBJECT(_obj)) then { + v_skipList pushBack _obj; + }; + v_skipList pushBack _obj; +}} forEach [OR(civilianVehicles,[]), OR(call allVehStoreVehicles,[])]; + + +v_isSaveable = { + ARGVX4(0,_obj,objNull,false); + + //it's a wreck, don't save it + if (not(alive _obj)) exitWith {false}; + + //not a vehicle, don't save it + if (not([_obj] call sh_isSaveableVehicle)) exitWith {false}; + + def(_purchasedVehicle); + def(_missionVehicle); + def(_usedVehicle); + def(_townVehicle); + def(_usedOnce); + + + _purchasedVehicle = ([_obj] call sh_isAPurchasedVehicle); + _missionVehicle = ([_obj] call sh_isAMissionVehicle); + _staticWeapon = [_obj] call sh_isStaticWeapon; + _townVehicle = not(_missionVehicle || {_purchasedVehicle || {_staticWeapon}}); + _usedOnce = not([_obj] call v_isVehicleVirgin); + + //diag_log format["%1, _purchasedVehicle = %2, _missionVehicle = %3, _usedOnce = %4, _townVehicle = %5, _staticWeapon = %6",_obj, _purchasedVehicle,_missionVehicle,_usedOnce,_townVehicle, _staticWeapon]; + + //it's a purchased vehicle, and saving purchased vehicles has been enabled, save it + if (_purchasedVehicle && {cfg_purchasedVehicleSaving_on}) exitWith {true}; + + //it's a mission spawned vehicle, and saving mission vehicles has been enabled, save it + if (_missionVehicle && {cfg_missionVehicleSaving_on}) exitWith {true}; + + //if it's a static weapon, and saving static weapons has been enabled, save it + if (_staticWeapon && {cfg_staticWeaponSaving_on}) exitWith {true}; + + //if it's a town vehicle that has been used at least once, save it + if (_townVehicle && {_usedOnce && {cfg_townVehicleSaving_on}}) exitWith {true}; + + false +}; + + +v_trackVehicleHoursAlive = { + ARGVX3(0,_obj,objNull); + + def(_spawnTime); + def(_hoursAlive); + + _spawnTime = _obj getVariable "baseSaving_spawningTime"; + _hoursAlive = _obj getVariable "baseSaving_hoursAlive"; + + if (isNil "_spawnTime") then { + _spawnTime = diag_tickTime; + _obj setVariable ["baseSaving_spawningTime", _spawnTime, true]; + }; + + if (isNil "_hoursAlive") then { + _hoursAlive = 0; + _obj setVariable ["baseSaving_hoursAlive", _hoursAlive, true]; + }; + + def(_totalHours); + _totalHours = _hoursAlive + (diag_tickTime - _spawnTime) / 3600; + + (_totalHours) +}; + +v_trackVehicleHoursAbandoned = { + ARGVX3(0,_obj,objNull); + + //if the vehicle is not empty, it can't possibly be abandoned + if (not([_obj] call v_isVehicleEmpty)) exitWith {0}; + + //if the vehicle has never been used, it's not technically abandoned, just un-used + if (isNil{_obj getVariable "vehicle_first_user"}) exitWith {0}; + + /* + * past this point, we know for sure that the vehicle is in 'abandoned' state + * which means that it has been used at least once, and left empty somewhere + * by a player + */ + + def(_hoursAbandoned); + def(_abandonedTime); + + _abandonedTime = _obj getVariable "vehicle_abandoned_time"; + _hoursAbandoned = _obj getVariable "vehicle_abandoned_hours"; + + if (!isSCALAR(_abandonedTime)) then { + _abandonedTime = diag_tickTime; + _obj setVariable ["vehicle_abandoned_time", _abandonedTime, true]; + }; + + if (!isSCALAR(_hoursAbandoned)) then { + _hoursAbandoned = 0; + _obj setVariable ["vehicle_abandoned_hours", _hoursAbandoned, true]; + }; + + + def(_totalHours); + _totalHours = _hoursAbandoned + (diag_tickTime - _abandonedTime) / 3600; + + (_totalHours) +}; + +v_setupVehicleSavedVariables = { + ARGVX3(0,_obj,objNull); + ARGVX3(1,_variables,[]); + + def(_ownerUID); + _ownerUID = _obj getVariable ["ownerUID", nil]; + if (isSTRING(_ownerUID) && {_ownerUID != ""}) then { + _variables pushBack ["ownerUID", _ownerUID];; + }; + + def(_ownerN); + _ownerN = _obj getVariable ["ownerN", nil]; + if (isSTRING(_ownerN) && {_ownerN != ""}) then { + _variables pushBack ["ownerN", _ownerN]; + }; + + def(_firstUser); + _firstUser = _obj getVariable ["vehicle_first_user", nil]; + if (isSTRING(_firstUser) && {_firstUser != ""}) then { + _variables pushBack ["vehicle_first_user", _firstUser]; + }; + + _variables pushBack ["vehicle_abandoned_by", (_obj getVariable "vehicle_abandoned_by")]; + _variables pushBack ["A3W_purchasedVehicle", (_obj getVariable ["A3W_purchasedVehicle",false])]; + _variables pushBack ["A3W_missionVehicle", (_obj getVariable ["A3W_missionVehicle",false])]; + + + + def(_r3fSide); + _r3fSide = _obj getVariable "R3F_Side"; + if (isSIDE(_r3fSide)) then { + _variables pushBack ["R3F_Side", str _r3fSide]; + }; + + if ([_obj] call sh_isBoomerang) then { + _variables pushBack ["has_boomerang", (_obj getVariable "has_boomerang")]; + _variables pushBack ["boomerang_owner_type", (_obj getVariable "boomerang_owner_type")]; + _variables pushBack ["boomerang_owner_value", (_obj getVariable "boomerang_owner_value")]; + }; + + _variables pushBack ["A3W_objectTextures", (_obj getVariable ["A3W_objectTextures",[]])]; + +}; + + +v_getSavePosition = { + ARGVX3(0,_obj,objNull); + + def(_pos); + _pos = ASLtoATL getPosWorld _obj; + _pos set [2, (_pos select 2) + 0.3]; + + def(_on_ground); + _on_ground = isTouchingGround _obj; + + def(_flying); + _flying = [_obj] call sh_isFlying; + + //diag_log format["_flying = %1, _on_ground = %2", _flying, _on_ground]; + + if ([_obj] call sh_isUAV && {_flying}) exitWith {_pos}; //save flying UAVs as-is + if (_on_ground) exitWith {_pos}; //directly in contact with ground, or on a roof + if ((getPos _obj) select 2 < 0.5) exitWith {_pos}; //FIXME: not exactly sure what this one is for + if ((getPosASL _obj) select 2 < 0.5) exitWith {_pos}; //underwater + + //force the Z-axis if the vehicle is high above ground, or deep underwater (bring it to the surface) + _pos set [2, 0]; + if (surfaceIsWater _pos) then { + _pos = ASLToATL (_pos); + }; + + (_pos) +}; + +v_addSaveVehicle = { + ARGVX3(0,_list,[]); + ARGVX3(1,_obj,objNull); + ARGV4(2,_hashify,false,true); + + if (not([_obj] call v_isSaveable)) exitWith {}; + + def(_class); + def(_netId); + def(_pos); + def(_dir); + def(_damage); + def(_hoursAlive); + def(_hoursAbandoned); + + _class = typeOf _obj; + _netId = netId _obj; + _dir = [vectorDir _obj, vectorUp _obj]; + _damage = damage _obj; + + _hoursAlive = [_obj] call v_trackVehicleHoursAlive; + _hoursAbandoned = [_obj] call v_trackVehicleHoursAbandoned; + + //diag_log format["%1: _hoursAlive = %2", _obj,_hoursAlive]; + //diag_log format["%1: _hoursAbandoned = %2", _obj,_hoursAbandoned]; + + def(_variables); + _variables = []; + [_obj,_variables] call v_setupVehicleSavedVariables; + + + init(_weapons,[]); + init(_magazines,[]); + init(_items,[]); + init(_backpacks,[]); + + // Save weapons & ammo + _weapons = (getWeaponCargo _obj) call cargoToPairs; + _magazines = (getMagazineCargo _obj) call cargoToPairs; + _items = (getItemCargo _obj) call cargoToPairs; + _backpacks = (getBackpackCargo _obj) call cargoToPairs; + + + + def(_all_turrets); + _all_turrets = [_obj] call sh_getVehicleTurrets; + init(_turret0,_all_turrets select 0); + init(_turret1,_all_turrets select 1); + init(_turret2,_all_turrets select 2); + + + init(_hitPoints,[]); + { + _hitPoint = configName _x; + _hitPoints pushBack [_hitPoint, _obj getHitPointDamage _hitPoint]; + } forEach (_obj call getHitPoints); + + init(_ammoCargo,getAmmoCargo _obj); + init(_fuelCargo,getFuelCargo _obj); + init(_repairCargo,getRepairCargo _obj); + init(_fuel, fuel _obj); + + def(_objName); + _objName = _obj getVariable ["vehicle_key", nil]; + + if (isNil "_objName") then { + _objName = format["veh_%1_%2",ceil(time), ceil(random 10000)]; + _obj setVariable ["vehicle_key", _objName, true]; + }; + + _pos = [_obj] call v_getSavePosition; + + def(_lock_state); + _lock_state = locked _obj; + + def(_result); + _result = [ + ["Class", _class], + ["Position", _pos], + ["Direction", _dir], + ["HoursAlive", _hoursAlive], + ["HoursAbandoned", _hoursAbandoned], + ["Damage", _damage], + ["Fuel", _fuel], + ["Variables", _variables], + ["Weapons", _weapons], + ["Magazines", _magazines], + ["Items", _items], + ["Backpacks", _backpacks], + ["TurretMagazines", OR(_turret0,nil)], + ["TurretMagazines2", OR(_turret1,nil)], + ["TurretMagazines3", OR(_turret2,nil)], + ["AmmoCargo", _ammoCargo], + ["FuelCargo", _fuelCargo], + ["RepairCargo", _repairCargo], + ["Hitpoints", _hitPoints], + ["LockState", _lock_state] + ]; + + _result = if (_hashify) then {_result call sock_hash} else {_result}; + _list pushBack [_objName, _result]; + + true +}; + +v_isVehicleEmpty = { + ARGVX4(0,_obj,objNull,false); + not({isPlayer _x} count crew _obj > 0 || isPlayer ((uavControl _obj) select 0)) +}; + +//a virgin vehicle is one that no-one has ever used +v_isVehicleVirgin = { + ARGVX4(0,_obj,objNull,false); + (isNil {_obj getVariable "vehicle_first_user"}) +}; + +v_GetIn_handler = { + //diag_log format["%1 call v_GetIn_handler", _this]; + ARGVX3(0,_obj,objNull); + ARGVX3(2,_player,objNull); + + //only track players + if (!(isPlayer _player)) exitWith {}; + init(_uid,getPlayerUID _player); + + if ([_obj] call v_isVehicleVirgin) then { + _obj setVariable ["vehicle_first_user", _uid, true]; + }; + + //diag_log format["%1 entered vehicle by %2", _obj, _player]; + _obj setVariable ["vehicle_abandoned_by", nil, true]; + _obj setVariable ["vehicle_abandoned_time", nil, true]; + _obj setVariable ["vehicle_abandoned_hours", nil, true]; + + [_obj] call v_trackVehicle; +}; + +v_GetOut_handler = { + //diag_log format["%1 call v_GetOut_handler", _this]; + ARGVX3(0,_obj,objNull); + ARGVX3(2,_player,objNull); + + //only track players + if (!(isPlayer _player)) exitWith {}; + init(_uid,getPlayerUID _player); + + //in case the player was already inside the vehicle ... (the get-in handler did not catch it) + if ([_obj] call v_isVehicleVirgin) then { + _obj setVariable ["vehicle_first_user", _uid, true]; + }; + + if ([_obj] call v_isVehicleEmpty) then { + //diag_log format["%1 left abandoned by %2", _obj, _player]; + _obj setVariable ["vehicle_abandoned_by", _uid, true]; + _obj setVariable ["vehicle_abandoned_time", diag_tickTime, true]; + _obj setVariable ["vehicle_abandoned_hours", nil, true]; //start counting the hours form 0 again + + }; +}; + +v_saveAllVechiles = { + ARGVX3(0,_scope,""); + init(_count,0); + init(_request,[_scope]); + + [_scope] call stats_wipe; + init(_bulk_size,100); + init(_start_time, diag_tickTime); + init(_last_save, diag_tickTime); + + + { + if (!isNil{[_request, _x] call v_addSaveVehicle}) then { + _count = _count + 1; + }; + + //save vehicles in bulks + if ((_count % _bulk_size) == 0 && {count(_request) > 1}) then { + init(_save_start, diag_tickTime); + _request call stats_set; + init(_save_end, diag_tickTime); + _request = [_scope]; + diag_log format["v_saveLoop: %1 vehicles saved in %2 ticks, save call took %3 ticks", (_bulk_size), (diag_tickTime - _start_time), (_save_end - _save_start)]; + _last_save = _save_end; + }; + } forEach (tracked_vehicles_list); + + if (count(_request) > 1) then { + init(_save_start, diag_tickTime); + _request call stats_set; + init(_save_end, diag_tickTime); + diag_log format["v_saveLoop: %1 vehicles saved in %2 ticks, save call took %3 ticks", (count(_request) -1), (_save_end - _last_save), (_save_end - _save_start)]; + }; + + diag_log format["v_saveLoop: total of %1 vehicles saved in %2 ticks", (_count), (diag_tickTime - _start_time)]; + + call v_trackedVehiclesListCleanup; +}; + +v_saveLoop_iteration = { + ARGVX3(0,_scope,""); + diag_log format["v_saveLoop: Saving all objects ... "]; + [[_scope], v_saveAllVechiles] call sh_fsm_invoke; + diag_log format["v_saveLoop: Saving all objects complete"]; +}; + + +v_saveLoop_iteration_hc = { + ARGVX3(0,_scope,""); + + init(_hc_id,owner HeadlessClient); + diag_log format["v_saveLoop: Offloading vehicles saving to headless client (id = %1)", _hc_id]; + + v_saveLoop_iteration_hc_handler = [_scope]; + _hc_id publicVariableClient "v_saveLoop_iteration_hc_handler"; + + call v_trackedVehiclesListCleanup; +}; + +if (!(hasInterface || isDedicated)) then { + diag_log format["Setting up HC handler for objects"]; + "v_saveLoop_iteration_hc_handler" addPublicVariableEventHandler { + //diag_log format["v_saveLoop_iteration_hc_handler = %1", _this]; + ARGVX3(1,_this,[]); + ARGVX3(0,_scope,""); + _this spawn v_saveLoop_iteration; + }; +}; + + +v_saveLoop = { + ARGVX3(0,_scope,""); + while {true} do { + sleep A3W_vehicle_saveInterval; + if (not(isBOOLEAN(v_saveLoopActive) && {!v_saveLoopActive})) then { + if (call sh_hc_ready) then { + [_scope] call v_saveLoop_iteration_hc; + } + else { + [_scope] call v_saveLoop_iteration; + }; + }; + }; +}; + +v_loadVehicles = { + ARGVX3(0,_scope,""); + + def(_vehicles); + _vehicles = [_scope] call stats_get; + + init(_vIds,[]); + + + //nothing to load + if (!isARRAY(_vehicles)) exitWith { + diag_log format["WARNING: No vehicles loaded from the database"]; + _vIds + }; + + diag_log format["A3Wasteland - will restore %1 vehicles", count(_vehicles)]; + { + _vIds pushBack (_x select 0); + [_x] spawn v_restoreVehicle; + } forEach _vehicles; + + v_loadVehicles_complete = true; + + ["tracked_vehicles_list"] call sh_hc_forward; //forward to headless client (if connected) + + + (_vIds) +}; + +diag_log "vFunctions.sqf loading complete"; diff --git a/persistence/world/vLoad.sqf b/persistence/world/vLoad.sqf new file mode 100644 index 000000000..338d9cba1 --- /dev/null +++ b/persistence/world/vLoad.sqf @@ -0,0 +1,28 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Version: 0.1 +// @file Name: vLoad.sqf +// @file Author: micovery +// @file Description: vehicle loading + +if (!isServer) exitWith {}; +diag_log "vLoad.sqf loading ..."; + +call compile preprocessFileLineNumbers "persistence\lib\normalize_config.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\hash.sqf"; +call compile preprocessFileLineNumbers "persistence\lib\shFunctions.sqf"; +call compile preprocessFileLineNumbers "persistence\world\vFunctions.sqf"; + +#include "macro.h" + +init(_vScope, "Vehicles" call PDB_vehicleFileName); + +def(_vIds); +_vIds = [_vScope] call v_loadVehicles; +[_vScope] spawn v_saveLoop; + +diag_log "vLoad.sqf loading complete"; + +(_vIds) + diff --git a/server/antihack/adminMenuLog.sqf b/server/antihack/adminMenuLog.sqf index d6049967b..27c19f20c 100644 --- a/server/antihack/adminMenuLog.sqf +++ b/server/antihack/adminMenuLog.sqf @@ -10,15 +10,18 @@ private ["_name", "_uid", "_action", "_value", "_sentChecksum"]; _sentChecksum = [_this, 4, "", [""]] call BIS_fnc_param; -if (_sentChecksum == _flagChecksum) then -{ +if (_sentChecksum == _flagChecksum) then { _name = [_this, 0, "", [""]] call BIS_fnc_param; _uid = [_this, 1, "", [""]] call BIS_fnc_param; _action = [_this, 2, "", [""]] call BIS_fnc_param; _value = [_this, 3, "", [0,"",[]]] call BIS_fnc_param; - if (!isNil "fn_logAdminMenu") then - { - [_uid, _name, _action, _value] call fn_logAdminMenu; - }; + private["_record"]; + _record = [ + ["name",_name], + ["action",_action], + ["value",_value] + ]; + + ["AdminLog2" call PDB_adminLogFileName, _uid + ".records", (_record call sock_hash)] spawn stats_push; }; diff --git a/server/antihack/compileFuncs.sqf b/server/antihack/compileFuncs.sqf index 9007fbd62..14a0c12ef 100644 --- a/server/antihack/compileFuncs.sqf +++ b/server/antihack/compileFuncs.sqf @@ -6,12 +6,13 @@ // @file Author: AgentRev // @file Created: 04/01/2014 02:51 -private ["_assignCompileKey", "_assignChecksum", "_assignPacketKey", "_rscParams", "_compileKey", "_checksum", "_packetKey"]; +private ["_assignCompileKey", "_assignChecksum", "_assignPacketKey", "_rscParams", "_payload", "_compileKey", "_checksum", "_packetKey"]; _assignCompileKey = [_this, 0, "", [""]] call BIS_fnc_param; _assignChecksum = [_this, 1, "", [""]] call BIS_fnc_param; _assignPacketKey = [_this, 2, "", [""]] call BIS_fnc_param; _rscParams = [_this, 3, [], [[]]] call BIS_fnc_param; +_payload = [_this, 4, 0, [{}]] call BIS_fnc_param; _compileKey = call compile (_assignCompileKey + "_compileKey"); _checksum = call compile (_assignChecksum + "_flagChecksum"); @@ -54,12 +55,19 @@ _packetKey = call compile (_assignPacketKey + "_mpPacketKey"); if (isServer) then { - [_checksum] execVM "server\antihack\serverSide.sqf"; // COMMENT THIS LINE IF YOU HAVE ISSUES WITH CUSTOM UNIT SCRIPTS, LIKE AI RECRUITMENT + [_checksum] execVM "server\antihack\serverSide.sqf"; }; if (!isDedicated) then { - [_checksum, _rscParams] execVM "server\antihack\payload.sqf"; + if (typeName _payload == "CODE") then + { + [_checksum, _rscParams] spawn _payload; + } + else + { + [_checksum, _rscParams] execVM "server\antihack\payload.sqf"; + }; }; missionNamespace setVariable [_compileKey, compileFinal "true"]; diff --git a/server/antihack/createUnit.sqf b/server/antihack/createUnit.sqf index 30c05fb56..165385ff5 100644 --- a/server/antihack/createUnit.sqf +++ b/server/antihack/createUnit.sqf @@ -12,7 +12,8 @@ _assignCompileKey = [_this, 0, "", [""]] call BIS_fnc_param; _assignChecksum = [_this, 1, "", [""]] call BIS_fnc_param; _assignPacketKey = [_this, 2, "", [""]] call BIS_fnc_param; _rscParams = [_this, 3, "", [""]] call BIS_fnc_param; +_payload = str ([_this, 4, 0, [{}]] call BIS_fnc_param); -_init = "[this, ['" + _assignCompileKey + "', '" + _assignChecksum + "', '" + _assignPacketKey + "', " + _rscParams + "]] call compile preprocessFileLineNumbers 'server\antihack\manageUnit.sqf'"; +_init = "[this, ['" + _assignCompileKey + "', '" + _assignChecksum + "', '" + _assignPacketKey + "', " + _rscParams + ", " + _payload + "]] call compile preprocessFileLineNumbers 'server\antihack\manageUnit.sqf'"; "Logic" createUnit [[0,0,0], createGroup sideLogic, _init]; diff --git a/server/antihack/flagHandler.sqf b/server/antihack/flagHandler.sqf index 4906f15e9..b0f6c5480 100644 --- a/server/antihack/flagHandler.sqf +++ b/server/antihack/flagHandler.sqf @@ -25,9 +25,14 @@ if (typeName _this == "ARRAY" && {count _this > 4}) then [[format ["[ANTI-HACK] %1 is using cheating scripts. (%2)", _playerName, _hackType], _playerUID, _flagChecksum], "A3W_fnc_chatBroadcast", true, false] call A3W_fnc_MP; diag_log format ["ANTI-HACK: %1 (%2) was detected for [%3] with the value [%4]", _playerName, _playerUID, _hackType, _hackValue]; - if (!isNil "fn_logAntihack") then - { - [_playerUID, _playerName, _hackType, _hackValue] call fn_logAntihack; - }; + private["_record"]; + _record = [ + ["uid",_playerUID], + ["name",_playerName], + ["hackType",_hackType], + ["hackValue",_hackValue] + ]; + ["Hackers2" call PDB_hackerLogFileName, _playerUID + ".records", (_record call sock_hash)] spawn stats_push; + }; }; diff --git a/server/antihack/notifyAdminMenu.sqf b/server/antihack/notifyAdminMenu.sqf index 2d4909734..45448b3a4 100644 --- a/server/antihack/notifyAdminMenu.sqf +++ b/server/antihack/notifyAdminMenu.sqf @@ -8,12 +8,13 @@ // This function was created with the purpose of letting players know when an admin is abusing his powers -if !([getPlayerUID player, 3] call isAdmin) exitWith {}; +_uid = getPlayerUID player; +if !(_uid call isAdmin) exitWith {}; private ["_action", "_value", "_cfg", "_displayStr", "_message"]; _action = [_this, 0, "", [""]] call BIS_fnc_param; -_value = [_this, 1, "", [0,"",[]]] call BIS_fnc_param; +_value = [_this, 1, "", [0,"",[],true]] call BIS_fnc_param; switch (toLower _action) do { @@ -24,7 +25,21 @@ switch (toLower _action) do _message = format ["[NOTICE] %1 used the admin menu to obtain $%2", name player, _value]; }; }; + case "godmode": + { + if (_value) then { + _message = format ["[NOTICE] %1 used the admin menu to ENABLED GodMode", name player]; + }else{ + _message = format ["[NOTICE] %1 used the admin menu to DISABLED GodMode", name player]; + }; + }; case "teleport": + { + _value resize 2; + { _value set [_forEachIndex, round _x] } forEach _value; + _message = format ["[NOTICE] %1 used the admin menu to teleport.", name player]; + }; + case "teleport2": { _value resize 2; { _value set [_forEachIndex, round _x] } forEach _value; @@ -54,6 +69,7 @@ if (!isNil "_cfg" && {isClass _cfg}) then if (!isNil "_message" && {_message != ""}) then { [[_message, getPlayerUID player, _flagChecksum, true], "A3W_fnc_chatBroadcast", true] call A3W_fnc_MP; + systemChat format ["Server notified about: %1. Use this for admin duties only.",_message]; }; [[profileName, getPlayerUID player, _action, _value, _flagChecksum], "A3W_fnc_adminMenuLog", false] call A3W_fnc_MP; diff --git a/server/antihack/payload.sqf b/server/antihack/payload.sqf index 4910cb1cb..ea2c55c0d 100644 --- a/server/antihack/payload.sqf +++ b/server/antihack/payload.sqf @@ -6,7 +6,9 @@ // @file Author: AgentRev, Tonic, AWA (OpenDayZ.net) // @file Created: 01/06/2013 21:31 -if (isDedicated) exitWith {}; +// This file can be moved to "A3Wasteland_settings\antihack" in order to be loaded externally from the server, which removes the need for it to be in the mission PBO + +if (!hasInterface) exitWith {}; private ["_flagChecksum", "_rscParams", "_cheatFlag", "_cfgPatches", "_escCheck", "_patchClass", "_patchName", "_ctrlCfg", "_memAnomaly", "_minRecoil", "_currentRecoil", "_loopCount"]; _flagChecksum = _this select 0; @@ -14,8 +16,6 @@ _rscParams = _this select 1; waitUntil {!isNull player}; -if (!hasInterface && typeOf player == "HeadlessClient_F") exitWith {}; - // diag_log "ANTI-HACK starting..."; _cfgPatches = configFile >> "CfgPatches"; @@ -39,7 +39,8 @@ for "_i" from 0 to (count _cfgPatches - 1) do "rhs_main", // RHS - Game Options "mcc_sandbox", // MCC keys "agm_core", // AGM Options - "ace_optionsmenu" // ACE Options + "ace_optionsmenu", // ACE Options + "alive_ui" // ALiVE ]) then { _escCheck = false }; }; @@ -231,7 +232,7 @@ while { true } do _cheatFlag = ["hack variable", _x]; }; sleep 0.01; - } forEach ["DurkSintax_Pro_RE", "iBeFlying", "dayz_godmode", "var_curCheatMenu", "Main_Fury_Menu_", "Hack_Pos_Orig", "REdasfsfwef", "ly_re_onetime", "XXMMWW_keybinds", "FUNMENUON", "JJMMEE_INIT_MENU", "activeITEMlistanzahl", "Detected_Remote_Execution", "g0dmode", "Pro_RE", "fn_runCheat", "xyzaa", "GOLDENS_GLOBAL_SHIT_YEAH", "HaxSmokeOn", "Lysto_Lyst", "pathtoscrdir", "ewrfdfcsf", "Ug8YtyGyvguGF", "LYSTIC_MENU_LOADED", "qofjqpofq", "c0lorthem", "shnmenu", "letmeknow", "DAYZ_CA1_Lollipops", "TONIC_HAS_A_GAPER_NUKE_2", "fazelist", "S_NyanCat_Toggle", "faze_fill", "PL4YER_CANN0N_T0GGLE", "aKTitans", "Fury_Are_G0ds", "LY_Exec", "inf_ammo_loop_infiSTAR", "Wookie_Pro_RE", "nook3_vars", "Wookie_Init_Menu", "TTT5OptionNR", "Team_Fury_Reck_Prebs", "faze_funcs_inited", "mein1", "biggies_pro_re", "godlol", "Lystic_Init", "FAG_NEON", "Lystic_Exec", "faze_getControl", "vehicleg0dv3_BushWookie", "earthBob", "t0ggl3", "morphm3", "fsdddInfectLOL", "cargod", "Init_Menu_Fury", "abcdefGEH", "RandyRandRanderson", "Wep_Spawn_Shitt", "Fury_Nuke", "faze_hax_dbclick", "LY_Init", "W00kie_Pro_RE", "LY_fly", "fdsgdr42424", "battleHIGH_vehpub", "WHY_ARE_THERE_SO_MANY_FISH_IN_THE_BIG_BLUE_OCEAN", "MenuInitLol", "wierdo", "mdh_ash", "faze_initMenu", "SG_Turtz_Are_H000t", "fuckfestv2", "xZombieBait", "W00kie_Init_Menu", "rainbow_var", "biggies_menu_open", "HAAJASDOKAD_mein", "CharlieSheenkeybinds", "POOP_Main", "colt_lmaoooo", "W_O_O_K_I_E_Pro_RE", "toggle_keyEH", "JME_M_E_N_U_initMenu", "dawr5wdfsf23", "FURY_IS_SEXC", "LOKI_GUI_Key_Color", "MPGHALLDAYEVRYDAY47LETSDOTHISBBYYAAAAAAA", "infi_STAR_exec", "M_R_IRecommend", "xtags_star_xx", "ChangingBullets_xx", "byebyezombies", "Root_Main4", "igodokxtt", "unlimammo", "tw4etinitMenu", "TORNADO_NOT_MOVE_NIGGA", "HydroxusRandomVarSwag2222", "oh_nmoe_pls", "Team_OMFG_WE_ARE_SEXC", "plrshldblckls", "Jme_Is_God", "Monky_funcs_inited", "fuckmegrandma", "qopfkqpofqk", "ShadowyFaz3VehZ", "Veh_Spawn_Shitt", "wuat_fpsMonitor", "Monky_hax_toggled", "mehatingjews", "InfiniteAmmo", "PersonWhomMadeThisCorroded_Init", "nuke_vars", "debug_star_colorful", "neo_fnc_throw", "W00kieMenu_hax_toggled", "AntiAntiAntiAntiHax", "Dummy_Menu", "XMVJEIUI133794_mein", "aim", "GodLolPenis", "MainMenubyThirtySix", "vehiclegooov3ood_BushWookie", "biggies_scroll_open", "ANTI_ANTI_HAX", "antiantiantiantih4x", "riasgremory_G0d_Mode", "BigFuckinBullets_0202020DDDEEDED", "monkytp", "hax_toggled", "JJJJ_MMMM___EEEEEEE_INIT_MENU", "B0X_CANN0N_T0GGLE", "omgwtfbbq", "bowonky", "ExtasyMenu_Binds", "PRO_SKILLZ_2015_ALLDAY_Noobs", "dontAddToTheArray", "rainbowbitch", "n0clip", "GLASS911_Init", "fuckfest", "BigFuckinBullets", "lmzsjgnas"]; + } forEach ["DurkSintax_Pro_RE", "iBeFlying", "dayz_godmode", "var_curCheatMenu", "Main_Fury_Menu_", "Hack_Pos_Orig", "REdasfsfwef", "ly_re_onetime", "XXMMWW_keybinds", "FUNMENUON", "JJMMEE_INIT_MENU", "activeITEMlistanzahl", "Detected_Remote_Execution", "g0dmode", "Pro_RE", "FireTide_Menu", "fn_runCheat", "xyzaa", "GOLDENS_GLOBAL_SHIT_YEAH", "HaxSmokeOn", "Lysto_Lyst", "pathtoscrdir", "ewrfdfcsf", "Ug8YtyGyvguGF", "LYSTIC_MENU_LOADED", "qofjqpofq", "c0lorthem", "shnmenu", "letmeknow", "DAYZ_CA1_Lollipops", "TONIC_HAS_A_GAPER_NUKE_2", "fazelist", "S_NyanCat_Toggle", "faze_fill", "PL4YER_CANN0N_T0GGLE", "aKTitans", "Fury_Are_G0ds", "LY_Exec", "inf_ammo_loop_infiSTAR", "youoiuoiasdfsd8433fadsfasd_Koko__hkeys", "Wookie_Pro_RE", "nook3_vars", "Wookie_Init_Menu", "TTT5OptionNR", "Team_Fury_Reck_Prebs", "faze_funcs_inited", "mein1", "biggies_pro_re", "godlol", "Lystic_Init", "FAG_NEON", "Lystic_Exec", "faze_getControl", "Fanatic_Menu", "vehicleg0dv3_BushWookie", "earthBob", "t0ggl3", "morphm3", "fsdddInfectLOL", "cargod", "Init_Menu_Fury", "abcdefGEH", "RandyRandRanderson", "Wep_Spawn_Shitt", "Fury_Nuke", "faze_hax_dbclick", "LY_Init", "W00kie_Pro_RE", "LY_fly", "fdsgdr42424", "battleHIGH_vehpub", "WHY_ARE_THERE_SO_MANY_FISH_IN_THE_BIG_BLUE_OCEAN", "MenuInitLol", "wierdo", "mdh_ash", "faze_initMenu", "SG_Turtz_Are_H000t", "fuckfestv2", "UuuNIX_M_I_S_S_I_L_E_Z", "xZombieBait", "W00kie_Init_Menu", "rainbow_var", "biggies_menu_open", "HAAJASDOKAD_mein", "CharlieSheenkeybinds", "POOP_Main", "colt_lmaoooo", "W_O_O_K_I_E_Pro_RE", "toggle_keyEH", "JME_M_E_N_U_initMenu", "dawr5wdfsf23", "FURY_IS_SEXC", "LOKI_GUI_Key_Color", "MPGHALLDAYEVRYDAY47LETSDOTHISBBYYAAAAAAA", "infi_STAR_exec", "M_R_IRecommend", "xtags_star_xx", "ChangingBullets_xx", "byebyezombies", "Root_Main4", "igodokxtt", "unlimammo", "tw4etinitMenu", "TORNADO_NOT_MOVE_NIGGA", "HydroxusRandomVarSwag2222", "oh_nmoe_pls", "Team_OMFG_WE_ARE_SEXC", "plrshldblckls", "Jme_Is_God", "Monky_funcs_inited", "SOMEONE_dsfnsjf", "fuckmegrandma", "qopfkqpofqk", "ShadowyFaz3VehZ", "Veh_Spawn_Shitt", "backtomenu", "wuat_fpsMonitor", "Monky_hax_toggled", "mehatingjews", "InfiniteAmmo", "PersonWhomMadeThisCorroded_Init", "nuke_vars", "debug_star_colorful", "SOMEONE_DurkSintax_Pro_RE", "neo_fnc_throw", "W00kieMenu_hax_toggled", "AntiAntiAntiAntiHax", "Dummy_Menu", "XMVJEIUI133794_mein", "aim", "GodLolPenis", "MainMenubyThirtySix", "vehiclegooov3ood_BushWookie", "biggies_scroll_open", "ANTI_ANTI_HAX", "Fire_ZeusMode", "antiantiantiantih4x", "riasgremory_G0d_Mode", "BigFuckinBullets_0202020DDDEEDED", "monkytp", "hax_toggled", "SOMEONE_Sweg_all_day", "JJJJ_MMMM___EEEEEEE_INIT_MENU", "B0X_CANN0N_T0GGLE", "omgwtfbbq", "bowonky", "ExtasyMenu_Binds", "PRO_SKILLZ_2015_ALLDAY_Noobs", "dontAddToTheArray", "rainbowbitch", "n0clip", "GLASS911_Init", "fuckfest", "BigFuckinBullets", "lmzsjgnas"]; }; if (isNil "_cheatFlag" && isNil "_memAnomaly") then diff --git a/server/antihack/serverSide.sqf b/server/antihack/serverSide.sqf index 066a04990..d041d27f3 100644 --- a/server/antihack/serverSide.sqf +++ b/server/antihack/serverSide.sqf @@ -8,6 +8,9 @@ if (!isServer) exitWith {}; +waitUntil {!isNil "A3W_serverSetupComplete"}; +if !(["A3W_antiHackUnitCheck"] call isConfigOn) exitWith {}; + private ["_flagChecksum", "_serverID", "_cheatFlag", "_unit"]; _flagChecksum = _this select 0; diff --git a/server/antihack/setup.sqf b/server/antihack/setup.sqf index a988d0c7b..5ac41b4fd 100644 --- a/server/antihack/setup.sqf +++ b/server/antihack/setup.sqf @@ -10,7 +10,7 @@ if (!isServer) exitWith {}; if (isNil "A3W_network_compileFuncs") then { - private ["_compileKey", "_assignCompileKey", "_packetKey", "_assignPacketKey", "_packetKeyArray", "_checksum", "_assignChecksum", "_checksumArray", "_rscList", "_rscParams", "_rscCfg"]; + private ["_compileKey", "_assignCompileKey", "_packetKey", "_assignPacketKey", "_packetKeyArray", "_checksum", "_assignChecksum", "_checksumArray", "_rscList", "_rscParams", "_rscCfg", "_payload", "_externPayload"]; _compileKey = call A3W_fnc_generateKey; @@ -69,7 +69,20 @@ if (isNil "A3W_network_compileFuncs") then }; } forEach _rscList; - [_assignCompileKey, _assignChecksum, _assignPacketKey, str _rscParams] call compile preprocessFileLineNumbers "server\antihack\createUnit.sqf"; + _payload = 0; + _externPayload = preprocessFile (externalConfigFolder + "\antihack\payload.sqf"); + + if (_externPayload == "") then + { + diag_log "ANTI-HACK: External payload unavailable, using internal payload"; + } + else + { + diag_log "ANTI-HACK: Using external payload"; + _payload = compile _externPayload; + }; + + [_assignCompileKey, _assignChecksum, _assignPacketKey, str _rscParams, _payload] call compile preprocessFileLineNumbers "server\antihack\createUnit.sqf"; waitUntil {!isNil {missionNamespace getVariable _compileKey}}; diag_log "ANTI-HACK: Started."; diff --git a/server/default_config.sqf b/server/default_config.sqf index 760d90049..49e00aaec 100644 --- a/server/default_config.sqf +++ b/server/default_config.sqf @@ -8,100 +8,117 @@ // This file is overriden by the external file "A3Wasteland_settings\main_config.sqf" if present // General settings -A3W_startHour = 15; // In-game hour at mission start (0 to 23) -A3W_timeMultiplierDay = 1.0; // Sets the speed of time between 5 AM and 8 PM (for example, 6.0 means 6 hours in-game will pass in 1 real hour) -A3W_timeMultiplierNight = 1.0; // Sets the speed of time between 8 PM and 5 AM +A3W_startHour = 4; // In-game hour at mission start (0 to 23) +A3W_timeMultiplierDay = 2.0; // Sets the speed of time between 5 AM and 8 PM (for example, 6.0 means 6 hours in-game will pass in 1 real hour) +A3W_timeMultiplierNight = 4.0; // Sets the speed of time between 8 PM and 5 AM A3W_moonLight = 1; // Moon light during night (0 = no, 1 = yes) A3W_teamPlayersMap = 1; // Show all friendly players on the map at all times, regardless of difficulty level (0 = no, 1 = yes) -A3W_globalVoiceWarnTimer = 5; // Number of seconds for which global voice chat must be active before triggering a warning (0 = disabled) -A3W_globalVoiceMaxWarns = 5; // Number of global voice warnings after which the player will be killed and crashed (0 = disabled) +A3W_disableGlobalVoice = 1; // Auto-switch channel to Direct communication whenever broadcasting voice on global, unless being admin (0 = no, 1 = yes) +A3W_antiHackUnitCheck = 1; // Detect players who spawn unauthorized AI units (0 = no, 1 = yes) - disable if you have custom unit scripts/mods like AI recruitment or ALiVE A3W_antiHackMinRecoil = 1.0; // Mininum recoil coefficient enforced by the antihack (recommended values: default = 1.0, TMR Mod = 0.5, VTS Weapon Resting = 0.25) (minimum: 0.02) -A3W_spawnBeaconCooldown = 5*60; // Number of seconds to wait between each use of an individual spawn beacon (0 = disabled) +A3W_townSpawnCooldown = 5*60; // Number of seconds to wait between each use of a spawn on friends in towns (0 = disabled) +A3W_spawnBeaconCooldown = 15*60; // Number of seconds to wait between each use of an individual spawn beacon (0 = disabled) A3W_spawnBeaconSpawnHeight = 1500; // Altitude in meters at which players will spawn when using spawn beacons (0 = ground/sea) +A3W_maxSpawnBeacons = 5; // Maxmimum number of spawn beacons (0 = disabled) A3W_uavControl = "group"; // Restrict connection to UAVs based on ownership ("owner", "group", "side") // Store settings A3W_showGunStoreStatus = 1; // Show enemy and friendly presence at gunstores on map (0 = no, 1 = yes) A3W_gunStoreIntruderWarning = 1; // Warn players in gunstore areas of enemy intruders (0 = no, 1 = yes) A3W_remoteBombStoreRadius = 75; // Prevent players from placing remote explosives within this distance from any store (0 = disabled) -A3W_vehiclePurchaseCooldown = 60; // Number of seconds to wait before allowing someone to purchase another vehicle, don't bother setting it too high because it can be bypassed by rejoining +A3W_vehiclePurchaseCooldown = 45; // Number of seconds to wait before allowing someone to purchase another vehicle, don't bother setting it too high because it can be bypassed by rejoining // Player settings -A3W_startingMoney = 100; // Amount of money that players start with +A3W_startingMoney = 1500; // Amount of money that players start with A3W_unlimitedStamina = 1; // Allow unlimited sprinting, jumping, etc. (0 = no, 1 = yes) - this also removes energy drinks from the mission -A3W_bleedingTime = 60; // Time in seconds for which to allow revive after a critical injury (minimum 10 seconds) +A3W_bleedingTime = 80; // Time in seconds for which to allow revive after a critical injury (minimum 10 seconds) +A3W_survivalSystem = 1; // Food and water are required to stay alive (0 = no, 1 = yes) - 0 removes food and water items from the mission // ATM settings -A3W_atmEnabled = 1; // Enable ATM system (0 = no, 1 = yes) -A3W_atmMaxBalance = 1000000; // Maximum amount of money that can be stored in a bank account (recommended: 1 million) -A3W_atmTransferFee = 5; // Fee in percent charged to players for money transfers to other players (0 to 50) +A3W_atmEnabled = 1; +A3W_atmMaxBalance = 300000; // Maximum amount of money that can be stored in a bank account (recommended: 1 million) +A3W_atmTransferFee = 10; // Fee in percent charged to players for money transfers to other players (0 to 50) A3W_atmTransferAllTeams = 0; // Allow money transfers between players of all teams/sides (0 = same team only, 1 = all teams) A3W_atmEditorPlacedOnly = 0; // Only allow access via ATMs placed from the mission editor (0 = all ATMs from towns & editor allowed, 1 = ATMs from editor only) Note: Stratis has no town ATMs, only editor ones. A3W_atmMapIcons = 1; // Draw small icons on the map that indicate ATM locations (0 = no, 1 = yes) -A3W_atmRemoveIfDisabled = 1; // Remove all ATMs from map if A3W_atmEnabled is set to 0 (0 = no, 1 = yes) +A3W_atmRemoveIfDisabled = 0; // Remove all ATMs from map if A3W_atmEnabled is set to 0 (0 = no, 1 = yes) + +A3W_healthTime = 60*5; //seconds till death +A3W_hungerTime = 80*60; //seconds till starving +A3W_thirstTime = 65*60; //seconds till dehydrated // Persistence settings -A3W_savingMethod = "profile"; // Method used for saving data ("profile", "iniDB", "extDB") A3W_playerSaving = 1; // Save player data like position, health, inventory, etc. (0 = no, 1 = yes) A3W_moneySaving = 1; // If playerSaving = 1, save player money amount (0 = no, 1 = yes) A3W_combatAbortDelay = 60; // If playerSaving = 1, delay in seconds for which to disable abort and respawn buttons after firing or being shot (0 = none) A3W_purchasedVehicleSaving = 1; // Save vehicles purchased at vehicle stores between server restarts (0 = no, 1 = yes) -A3W_missionVehicleSaving = 1; // Save vehicles captured from missions between server restarts (0 = no, 1 = yes) +A3W_missionVehicleSaving = 0; // Save vehicles captured from missions between server restarts (0 = no, 1 = yes) +A3W_townVehicleSaving = 0; // Save vehicles captured from missions between server restarts (0 = no, 1 = yes) A3W_baseSaving = 1; // Save locked base parts between server restarts (0 = no, 1 = yes) A3W_boxSaving = 1; // Save locked weapon crates and their contents between server restarts (0 = no, 1 = yes) -A3W_staticWeaponSaving = 1; // Save locked static weapons and their magazines between server restarts (0 = no, 1 = yes) -A3W_warchestSaving = 1; // Save warchest objects deployed by players between server restarts (0 = no, 1 = yes) -A3W_warchestMoneySaving = 1; // Save warchest team money between server restarts (0 = no, 1 = yes) +A3W_staticWeaponSaving = 0; // Save locked static weapons and their magazines between server restarts (0 = no, 1 = yes) +A3W_warchestSaving = 0; // Save warchest objects deployed by players between server restarts (0 = no, 1 = yes) +A3W_warchestMoneySaving = 0; // Save warchest team money between server restarts (0 = no, 1 = yes) A3W_spawnBeaconSaving = 1; // Save spawn beacons between server restarts (0 = no, 1 = yes) -A3W_objectLifetime = 5*24; // Maximum lifetime in hours for saved objects (baseparts, crates, etc. except vehicles) across server restarts (0 = no time limit) +A3W_objectLifetime = 7*24; // Maximum lifetime in hours for saved objects (baseparts, crates, etc. except vehicles) across server restarts (0 = no time limit) +A3W_cctvCameraSaving = 1; // Save cctv cameras between restarts (0 = no, 1 = yes) +A3W_mineSaving = 1; // Save mines between server restarts (0 = no, 1 = yes) + // List of mine ammo classes that can be saved +A3W_saveable_mines_list = ["APERSTripMine_Wire_Ammo", "APERSBoundingMine_Range_Ammo", "APERSMine_Range_Ammo", "ATMine_Range_Ammo", "SLAMDirectionalMine_Wire_Ammo" ]; +A3W_mineLifetime = 2*24; // Maximum lifetime in hours for mines across server restarts (0 = no time limit) A3W_vehicleLifetime = 0; // Maximum lifetime in hours for saved vehicles across server restarts, regardless of usage (0 = no time limit) A3W_vehicleMaxUnusedTime = 2*24; // Maximum parking time in hours after which unused saved vehicles will be marked for deletion (0 = no time limit) -A3W_serverSavingInterval = 1*60; // Interval in seconds between automatic vehicle & object saves; should be kept at 1 min for profileNamespace and iniDB, while for extDB it can be relaxed to 3-5 mins +A3W_storageLifetime = 0; // Maximum lifetime in horus for player's private storage (0 = no time limit) + +PDB_PlayerFileID = "A3W_"; // Player savefile prefix (change this in case you run multiple servers from the same folder) +PDB_ObjectFileID = "A3W_"; // Object savefile prefix (change this in case you run multiple servers from the same folder) +PDB_VehicleFileID = "A3W_"; // Vehicle savefile prefix (change this in case you run multiple servers from the same folder) +PDB_MessagesFileID = "A3W_"; // Messages savefile prefix (change this in case you run multiple servers from the same folder) +PDB_AdminLogFileID = "A3W_"; // Admin log savefile prefix (change this in case you run multiple servers from the same folder) +PDB_HackerLogFileID = "A3W_"; // Hacker log savefile prefix (change this in case you run multiple servers from the same folder) +PDB_PlayersListFileID = "A3W_"; // PlayerList savefile prefix (change this in case you run multiple servers from the same folder) -// iniDB settings -PDB_PlayerFileID = "A3W_"; // Player savefile prefix (if you run multiple servers, keep it the same for all of them) -PDB_ObjectFileID = "A3W_"; // Object savefile prefix (if you run multiple servers, change it to a unique value for each server) +A3W_vehicle_saveInterval = 1200; // Number of seconds between vehicle saves +A3W_object_saveInterval = 1200; // Number of seconds between object saves +A3W_player_saveInterval = 1200; // Number of seconds between player saves +A3W_playersList_saveInterval = 1200; // Number of seconds between player list saves -// extDB settings -A3W_extDB_ServerID = 1; // Server ID to use in the database for the particular server running off this config file; if you have multiple servers, they all need different IDs -A3W_extDB_Environment = "normal"; // Value used to separate player & object data from multiple environments running on the same map (e.g. "normal", "hardcore", "dev", etc. can be whatever you want) -A3W_extDB_SaveUnlockedObjects = 1; // Save and restore unlocked baseparts that were locked at least once during their lifetime (0 = no, 1 = yes) -A3W_extDB_ConfigName = "A3W"; // Name of the connection config from extdb-conf.ini to be used (the one within [brackets]) -A3W_extDB_IniName = "a3wasteland"; // Name of the INI file in extDB\db_custom to be used -A3W_extDB_Debug = 0; // Log all queries to server RPT (0 = no, 1 = yes) +A3W_saveable_vehicles_list = ["StaticWeapon", "C_Kart_01_F", "Quadbike_01_base_F", "Hatchback_01_base_F", "SUV_01_base_F", "Offroad_01_base_F", "Van_01_base_F", "MRAP_01_base_F", "MRAP_02_base_F", "MRAP_03_base_F", "Truck_01_base_F", "Truck_02_base_F", "Truck_03_base_F", "Wheeled_APC_F", "Tank_F", "Rubber_duck_base_F", "SDV_01_base_F", "Boat_Civil_01_base_F", "Boat_Armed_01_base_F", "Helicopter_Base_F", "Plane", "UGV_01_base_F"]; // List of classes for vehicles that are saveable +A3W_locked_vehicles_list = []; // List of class names for vehicles that should be automatically locked upon restore +A3W_autosave_vehicles_list = ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F", "O_MRAP_02_hmg_F", "O_MRAP_02_gmg_F", "I_MRAP_03_hmg_F", "I_MRAP_03_gmg_F", "B_Truck_01_ammo_F", "O_Truck_03_ammo_F", "I_Truck_02_ammo_F", "Wheeled_APC_F", "Tank_F", "O_Heli_Light_02_unarmed_F", "I_Heli_light_03_unarmed_F", "B_Heli_Transport_01_F", "B_Heli_Transport_01_camo_F", "B_Heli_Light_01_armed_F", "O_Heli_Light_02_F", "O_Heli_Light_02_v2_F", "I_Heli_light_03_F", "B_Heli_Attack_01_F", "O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F", "Heli_Transport_04_base_F", "B_Heli_Transport_03_unarmed_F", "B_Heli_Transport_03_F", "I_Heli_Transport_02_F", "I_Plane_Fighter_03_AA_F", "I_Plane_Fighter_03_CAS_F", "B_Plane_CAS_01_F", "O_Plane_CAS_02_F"]; // List of class names for vehicles that should be automatically locked and saved when bought // Spawning settings A3W_serverSpawning = 1; // Vehicle, object, and loot spawning (0 = no, 1 = yes) A3W_vehicleSpawning = 1; // If serverSpawning = 1, spawn vehicles in towns (0 = no, 1 = yes) -A3W_vehicleQuantity = 200; // Approximate number of land vehicles to be spawned in towns +A3W_vehicleQuantity = 225; // Approximate number of land vehicles to be spawned in towns A3W_boatSpawning = 1; // If serverSpawning = 1, spawn boats at marked areas near coasts (0 = no, 1 = yes) A3W_heliSpawning = 1; // If serverSpawning = 1, spawn helicopters in some towns and airfields (0 = no, 1 = yes) A3W_planeSpawning = 1; // If serverSpawning = 1, spawn planes at some airfields (0 = no, 1 = yes) A3W_boxSpawning = 0; // If serverSpawning = 1, spawn weapon crates in 50% towns (0 = no, 1 = yes) -A3W_baseBuilding = 1; // If serverSpawning = 1, spawn base parts in towns (0 = no, 1 = yes) +A3W_baseBuilding = 0; // If serverSpawning = 1, spawn base parts in towns (0 = no, 1 = yes) // Loot settings A3W_buildingLootWeapons = 0; // Spawn weapon loot in all buildings (0 = no, 1 = yes) -A3W_buildingLootSupplies = 1; // Spawn supply loot (backpacks & player items) in all buildings (0 = no, 1 = yes) -A3W_buildingLootChances = 25; // Chance percentage that loot will spawn at each spot in a building (0 to 100) +A3W_buildingLootSupplies = 0; // Spawn supply loot (backpacks & player items) in all buildings (0 = no, 1 = yes) +A3W_buildingLootChances = 0; // Chance percentage that loot will spawn at each spot in a building (0 to 100) A3W_vehicleLoot = 2; // Level of loot added to vehicles (0 = none, 1 = weapon OR items, 2 = weapon AND items, 3 = two weapons AND items) - 2 or 3 recommended if buildingLoot = 0 // Territory settings -A3W_territoryCaptureTime = 3*60; // Time in seconds needed to capture a territory +A3W_territoryCaptureTime = 2*60; // Time in seconds needed to capture a territory A3W_territoryPayroll = 1; // Periodically reward sides and indie groups based on how many territories they own (0 = no, 1 = yes) A3W_payrollInterval = 30*60; // Delay in seconds between each payroll -A3W_payrollAmount = 100; // Amount of money rewarded per territory on each payroll +A3W_payrollAmount = 400; // Amount of money rewarded per territory on each payroll // Mission settings A3W_serverMissions = 1; // Enable server missions (0 = no, 1 = yes) A3W_missionsDifficulty = 0; // Missions difficulty (0 = normal, 1 = hard) +A3W_missionsQuantity = 5; // Number of missions running at the same time (0 to 6) A3W_missionFarAiDrawLines = 1; // Draw small red lines on the map from mission markers to individual units & vehicles which are further away than 75m from the objective (0 = no, 1 = yes) -A3W_missionsQuantity = 6; // Number of missions running at the same time (0 to 6) A3W_heliPatrolMissions = 1; // Enable missions involving flying helicopters piloted by AI (0 = no, 1 = yes) A3W_underWaterMissions = 1; // Enable underwater missions which require diving gear (0 = no, 1 = yes) -A3W_mainMissionDelay = 10*60; // Time in seconds between Main Missions +A3W_mainMissionDelay = 5*60; // Time in seconds between Main Missions A3W_mainMissionTimeout = 60*60; // Time in seconds that a Main Mission will run for, unless completed A3W_sideMissionDelay = 5*60; // Time in seconds between Side Missions -A3W_sideMissionTimeout = 45*60; // Time in seconds that a Side Mission will run for, unless completed -A3W_moneyMissionDelay = 15*60; // Time in seconds between Money Missions +A3W_sideMissionTimeout = 60*60; // Time in seconds that a Side Mission will run for, unless completed +A3W_moneyMissionDelay = 10*60; // Time in seconds between Money Missions A3W_moneyMissionTimeout = 60*60; // Time in seconds that a Money Mission will run for, unless completed diff --git a/server/functions/basePartSetup.sqf b/server/functions/basePartSetup.sqf index 912beceba..402a405da 100644 --- a/server/functions/basePartSetup.sqf +++ b/server/functions/basePartSetup.sqf @@ -14,8 +14,10 @@ _obj addEventHandler ["Killed", _obj = _this select 0; _obj setVariable ["processedDeath", diag_tickTime]; + /* Not needed for sock-rpc-stats ... since object is not the map, it would not be saved if (!isNil "fn_manualObjectDelete") then { [objNull, _obj getVariable "A3W_objectID"] call fn_manualObjectDelete; }; + */ }]; diff --git a/server/functions/findClientPlayer.sqf b/server/functions/findClientPlayer.sqf index ac5210c6c..d823bc7d2 100644 --- a/server/functions/findClientPlayer.sqf +++ b/server/functions/findClientPlayer.sqf @@ -16,6 +16,6 @@ _player = objNull; _player = _x; }; } -forEach (call allPlayers); +forEach (call fn_allPlayers); _player diff --git a/server/functions/fn_addScore.sqf b/server/functions/fn_addScore.sqf index 21126cdd0..b46196354 100644 --- a/server/functions/fn_addScore.sqf +++ b/server/functions/fn_addScore.sqf @@ -49,10 +49,4 @@ if (isPlayer _player) then // sync Steam scoreboard _player addScore ((([_player, "playerKills"] call fn_getScore) - ([_player, "teamKills"] call fn_getScore)) - score _player); - - if (!isNil "_column" && !isNil "_score" && !isNil "fn_updateStats") then - { - // Log Scores to DB - [getPlayerUID _player, _column, _score] call fn_updateStats; - }; }; diff --git a/server/functions/fn_getScore.sqf b/server/functions/fn_getScore.sqf index e1da47556..74c76cbbc 100644 --- a/server/functions/fn_getScore.sqf +++ b/server/functions/fn_getScore.sqf @@ -2,18 +2,33 @@ // * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * // ****************************************************************************************** // @file Name: fn_getScore.sqf -// @file Author: AgentRev +// @file Author: AgentRev, micovery -private ["_player", "_column", "_val", "_var"]; +private ["_arg1", "_column", "_val", "_var", "_uid"]; -_player = _this select 0; +_arg1 = _this select 0; _column = _this select 1; -_val = 0; + _val = 0; + +if (isNil "_arg1") exitWith {_val}; + +private["_type"]; +_type = typeName _arg1; + +//arg1 could be either UID, or player object +if (_type == "STRING") then { + _uid = _arg1; +} +else { if (_type == "OBJECT" && {isPlayer _arg1}) then { + _uid = getPlayerUID _arg1; +};}; + +//exit if not a vlaid UID +if (isNil "_uid" || {typeName _uid != "STRING" || {_uid == ""}}) exitWith {_val}; + + +_var = format ["A3W_playerScore_%1_%2", _column, _uid]; +_val = missionNamespace getVariable [_var, 0]; -if (!isNil "_player" && {isPlayer _player}) then -{ - _var = format ["A3W_playerScore_%1_%2", _column, getPlayerUID _player]; - _val = missionNamespace getVariable [_var, 0]; -}; _val diff --git a/server/functions/fn_onPlayerDisconnected.sqf b/server/functions/fn_onPlayerDisconnected.sqf index 5f64624f6..478ed7df7 100644 --- a/server/functions/fn_onPlayerDisconnected.sqf +++ b/server/functions/fn_onPlayerDisconnected.sqf @@ -4,13 +4,30 @@ // @file Name: fn_onPlayerDisconnected.sqf // @file Author: AgentRev -private ["_id", "_uid", "_name", "_resend"]; +private ["_unit", "_id", "_uid", "_name", "_resend"]; + _id = _this select 0; _uid = _this select 1; _name = _this select 2; +_unit = _this select 3; diag_log format ["Player disconnected: %1 (%2)", _name, _uid]; +[_unit, _uid, _name] call p_disconnectSave; +if (_unit getVariable ["stats_reset",false]) then { + [_unit] spawn { + private["_unit"]; + _unit = _this select 0; + if (vehicle _unit != _unit && !isNil "fn_ejectCorpse") then { + _unit call fn_ejectCorpse; + }; + _unit call sh_drop_player_inventory; + _unit setDamage 1; + }; +}else{ + deleteVehicle _unit; +}; + _resend = false; // Clear player from group invites diff --git a/server/functions/fn_refillbox.sqf b/server/functions/fn_refillbox.sqf index dffe9e431..6d2cad619 100644 --- a/server/functions/fn_refillbox.sqf +++ b/server/functions/fn_refillbox.sqf @@ -33,7 +33,7 @@ switch (_boxType) do _boxItems = [ // Item type, Item class(es), # of items, # of magazines per weapon - ["wep", ["launch_RPG32_F", "launch_NLAW_F", "launch_Titan_short_F"], RANDOM_BETWEEN(3,5), RANDOM_BETWEEN(1,2)], + ["wep", ["launch_RPG32_F", "launch_NLAW_F"], RANDOM_BETWEEN(3,5), RANDOM_BETWEEN(1,2)], ["wep", "launch_Titan_F", RANDOM_BETWEEN(1,2), RANDOM_BETWEEN(1,2)], ["mag", ["ClaymoreDirectionalMine_Remote_Mag", "SLAMDirectionalMine_Wire_Mag", "ATMine_Range_Mag", "DemoCharge_Remote_Mag", "SatchelCharge_Remote_Mag"], RANDOM_BETWEEN(3,8)] ]; diff --git a/server/functions/fn_refilltruck.sqf b/server/functions/fn_refilltruck.sqf index 22b2b373b..ee13b0d08 100644 --- a/server/functions/fn_refilltruck.sqf +++ b/server/functions/fn_refilltruck.sqf @@ -31,7 +31,7 @@ _truckItems = ["wep", ["arifle_Mk20_GL_F", "arifle_TRG21_GL_F", "arifle_Katiba_GL_F", "arifle_MX_GL_F"], RANDOM_BETWEEN(2,5), RANDOM_BETWEEN(4,5)], ["mag", "1Rnd_HE_Grenade_shell", RANDOM_BETWEEN(5,10)], ["wep", ["srifle_GM6_LRPS_F", "srifle_LRR_LRPS_F"], RANDOM_BETWEEN(1,2), RANDOM_BETWEEN(4,6)], - ["wep", ["launch_RPG32_F", "launch_Titan_short_F"], RANDOM_BETWEEN(1,3), RANDOM_BETWEEN(1,2)], + ["wep", ["launch_RPG32_F", "launch_NLAW_F"], RANDOM_BETWEEN(1,3), RANDOM_BETWEEN(1,2)], ["mag", "HandGrenade", RANDOM_BETWEEN(0,5)], ["mag", ["APERSTripMine_Wire_Mag", "APERSBoundingMine_Range_Mag", "SLAMDirectionalMine_Wire_Mag", "ATMine_Range_Mag"], RANDOM_BETWEEN(2,6)] ]; diff --git a/server/functions/fn_setScore.sqf b/server/functions/fn_setScore.sqf new file mode 100644 index 000000000..33a6e9b4a --- /dev/null +++ b/server/functions/fn_setScore.sqf @@ -0,0 +1,20 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Name: fn_setScore.sqf +// @file Author: micovery + +private ["_player", "_column", "_value", "_var"]; + +_player = _this select 0; +_column = _this select 1; +_value = _this select 2; + +if (isNil "_player" || {not(isPlayer _player)}) exitWith {}; + +_var = format ["A3W_playerScore_%1_%2", _column, getPlayerUID _player]; +missionNamespace setVariable [_var, _value]; +publicVariable _var; + + + diff --git a/server/functions/serverCompile.sqf b/server/functions/serverCompile.sqf index 708b4ca11..d4baae030 100644 --- a/server/functions/serverCompile.sqf +++ b/server/functions/serverCompile.sqf @@ -56,6 +56,7 @@ fn_replaceMagazines = [_path, "fn_replaceMagazines.sqf"] call mf_compile; fn_replaceWeapons = [_path, "fn_replaceWeapons.sqf"] call mf_compile; fn_selectRandomWeighted = [_path, "fn_selectRandomWeighted.sqf"] call mf_compile; fn_updatePlayerScore = [_path, "fn_updatePlayerScore.sqf"] call mf_compile; + hintBroadcast = [_path, "hintBroadcast.sqf"] call mf_compile; parachuteLiftedVehicle = [_path, "parachuteLiftedVehicle.sqf"] call mf_compile; playerRespawnServer = [_path, "playerRespawnServer.sqf"] call mf_compile; diff --git a/server/functions/serverVars.sqf b/server/functions/serverVars.sqf index d645bd918..5059b0bff 100644 --- a/server/functions/serverVars.sqf +++ b/server/functions/serverVars.sqf @@ -144,9 +144,7 @@ staticHeliList = //Object List - Random Planes. staticPlaneList = [ - "B_Plane_CAS_01_F", - "O_Plane_CAS_02_F", - "I_Plane_Fighter_03_CAS_F" + "I_Plane_Fighter_03_AA_F" ]; //Random Weapon List - Change this to what you want to spawn in cars. @@ -196,10 +194,7 @@ vehicleAddition = "optic_Holosight_smg", "acc_flashlight", "acc_pointer_IR", - "Medikit", - "Medikit", - "FirstAidKit", - "ToolKit" + "FirstAidKit" ]; vehicleAddition2 = @@ -209,3 +204,4 @@ vehicleAddition2 = "Chemlight_yellow", "Chemlight_red" ]; + diff --git a/server/functions/setMissionSkill.sqf b/server/functions/setMissionSkill.sqf index 7478beaf1..c0489d477 100644 --- a/server/functions/setMissionSkill.sqf +++ b/server/functions/setMissionSkill.sqf @@ -14,13 +14,13 @@ _unit = _this; if (["A3W_missionsDifficulty"] call isConfigOn) then { - _skill = 0.5; // Default skill for ARMA3 is 0.5 - _accuracy = 1; // Relative multiplier; absolute default accuracy for ARMA3 is 0.25 + _skill = 0.75; // Default skill for ARMA3 is 0.5 + _accuracy = 0.5; // Relative multiplier; absolute default accuracy for ARMA3 is 0.25 } else { - _skill = 0.33; - _accuracy = 0.75; + _skill = 0.65; + _accuracy = 0.4; }; _unit allowFleeing 0; diff --git a/server/functions/setupStoreNPC.sqf b/server/functions/setupStoreNPC.sqf index b242aee54..9da0beadb 100644 --- a/server/functions/setupStoreNPC.sqf +++ b/server/functions/setupStoreNPC.sqf @@ -52,6 +52,7 @@ if (hasInterface) then _npc addAction [" Sell crate", "client\systems\selling\sellCrateItems.sqf", [false, false, true], 0.99, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_CRATE_CONDITION]; _npc addAction [" Sell contents", "client\systems\selling\sellCrateItems.sqf", [], 0.98, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_CONTENTS_CONDITION]; _npc addAction [" Sell last vehicle contents", "client\systems\selling\sellVehicleItems.sqf", [], 0.97, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_VEH_CONTENTS_CONDITION]; + _npc addAction [" Sell last vehicle", "client\systems\selling\sellVehicle.sqf", [], 0.97, false, true, "", STORE_ACTION_CONDITION + " && " + SELL_VEH_CONTENTS_CONDITION]; }; if (isServer) then diff --git a/server/functions/spawnStoreObject.sqf b/server/functions/spawnStoreObject.sqf index c6a34216a..0f41909f4 100644 --- a/server/functions/spawnStoreObject.sqf +++ b/server/functions/spawnStoreObject.sqf @@ -128,7 +128,8 @@ if (_key != "" && isPlayer _player && {_isGenStore || _isGunStore || _isVehStore _objectID = netId _object; _object setVariable ["A3W_purchasedStoreObject", true]; - _object setVariable ["ownerUID", getPlayerUID _player, true]; + + [_object] call v_trackVehicle; if (getNumber (configFile >> "CfgVehicles" >> _class >> "isUav") > 0) then { @@ -165,33 +166,50 @@ if (_key != "" && isPlayer _player && {_isGenStore || _isGunStore || _isVehStore { _object setPosATL [_safePos select 0, _safePos select 1, 0.05]; _object setVelocity [0,0,0.01]; - // _object spawn cleanVehicleWreck; - _object setVariable ["A3W_purchasedVehicle", true, true]; + //_object spawn cleanVehicleWreck; + //_object setVariable ["A3W_purchasedVehicle", true, true]; + + if ({_object isKindOf _x} count ["UAV_02_base_F", "UGV_01_base_F"] > 0) then { + _object setVariable ["A3W_purchasedVehicle", true]; + _object setVariable ["A3W_missionVehicle", false]; + _object setVariable ["ownerUID", getPlayerUID _player, true]; + _object setVariable ["ownerN", name _player, true]; + }; + + if ({_object isKindOf _x} count A3W_autosave_vehicles_list > 0) then { + [[netId _object, 2], "A3W_fnc_setLockState", _object] call A3W_fnc_MP; // Lock + _object setVariable ["objectLocked", true, true]; + _object setVariable ["R3F_LOG_disabled", true, true]; + _object setVariable ["A3W_purchasedVehicle", true]; + _object setVariable ["A3W_missionVehicle", false]; + _object setVariable ["ownerUID", getPlayerUID _player, true]; + _object setVariable ["ownerN", name _player, true]; + }; }; _object setDir (if (_object isKindOf "Plane") then { markerDir _marker } else { random 360 }); - _isDamageable = !(_object isKindOf "ReammoBox_F"); // ({_object isKindOf _x} count ["AllVehicles", "Lamps_base_F", "Cargo_Patrol_base_F", "Cargo_Tower_base_F"] > 0); + //_isDamageable = !(_object isKindOf "ReammoBox_F"); // ({_object isKindOf _x} count ["AllVehicles", "Lamps_base_F", "Cargo_Patrol_base_F", "Cargo_Tower_base_F"] > 0); [_object, false] call vehicleSetup; - _object allowDamage _isDamageable; - _object setVariable ["allowDamage", _isDamageable]; + //_object allowDamage _isDamageable; + //_object setVariable ["allowDamage", _isDamageable]; switch (true) do { case ({_object isKindOf _x} count ["Box_NATO_AmmoVeh_F", "Box_East_AmmoVeh_F", "Box_IND_AmmoVeh_F"] > 0): { - _object setAmmoCargo 5; + _object setAmmoCargo 0; }; case (_object isKindOf "O_Heli_Transport_04_ammo_F"): { - _object setAmmoCargo 10; + _object setAmmoCargo 0; }; case ({_object isKindOf _x} count ["B_Truck_01_ammo_F", "O_Truck_02_Ammo_F", "O_Truck_03_ammo_F", "I_Truck_02_ammo_F"] > 0): { - _object setAmmoCargo 25; + _object setAmmoCargo 0; }; case ({_object isKindOf _x} count ["C_Van_01_fuel_F", "I_G_Van_01_fuel_F", "O_Heli_Transport_04_fuel_F"] > 0): @@ -218,12 +236,101 @@ if (_key != "" && isPlayer _player && {_isGenStore || _isGunStore || _isVehStore { _object setRepairCargo 25; }; + + case ({_object isKindOf _x} count ["B_UAV_02_F", "O_UAV_02_F", "I_UAV_02_F"] > 0): + { + _object setVehicleAmmoDef 0; + _object addMagazineTurret ["Laserbatteries",[0]]; + _object addMagazineTurret ["2Rnd_LG_scalpel",[0]]; + _object addMagazineTurret ["120Rnd_CMFlare_Chaff_Magazine",[-1]]; + }; + + case (_object isKindOf "B_Plane_CAS_01_F"): + { + _object setVehicleAmmoDef 0; + _object removeWeaponTurret ["Missile_AGM_02_Plane_CAS_01_F",[-1]]; + _object removeWeaponTurret ["Rocket_04_HE_Plane_CAS_01_F",[-1]]; + _object removeWeaponTurret ["Rocket_04_AP_Plane_CAS_01_F",[-1]]; + _object removeWeaponTurret ["Bomb_04_Plane_CAS_01_F",[-1]]; + _object addMagazineTurret ["1000Rnd_Gatling_30mm_Plane_CAS_01_F",[-1]]; + _object addMagazineTurret ["2Rnd_Missile_AA_04_F",[-1]]; + _object addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; + }; + + case (_object isKindOf "O_Plane_CAS_02_F"): + { + _object setVehicleAmmoDef 0; + _object removeWeaponTurret ["Missile_AGM_01_Plane_CAS_02_F",[-1]]; + _object removeWeaponTurret ["Rocket_03_AP_Plane_CAS_02_F",[-1]]; + _object removeWeaponTurret ["Bomb_03_Plane_CAS_02_F",[-1]]; + _object addMagazineTurret ["500Rnd_Cannon_30mm_Plane_CAS_02_F",[-1]]; + _object addMagazineTurret ["20Rnd_Rocket_03_HE_F",[-1]]; + _object addMagazineTurret ["2Rnd_Missile_AA_03_F",[-1]]; + _object addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; + }; + + case (_object isKindOf "I_Plane_Fighter_03_CAS_F"): + { + _object setVehicleAmmoDef 0; + _object removeWeaponTurret ["missiles_SCALPEL",[-1]]; + _object addMagazineTurret ["300Rnd_20mm_shells",[-1]]; + _object addMagazineTurret ["300Rnd_20mm_shells",[-1]]; + _object addMagazineTurret ["2Rnd_AAA_missiles",[-1]]; + _object addMagazineTurret ["2Rnd_GBU12_LGB_MI10",[-1]]; + _object addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; + }; + + case (_object isKindOf "O_Heli_Light_02_F"): + { + _object setVehicleAmmoDef 0; + _object removeWeaponTurret ["missiles_DAGR",[-1]]; + _object addWeaponTurret ["missiles_DAR",[-1]]; + _object addMagazineTurret ["2000Rnd_65x39_Belt_Tracer_Green_Splash",[-1]]; + _object addMagazineTurret ["12Rnd_missiles",[-1]]; + _object addMagazineTurret ["168Rnd_CMFlare_Chaff_Magazine",[-1]]; + }; + + case (_object isKindOf "B_Heli_Attack_01_F"): + { + _object setVehicleAmmoDef 0; + _object addMagazineTurret ["12Rnd_PG_missiles",[0]]; + _object addMagazineTurret ["4Rnd_AAA_missiles",[0]]; + _object addMagazineTurret ["1000Rnd_20mm_shells",[0]]; + _object addMagazineTurret ["240Rnd_CMFlare_Chaff_Magazine",[-1]]; + }; + + case ({_object isKindOf _x} count ["O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F"] > 0): + { + _object setVehicleAmmoDef 0; + _object addMagazineTurret ["6Rnd_LG_scalpel",[0]]; + _object addMagazineTurret ["14Rnd_80mm_rockets",[0]]; + _object addMagazineTurret ["250Rnd_30mm_HE_shells",[0]]; + _object addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]]; + _object addMagazineTurret ["192Rnd_CMFlare_Chaff_Magazine",[-1]]; + }; + + case (_object isKindOf "Box_NATO_Ammo_F"): + { + _object allowDamage false; + }; + + case ({_object isKindOf _x} count ["B_Mortar_01_F", "O_Mortar_01_F", "I_Mortar_01_F"] > 0): + { + _object setVehicleAmmoDef 0; + _object addMagazineTurret ["8Rnd_82mm_Mo_shells",[0]]; + _object addMagazineTurret ["8Rnd_82mm_Mo_Flare_white",[0]]; + _object addMagazineTurret ["8Rnd_82mm_Mo_LG",[0]]; + _object setVariable ["A3W_purchasedVehicle", true]; + _object setVariable ["A3W_missionVehicle", false]; + _object setVariable ["ownerUID", getPlayerUID _player, true]; + _object setVariable ["ownerN", name _player, true]; + }; }; if (_object getVariable ["A3W_purchasedVehicle", false] && !isNil "fn_manualVehicleSave") then { - _object call fn_manualVehicleSave; - }; + _object call fn_manualVehicleSave; + }; }; }; }; diff --git a/server/functions/vehicleSetup.sqf b/server/functions/vehicleSetup.sqf index 48983b714..a6e951ea5 100644 --- a/server/functions/vehicleSetup.sqf +++ b/server/functions/vehicleSetup.sqf @@ -67,7 +67,7 @@ _vehicle addEventHandler ["Killed", }; }]; -if ({_class isKindOf _x} count ["Air","UGV_01_base_F"] > 0) then +if ({_class isKindOf _x} count ["LandVehicle", "Ship", "Air"] > 0) then { [netId _vehicle, "A3W_fnc_setupAntiExplode", true] call A3W_fnc_MP; }; @@ -82,7 +82,7 @@ switch (true) do _centerOfMass set [2, -0.657]; // original = -0.557481 _vehicle setCenterOfMass _centerOfMass; }; - case ({_class isKindOf _x} count ["B_Heli_Light_01_F", "B_Heli_Light_01_armed_F", "O_Heli_Light_02_unarmed_F"] > 0): + case ({_class isKindOf _x} count ["B_Heli_Light_01_F", "B_Heli_Light_01_armed_F", "O_Heli_Light_02_unarmed_F", "C_Heli_Light_01_civil_F"] > 0): { // Add flares to those poor helis _vehicle addWeaponTurret ["CMFlareLauncher", [-1]]; @@ -124,6 +124,13 @@ switch (true) do }; }; + +if (isDedicated) then { + //used for keeping track of the vehicle used un-used lifetime + _vehicle addEventHandler ["GetIn", { _this spawn v_GetIn_handler}]; + _vehicle addEventHandler ["GetOut", { _this spawn v_GetOut_handler}]; +}; + // Double minigun ammo to compensate for Bohemia's incompetence (http://feedback.arma3.com/view.php?id=21613) { _path = _x; diff --git a/server/init.sqf b/server/init.sqf index 0d6772e0f..bce1ad7b8 100644 --- a/server/init.sqf +++ b/server/init.sqf @@ -3,7 +3,7 @@ // ****************************************************************************************** // @file Version: 1.1 // @file Name: init.sqf -// @file Author: [404] Deadbeat, [GoT] JoSchaap, AgentRev +// @file Author: [404] Deadbeat, [GoT] JoSchaap, AgentRev, micovery // @file Created: 20/11/2012 05:19 // @file Description: The server init. // @file Args: @@ -22,8 +22,7 @@ addMissionEventHandler ["HandleDisconnect", _uid = _this select 2; _name = _this select 3; - diag_log format ["HandleDisconnect - %1", [_name, _uid]]; - +/* if (alive _unit) then { if (!(_unit call A3W_fnc_isUnconscious) && {!isNil "isConfigOn" && {["A3W_playerSaving"] call isConfigOn}}) then @@ -43,6 +42,12 @@ addMissionEventHandler ["HandleDisconnect", _unit spawn fn_ejectCorpse; }; }; + */ + + if (!isNil "fn_onPlayerDisconnected") then + { + [_id, _uid, _name, _unit] call fn_onPlayerDisconnected; + }; false }]; @@ -97,8 +102,7 @@ forEach "A3W_teamPlayersMap", "A3W_remoteBombStoreRadius", "A3W_vehiclePurchaseCooldown", - "A3W_globalVoiceWarnTimer", - "A3W_globalVoiceMaxWarns", + "A3W_disableGlobalVoice", "A3W_antiHackMinRecoil", "A3W_spawnBeaconCooldown", "A3W_spawnBeaconSpawnHeight", @@ -112,11 +116,13 @@ forEach "A3W_atmEditorPlacedOnly", "A3W_atmMapIcons", "A3W_atmRemoveIfDisabled", - "A3W_uavControl" + "A3W_uavControl", + "A3W_maxSpawnBeacons", + "A3W_townSpawnCooldown", + "A3W_survivalSystem" ]; ["A3W_join", "onPlayerConnected", { [_id, _uid, _name] spawn fn_onPlayerConnected }] call BIS_fnc_addStackedEventHandler; -["A3W_quit", "onPlayerDisconnected", { diag_log format ["onPlayerDisconnected - %1", [_name, _uid]] }] call BIS_fnc_addStackedEventHandler; _playerSavingOn = ["A3W_playerSaving"] call isConfigOn; _baseSavingOn = ["A3W_baseSaving"] call isConfigOn; @@ -142,6 +148,19 @@ if (_playerSavingOn || _objectSavingOn || _vehicleSavingOn) then _savingMethod = ["A3W_savingMethod", "profile"] call getPublicVar; if (_savingMethod == "iniDBI") then { _savingMethod = "iniDB" }; + _savingMethod = "sock"; + + if (_savingMethod == "sock") then { + A3W_savingMethod = compileFinal "sock"; + A3W_savingMethodName = compileFinal "'sock'"; + + diag_log format ["[INFO] ### A3W running with %1", call A3W_savingMethodName]; + + call compile preProcessFileLineNumbers "persistence\fn_sock_custom.sqf"; + + diag_log format ["[INFO] ### Saving method = %1", call A3W_savingMethodName]; + }; + // extDB if (_savingMethod == "extDB") then { @@ -203,11 +222,11 @@ if (_playerSavingOn || _objectSavingOn || _vehicleSavingOn) then //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - call compile preProcessFileLineNumbers format ["persistence\server\setup\%1\init.sqf", call A3W_savingMethodDir]; + //call compile preProcessFileLineNumbers format ["persistence\server\setup\%1\init.sqf", call A3W_savingMethodDir]; if (_playerSavingOn) then { - _setupPlayerDB = [] spawn compile preprocessFileLineNumbers "persistence\server\players\setupPlayerDB.sqf"; // scriptDone stays stuck on false when using execVM on Linux + _setupPlayerDB = [] spawn compile preprocessFileLineNumbers "persistence\players\s_setupPlayerDB.sqf"; // scriptDone stays stuck on false on Linux servers when using execVM // profileNamespace doesn't save antihack logs if (_savingMethod != "profile") then @@ -218,7 +237,7 @@ if (_playerSavingOn || _objectSavingOn || _vehicleSavingOn) then ["A3W_flagCheckOnJoin", "onPlayerConnected", { [_uid, _name] spawn fn_kickPlayerIfFlagged }] call BIS_fnc_addStackedEventHandler; - { [getPlayerUID _x, name _x] call fn_kickPlayerIfFlagged } forEach (call allPlayers); + { [getPlayerUID _x, name _x] call fn_kickPlayerIfFlagged } forEach (call fn_allPlayers); }; }; }; @@ -229,24 +248,26 @@ if (_playerSavingOn || _objectSavingOn || _vehicleSavingOn) then _objectSavingOn = _this select 1; _vehicleSavingOn = _this select 2; - A3W_objectIDs = []; - A3W_vehicleIDs = []; + _objectIDs = []; + _vehicleIDs = []; if (_objectSavingOn) then { - call compile preprocessFileLineNumbers "persistence\server\world\oLoad.sqf"; + _objectIDs = call compile preprocessFileLineNumbers "persistence\world\oLoad.sqf"; }; if (_vehicleSavingOn) then { - call compile preprocessFileLineNumbers "persistence\server\world\vLoad.sqf"; + _vehicleIDs = call compile preprocessFileLineNumbers "persistence\world\vLoad.sqf"; }; + /* if (_objectSavingOn || _vehicleSavingOn || {_playerSavingOn && call A3W_savingMethod == "profile"}) then { execVM "persistence\server\world\oSave.sqf"; //waitUntil {!isNil "A3W_oSaveReady"}; }; + */ }; { @@ -373,3 +394,5 @@ if (["A3W_serverMissions"] call isConfigOn) then // Start clean-up loop [] execVM "server\WastelandServClean.sqf"; + + diff --git a/server/missions/factoryMethods/createUnits/createRandomSoldier.sqf b/server/missions/factoryMethods/createUnits/createRandomSoldier.sqf index 9f6b27688..7ebe913da 100644 --- a/server/missions/factoryMethods/createUnits/createRandomSoldier.sqf +++ b/server/missions/factoryMethods/createUnits/createRandomSoldier.sqf @@ -18,9 +18,9 @@ if (!isServer) exitWith {}; private ["_soldierTypes", "_uniformTypes", "_vestTypes", "_weaponTypes", "_group", "_position", "_rank", "_soldier"]; _soldierTypes = ["C_man_polo_1_F", "C_man_polo_2_F", "C_man_polo_3_F", "C_man_polo_4_F", "C_man_polo_5_F", "C_man_polo_6_F"]; -_uniformTypes = ["U_B_CombatUniform_mcam_vest", "U_B_CombatUniform_mcam_tshirt" ,"U_B_CombatUniform_mcam"]; +_uniformTypes = ["U_IG_Guerilla1_1","U_IG_Guerilla2_3","U_IG_Guerilla2_1"]; _vestTypes = ["V_PlateCarrier1_rgr","V_PlateCarrier2_rgr"]; -_weaponTypes = ["arifle_TRG20_F","LMG_Mk200_F","arifle_MXM_F","arifle_MX_GL_F"]; +_weaponTypes = ["LMG_Mk200_MRCO_F","srifle_EBR_ARCO_pointer_snds_F","arifle_MXM_Hamr_pointer_F","arifle_Katiba_ARCO_pointer_F"]; _group = _this select 0; _position = _this select 1; diff --git a/server/missions/factoryMethods/createUnits/createRandomSoldierC.sqf b/server/missions/factoryMethods/createUnits/createRandomSoldierC.sqf index 9bbe41b77..2284e9254 100644 --- a/server/missions/factoryMethods/createUnits/createRandomSoldierC.sqf +++ b/server/missions/factoryMethods/createUnits/createRandomSoldierC.sqf @@ -8,11 +8,11 @@ if (!isServer) exitWith {}; private ["_soldierTypes", "_weaponTypes", "_group", "_position", "_soldier"]; _soldierTypes = ["C_man_1_3_F","C_man_polo_1_F","C_man_polo_2_F","C_man_polo_3_F","C_man_polo_4_F","C_man_polo_5_F"]; -_weaponTypes = ["arifle_TRG20_F","LMG_Mk200_F","arifle_MXM_F","arifle_MX_GL_F"]; +_weaponTypes = ["srifle_EBR_ARCO_pointer_F","arifle_MXM_Hamr_pointer_F","srifle_EBR_ARCO_pointer_snds_F","LMG_Mk200_MRCO_F"]; _group = _this select 0; _position = _this select 1; _soldier = _group createUnit [_soldierTypes call BIS_fnc_selectRandom, _position, [], 0, "NONE"]; -_soldier addUniform "U_B_Ghilliesuit"; +_soldier addUniform "U_I_GhillieSuit"; [_soldier, _weaponTypes call BIS_fnc_selectRandom, 3] call BIS_fnc_addWeapon; _soldier spawn refillPrimaryAmmo; diff --git a/server/missions/factoryMethods/createUnits/customGroup.sqf b/server/missions/factoryMethods/createUnits/customGroup.sqf index 8d7157010..3d5201ef0 100644 --- a/server/missions/factoryMethods/createUnits/customGroup.sqf +++ b/server/missions/factoryMethods/createUnits/customGroup.sqf @@ -2,7 +2,7 @@ // * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * // ****************************************************************************************** // @file Name: customGroup.sqf -// @file Author: AgentRev +// @file Author: AgentRev, micovery if (!isServer) exitWith {}; @@ -23,72 +23,204 @@ _unitTypes = "C_man_polo_6_F", "C_man_polo_6_F_euro", "C_man_polo_6_F_afro", "C_man_polo_6_F_asia" ]; +grenadier_loadout = { + private["_unit"]; + _unit = _this; + _unit addUniform "U_IG_Guerilla1_1"; + _unit addMagazine "1Rnd_HE_Grenade_shell"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addWeapon "arifle_MX_GL_F"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addMagazine "1Rnd_HE_Grenade_shell"; + _unit addMagazine "1Rnd_HE_Grenade_shell"; + _unit addItem "NVGoggles"; + _unit assignItem "NVGoggles"; +}; + +support_loadout = { + private["_unit"]; + _unit = _this; + + _unit addUniform "U_IG_Guerilla1_1"; + _unit addBackpack "B_Carryall_oli"; + _unit addMagazine "200Rnd_65x39_cased_Box"; + _unit addMagazine "200Rnd_65x39_cased_Box"; + _unit addWeapon "LMG_Mk200_MRCO_F"; + _unit addUniform "U_IG_Guerilla1_1"; + _unit addMagazine "200Rnd_65x39_cased_Box"; + _unit addItem "FirstAidKit"; + _unit addItem "NVGoggles"; + _unit assignItem "NVGoggles"; +}; + +sniper_loadout = { + private["_unit"]; + _unit = _this; + + _unit addUniform "U_I_GhillieSuit"; + _unit addBackpack "B_AssaultPack_rgr"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addWeapon "arifle_MXM_Hamr_pointer_F"; + _unit addPrimaryWeaponItem "muzzle_snds_H"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addItem "Rangefinder"; + _unit assignItem "Rangefinder"; + _unit addItem "ItemGps"; + _unit assignItem "ItemGps"; + _unit addItem "ItemCompass"; + _unit assignItem "ItemCompass"; + _unit addItem "NVGoggles"; + _unit assignItem "NVGoggles"; +}; + +aa_loadout = { + private["_unit"]; + _unit = _this; + + _unit addUniform "U_IG_Guerilla1_1"; + _unit addMagazine "30Rnd_9x21_Mag"; + _unit addMagazine "30Rnd_9x21_Mag"; + _unit addMagazine "30Rnd_9x21_Mag"; + _unit addMagazine "30Rnd_9x21_Mag"; + _unit addWeapon "SMG_02_ARCO_pointg_F"; + _unit addBackpack "B_Carryall_oli"; + _unit addMagazine "Titan_AA"; + _unit addWeapon "launch_Titan_F"; + _unit addMagazine "Titan_AA"; + _unit addItem "NVGoggles"; + _unit assignItem "NVGoggles"; +}; + +at_loadout = { + private["_unit"]; + _unit = _this; + + _unit addUniform "U_IG_Guerilla2_1"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addWeapon "SMG_01_Holo_pointer_snds_F"; + _unit addBackpack "B_Carryall_oli"; + _unit addMagazine "NLAW_F"; + _unit addWeapon "launch_NLAW_F"; + _unit addMagazine "NLAW_F"; + _unit addMagazine "NLAW_F"; + _unit addItem "NVGoggles"; + _unit assignItem "NVGoggles"; +}; + +leader_loadout = { + private["_unit"]; + _unit = _this; + + _unit addUniform "U_IG_leader"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addWeapon "arifle_Katiba_ARCO_pointer_F"; + _unit addBackpack "B_Carryall_oli"; + _unit addMagazine "NLAW_F"; + _unit addWeapon "launch_NLAW_F"; + _unit addMagazine "NLAW_F"; + _unit addItem "ItemGps"; + _unit assignItem "ItemGps"; + _unit addItem "ItemCompass"; + _unit assignItem "ItemCompass"; + _unit addItem "NVGoggles"; + _unit assignItem "NVGoggles"; +}; + +rifleman_loadout = { + private["_unit"]; + _unit = _this; + + _unit addUniform "U_IG_Guerilla2_3"; + _unit addMagazine "30Rnd_65x39_caseless_mag_Tracer"; + _unit addBackpack "B_AssaultPack_rgr"; + _unit addMagazine "30Rnd_65x39_caseless_mag_Tracer"; + _unit addMagazine "30Rnd_65x39_caseless_mag_Tracer"; + _unit addWeapon "arifle_MX_ACO_F"; + _unit addMagazine "30Rnd_65x39_caseless_mag_Tracer"; + _unit addPrimaryWeaponItem "acc_flashlight"; + _unit enablegunlights "forceOn"; +}; + +weighted_list = +[ + [1, sniper_loadout], + [1.1, aa_loadout], + [0.8, at_loadout], + [1.1, support_loadout], + [1, rifleman_loadout], + [1, grenadier_loadout] +]; + +get_weighted_loadout = { + private["_items"]; + _items = weighted_list; + + //calculate the total weight + private["_totalSum", "_weight"]; + _totalSum = 0; + { + _weight = _x select 0; + _totalSum = _weight + _totalSum; + } forEach _items; + + //pick at random from the distribution + private["_index", "_i", "_item", "_sum"]; + _index = random _totalSum; + _sum = 0; + _i = 0; + + while {_sum < _index} do { + _item = _items select _i; + _weight = _item select 0; + _sum = _sum + _weight; + _i = _i + 1; + }; + + ((_items select (_i - 1)) select 1) +}; + for "_i" from 1 to _nbUnits do { - _uPos = _pos vectorAdd ([[random _radius, 0, 0], random 360] call BIS_fnc_rotateVector2D); - _unit = _group createUnit [_unitTypes call BIS_fnc_selectRandom, _uPos, [], 0, "Form"]; - _unit setPosATL _uPos; - - removeAllWeapons _unit; - removeAllAssignedItems _unit; - removeUniform _unit; - removeVest _unit; - removeBackpack _unit; - removeHeadgear _unit; - removeGoggles _unit; - - _unit addVest "V_PlateCarrier1_rgr"; - _unit addMagazine "30Rnd_556x45_Stanag"; - _unit addMagazine "30Rnd_556x45_Stanag"; - _unit addMagazine "30Rnd_556x45_Stanag"; - - switch (true) do - { - // Grenadier every 3 units - case (_i % 3 == 0): - { - _unit addUniform "U_B_CombatUniform_mcam_vest"; - _unit addMagazine "1Rnd_HE_Grenade_shell"; - _unit addWeapon "arifle_TRG21_GL_F"; - _unit addMagazine "1Rnd_HE_Grenade_shell"; - _unit addMagazine "1Rnd_HE_Grenade_shell"; - }; - // RPG every 7 units, starting from second one - case ((_i + 5) % 7 == 0): - { - _unit addUniform "U_B_CombatUniform_mcam_tshirt"; - _unit addBackpack "B_Kitbag_mcamo"; - _unit addWeapon "arifle_TRG20_F"; - _unit addMagazine "Titan_AT"; - _unit addWeapon "launch_Titan_short_F"; - _unit addMagazine "Titan_AT"; - _unit addMagazine "Titan_AT"; - }; - // Rifleman - default - { - _unit addUniform "U_B_CombatUniform_mcam"; - - if (_unit == leader _group) then - { - _unit addWeapon "arifle_TRG21_F"; - _unit setRank "SERGEANT"; - } - else - { - _unit addWeapon "arifle_TRG20_F"; - }; - }; - }; - - _unit addPrimaryWeaponItem "acc_flashlight"; - _unit enablegunlights "forceOn"; - - _unit addRating 1e11; - _unit spawn addMilCap; - _unit spawn refillPrimaryAmmo; - _unit call setMissionSkill; - _unit addEventHandler ["Killed", server_playerDied]; + _uPos = _pos vectorAdd ([[random _radius, 0, 0], random 360] call BIS_fnc_rotateVector2D); + _unit = _group createUnit [_unitTypes call BIS_fnc_selectRandom, _uPos, [], 0, "Form"]; + _unit setPosATL _uPos; + + removeAllWeapons _unit; + removeAllAssignedItems _unit; + removeUniform _unit; + removeVest _unit; + removeBackpack _unit; + removeHeadgear _unit; + removeGoggles _unit; + + _unit addVest "V_PlateCarrier1_rgr"; + _unit addItem "FirstAidKit"; + + if (_unit == leader _group) then { + _unit call leader_loadout; + _unit setRank "SERGEANT"; + } + else { + private["_loadout"]; + _loadout = call get_weighted_loadout; + _unit call _loadout; + }; + + _unit addRating 1e11; + _unit spawn addMilCap; + _unit spawn refillPrimaryAmmo; + _unit call setMissionSkill; + _unit addEventHandler ["Killed", server_playerDied]; }; [_group, _pos] call defendArea; diff --git a/server/missions/factoryMethods/createUnits/customGroup2.sqf b/server/missions/factoryMethods/createUnits/customGroup2.sqf index 0439ef812..0cf963cc8 100644 --- a/server/missions/factoryMethods/createUnits/customGroup2.sqf +++ b/server/missions/factoryMethods/createUnits/customGroup2.sqf @@ -34,12 +34,14 @@ for "_i" from 1 to _nbUnits do removeAllWeapons _unit; removeAllAssignedItems _unit; + //removeUniform _unit; removeVest _unit; removeBackpack _unit; - _unit addVest "V_HarnessOSpec_gry"; - _unit addMagazine "30Rnd_556x45_Stanag"; - _unit addMagazine "30Rnd_556x45_Stanag"; - _unit addMagazine "30Rnd_556x45_Stanag"; + removeHeadgear _unit; + removeGoggles _unit; + + _unit addVest "V_PlateCarrier1_rgr"; + _unit addItem "FirstAidKit"; switch (true) do { @@ -47,31 +49,50 @@ for "_i" from 1 to _nbUnits do case (_i % 3 == 0): { _unit addMagazine "1Rnd_HE_Grenade_shell"; - _unit addWeapon "arifle_TRG21_GL_F"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addWeapon "arifle_MX_GL_F"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; + _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "1Rnd_HE_Grenade_shell"; _unit addMagazine "1Rnd_HE_Grenade_shell"; }; // RPG every 7 units, starting from second one case ((_i + 5) % 7 == 0): { - _unit addBackpack "B_Kitbag_mcamo"; - _unit addWeapon "arifle_TRG20_F"; - _unit addMagazine "Titan_AT"; - _unit addWeapon "launch_Titan_short_F"; - _unit addMagazine "Titan_AT"; - _unit addMagazine "Titan_AT"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addMagazine "30Rnd_65x39_caseless_green_mag_Tracer"; + _unit addWeapon "arifle_Katiba_ARCO_F"; + _unit addBackpack "B_Carryall_oli"; + _unit addMagazine "NLAW_F"; + _unit addWeapon "launch_NLAW_F"; + _unit addMagazine "NLAW_F"; }; // Rifleman default { if (_unit == leader _group) then { - _unit addWeapon "arifle_TRG21_F"; + _unit addBackpack "B_AssaultPack_rgr"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addMagazine "30Rnd_45ACP_Mag_SMG_01"; + _unit addWeapon "SMG_01_Holo_pointer_snds_F"; + _unit addItem "ItemGps"; + _unit assignItem "ItemGps"; + _unit addItem "ItemCompass"; + _unit assignItem "ItemCompass"; _unit setRank "SERGEANT"; } else { - _unit addWeapon "arifle_TRG20_F"; + _unit addMagazine "30Rnd_556x45_Stanag_Tracer_Red"; + _unit addWeapon "arifle_TRG20_Holo_F"; + _unit addMagazine "30Rnd_556x45_Stanag_Tracer_Red"; + _unit addMagazine "30Rnd_556x45_Stanag_Tracer_Red"; + _unit addMagazine "30Rnd_556x45_Stanag_Tracer_Red"; }; }; }; diff --git a/server/missions/factoryMethods/createUnits/largeDivers.sqf b/server/missions/factoryMethods/createUnits/largeDivers.sqf index 5e8005b9f..bc7d90746 100644 --- a/server/missions/factoryMethods/createUnits/largeDivers.sqf +++ b/server/missions/factoryMethods/createUnits/largeDivers.sqf @@ -15,68 +15,92 @@ _pos = _this select 1; // Rifleman _leader = _group createUnit ["C_man_polo_1_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _leader; -_leader addVest "V_RebreatherB"; -_leader addUniform "U_B_Wetsuit"; +removeUniform _leader; +_leader addVest "V_RebreatherIA"; +_leader addUniform "U_I_Wetsuit"; _leader addGoggles "G_Diving"; _leader addMagazine "20Rnd_556x45_UW_Mag"; _leader addWeapon "arifle_SDAR_F"; _leader addMagazine "20Rnd_556x45_UW_Mag"; _leader addMagazine "20Rnd_556x45_UW_Mag"; +_leader addItem "NVGoggles"; +_leader assignItem "NVGoggles"; +_leader addItem "FirstAidKit"; // Rifleman _man2 = _group createUnit ["C_man_polo_2_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man2; -_man2 addUniform "U_B_Wetsuit"; -_man2 addVest "V_RebreatherB"; +removeUniform _man2; +_man2 addVest "V_RebreatherIA"; +_man2 addUniform "U_I_Wetsuit"; _man2 addGoggles "G_Diving"; _man2 addMagazine "20Rnd_556x45_UW_Mag"; _man2 addWeapon "arifle_SDAR_F"; _man2 addMagazine "20Rnd_556x45_UW_Mag"; _man2 addMagazine "20Rnd_556x45_UW_Mag"; +_man2 addItem "NVGoggles"; +_man2 assignItem "NVGoggles"; +_man2 addItem "FirstAidKit"; // Rifleman _man3 = _group createUnit ["C_man_polo_3_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man3; -_man3 addUniform "U_B_Wetsuit"; -_man3 addVest "V_RebreatherB"; +removeUniform _man3; +_man3 addVest "V_RebreatherIA"; +_man3 addUniform "U_I_Wetsuit"; _man3 addGoggles "G_Diving"; _man3 addMagazine "20Rnd_556x45_UW_Mag"; _man3 addWeapon "arifle_SDAR_F"; _man3 addMagazine "20Rnd_556x45_UW_Mag"; _man3 addMagazine "20Rnd_556x45_UW_Mag"; +_man3 addItem "NVGoggles"; +_man3 assignItem "NVGoggles"; +_man3 addItem "FirstAidKit"; // Rifleman _man4 = _group createUnit ["C_man_polo_4_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man4; -_man4 addUniform "U_B_Wetsuit"; -_man4 addVest "V_RebreatherB"; +removeUniform _man4; +_man4 addVest "V_RebreatherIA"; +_man4 addUniform "U_I_Wetsuit"; _man4 addGoggles "G_Diving"; _man4 addMagazine "20Rnd_556x45_UW_Mag"; _man4 addWeapon "arifle_SDAR_F"; _man4 addMagazine "20Rnd_556x45_UW_Mag"; _man4 addMagazine "20Rnd_556x45_UW_Mag"; +_man4 addItem "NVGoggles"; +_man4 assignItem "NVGoggles"; +_man4 addItem "FirstAidKit"; // Rifleman _man5 = _group createUnit ["C_man_polo_5_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man5; -_man5 addUniform "U_B_Wetsuit"; -_man5 addVest "V_RebreatherB"; +removeUniform _man5; +_man5 addVest "V_RebreatherIA"; +_man5 addUniform "U_I_Wetsuit"; _man5 addGoggles "G_Diving"; _man5 addMagazine "20Rnd_556x45_UW_Mag"; _man5 addWeapon "arifle_SDAR_F"; _man5 addMagazine "20Rnd_556x45_UW_Mag"; _man5 addMagazine "20Rnd_556x45_UW_Mag"; +_man5 addItem "NVGoggles"; +_man5 assignItem "NVGoggles"; +_man5 addItem "FirstAidKit"; // Rifleman _man6 = _group createUnit ["C_man_polo_4_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man6; -_man6 addUniform "U_B_Wetsuit"; -_man6 addVest "V_RebreatherB"; +removeUniform _man6; +_man6 addVest "V_RebreatherIA"; +_man6 addUniform "U_I_Wetsuit"; _man6 addGoggles "G_Diving"; _man6 addMagazine "20Rnd_556x45_UW_Mag"; _man6 addWeapon "arifle_SDAR_F"; _man6 addMagazine "20Rnd_556x45_UW_Mag"; _man6 addMagazine "20Rnd_556x45_UW_Mag"; +_man6 addItem "NVGoggles"; +_man6 assignItem "NVGoggles"; +_man6 addItem "FirstAidKit"; _leader = leader _group; diff --git a/server/missions/factoryMethods/createUnits/smallDivers.sqf b/server/missions/factoryMethods/createUnits/smallDivers.sqf index 4f5b95b02..6c79d83d6 100644 --- a/server/missions/factoryMethods/createUnits/smallDivers.sqf +++ b/server/missions/factoryMethods/createUnits/smallDivers.sqf @@ -15,35 +15,47 @@ _pos = _this select 1; // Leader _leader = _group createUnit ["C_man_polo_1_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _leader; -_leader addVest "V_RebreatherB"; -_leader addUniform "U_B_Wetsuit"; +removeUniform _leader; +_leader addVest "V_RebreatherIA"; +_leader addUniform "U_I_Wetsuit"; _leader addGoggles "G_Diving"; _leader addMagazine "20Rnd_556x45_UW_Mag"; _leader addWeapon "arifle_SDAR_F"; _leader addMagazine "20Rnd_556x45_UW_Mag"; _leader addMagazine "20Rnd_556x45_UW_Mag"; +_leader addItem "NVGoggles"; +_leader assignItem "NVGoggles"; +_leader addItem "FirstAidKit"; // Rifleman _man2 = _group createUnit ["C_man_polo_2_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man2; -_man2 addUniform "U_B_Wetsuit"; -_man2 addVest "V_RebreatherB"; +removeUniform _man2; +_man2 addVest "V_RebreatherIA"; +_man2 addUniform "U_I_Wetsuit"; _man2 addGoggles "G_Diving"; _man2 addMagazine "20Rnd_556x45_UW_Mag"; _man2 addWeapon "arifle_SDAR_F"; _man2 addMagazine "20Rnd_556x45_UW_Mag"; _man2 addMagazine "20Rnd_556x45_UW_Mag"; +_man2 addItem "NVGoggles"; +_man2 assignItem "NVGoggles"; +_man2 addItem "FirstAidKit"; // Rifleman _man3 = _group createUnit ["C_man_polo_3_F", [(_pos select 0) + 10, _pos select 1, 0], [], 1, "Form"]; removeAllAssignedItems _man3; -_man3 addUniform "U_B_Wetsuit"; -_man3 addVest "V_RebreatherB"; +removeUniform _man3; +_man3 addVest "V_RebreatherIA"; +_man3 addUniform "U_I_Wetsuit"; _man3 addGoggles "G_Diving"; _man3 addMagazine "20Rnd_556x45_UW_Mag"; _man3 addWeapon "arifle_SDAR_F"; _man3 addMagazine "20Rnd_556x45_UW_Mag"; _man3 addMagazine "20Rnd_556x45_UW_Mag"; +_man3 addItem "NVGoggles"; +_man3 assignItem "NVGoggles"; +_man3 addItem "FirstAidKit"; _leader = leader _group; diff --git a/server/missions/moneyMissions/mission_MoneyShipment.sqf b/server/missions/moneyMissions/mission_MoneyShipment.sqf index de7f9e7d6..f421a00fc 100644 --- a/server/missions/moneyMissions/mission_MoneyShipment.sqf +++ b/server/missions/moneyMissions/mission_MoneyShipment.sqf @@ -44,7 +44,7 @@ _setupVars = // Medium [ "Medium Money Shipment", // Marker text - 50000, // Money + 35000, // Money [ [ // NATO convoy ["B_MRAP_01_hmg_F", "B_MRAP_01_gmg_F"], // Veh 1 @@ -66,7 +66,7 @@ _setupVars = // Hard [ "Large Money Shipment", // Marker text - 75000, // Money + 50000, // Money [ [ // NATO convoy ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F"], // Veh 1 @@ -88,7 +88,7 @@ _setupVars = // Extreme [ "Heavy Money Shipment", // Marker text - 100000, // Money + 75000, // Money [ [ // NATO convoy ["B_APC_Wheeled_01_cannon_F", "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_AA_F", "B_MBT_01_cannon_F", "B_MBT_01_TUSK_F"], // Veh 1 diff --git a/server/missions/moneyMissions/mission_SunkenTreasure.sqf b/server/missions/moneyMissions/mission_SunkenTreasure.sqf index 25e71d199..d0738587a 100644 --- a/server/missions/moneyMissions/mission_SunkenTreasure.sqf +++ b/server/missions/moneyMissions/mission_SunkenTreasure.sqf @@ -54,7 +54,7 @@ _setupObjects = [_vehicle, _aiGroup] spawn checkMissionVehicleLock; _missionPicture = getText (configFile >> "CfgVehicles" >> _vehicleClass >> "picture"); - _missionHintText = format ["A treasure containing $25,000 and weapons is being recovered.
If you want to capture it, you will need diving gear and an underwater weapon.", moneyMissionColor]; + _missionHintText = format ["A treasure containing $30,000 and weapons is being recovered.
If you want to capture it, you will need diving gear and an underwater weapon.", moneyMissionColor]; }; _waitUntilMarkerPos = nil; @@ -78,7 +78,7 @@ _successExec = // Give the rewards { - _x setVariable ["cmoney", 2500, true]; + _x setVariable ["cmoney", 3000, true]; _x setVariable ["owner", "world", true]; } forEach _cashObjects; diff --git a/server/missions/setupMissionArrays.sqf b/server/missions/setupMissionArrays.sqf index e31c1f36e..8418303c5 100644 --- a/server/missions/setupMissionArrays.sqf +++ b/server/missions/setupMissionArrays.sqf @@ -9,10 +9,10 @@ if (!isServer) exitWith {}; MainMissions = [ // Mission filename, weight - ["mission_ArmedDiversquad", 1], - ["mission_Coastal_Convoy", 1], + ["mission_ArmedDiversquad", 0.1], + ["mission_Coastal_Convoy", 0.5], ["mission_Convoy", 1], - ["mission_HostileHeliFormation", 0.5], + ["mission_HostileHeliFormation", 0.1], ["mission_APC", 1], ["mission_MBT", 1], ["mission_LightArmVeh", 1], @@ -22,20 +22,22 @@ MainMissions = SideMissions = [ - ["mission_HostileHelicopter", 0.5], - ["mission_MiniConvoy", 1], - ["mission_SunkenSupplies", 1], + ["mission_HostileHelicopter", 0.1], + ["mission_MiniConvoy", 0.5], + ["mission_SunkenSupplies", 0.1], ["mission_TownInvasion", 2], //["mission_AirWreck", 1.5], //["mission_WepCache", 1.5], - ["mission_Outpost", 3], - ["mission_Truck", 1] + ["mission_Outpost", 1.5], + ["mission_Truck", 0.5], + ["mission_Smugglers", 2], + ["mission_drugsRunners", 1] ]; MoneyMissions = [ ["mission_MoneyShipment", 1], - ["mission_SunkenTreasure", 1] + ["mission_SunkenTreasure", 0.5] ]; MainMissions = [MainMissions, [["A3W_heliPatrolMissions", ["mission_Coastal_Convoy", "mission_HostileHeliFormation"]], ["A3W_underWaterMissions", ["mission_ArmedDiversquad"]]]] call removeDisabledMissions; diff --git a/server/missions/sideMissions/mission_Smugglers.sqf b/server/missions/sideMissions/mission_Smugglers.sqf new file mode 100644 index 000000000..fb85d4be7 --- /dev/null +++ b/server/missions/sideMissions/mission_Smugglers.sqf @@ -0,0 +1,147 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Name: mission_Smugglers.sqf +// @file Author: JoSchaap, AgentRev, LouD + +if (!isServer) exitwith {}; +#include "sideMissionDefines.sqf"; + +private ["_positions", "_smugglerVeh", "_vehicle1", "_vehicle2", "_boxes1", "_currBox1", "_randomBox", "_box1", "_boxes2", "_currBox2", "_box2", "_cashrandomizera", "_cashamountrandomizera", "_cashpilerandomizera", "_casha", "_cashamounta", "_cashpilea", "_cashrandomizerb", "_cashamountrandomizerb", "_cashpilerandomizerb", "_cashb", "_cashamountb", "_cashpileb", "_cash1", "_cash2", "_drop_item", "_drugpilerandomizer", "_drugpile"]; + +_setupVars = +{ + _missionType = "Weapon Smugglers"; + + _locationsArray = MissionSpawnMarkers; +}; + +_setupObjects = +{ + _missionPos = markerPos _missionLocation; + _smugglerVeh = ["B_MRAP_01_hmg_F","O_MRAP_02_hmg_F","I_MRAP_03_hmg_F"] call BIS_fnc_selectRandom; + + _vehicle1 = [_smugglerVeh,[(_missionPos select 0) - 5, (_missionPos select 1) + 10,0],0.5,1,0,"NONE"] call createMissionVehicle; + _vehicle1 setVariable [call vChecksum, true, false]; + _vehicle1 setFuel 1; + _vehicle1 setVehicleLock "UNLOCKED"; + _vehicle1 setVariable ["R3F_LOG_disabled", false, true]; + + _vehicle2 = [_smugglerVeh,[(_missionPos select 0) - 5, (_missionPos select 1) - 10,0],0.5,1,0,"NONE"] call createMissionVehicle; + _vehicle2 setVariable [call vChecksum, true, false]; + _vehicle2 setFuel 1; + _vehicle2 setVehicleLock "UNLOCKED"; + _vehicle2 setVariable ["R3F_LOG_disabled", false, true]; + + _boxes1 = ["Box_FIA_Support_F","Box_FIA_Wps_F","Box_FIA_Ammo_F"]; + _currBox1 = _boxes1 call BIS_fnc_selectRandom; + _randomBox = ["mission_USLaunchers","mission_USSpecial","mission_Main_A3snipers"] call BIS_fnc_selectRandom; + _box1 = createVehicle [_currBox1,[(_missionPos select 0), (_missionPos select 1),0],[], 0, "NONE"]; + [_box1, _randomBox] call fn_refillbox; + + _boxes2 = ["Box_FIA_Support_F","Box_FIA_Wps_F","Box_FIA_Ammo_F"]; + _currBox2 = _boxes2 call BIS_fnc_selectRandom; + _box2 = createVehicle [_currBox2,[(_missionPos select 0) - 5, (_missionPos select 1) - 8,0],[], 0, "NONE"]; + _box2 allowDamage false; + _box2 setVariable ["R3F_LOG_disabled", true, true]; + + _aiGroup = createGroup CIVILIAN; + [_aiGroup, _missionPos, _nbUnits] call createCustomGroup; + + _aiGroup setCombatMode "RED"; + _aiGroup setBehaviour "COMBAT"; + + _missionPicture = getText (configFile >> "CfgVehicles" >> _smugglerVeh >> "picture"); + + _missionHintText = format ["A group of weapon smugglers have been spotted. Stop the weapon deal and take their weapons and money.", sideMissionColor]; +}; + +_waitUntilMarkerPos = nil; +_waitUntilExec = nil; +_waitUntilCondition = nil; + +_failedExec = +{ + // Mission failed + { deleteVehicle _x } forEach [_box1, _box2, _vehicle1, _vehicle2]; +}; + +_drop_item = +{ + private["_item", "_pos"]; + _item = _this select 0; + _pos = _this select 1; + + if (isNil "_item" || {typeName _item != typeName [] || {count(_item) != 2}}) exitWith {}; + if (isNil "_pos" || {typeName _pos != typeName [] || {count(_pos) != 3}}) exitWith {}; + + private["_id", "_class"]; + _id = _item select 0; + _class = _item select 1; + + private["_obj"]; + _obj = createVehicle [_class, _pos, [], 5, "None"]; + _obj setPos ([_pos, [[2 + random 3,0,0], random 360] call BIS_fnc_rotateVector2D] call BIS_fnc_vectorAdd); + _obj setVariable ["mf_item_id", _id, true]; +}; + +_successExec = +{ + // Mission completed + { _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1, _box2]; + { _x setVariable ["A3W_missionVehicle", true] } forEach [_vehicle1, _vehicle2]; + + //Random fake - real money + _cashrandomizera = ["money","cmoney","money","cmoney"]; + _cashamountrandomizera = [1000,1500,2000,2500,3000,3500,4000,4500,5000]; + _cashpilerandomizera = [3,5]; + + _casha = _cashrandomizera call BIS_fnc_SelectRandom; + _cashamounta = _cashamountrandomizera call BIS_fnc_SelectRandom; + _cashpilea = _cashpilerandomizera call BIS_fnc_SelectRandom; + + for "_i" from 1 to _cashpilea do + { + _cash1 = createVehicle ["Land_Money_F",[(_lastPos select 0), (_lastPos select 1) - 5,0],[], 0, "NONE"]; + _cash1 setPos ([_lastPos, [[2 + random 3,0,0], random 360] call BIS_fnc_rotateVector2D] call BIS_fnc_vectorAdd); + _cash1 setDir random 360; + _cash1 setVariable [_casha, _cashamounta, true]; + _cash1 setVariable ["owner", "world", true]; + }; + + _cashrandomizerb = ["money","cmoney","money","cmoney"]; + _cashamountrandomizerb = [1000,1500,2000,2500,3000,3500,4000,4500,5000]; + _cashpilerandomizerb = [3,5]; + + _cashb = _cashrandomizerb call BIS_fnc_SelectRandom; + _cashamountb = _cashamountrandomizerb call BIS_fnc_SelectRandom; + _cashpileb = _cashpilerandomizerb call BIS_fnc_SelectRandom; + + for "_i" from 1 to _cashpileb do + { + _cash2 = createVehicle ["Land_Money_F",[(_lastPos select 0), (_lastPos select 1) - 5,0],[], 0, "NONE"]; + _cash2 setPos ([_lastPos, [[2 + random 3,0,0], random 360] call BIS_fnc_rotateVector2D] call BIS_fnc_vectorAdd); + _cash2 setDir random 360; + _cash2 setVariable [_cashb, _cashamountb, true]; + _cash2 setVariable ["owner", "world", true]; + }; + + _drugpilerandomizer = [4,8]; + _drugpile = _drugpilerandomizer call BIS_fnc_SelectRandom; + + for "_i" from 1 to _drugpile do + { + private["_item"]; + _item = [ + ["lsd", "Land_WaterPurificationTablets_F"], + ["marijuana", "Land_VitaminBottle_F"], + ["cocaine","Land_PowderedMilk_F"], + ["heroin", "Land_PainKillers_F"] + ] call BIS_fnc_selectRandom; + [_item, _lastPos] call _drop_item; + }; + + _successHintMessage = format ["The smugglers are dead. The weapons, drugs, and money are yours!"]; +}; + +_this call sideMissionProcessor; diff --git a/server/missions/sideMissions/mission_TownInvasion.sqf b/server/missions/sideMissions/mission_TownInvasion.sqf index 21596363d..53de597bb 100644 --- a/server/missions/sideMissions/mission_TownInvasion.sqf +++ b/server/missions/sideMissions/mission_TownInvasion.sqf @@ -32,6 +32,7 @@ _setupVars = if (random 1 < 0.75) then { _fillEvenly = true } else { _fillEvenly = false }; }; + _setupObjects = { // spawn some crates in the middle of town (Town marker position) @@ -39,6 +40,7 @@ _setupObjects = _box1 setDir random 360; [_box1, "mission_USSpecial"] call fn_refillbox; + _box2 = createVehicle ["Box_East_Wps_F", _missionPos, [], 5, "None"]; _box2 setDir random 360; [_box2, "mission_USLaunchers"] call fn_refillbox; @@ -52,6 +54,7 @@ _setupObjects = _chair2 setDir random 180; _cFire1 = createVehicle ["Campfire_burning_F", _missionPos, [], 2, "None"]; + townInvasionDrugPos = getPos _cFire1; { _x setVariable ["R3F_LOG_disabled", true, true] } forEach [_box1, _box2]; @@ -69,6 +72,24 @@ _waitUntilMarkerPos = nil; _waitUntilExec = nil; _waitUntilCondition = nil; +_drop_item = { + private["_item", "_pos"]; + _item = _this select 0; + _pos = _this select 1; + + if (isNil "_item" || {typeName _item != typeName [] || {count(_item) != 2}}) exitWith {}; + if (isNil "_pos" || {typeName _pos != typeName [] || {count(_pos) != 3}}) exitWith {}; + + private["_id", "_class"]; + _id = _item select 0; + _class = _item select 1; + + private["_obj"]; + _obj = createVehicle [_class, _pos, [], 5, "None"]; + _obj setPos ([_pos, [[2 + random 3,0,0], random 360] call BIS_fnc_rotateVector2D] call BIS_fnc_vectorAdd); + _obj setVariable ["mf_item_id", _id, true]; +}; + _failedExec = { // Mission failed @@ -80,7 +101,21 @@ _successExec = // Mission completed { _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1, _box2]; - _successHintMessage = format ["Nice work!

%2
is a safe place again!
Their belongings are now yours to take!", sideMissionColor, _townName]; + for "_i" from 4 to 16 do { + private["_item"]; + _item = [ + ["lsd", "Land_WaterPurificationTablets_F"], + ["marijuana", "Land_VitaminBottle_F"], + ["cocaine","Land_PowderedMilk_F"], + ["heroin", "Land_PainKillers_F"], + ["water","Land_BottlePlastic_V2_F"], + ["cannedfood", "Land_BakedBeans_F"] + + ] call BIS_fnc_selectRandom; + [_item, townInvasionDrugPos] call _drop_item; + }; + + _successHintMessage = format ["Nice work!

%2
is a safe place again!
Their belongings, and drugs are now yours to take!", sideMissionColor, _townName]; { deleteVehicle _x } forEach [_tent1, _chair1, _chair2, _cFire1]; }; diff --git a/server/missions/sideMissions/mission_drugsRunners.sqf b/server/missions/sideMissions/mission_drugsRunners.sqf new file mode 100644 index 000000000..8b4553892 --- /dev/null +++ b/server/missions/sideMissions/mission_drugsRunners.sqf @@ -0,0 +1,162 @@ +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +// @file Version: 2.1 +// @file Name: mission_drugsRunners.sqf +// @file Author: JoSchaap / routes by Del1te - (original idea by Sanjo), AgentRev, LouD +// @file Created: 31/08/2013 18:19 + +if (!isServer) exitwith {}; +#include "sideMissionDefines.sqf"; + +private ["_convoyVeh", "_veh1", "_veh2", "_createVehicle", "_vehicles", "_leader", "_speedMode", "_waypoint", "_vehicleName", "_numWaypoints", "_drop_item", "_drugpilerandomizer", "_drugpile"]; + +_setupVars = +{ + _missionType = "Drugs Runners"; + _locationsArray = nil; +}; + +_setupObjects = +{ + _town = (call cityList) call BIS_fnc_selectRandom; + _missionPos = markerPos (_town select 0); + + // pick the vehicles for the convoy + _convoyVeh = if (missionDifficultyHard) then + { + ["C_Hatchback_01_sport_F"] + } + else + { + ["C_Hatchback_01_sport_F"] + }; + + _veh1 = _convoyVeh select 0; + + _createVehicle = + { + private ["_type", "_position", "_direction", "_vehicle", "_soldier"]; + + _type = _this select 0; + _position = _this select 1; + _direction = _this select 2; + + _vehicle = createVehicle [_type, _position, [], 0, "None"]; + _vehicle setVariable ["R3F_LOG_disabled", true, true]; + [_vehicle] call vehicleSetup; + + _vehicle setDir _direction; + _aiGroup addVehicle _vehicle; + + _soldier = [_aiGroup, _position] call createRandomSoldier; + _soldier moveInDriver _vehicle; + + _soldier = [_aiGroup, _position] call createRandomSoldier; + _soldier moveInCargo [_vehicle, 0]; + + switch (true) do + { + case (_type isKindOf "C_Hatchback_01_sport_F"): + { + [_vehicle, "#(rgb,1,1,1)color(0.01,0.01,0.01,1)", [0]] call applyVehicleTexture; // Apply black color + }; + }; + + [_vehicle, _aiGroup] spawn checkMissionVehicleLock; + + _vehicle + }; + + _aiGroup = createGroup CIVILIAN; + + _pos = getMarkerPos (_town select 0); + _rad = _town select 1; + _vehiclePos = [_pos,5,_rad,5,0,0,0] call findSafePos; + + _vehicles = + [ + [_veh1, _vehiclePos, 0] call _createVehicle + ]; + + _leader = effectiveCommander (_vehicles select 0); + _aiGroup selectLeader _leader; + + _aiGroup setCombatMode "GREEN"; // units will never fire + _aiGroup setBehaviour "CARELESS"; // nits will try to stay on roads, not caring about finding any cover + _aiGroup setFormation "STAG COLUMN"; + + _speedMode = if (missionDifficultyHard) then { "FULL" } else { "FULL" }; + + _aiGroup setSpeedMode _speedMode; + + // behaviour on waypoints + { + _waypoint = _aiGroup addWaypoint [markerPos (_x select 0), 0]; + _waypoint setWaypointType "MOVE"; + _waypoint setWaypointCompletionRadius 50; + _waypoint setWaypointCombatMode "GREEN"; + _waypoint setWaypointBehaviour "CARELESS"; + _waypoint setWaypointFormation "STAG COLUMN"; + _waypoint setWaypointSpeed _speedMode; + } forEach ((call cityList) call BIS_fnc_arrayShuffle); + + _missionPos = getPosATL leader _aiGroup; + + _missionPicture = getText (configFile >> "CfgVehicles" >> _veh1 >> "picture"); + _vehicleName = getText (configFile >> "CfgVehicles" >> _veh1 >> "displayName"); + + _missionHintText = format ["Drugrunners have been spotted driving a %1. Stop them quickly and retrieve their drugs!", _vehicleName, sideMissionColor]; + + _numWaypoints = count waypoints _aiGroup; +}; + +_waitUntilMarkerPos = {getPosATL _leader}; +_waitUntilExec = nil; +_waitUntilCondition = {currentWaypoint _aiGroup >= _numWaypoints}; + +_failedExec = nil; + +// _vehicles are automatically deleted or unlocked in missionProcessor depending on the outcome + +_drop_item = +{ + private["_item", "_pos"]; + _item = _this select 0; + _pos = _this select 1; + + if (isNil "_item" || {typeName _item != typeName [] || {count(_item) != 2}}) exitWith {}; + if (isNil "_pos" || {typeName _pos != typeName [] || {count(_pos) != 3}}) exitWith {}; + + private["_id", "_class"]; + _id = _item select 0; + _class = _item select 1; + + private["_obj"]; + _obj = createVehicle [_class, _pos, [], 5, "None"]; + _obj setPos ([_pos, [[2 + random 3,0,0], random 360] call BIS_fnc_rotateVector2D] call BIS_fnc_vectorAdd); + _obj setVariable ["mf_item_id", _id, true]; +}; + +_successExec = +{ + // Mission completed + _drugpilerandomizer = [2,4,8]; + _drugpile = _drugpilerandomizer call BIS_fnc_SelectRandom; + + for "_i" from 1 to _drugpile do + { + private["_item"]; + _item = [ + ["lsd", "Land_WaterPurificationTablets_F"], + ["marijuana", "Land_VitaminBottle_F"], + ["cocaine","Land_PowderedMilk_F"], + ["heroin", "Land_PainKillers_F"] + ] call BIS_fnc_selectRandom; + [_item, _lastPos] call _drop_item; + }; + + _successHintMessage = "You have stopped the drugrunners! The drugs are yours to take!"; +}; + +_this call sideMissionProcessor; diff --git a/storeConfig.sqf b/storeConfig.sqf index 8db303766..46b39ea24 100644 --- a/storeConfig.sqf +++ b/storeConfig.sqf @@ -1,945 +1,980 @@ -// ****************************************************************************************** -// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * -// ****************************************************************************************** -/*********************************************************# -# @@ScriptName: storeConfig.sqf -# @@Author: His_Shadow, AgentRev -# @@Create Date: 2013-09-16 20:40:58 -#*********************************************************/ - -// This tracks which store owner the client is interacting with -currentOwnerName = ""; - -// Gunstore Weapon List - Gun Store Base List -// Text name, classname, buy cost - -pistolArray = compileFinal str -[ - // Handguns - ["P07 Pistol", "hgun_P07_F", 50], - ["Rook-40 Pistol", "hgun_Rook40_F", 50], - ["ACP-C2 Pistol", "hgun_ACPC2_F", 75], - ["Zubr Revolver", "hgun_Pistol_heavy_02_F", 75], - ["4-Five Pistol", "hgun_Pistol_heavy_01_F", 100] -]; - -smgArray = compileFinal str -[ - ["PDW2000 SMG", "hgun_PDW2000_F", 100], - ["Sting SMG", "SMG_02_F", 125], - ["Vermin SMG", "SMG_01_F", 125] -]; - -rifleArray = compileFinal str -[ - // Underwater Gun - ["SDAR Underwater Rifle", "arifle_SDAR_F", 100], - - // Assault Rifles - ["Mk20 Carbine", "arifle_Mk20C_plain_F", 150], - ["Mk20 Carbine (Camo)", "arifle_Mk20C_F", 150], - ["Mk20 Rifle", "arifle_Mk20_plain_F", 200], - ["Mk20 Rifle (Camo)", "arifle_Mk20_F", 200], - ["Mk20 EGLM Rifle", "arifle_Mk20_GL_plain_F", 250], - ["Mk20 EGLM Rifle (Camo)", "arifle_Mk20_GL_F", 250], - - ["TRG-20 Carbine", "arifle_TRG20_F", 150], - ["TRG-21 Rifle ", "arifle_TRG21_F", 200], - ["TRG-21 EGLM Rifle", "arifle_TRG21_GL_F", 250], - - ["Katiba Carbine", "arifle_Katiba_C_F", 150], - ["Katiba Rifle", "arifle_Katiba_F", 200], - ["Katiba GL Rifle", "arifle_Katiba_GL_F", 250], - - ["MX Carbine", "arifle_MXC_F", 150], - ["MX Carbine (Black)", "arifle_MXC_Black_F", 175], - ["MX Rifle", "arifle_MX_F", 200], - ["MX Rifle (Black)", "arifle_MX_Black_F", 225], - ["MX 3GL Rifle", "arifle_MX_GL_F", 250], - ["MX 3GL Rifle (Black)", "arifle_MX_GL_Black_F", 275], - - // Markman Rifles - ["MXM Rifle", "arifle_MXM_F", 300], - ["MXM Rifle (Black)", "arifle_MXM_Black_F", 325], - ["DMR Rifle", "srifle_DMR_01_F", 375], - ["Mk18 ABR Rifle", "srifle_EBR_F", 450], - - // DLC - ["Mk14 Rifle (Camo) [DLC]", "srifle_DMR_06_camo_F", 450], - ["Mk14 Rifle (Olive) [DLC]", "srifle_DMR_06_olive_F", 450], - ["Mk-I EMR Rifle [DLC]", "srifle_DMR_03_F", 500], - ["Mk-I EMR Rifle (Camo) [DLC]", "srifle_DMR_03_multicam_F", 550], - ["Mk-I EMR Rifle (Khaki) [DLC]", "srifle_DMR_03_khaki_F", 550], - ["Mk-I EMR Rifle (Sand) [DLC]", "srifle_DMR_03_tan_F", 550], - ["Mk-I EMR Rifle (Woodland) [DLC]", "srifle_DMR_03_woodland_F", 550], - ["MAR-10 Rifle [DLC]", "srifle_DMR_02_F", 750], - ["MAR-10 Rifle (Camo) [DLC]", "srifle_DMR_02_camo_F", 800], - ["MAR-10 Rifle (Sand) [DLC]", "srifle_DMR_02_sniper_F", 800], - ["Cyrus Rifle [DLC]", "srifle_DMR_05_blk_F", 750], - ["Cyrus Rifle (Hex) [DLC]", "srifle_DMR_05_hex_F", 800], - ["Cyrus Rifle (Tan) [DLC]", "srifle_DMR_05_tan_f", 800], - - // Sniper Rifles - ["M320 LRR Sniper", "srifle_LRR_LRPS_F", 1000], - ["M320 LRR Sniper (Camo)", "srifle_LRR_camo_LRPS_F", 1200], - ["GM6 Lynx Sniper", "srifle_GM6_LRPS_F", 1250], - ["GM6 Lynx Sniper (Camo)", "srifle_GM6_camo_LRPS_F", 1500], - - ["ASP-1 Kir Rifle [DLC]", "srifle_DMR_04_F", 2000], - ["ASP-1 Kir Rifle (Tan) [DLC]", "srifle_DMR_04_tan_F", 2250] -]; - -lmgArray = compileFinal str -[ - ["MX SW LMG", "arifle_MX_SW_F", 300], - ["MX SW LMG (Black)", "arifle_MX_SW_Black_F", 325], - ["Mk200 LMG", "LMG_Mk200_F", 400], - ["Zafir LMG", "LMG_Zafir_F", 500], - ["Navid MMG (Tan) [DLC]", "MMG_01_tan_F", 750], - ["Navid MMG (Hex) [DLC]", "MMG_01_hex_F", 750], - ["SPMG MMG (Sand) [DLC]", "MMG_02_sand_F", 750], - ["SPMG MMG (MTP) [DLC]", "MMG_02_camo_F", 750], - ["SPMG MMG (Black) [DLC]", "MMG_02_black_F", 800] -]; - -launcherArray = compileFinal str -[ - ["RPG-42 Alamut", "launch_RPG32_F", 400], - ["PCML", "launch_NLAW_F", 600], - ["Titan MPRL Compact (Tan)", "launch_Titan_short_F", 500], - ["Titan MPRL Compact (Brown)", "launch_O_Titan_short_F", 500], - ["Titan MPRL Compact (Olive)", "launch_I_Titan_short_F", 500], - ["Titan MPRL AA (Desert)", "launch_Titan_F", 600], - ["Titan MPRL AA (Hex)", "launch_O_Titan_F", 600], - ["Titan MPRL AA (Digi)", "launch_I_Titan_F", 600] -]; - -allGunStoreFirearms = compileFinal str (call pistolArray + call smgArray + call rifleArray + call lmgArray + call launcherArray); - -staticGunsArray = compileFinal str -[ - // ["Vehicle Ammo Crate", "Box_NATO_AmmoVeh_F", 2500], - ["Static Titan AT 4Rnd (NATO)", "B_static_AT_F", 2500], // Static launchers only have 4 ammo, hence the low price - ["Static Titan AT 4Rnd (CSAT)", "O_static_AT_F", 2500], - ["Static Titan AT 4Rnd (AAF)", "I_static_AT_F", 2500], - ["Static Titan AA 4Rnd (NATO)", "B_static_AA_F", 3000], - ["Static Titan AA 4Rnd (CSAT)", "O_static_AA_F", 3000], - ["Static Titan AA 4Rnd (AAF)", "I_static_AA_F", 3000], - ["Mk30 HMG .50 Low tripod (NATO)", "B_HMG_01_F", 2000], - ["Mk30 HMG .50 Low tripod (CSAT)", "O_HMG_01_F", 2000], - ["Mk30 HMG .50 Low tripod (AAF)", "I_HMG_01_F", 2000], - // ["Mk30A HMG .50 Sentry (NATO)", "B_HMG_01_A_F", 5000], // "A" = Autonomous = Overpowered - // ["Mk30A HMG .50 Sentry (CSAT)", "O_HMG_01_A_F", 5000], - // ["Mk30A HMG .50 Sentry (AAF)", "I_HMG_01_A_F", 5000], - ["Mk30 HMG .50 High tripod (NATO)", "B_HMG_01_high_F", 3000], - ["Mk30 HMG .50 High tripod (CSAT)", "O_HMG_01_high_F", 3000], - ["Mk30 HMG .50 High tripod (AAF)", "I_HMG_01_high_F", 3000], - ["Mk32 GMG 20mm Low tripod (NATO)", "B_GMG_01_F", 5000], - ["Mk32 GMG 20mm Low tripod (CSAT)", "O_GMG_01_F", 5000], - ["Mk32 GMG 20mm Low tripod (AAF)", "I_GMG_01_F", 5000], - // ["Mk32A GMG 20mm Sentry (NATO)", "B_GMG_01_A_F", 10000], - // ["Mk32A GMG 20mm Sentry (CSAT)", "O_GMG_01_A_F", 10000], - // ["Mk32A GMG 20mm Sentry (AAF)", "I_GMG_01_A_F", 10000], - ["Mk32 GMG 20mm High tripod (NATO)", "B_GMG_01_high_F", 6000], - ["Mk32 GMG 20mm High tripod (CSAT)", "O_GMG_01_high_F", 6000], - ["Mk32 GMG 20mm High tripod (AAF)", "I_GMG_01_high_F", 6000], - ["Mk6 Mortar (NATO)", "B_Mortar_01_F", 12500], - ["Mk6 Mortar (CSAT)", "O_Mortar_01_F", 12500], - ["Mk6 Mortar (AAF)", "I_Mortar_01_F", 12500] -]; - -throwputArray = compileFinal str -[ - ["Mini Grenade", "MiniGrenade", 50], - ["Frag Grenade", "HandGrenade", 100], - ["APERS Tripwire Mine", "APERSTripMine_Wire_Mag", 200], - ["APERS Bounding Mine", "APERSBoundingMine_Range_Mag", 250], - ["APERS Mine", "APERSMine_Range_Mag", 300], - ["Claymore Charge", "ClaymoreDirectionalMine_Remote_Mag", 350], - ["M6 SLAM Mine", "SLAMDirectionalMine_Wire_Mag", 350], - ["AT Mine", "ATMine_Range_Mag", 400], - ["Explosive Charge", "DemoCharge_Remote_Mag", 450], - ["Explosive Satchel", "SatchelCharge_Remote_Mag", 500], - ["Smoke Grenade (White)", "SmokeShell", 50], - ["Smoke Grenade (Purple)", "SmokeShellPurple", 50], - ["Smoke Grenade (Blue)", "SmokeShellBlue", 50], - ["Smoke Grenade (Green)", "SmokeShellGreen", 50], - ["Smoke Grenade (Yellow)", "SmokeShellYellow", 50], - ["Smoke Grenade (Orange)", "SmokeShellOrange", 50], - ["Smoke Grenade (Red)", "SmokeShellRed", 50] -]; - -//Gun Store Ammo List -//Text name, classname, buy cost -ammoArray = compileFinal str -[ - ["9mm 16Rnd Mag", "16Rnd_9x21_Mag", 10], - ["9mm 30Rnd Mag", "30Rnd_9x21_Mag", 15], - [".45 ACP 6Rnd Cylinder", "6Rnd_45ACP_Cylinder", 5], - [".45 ACP 9Rnd Mag", "9Rnd_45ACP_Mag", 10], - [".45 ACP 11Rnd Mag", "11Rnd_45ACP_Mag", 15], - [".45 ACP 30Rnd Vermin Mag", "30Rnd_45ACP_MAG_SMG_01", 20], - [".45 ACP 30Rnd Tracer (Green) Mag", "30Rnd_45ACP_Mag_SMG_01_tracer_green", 15], - ["5.56mm 20Rnd Underwater Mag", "20Rnd_556x45_UW_mag", 10], - ["5.56mm 30Rnd STANAG Mag", "30Rnd_556x45_Stanag", 20], - ["5.56mm 30Rnd Tracer (Green) Mag", "30Rnd_556x45_Stanag_Tracer_Green", 15], - ["5.56mm 30Rnd Tracer (Yellow) Mag", "30Rnd_556x45_Stanag_Tracer_Yellow", 15], - ["5.56mm 30Rnd Tracer (Red) Mag", "30Rnd_556x45_Stanag_Tracer_Red", 15], - ["6.5mm 30Rnd STANAG Mag", "30Rnd_65x39_caseless_mag", 20], - ["6.5mm 30Rnd Tracer (Red) Mag", "30Rnd_65x39_caseless_mag_Tracer", 15], - ["6.5mm 30Rnd Caseless Mag", "30Rnd_65x39_caseless_green", 20], - ["6.5mm 30Rnd Tracer (Green) Mag", "30Rnd_65x39_caseless_green_mag_Tracer", 15], - ["6.5mm 100Rnd Belt Case", "100Rnd_65x39_caseless_mag", 75], - ["6.5mm 100Rnd Tracer (Red) Belt Case", "100Rnd_65x39_caseless_mag_Tracer", 50], - ["6.5mm 200Rnd Belt Case", "200Rnd_65x39_cased_Box", 150], - ["6.5mm 200Rnd Tracer (Yellow) Belt Case", "200Rnd_65x39_cased_Box_Tracer", 125], - //["7.62mm 10Rnd Mag", "10Rnd_762x51_Mag", 15], - ["7.62mm 10Rnd Mag", "10Rnd_762x54_Mag", 15], - ["7.62mm 20Rnd Mag", "20Rnd_762x51_Mag", 25], - //["7.62mm 150Rnd Box", "150Rnd_762x51_Box", 150], - //["7.62mm 150Rnd Tracer (Green) Box", "150Rnd_762x51_Box_Tracer", 125], - ["7.62mm 150Rnd Box", "150Rnd_762x54_Box", 150], - ["7.62mm 150Rnd Tracer (Green) Box", "150Rnd_762x54_Box_Tracer", 125], - [".338 LM 10Rnd Mag", "10Rnd_338_Mag", 50], - [".338 NM 130Rnd Belt", "130Rnd_338_Mag", 150], - ["9.3mm 10Rnd Mag", "10Rnd_93x64_DMR_05_Mag", 50], - ["9.3mm 150Rnd Belt", "150Rnd_93x64_Mag", 150], - [".408 7Rnd Cheetah Mag", "7Rnd_408_Mag", 50], - ["12.7mm 5Rnd Mag", "5Rnd_127x108_Mag", 50], - ["12.7mm 5Rnd Armor-Piercing Mag", "5Rnd_127x108_APDS_Mag", 60], - ["12.7mm 10Rnd Subsonic Mag", "10Rnd_127x54_Mag", 75], - ["RPG-42 Anti-Tank Rocket", "RPG32_F", 250], // Direct damage: high | Splash damage: low | Guidance: none - ["RPG-42 High-Explosive Rocket", "RPG32_HE_F", 250], // Direct damage: medium | Splash damage: medium | Guidance: none - ["PCML Anti-Tank Missile", "NLAW_F", 400], // Direct damage: very high | Splash damage: low | Guidance: laser, ground vehicles - ["Titan Anti-Tank Missile", "Titan_AT", 350], // Direct damage: high | Splash damage: low | Guidance: mouse, laser, ground vehicles - ["Titan Anti-Personnel Missile", "Titan_AP", 350], // Direct damage: low | Splash damage: high | Guidance: mouse, laser - ["Titan Anti-Air Missile", "Titan_AA", 350], // Direct damage: low | Splash damage: medium | Guidance: aircraft - ["40mm HE Grenade Round", "1Rnd_HE_Grenade_shell", 125], - ["40mm 3Rnd HE Grenades", "3Rnd_HE_Grenade_shell", 250], - ["40mm Smoke Round (White)", "1Rnd_Smoke_Grenade_shell", 50], - ["40mm Smoke Round (Purple)", "1Rnd_SmokePurple_Grenade_shell", 50], - ["40mm Smoke Round (Blue)", "1Rnd_SmokeBlue_Grenade_shell", 50], - ["40mm Smoke Round (Green)", "1Rnd_SmokeGreen_Grenade_shell", 50], - ["40mm Smoke Round (Yellow)", "1Rnd_SmokeYellow_Grenade_shell", 50], - ["40mm Smoke Round (Orange)", "1Rnd_SmokeOrange_Grenade_shell", 50], - ["40mm Smoke Round (Red)", "1Rnd_SmokeRed_Grenade_shell", 50], - ["40mm 3Rnd Smokes (White)", "3Rnd_Smoke_Grenade_shell", 100], - ["40mm 3Rnd Smokes (Purple)", "3Rnd_SmokePurple_Grenade_shell", 100], - ["40mm 3Rnd Smokes (Blue)", "3Rnd_SmokeBlue_Grenade_shell", 100], - ["40mm 3Rnd Smokes (Green)", "3Rnd_SmokeGreen_Grenade_shell", 100], - ["40mm 3Rnd Smokes (Yellow)", "3Rnd_SmokeYellow_Grenade_shell", 100], - ["40mm 3Rnd Smokes (Orange)", "3Rnd_SmokeOrange_Grenade_shell", 100], - ["40mm 3Rnd Smokes (Red)", "3Rnd_SmokeRed_Grenade_shell", 100], - ["40mm Flare Round (White)", "UGL_FlareWhite_F", 25], - ["40mm Flare Round (Green)", "UGL_FlareGreen_F", 25], - ["40mm Flare Round (Yellow)", "UGL_FlareYellow_F", 25], - ["40mm Flare Round (Red)", "UGL_FlareRed_F", 25], - ["40mm Flare Round (IR)", "UGL_FlareCIR_F", 25], - ["40mm 3Rnd Flares (White)", "3Rnd_UGL_FlareWhite_F", 50], - ["40mm 3Rnd Flares (Green)", "3Rnd_UGL_FlareGreen_F", 50], - ["40mm 3Rnd Flares (Yellow)", "3Rnd_UGL_FlareYellow_F", 50], - ["40mm 3Rnd Flares (Red)", "3Rnd_UGL_FlareRed_F", 50], - ["40mm 3Rnd Flares (IR)", "3Rnd_UGL_FlareCIR_F", 50] -]; - -//Gun Store item List -//Text name, classname, buy cost, item class -accessoriesArray = compileFinal str -[ - ["Suppressor 9mm", "muzzle_snds_L", 50, "item"], - ["Suppressor .45 ACP", "muzzle_snds_acp", 75, "item"], - ["Suppressor 5.56mm", "muzzle_snds_M", 100, "item"], - ["Suppressor 6.5mm", "muzzle_snds_H", 100, "item"], - ["Suppressor 6.5mm LMG", "muzzle_snds_H_MG", 125, "item"], - ["Suppressor 7.62mm", "muzzle_snds_B", 125, "item"], - ["Suppressor .338 [DLC]", "muzzle_snds_338_black", 150, "item"], - ["Suppressor .338 (Green) [DLC]", "muzzle_snds_338_green", 150, "item"], - ["Suppressor .338 (Sand) [DLC]", "muzzle_snds_338_sand", 175, "item"], - ["Suppressor 9.3mm [DLC]", "muzzle_snds_93mmg", 175, "item"], - ["Suppressor 9.3mm (Tan) [DLC]", "muzzle_snds_93mmg_tan", 175, "item"], - ["Bipod (NATO)", "bipod_01_F_blk", 250, "item"], - ["Bipod (CSAT)", "bipod_02_F_blk", 250, "item"], - ["Bipod (AAF)", "bipod_03_F_blk", 250, "item"], - ["Bipod (MTP)", "bipod_01_F_mtp", 250, "item"], - ["Bipod (Hex)", "bipod_02_F_hex", 250, "item"], - ["Bipod (Olive)", "bipod_03_F_oli", 250, "item"], - ["Bipod (Sand)", "bipod_01_F_snd", 250, "item"], - ["Bipod (Tan)", "bipod_02_F_tan", 250, "item"], - ["Flashlight", "acc_flashlight", 25, "item"], - ["IR Laser Pointer", "acc_pointer_IR", 25, "item"], - ["Yorris Sight (Zubr Revolver)", "optic_Yorris", 50, "item"], - ["MRD Sight (4-Five Pistol)", "optic_MRD", 50, "item"], - ["ACO (CQB)", "optic_aco_smg", 50, "item"], - ["Holosight (CQB)", "optic_Holosight_smg", 50, "item"], - ["ACO (Red)", "optic_Aco", 75, "item"], - ["ACO (Green)", "optic_Aco_grn", 75, "item"], - ["Holosight", "optic_Holosight", 75, "item"], - ["MRCO", "optic_MRCO", 100, "item"], - ["ARCO", "optic_Arco", 125, "item"], - ["RCO", "optic_Hamr", 150, "item"], - ["MOS", "optic_SOS", 150, "item"], - ["DMS", "optic_DMS", 175, "item"], - ["AMS [DLC]", "optic_AMS", 200, "item"], - ["AMS (Khaki) [DLC]", "optic_AMS_khk", 200, "item"], - ["AMS (Sand) [DLC]", "optic_AMS_snd", 200, "item"], - ["Kahlia [DLC]", "optic_KHS_blk", 250, "item"], - ["Kahlia (Hex) [DLC]", "optic_KHS_hex", 250, "item"], - ["Kahlia (Tan) [DLC]", "optic_KHS_tan", 250, "item"], - ["Kahlia (Old) [DLC]", "optic_KHS_old", 250, "item"], - ["LRPS", "optic_LRPS", 300, "item"], - ["NVS", "optic_NVS", 500, "item"], - ["TWS", "optic_tws", 5000, "item"], - ["TWS MG", "optic_tws_mg", 6000, "item"], - ["Nightstalker", "optic_Nightstalker", 7500, "item"] -]; - -// If commented, means the color/camo isn't implemented or is a duplicate of another hat -headArray = compileFinal str -[ - ["ECH", "H_HelmetB", 50, "hat"], - ["ECH (Ghillie)", "H_HelmetB_camo", 50, "hat"], - ["ECH (Light)", "H_HelmetB_light", 50, "hat"], - ["ECH (Spraypaint)", "H_HelmetB_paint", 50, "hat"], - ["SF Helmet", "H_HelmetSpecB", 50, "hat"], - ["SF Helmet (Black)", "H_HelmetSpecB_blk", 50, "hat"], - ["SF Helmet (Light Paint)", "H_HelmetSpecB_paint1", 50, "hat"], - ["SF Helmet (Dark Paint)", "H_HelmetSpecB_paint2", 50, "hat"], - ["Combat Helmet (Black)", "H_HelmetB_plain_blk", 50, "hat"], - ["Protector Helmet (Hex)", "H_HelmetO_ocamo", 50, "hat"], - ["Protector Helmet (Urban)", "H_HelmetO_oucamo", 50, "hat"], - ["Defender Helmet (Hex)", "H_HelmetLeaderO_ocamo", 50, "hat"], - ["Defender Helmet (Urban)", "H_HelmetLeaderO_oucamo", 50, "hat"], - // ["Assassin Helmet (Hex)", "H_HelmetSpecO_ocamo", 50, "hat"], - ["Assassin Helmet (Black)", "H_HelmetSpecO_blk", 50, "hat"], - ["MICH", "H_HelmetIA", 50, "hat"], - // ["MICH (Camo)", "H_HelmetIA_net", 50, "hat"], - // ["MICH 2 (Camo)", "H_HelmetIA_camo", 50, "hat"], - ["Heli Crew Helmet (NATO)", "H_CrewHelmetHeli_B", 50, "hat"], - ["Heli Crew Helmet (CSAT)", "H_CrewHelmetHeli_O", 50, "hat"], - ["Heli Crew Helmet (AAF)", "H_CrewHelmetHeli_I", 50, "hat"], - ["Heli Pilot Helmet (NATO)", "H_PilotHelmetHeli_B", 50, "hat"], - ["Heli Pilot Helmet (CSAT)", "H_PilotHelmetHeli_O", 50, "hat"], - ["Heli Pilot Helmet (AAF)", "H_PilotHelmetHeli_I", 50, "hat"], - ["Crew Helmet (NATO)", "H_HelmetCrew_B", 50, "hat"], - ["Crew Helmet (CSAT)", "H_HelmetCrew_O", 50, "hat"], - ["Crew Helmet (AAF)", "H_HelmetCrew_I", 50, "hat"], - ["Pilot Helmet (NATO)", "H_PilotHelmetFighter_B", 50, "hat"], - ["Pilot Helmet (CSAT)", "H_PilotHelmetFighter_O", 50, "hat"], - ["Pilot Helmet (AAF)", "H_PilotHelmetFighter_I", 50, "hat"], - ["Military Cap (Blue)", "H_MilCap_blue", 25, "hat"], - ["Military Cap (Gray)", "H_MilCap_gry", 25, "hat"], - ["Military Cap (Urban)", "H_MilCap_oucamo", 25, "hat"], - ["Military Cap (Russia)", "H_MilCap_rucamo", 25, "hat"], - ["Military Cap (MTP)", "H_MilCap_mcamo", 25, "hat"], - ["Military Cap (Hex)", "H_MilCap_ocamo", 25, "hat"], - ["Military Cap (AAF)", "H_MilCap_dgtl", 25, "hat"], - ["Rangemaster Cap", "H_Cap_headphones", 25, "hat"], - ["Bandanna (Coyote)", "H_Bandanna_cbr", 10, "hat"], - ["Bandanna (Camo)", "H_Bandanna_camo", 10, "hat"], - ["Bandanna (Gray)", "H_Bandanna_gry", 10, "hat"], - ["Bandanna (Khaki)", "H_Bandanna_khk", 10, "hat"], - ["Bandanna (MTP)", "H_Bandanna_mcamo", 10, "hat"], - ["Bandanna (Sage)", "H_Bandanna_sgg", 10, "hat"], - ["Bandanna (Surfer)", "H_Bandanna_surfer", 10, "hat"], - // ["Bandanna Mask (Black)", "H_BandMask_blk", 10, "hat"], - // ["Bandanna Mask (Demon)", "H_BandMask_demon", 10, "hat"], - // ["Bandanna Mask (Khaki)", "H_BandMask_khk", 10, "hat"], - // ["Bandanna Mask (Reaper)", "H_BandMask_reaper", 10, "hat"], - ["Beanie (Black)", "H_Watchcap_blk", 10, "hat"], - ["Beanie (Dark blue)", "H_Watchcap_sgg", 10, "hat"], - ["Beanie (Dark brown)", "H_Watchcap_cbr", 10, "hat"], - ["Beanie (Dark khaki)", "H_Watchcap_khk", 10, "hat"], - ["Beanie (Dark green)", "H_Watchcap_camo", 10, "hat"], - ["Beret (Black)", "H_Beret_blk", 10, "hat"], - ["Beret (Colonel)", "H_Beret_Colonel", 10, "hat"], - ["Beret (NATO)", "H_Beret_02", 10, "hat"], - // ["Beret (Green)", "H_Beret_grn", 10, "hat"], - // ["Beret (Police)", "H_Beret_blk_POLICE", 10, "hat"], - // ["Beret (Red)", "H_Beret_red", 10, "hat"], - // ["Beret (SAS)", "H_Beret_brn_SF", 10, "hat"], - // ["Beret (SF)", "H_Beret_grn_SF", 10, "hat"], - // ["Beret (RED)", "H_Beret_ocamo", 10, "hat"], - // ["Black Turban", "H_TurbanO_blk", 50, "hat"], - // ["Booniehat (Dirty)", "H_Booniehat_dirty", 10, "hat"], - // ["Booniehat (Green)", "H_Booniehat_grn", 10, "hat"], - // ["Booniehat (Khaki)", "H_Booniehat_indp", 10, "hat"], - ["Booniehat (Khaki)", "H_Booniehat_khk", 10, "hat"], - ["Booniehat (Tan)", "H_Booniehat_tan", 10, "hat"], - ["Booniehat (MTP)", "H_Booniehat_mcamo", 10, "hat"], - ["Booniehat (Digi)", "H_Booniehat_dgtl", 10, "hat"], - ["Fedora (Blue)", "H_Hat_blue", 10, "hat"], - ["Fedora (Brown)", "H_Hat_brown", 10, "hat"], - ["Fedora (Camo)", "H_Hat_camo", 10, "hat"], - ["Fedora (Checker)", "H_Hat_checker", 10, "hat"], - ["Fedora (Gray)", "H_Hat_grey", 10, "hat"], - ["Fedora (Tan)", "H_Hat_tan", 10, "hat"], - ["Cap (Black)", "H_Cap_blk", 10, "hat"], - ["Cap (Blue)", "H_Cap_blu", 10, "hat"], - ["Cap (Green)", "H_Cap_grn", 10, "hat"], - ["Cap (Olive)", "H_Cap_oli", 10, "hat"], - ["Cap (Red)", "H_Cap_red", 10, "hat"], - ["Cap (Tan)", "H_Cap_tan", 10, "hat"], - ["Cap (BI)", "H_Cap_grn_BI", 10, "hat"], - ["Cap (CMMG)", "H_Cap_blk_CMMG", 10, "hat"], - ["Cap (ION)", "H_Cap_blk_ION", 10, "hat"], - ["Cap (Raven Security)", "H_Cap_blk_Raven", 10, "hat"], - ["Cap (SAS)", "H_Cap_khaki_specops_UK", 10, "hat"], - ["Cap (SF)", "H_Cap_tan_specops_US", 10, "hat"], - ["Cap (SPECOPS)", "H_Cap_brn_SPECOPS", 10, "hat"], - ["Shemag (White)", "H_ShemagOpen_khk", 25, "hat"], - ["Shemag (Brown)", "H_ShemagOpen_tan", 25, "hat"], - ["Shemag mask (Khaki)", "H_Shemag_khk", 25, "hat"], - ["Shemag mask (Olive)", "H_Shemag_olive", 25, "hat"], - // ["Shemag mask (Tan)", "H_Shemag_tan", 25, "hat"], - ["Racing Helmet (Black)", "H_RacingHelmet_1_black_F", 25, "hat"], - ["Racing Helmet (Blue)", "H_RacingHelmet_1_blue_F", 25, "hat"], - ["Racing Helmet (Green)", "H_RacingHelmet_1_green_F", 25, "hat"], - ["Racing Helmet (Yellow)", "H_RacingHelmet_1_yellow_F", 25, "hat"], - ["Racing Helmet (Orange)", "H_RacingHelmet_1_orange_F", 25, "hat"], - ["Racing Helmet (Red)", "H_RacingHelmet_1_red_F", 25, "hat"], - ["Racing Helmet (White)", "H_RacingHelmet_1_white_F", 25, "hat"], - ["Racing Helmet (Fuel)", "H_RacingHelmet_1_F", 25, "hat"], - ["Racing Helmet (Bluking)", "H_RacingHelmet_2_F", 25, "hat"], - ["Racing Helmet (Redstone)", "H_RacingHelmet_3_F", 25, "hat"], - ["Racing Helmet (Vrana)", "H_RacingHelmet_4_F", 25, "hat"] -]; - -uniformArray = compileFinal str -[ - ["Ghillie Suit (NATO)", "U_B_GhillieSuit", 300, "uni"], - ["Ghillie Suit (CSAT)", "U_O_GhillieSuit", 300, "uni"], - ["Ghillie Suit (AAF)", "U_I_GhillieSuit", 300, "uni"], - ["Full Ghillie (Arid) (NATO)", "U_B_FullGhillie_ard", 2000, "uni"], - ["Full Ghillie (Arid) (CSAT)", "U_O_FullGhillie_ard", 2000, "uni"], - ["Full Ghillie (Arid) (AAF)", "U_I_FullGhillie_ard", 2000, "uni"], - ["Full Ghillie (Lush) (NATO)", "U_B_FullGhillie_lsh", 2000, "uni"], - ["Full Ghillie (Lush) (CSAT)", "U_O_FullGhillie_lsh", 2000, "uni"], - ["Full Ghillie (Lush) (AAF)", "U_I_FullGhillie_lsh", 2000, "uni"], - ["Full Ghillie (Semi-Arid) (NATO)", "U_B_FullGhillie_sard", 2000, "uni"], - ["Full Ghillie (Semi-Arid) (CSAT)", "U_O_FullGhillie_sard", 2000, "uni"], - ["Full Ghillie (Semi-Arid) (AAF)", "U_I_FullGhillie_sard", 2000, "uni"], - ["Wetsuit (NATO)", "U_B_Wetsuit", 200, "uni"], - ["Wetsuit (CSAT)", "U_O_Wetsuit", 200, "uni"], - ["Wetsuit (AAF)", "U_I_Wetsuit", 200, "uni"], - ["Default Uniform (NATO)", "U_B_CombatUniform_mcam", 50, "uni"], - ["Default Uniform (CSAT)", "U_O_CombatUniform_ocamo", 50, "uni"], - ["Default Uniform (AAF)", "U_I_CombatUniform", 50, "uni"], - ["Combat Fatigues (MTP) (Tee)", "U_B_CombatUniform_mcam_tshirt", 50, "uni"], - ["Recon Fatigues (MTP)", "U_B_CombatUniform_mcam_vest", 50, "uni"], - ["Recon Fatigues (Sage)", "U_B_SpecopsUniform_sgg", 50, "uni"], - ["CTRG Combat Uniform (UBACS)", "U_B_CTRG_1", 50, "uni"], - ["CTRG Combat Uniform (UBACS2)", "U_B_CTRG_2", 50, "uni"], - ["CTRG Combat Uniform (Tee)", "U_B_CTRG_3", 50, "uni"], - ["Recon Fatigues (Hex)", "U_O_SpecopsUniform_ocamo", 50, "uni"], - ["Fatigues (Urban)", "U_O_CombatUniform_oucamo", 50, "uni"], - ["Combat Fatigues Short (Digi)", "U_I_CombatUniform_shortsleeve", 50, "uni"], - ["Combat Fatigues Shirt (Digi)", "U_I_CombatUniform_tshirt", 50, "uni"], - ["Officer Fatigues (Hex)", "U_O_OfficerUniform_ocamo", 50, "uni"], - ["Officer Fatigues (Digi)", "U_I_OfficerUniform", 50, "uni"], - ["Pilot Coveralls (NATO)", "U_B_PilotCoveralls", 50, "uni"], - ["Pilot Coveralls (CSAT)", "U_O_PilotCoveralls", 50, "uni"], - ["Pilot Coveralls (AAF)", "U_I_pilotCoveralls", 50, "uni"], - ["Heli Pilot Coveralls (NATO)", "U_B_HeliPilotCoveralls", 50, "uni"], - ["Heli Pilot Coveralls (AAF)", "U_I_HeliPilotCoveralls", 50, "uni"], - ["Guerilla Smocks 1", "U_BG_Guerilla1_1", 25, "uni"], // BLUFOR - ["Guerilla Smocks 2", "U_BG_Guerilla2_1", 25, "uni"], - ["Guerilla Smocks 3", "U_BG_Guerilla2_2", 25, "uni"], - ["Guerilla Smocks 4", "U_BG_Guerilla2_3", 25, "uni"], - ["Guerilla Smocks 5", "U_BG_Guerilla3_1", 25, "uni"], - ["Guerilla Smocks 6", "U_BG_Guerilla3_2", 25, "uni"], - ["Guerilla Smocks 7", "U_BG_leader", 25, "uni"], - ["Guerilla Smocks 1", "U_OG_Guerilla1_1", 25, "uni"], // OPFOR - ["Guerilla Smocks 2", "U_OG_Guerilla2_1", 25, "uni"], - ["Guerilla Smocks 3", "U_OG_Guerilla2_2", 25, "uni"], - ["Guerilla Smocks 4", "U_OG_Guerilla2_3", 25, "uni"], - ["Guerilla Smocks 5", "U_OG_Guerilla3_1", 25, "uni"], - ["Guerilla Smocks 6", "U_OG_Guerilla3_2", 25, "uni"], - ["Guerilla Smocks 7", "U_OG_leader", 25, "uni"], - ["Guerilla Smocks 1", "U_IG_Guerilla1_1", 25, "uni"], // Independent - ["Guerilla Smocks 2", "U_IG_Guerilla2_1", 25, "uni"], - ["Guerilla Smocks 3", "U_IG_Guerilla2_2", 25, "uni"], - ["Guerilla Smocks 4", "U_IG_Guerilla2_3", 25, "uni"], - ["Guerilla Smocks 5", "U_IG_Guerilla3_1", 25, "uni"], - ["Guerilla Smocks 6", "U_IG_Guerilla3_2", 25, "uni"], - ["Guerilla Smocks 7", "U_IG_leader", 25, "uni"], - /*["Worker Coveralls", "U_C_WorkerCoveralls", 25, "uni"], // can only be worn by civilian units - ["T-Shirt (Blue)", "U_C_Poor_1", 25, "uni"], - ["Polo (Red/white)", "U_C_Poloshirt_redwhite", 25, "uni"], - ["Polo (Salmon)", "U_C_Poloshirt_salmon", 25, "uni"], - ["Polo (Tri-color)", "U_C_Poloshirt_tricolour", 25, "uni"], - ["Polo (Navy)", "U_C_Poloshirt_blue", 25, "uni"], - ["Polo (Burgundy)", "U_C_Poloshirt_burgundy", 25, "uni"], - ["Polo (Blue/green)", "U_C_Poloshirt_stripped", 25, "uni"],*/ - ["Polo (Competitor)", "U_Competitor", 25, "uni"], - ["Polo (Rangemaster)", "U_Rangemaster", 25, "uni"], - /*["Racing Suit (Black)", "U_C_Driver_1_black", 25, "uni"], // can only be worn by civilian units - ["Racing Suit (Blue)", "U_C_Driver_1_blue", 25, "uni"], - ["Racing Suit (Green)", "U_C_Driver_1_green", 25, "uni"], - ["Racing Suit (Yellow)", "U_C_Driver_1_yellow", 25, "uni"], - ["Racing Suit (Orange)", "U_C_Driver_1_orange", 25, "uni"], - ["Racing Suit (Red)", "U_C_Driver_1_red", 25, "uni"], - ["Racing Suit (White)", "U_C_Driver_1_white", 25, "uni"], - ["Racing Suit (Fuel)", "U_C_Driver_1", 25, "uni"], - ["Racing Suit (Bluking)", "U_C_Driver_2", 25, "uni"], - ["Racing Suit (Redstone)", "U_C_Driver_3", 25, "uni"], - ["Racing Suit (Vrana)", "U_C_Driver_4", 25, "uni"],*/ - ["Tron Light Suit (Blue)", "U_B_Protagonist_VR", 5000, "uni"], - ["Tron Light Suit (Red)", "U_O_Protagonist_VR", 5000, "uni"], - ["Tron Light Suit (Green)", "U_I_Protagonist_VR", 5000, "uni"] -]; - -vestArray = compileFinal str -[ - ["Rebreather (NATO)", "V_RebreatherB", 200, "vest"], - ["Rebreather (CSAT)", "V_RebreatherIR", 200, "vest"], - ["Rebreather (AAF)", "V_RebreatherIA", 200, "vest"], - ["Carrier Lite (Green)", "V_PlateCarrier1_rgr", -1, "vest"], - ["Carrier Lite (Black)", "V_PlateCarrier1_blk", -1, "vest"], - ["Carrier Rig (Green)", "V_PlateCarrier3_rgr", -1, "vest"], - ["Carrier GL Rig (Green)", "V_PlateCarrierGL_rgr", -1, "vest"], - ["Carrier GL Rig (Black)", "V_PlateCarrierGL_blk", -1, "vest"], - ["Carrier GL Rig (MTP)", "V_PlateCarrierGL_mtp", -1, "vest"], - ["Carrier Special Rig (Green)", "V_PlateCarrierSpec_rgr", -1, "vest"], - ["Carrier Special Rig (Black)", "V_PlateCarrierSpec_blk", -1, "vest"], - ["Carrier Special Rig (MTP)", "V_PlateCarrierSpec_mtp", -1, "vest"], - ["GA Carrier Lite (Digi)", "V_PlateCarrierIA1_dgtl", -1, "vest"], - ["GA Carrier Rig (Digi)", "V_PlateCarrierIA2_dgtl", -1, "vest"], - ["GA Carrier GL Rig (Digi)", "V_PlateCarrierIAGL_dgtl", -1, "vest"], - ["GA Carrier GL Rig (Olive)", "V_PlateCarrierIAGL_oli", -1, "vest"], - ["LBV Harness", "V_HarnessO_brn", -1, "vest"], - ["LBV Harness (Gray)", "V_HarnessO_gry", -1, "vest"], - ["LBV Grenadier Harness", "V_HarnessOGL_brn", -1, "vest"], - ["LBV Grenadier Harness (Gray)", "V_HarnessOGL_gry", -1, "vest"], - ["ELBV Harness", "V_HarnessOSpec_brn", -1, "vest"], - ["ELBV Harness (Gray)", "V_HarnessOSpec_gry", -1, "vest"], - ["Slash Bandolier (Black)", "V_BandollierB_blk", -1, "vest"], - ["Slash Bandolier (Coyote)", "V_BandollierB_cbr", -1, "vest"], - ["Slash Bandolier (Green)", "V_BandollierB_rgr", -1, "vest"], - ["Slash Bandolier (Khaki)", "V_BandollierB_khk", -1, "vest"], - ["Slash Bandolier (Olive)", "V_BandollierB_oli", -1, "vest"], - ["Chest Rig (Khaki)", "V_Chestrig_khk", -1, "vest"], - ["Chest Rig (Green)", "V_Chestrig_rgr", -1, "vest"], - ["Fighter Chestrig (Black)", "V_Chestrig_blk", -1, "vest"], - ["Fighter Chestrig (Olive)", "V_Chestrig_oli", -1, "vest"], - ["Tactical Vest (Black)", "V_TacVest_blk", -1, "vest"], - ["Tactical Vest (Brown)", "V_TacVest_brn", -1, "vest"], - ["Tactical Vest (Camo)", "V_TacVest_camo", -1, "vest"], - ["Tactical Vest (Khaki)", "V_TacVest_khk", -1, "vest"], - ["Tactical Vest (Olive)", "V_TacVest_oli", -1, "vest"], - ["Raven Night Vest", "V_TacVestIR_blk", -1, "vest"] -]; - -backpackArray = compileFinal str -[ - //["Parachute", "B_Parachute", 200, "backpack"], - - ["Assault Pack (Black)", "B_AssaultPack_blk", 150, "backpack"], - ["Assault Pack (Green)", "B_AssaultPack_rgr", 150, "backpack"], - ["Assault Pack (MTP)", "B_AssaultPack_mcamo", 150, "backpack"], - ["Assault Pack (Hex)", "B_AssaultPack_ocamo", 150, "backpack"], - - ["Field Pack (Black)", "B_FieldPack_blk", 200, "backpack"], - ["Field Pack (Coyote)", "B_FieldPack_cbr", 200, "backpack"], - ["Field Pack (Khaki)", "B_FieldPack_khk", 200, "backpack"], - ["Field Pack (Urban)", "B_FieldPack_oucamo", 200, "backpack"], - - ["Kitbag (Coyote)", "B_Kitbag_cbr", 350, "backpack"], - ["Kitbag (Green)", "B_Kitbag_rgr", 350, "backpack"], - ["Kitbag (MTP)", "B_Kitbag_mcamo", 350, "backpack"], - ["Kitbag (Sage)", "B_Kitbag_sgg", 350, "backpack"], - - ["Bergen (Black)", "B_Bergen_blk", 350, "backpack"], - ["Bergen (Green)", "B_Bergen_rgr", 350, "backpack"], - ["Bergen (MTP)", "B_Bergen_mcamo", 350, "backpack"], - ["Bergen (Sage)", "B_Bergen_sgg", 350, "backpack"], - - ["Carryall (Khaki)", "B_Carryall_khk", 500, "backpack"], - ["Carryall (MTP)", "B_Carryall_mcamo", 500, "backpack"], - ["Carryall (Olive)", "B_Carryall_oli", 500, "backpack"], - ["Carryall (Urban)", "B_Carryall_oucamo", 500, "backpack"] -]; - -genItemArray = compileFinal str -[ - ["UAV Terminal (NATO)", "B_UavTerminal", 150, "gps"], - ["UAV Terminal (CSAT)", "O_UavTerminal", 150, "gps"], - ["UAV Terminal (AAF)", "I_UavTerminal", 150, "gps"], - ["Quadrotor UAV (NATO)", "B_UAV_01_backpack_F", 500, "backpack"], - ["Quadrotor UAV (CSAT)", "O_UAV_01_backpack_F", 500, "backpack"], - ["Quadrotor UAV (AAF)", "I_UAV_01_backpack_F", 500, "backpack"], - ["Remote Designator Bag (NATO) [DLC]", "B_Static_Designator_01_weapon_F", 1000, "backpack"], - ["Remote Designator Bag (CSAT) [DLC]", "O_Static_Designator_02_weapon_F", 1000, "backpack"], - ["GPS", "ItemGPS", 100, "gps"], - ["First Aid Kit", "FirstAidKit", 25, "item"], - ["Medikit", "Medikit", 150, "item"], - ["Toolkit", "ToolKit", 150, "item"], - ["Mine Detector", "MineDetector", 100, "item"], - ["NV Goggles", "NVGoggles", 100, "nvg"], - ["Diving Goggles", "G_Diving", 100, "gogg"], - ["Binoculars", "Binocular", 50, "binoc"], - ["Rangefinder", "Rangefinder", 150, "binoc"], - ["Laser Designator", "Laserdesignator", 1000, "binoc"], - ["Chemlight (Blue)", "Chemlight_blue", 25, "mag"], - ["Chemlight (Green)", "Chemlight_green", 25, "mag"], - ["Chemlight (Yellow)", "Chemlight_yellow", 25, "mag"], - ["Chemlight (Red)", "Chemlight_red", 25, "mag"] -]; - -allStoreMagazines = compileFinal str (call ammoArray + call throwputArray + call genItemArray); -allRegularStoreItems = compileFinal str (call allGunStoreFirearms + call allStoreMagazines + call accessoriesArray); -allStoreGear = compileFinal str (call headArray + call uniformArray + call vestArray + call backpackArray); - -genObjectsArray = compileFinal str -[ - ["Empty Ammo Crate", "Box_NATO_Ammo_F", 200, "ammocrate"], - //["Metal Barrel", "Land_MetalBarrel_F", 25, "object"], - //["Toilet Box", "Land_ToiletBox_F", 25, "object"], - ["Lamp Post (Harbour)", "Land_LampHarbour_F", 100, "object"], - ["Lamp Post (Shabby)", "Land_LampShabby_F", 100, "object"], - ["Boom Gate", "Land_BarGate_F", 150, "object"], - ["Pipes", "Land_Pipes_Large_F", 200, "object"], - ["Concrete Frame", "Land_CncShelter_F", 200, "object"], - ["Highway Guardrail", "Land_Crash_barrier_F", 200, "object"], - ["Concrete Barrier", "Land_CncBarrier_F", 200, "object"], - ["Concrete Barrier (Medium)", "Land_CncBarrierMedium_F", 350, "object"], - ["Concrete Barrier (Long)", "Land_CncBarrierMedium4_F", 500, "object"], - ["HBarrier (1 block)", "Land_HBarrier_1_F", 150, "object"], - ["HBarrier (3 blocks)", "Land_HBarrier_3_F", 200, "object"], - ["HBarrier (5 blocks)", "Land_HBarrier_5_F", 250, "object"], - ["HBarrier Big", "Land_HBarrierBig_F", 500, "object"], - ["HBarrier Wall (4 blocks)", "Land_HBarrierWall4_F", 400, "object"], - ["HBarrier Wall (6 blocks)", "Land_HBarrierWall6_F", 500, "object"], - ["HBarrier Watchtower", "Land_HBarrierTower_F", 600, "object"], - ["Concrete Wall", "Land_CncWall1_F", 400, "object"], - ["Concrete Military Wall", "Land_Mil_ConcreteWall_F", 400, "object"], - ["Concrete Wall (Long)", "Land_CncWall4_F", 600, "object"], - ["Military Wall (Big)", "Land_Mil_WallBig_4m_F", 600, "object"], - //["Shoot House Wall", "Land_Shoot_House_Wall_F", 180, "object"], - ["Canal Wall (Small)", "Land_Canal_WallSmall_10m_F", 400, "object"], - ["Canal Stairs", "Land_Canal_Wall_Stairs_F", 500, "object"], - ["Bag Fence (Corner)", "Land_BagFence_Corner_F", 150, "object"], - ["Bag Fence (End)", "Land_BagFence_End_F", 150, "object"], - ["Bag Fence (Long)", "Land_BagFence_Long_F", 200, "object"], - ["Bag Fence (Round)", "Land_BagFence_Round_F", 150, "object"], - ["Bag Fence (Short)", "Land_BagFence_Short_F", 150, "object"], - ["Bag Bunker (Small)", "Land_BagBunker_Small_F", 250, "object"], - ["Bag Bunker (Large)", "Land_BagBunker_Large_F", 500, "object"], - ["Bag Bunker Tower", "Land_BagBunker_Tower_F", 1000, "object"], - ["Military Cargo Post", "Land_Cargo_Patrol_V1_F", 800, "object"], - ["Military Cargo Tower", "Land_Cargo_Tower_V1_F", 10000, "object"], - ["Concrete Ramp", "Land_RampConcrete_F", 350, "object"], - ["Concrete Ramp (High)", "Land_RampConcreteHigh_F", 500, "object"], - ["Scaffolding", "Land_Scaffolding_F", 250, "object"] -]; - -allGenStoreVanillaItems = compileFinal str (call genItemArray + call genObjectsArray + call allStoreGear); - -//Text name, classname, buy cost, spawn type, sell price (selling not implemented) or spawning color -landArray = compileFinal str -[ - ["Kart", "C_Kart_01_F", 500, "vehicle"], - - ["Quadbike (Civilian)", "C_Quadbike_01_F", 600, "vehicle"], - ["Quadbike (NATO)", "B_Quadbike_01_F", 650, "vehicle"], - ["Quadbike (CSAT)", "O_Quadbike_01_F", 650, "vehicle"], - ["Quadbike (AAF)", "I_Quadbike_01_F", 650, "vehicle"], - ["Quadbike (FIA)", "B_G_Quadbike_01_F", 650, "vehicle"], - - ["Hatchback", "C_Hatchback_01_F", 800, "vehicle"], - ["Hatchback Sport", "C_Hatchback_01_sport_F", 1000, "vehicle"], - ["SUV", "C_SUV_01_F", 1100, "vehicle"], - ["Offroad", "C_Offroad_01_F", 1100, "vehicle"], - ["Offroad Camo", "B_G_Offroad_01_F", 1250, "vehicle"], - ["Offroad Repair", "C_Offroad_01_repair_F", 1500, "vehicle"], - ["Offroad HMG", "B_G_Offroad_01_armed_F", 2500, "vehicle"], - - ["Truck", "C_Van_01_transport_F", 700, "vehicle"], - ["Truck (Camo)", "B_G_Van_01_transport_F", 800, "vehicle"], - ["Truck Box", "C_Van_01_box_F", 900, "vehicle"], - ["Fuel Truck", "C_Van_01_fuel_F", 2000, "vehicle"], - ["Fuel Truck (Camo)", "B_G_Van_01_fuel_F", 2100, "vehicle"], - - ["HEMTT Tractor", "B_Truck_01_mover_F", 4000, "vehicle"], - ["HEMTT Box", "B_Truck_01_box_F", 5000, "vehicle"], - ["HEMTT Transport", "B_Truck_01_transport_F", 6000, "vehicle"], - ["HEMTT Covered", "B_Truck_01_covered_F", 7500, "vehicle"], - ["HEMTT Fuel", "B_Truck_01_fuel_F", 9000, "vehicle"], - ["HEMTT Medical", "B_Truck_01_medical_F", 10000, "vehicle"], - ["HEMTT Repair", "B_Truck_01_Repair_F", 12500, "vehicle"], - ["HEMTT Ammo", "B_Truck_01_ammo_F", 27500, "vehicle"], - - ["Tempest Device", "O_Truck_03_device_F", 4000, "vehicle"], - ["Tempest Transport", "O_Truck_03_transport_F", 6000, "vehicle"], - ["Tempest Covered", "O_Truck_03_covered_F", 7500, "vehicle"], - ["Tempest Fuel", "O_Truck_03_fuel_F", 9000, "vehicle"], - ["Tempest Medical", "O_Truck_03_medical_F", 10000, "vehicle"], - ["Tempest Repair", "O_Truck_03_repair_F", 12500, "vehicle"], - ["Tempest Ammo", "O_Truck_03_ammo_F", 27500, "vehicle"], - - ["Zamak Transport", "I_Truck_02_transport_F", 4000, "vehicle"], - ["Zamak Covered", "I_Truck_02_covered_F", 5000, "vehicle"], - ["Zamak Fuel", "I_Truck_02_fuel_F", 7500, "vehicle"], - ["Zamak Medical", "I_Truck_02_medical_F", 9000, "vehicle"], - ["Zamak Repair", "I_Truck_02_box_F", 10000, "vehicle"], - ["Zamak Ammo", "I_Truck_02_ammo_F", 25000, "vehicle"], - - ["UGV Stomper (NATO)", "B_UGV_01_F", 2500, "vehicle"], - ["UGV Stomper RCWS (NATO)", "B_UGV_01_rcws_F", 15000, "vehicle"], - ["UGV Stomper (AAF)", "I_UGV_01_F", 2500, "vehicle"], - ["UGV Stomper RCWS (AAF)", "I_UGV_01_rcws_F", 15000, "vehicle"], - ["UGV Saif (CSAT)", "O_UGV_01_F", 2500, "vehicle"], - ["UGV Saif RCWS (CSAT)", "O_UGV_01_rcws_F", 15000, "vehicle"] -]; - -armoredArray = compileFinal str -[ - ["Hunter", "B_MRAP_01_F", 4000, "vehicle"], - ["Hunter HMG", "B_MRAP_01_hmg_F", 15000, "vehicle"], - ["Hunter GMG", "B_MRAP_01_gmg_F", 17500, "vehicle"], - ["Ifrit", "O_MRAP_02_F", 4000, "vehicle"], - ["Ifrit HMG", "O_MRAP_02_hmg_F", 15000, "vehicle"], - ["Ifrit GMG", "O_MRAP_02_gmg_F", 17500, "vehicle"], - ["Strider", "I_MRAP_03_F", 4000, "vehicle"], - ["Strider HMG", "I_MRAP_03_hmg_F", 15000, "vehicle"], - ["Strider GMG", "I_MRAP_03_gmg_F", 17500, "vehicle"], - ["MSE-3 Marid", "O_APC_Wheeled_02_rcws_F", 22500, "vehicle"], - ["AMV-7 Marshall", "B_APC_Wheeled_01_cannon_F", 27500, "vehicle"], - ["AFV-4 Gorgon", "I_APC_Wheeled_03_cannon_F", 30000, "vehicle"] -]; - -tanksArray = compileFinal str -[ - ["CRV-6e Bobcat", "B_APC_Tracked_01_CRV_F", 32500, "vehicle"], - ["IFV-6c Panther", "B_APC_Tracked_01_rcws_F", 35000, "vehicle"], - ["FV-720 Mora", "I_APC_tracked_03_cannon_F", 37500, "vehicle"], - ["BTR-K Kamysh", "O_APC_Tracked_02_cannon_F", 40000, "vehicle"], - ["IFV-6a Cheetah AA", "B_APC_Tracked_01_AA_F", 40000, "vehicle"], - ["ZSU-39 Tigris AA", "O_APC_Tracked_02_AA_F", 40000, "vehicle"], - ["M2A1 Slammer", "B_MBT_01_cannon_F", 50000, "vehicle"], - ["M2A4 Slammer HMG", "B_MBT_01_TUSK_F", 50000, "vehicle"], // Commander gun variant - ["T-100 Varsuk", "O_MBT_02_cannon_F", 50000, "vehicle"], - ["MBT-52 Kuma", "I_MBT_03_cannon_F", 50000, "vehicle"] -]; - - -helicoptersArray = compileFinal str -[ - ["M-900 Civilian", "C_Heli_Light_01_civil_F", 4000, "vehicle"], // MH-6, no flares - ["MH-9 Hummingbird", "B_Heli_Light_01_F", 5000, "vehicle"], // MH-6 - ["PO-30 Orca (Black)", "O_Heli_Light_02_unarmed_F", 7000, "vehicle"], // Ka-60 - ["WY-55 Hellcat (Green)", "I_Heli_light_03_unarmed_F", 7000, "vehicle"], // AW159 - - ["Mi-290 Taru (Crane) [DLC]", "O_Heli_Transport_04_F", 7500, "vehicle"], // CH-54 - ["Mi-290 Taru (Box) [DLC]", "O_Heli_Transport_04_box_F", 8000, "vehicle"], - ["Mi-290 Taru (Fuel) [DLC]", "O_Heli_Transport_04_fuel_F", 8500, "vehicle"], - ["Mi-290 Taru (Bench) [DLC]", "O_Heli_Transport_04_bench_F", 9000, "vehicle"], - ["Mi-290 Taru (Transport) [DLC]", "O_Heli_Transport_04_covered_F", 9500, "vehicle"], - ["CH-67 Huron (Black) [DLC]", "B_Heli_Transport_03_unarmed_F", 10000, "vehicle"], // CH-47 - ["CH-49 Mohawk", "I_Heli_Transport_02_F", 10000, "vehicle"], // AW101 - - ["Mi-290 Taru (Medical) [DLC]", "O_Heli_Transport_04_medevac_F",12500, "vehicle"], - ["Mi-290 Taru (Repair) [DLC]", "O_Heli_Transport_04_repair_F", 15000, "vehicle"], - ["Mi-290 Taru (Ammo) [DLC]", "O_Heli_Transport_04_ammo_F", 25000, "vehicle"], - - ["UH-80 Ghost Hawk (Black)", "B_Heli_Transport_01_F", 25000, "vehicle"], // UH-60 Stealth with 2 side miniguns - ["UH-80 Ghost Hawk (Green)", "B_Heli_Transport_01_camo_F", 25000, "vehicle"], // UH-60 Stealth with 2 side miniguns (green camo) - ["CH-67 Huron (Armed) [DLC]", "B_Heli_Transport_03_F", 30000, "vehicle"], // CH-47 with 2 side miniguns - ["AH-9 Pawnee", "B_Heli_Light_01_armed_F", 30000, "vehicle"], // Armed AH-6 - ["PO-30 Orca (Armed, Black)", "O_Heli_Light_02_v2_F", 30000, "vehicle"], // Armed Ka-60 with orca paintjob - ["PO-30 Orca (Armed, Hex)", "O_Heli_Light_02_F", 35000, "vehicle"], // Armed Ka-60 - ["WY-55 Hellcat (Armed)", "I_Heli_light_03_F", 40000, "vehicle"], // Armed AW159 - ["AH-99 Blackfoot", "B_Heli_Attack_01_F", 50000, "vehicle"], // RAH-66 with gunner - ["Mi-48 Kajman (Hex)", "O_Heli_Attack_02_F", 60000, "vehicle"], // Mi-28 with gunner - ["Mi-48 Kajman (Black)", "O_Heli_Attack_02_black_F", 60000, "vehicle"] // Mi-28 with gunner (black camo) -]; - -planesArray = compileFinal str -[ - ["A-143 Buzzard AA", "I_Plane_Fighter_03_AA_F", 40000, "vehicle"], - ["A-143 Buzzard CAS", "I_Plane_Fighter_03_CAS_F", 45000, "vehicle"], - ["A-164 Wipeout CAS", "B_Plane_CAS_01_F", 60000, "vehicle"], - ["To-199 Neophron CAS", "O_Plane_CAS_02_F", 60000, "vehicle"], - ["MQ4A Greyhawk ATGM UAV", "B_UAV_02_F", 20000, "vehicle"], - ["MQ4A Greyhawk Bomber UAV", "B_UAV_02_CAS_F", 10000, "vehicle"], // Bomber UAVs are a lot harder to use, hence why they are cheaper than ATGMs - ["K40 Ababil-3 ATGM UAV (CSAT)", "O_UAV_02_F", 20000, "vehicle"], - ["K40 Ababil-3 Bomber UAV (CSAT)", "O_UAV_02_CAS_F", 10000, "vehicle"], - ["K40 Ababil-3 ATGM UAV (AAF)", "I_UAV_02_F", 20000, "vehicle"], - ["K40 Ababil-3 Bomber UAV (AAF)", "I_UAV_02_CAS_F", 10000, "vehicle"] -]; - -boatsArray = compileFinal str -[ - ["Rescue Boat", "C_Rubberboat", 500, "boat"], - ["Rescue Boat (NATO)", "B_Lifeboat", 500, "boat"], - ["Rescue Boat (CSAT)", "O_Lifeboat", 500, "boat"], - ["Assault Boat (NATO)", "B_Boat_Transport_01_F", 600, "boat"], - ["Assault Boat (CSAT)", "O_Boat_Transport_01_F", 600, "boat"], - ["Assault Boat (AAF)", "I_Boat_Transport_01_F", 600, "boat"], - ["Assault Boat (FIA)", "B_G_Boat_Transport_01_F", 600, "boat"], - ["Motorboat", "C_Boat_Civil_01_F", 1000, "boat"], - ["Motorboat Rescue", "C_Boat_Civil_rescue_01_F", 900, "boat"], - ["Motorboat Police", "C_Boat_Civil_police_01_F", 1250, "boat"], - ["Speedboat HMG (CSAT)", "O_Boat_Armed_01_hmg_F", 4000, "boat"], - ["Speedboat Minigun (NATO)", "B_Boat_Armed_01_minigun_F", 4000, "boat"], - ["Speedboat Minigun (AAF)", "I_Boat_Armed_01_minigun_F", 4000, "boat"], - ["SDV Submarine (NATO)", "B_SDV_01_F", 1000, "submarine"], - ["SDV Submarine (CSAT)", "O_SDV_01_F", 1000, "submarine"], - ["SDV Submarine (AAF)", "I_SDV_01_F", 1000, "submarine"] -]; - -allVehStoreVehicles = compileFinal str (call landArray + call armoredArray + call tanksArray + call helicoptersArray + call planesArray + call boatsArray); - -uavArray = compileFinal str -[ - "UAV_02_base_F", - "UGV_01_base_F" -]; - -noColorVehicles = compileFinal str -[ - // Deprecated -]; - -rgbOnlyVehicles = compileFinal str -[ - // Deprecated -]; - -_color = "#(rgb,1,1,1)color"; -_texDir = "client\images\vehicleTextures\"; -_kartDir = "\A3\soft_f_kart\Kart_01\Data\"; -_mh9Dir = "\A3\air_f\Heli_Light_01\Data\"; -_mohawkDir = "\A3\air_f_beta\Heli_Transport_02\Data\"; -_taruDir = "\A3\air_f_heli\Heli_Transport_04\Data\"; - -colorsArray = compileFinal str -[ - [ // Main colors - "All", - [ - ["Black", _color + "(0.01,0.01,0.01,1)"], // #(argb,8,8,3)color(0.1,0.1,0.1,0.1) - ["Grey", _color + "(0.15,0.151,0.152,1)"], // #(argb,8,8,3)color(0.5,0.51,0.512,0.3) - ["White", _color + "(0.75,0.75,0.75,1)"], // #(argb,8,8,3)color(1,1,1,0.5) - ["Dark Blue", _color + "(0,0.05,0.15,1)"], // #(argb,8,8,3)color(0,0.3,0.6,0.05) - ["Blue", _color + "(0,0.03,0.5,1)"], // #(argb,8,8,3)color(0,0.2,1,0.75) - ["Teal", _color + "(0,0.3,0.3,1)"], // #(argb,8,8,3)color(0,1,1,0.15) - ["Green", _color + "(0,0.5,0,1)"], // #(argb,8,8,3)color(0,1,0,0.15) - ["Yellow", _color + "(0.5,0.4,0,1)"], // #(argb,8,8,3)color(1,0.8,0,0.4) - ["Orange", _color + "(0.4,0.09,0,1)"], // #(argb,8,8,3)color(1,0.5,0,0.4) - ["Red", _color + "(0.45,0.005,0,1)"], // #(argb,8,8,3)color(1,0.1,0,0.3) - ["Pink", _color + "(0.5,0.03,0.3,1)"], // #(argb,8,8,3)color(1,0.06,0.6,0.5) - ["Purple", _color + "(0.1,0,0.3,1)"], // #(argb,8,8,3)color(0.8,0,1,0.1) - ["NATO Tan", _texDir + "nato.jpg"], // #(argb,8,8,3)color(0.584,0.565,0.515,0.3) - ["CSAT Brown", _texDir + "csat.jpg"], // #(argb,8,8,3)color(0.624,0.512,0.368,0.3) - ["AAF Green", _texDir + "aaf.jpg"], // #(argb,8,8,3)color(0.546,0.59,0.363,0.2) - ["Trippy", _texDir + "rainbow.jpg"], - ["Carbon", _texDir + "carbon.jpg"], - ["Rusty", _texDir + "rusty.jpg"], - ["Denim", _texDir + "denim.jpg"], - ["Psych", _texDir + "psych.jpg"], - ["Leopard", _texDir + "leopard.jpg"], - ["Weed", _texDir + "weed.jpg"], - ["'Murica", _texDir + "murica.jpg"], - ["Confederate", _texDir + "confederate.jpg"], - ["Union Jack", _texDir + "unionjack.jpg"], - ["Yellow Camo", _texDir + "camo_fuel.jpg"], - ["Orange Camo", _texDir + "camo_fack.jpg"], - ["Red Camo", _texDir + "camo_deser.jpg"], - ["Pink Camo", _texDir + "camo_pank.jpg"] - ] - ], - [ // Kart colors - "Kart_01_Base_F", - [ - ["Black (Kart)", [[0, _kartDir + "kart_01_base_black_co.paa"]]], - ["White (Kart)", [[0, _kartDir + "kart_01_base_white_co.paa"]]], - ["Blue (Kart)", [[0, _kartDir + "kart_01_base_blue_co.paa"]]], - ["Green (Kart)", [[0, _kartDir + "kart_01_base_green_co.paa"]]], - ["Yellow (Kart)", [[0, _kartDir + "kart_01_base_yellow_co.paa"]]], - ["Orange (Kart)", [[0, _kartDir + "kart_01_base_orange_co.paa"]]], - ["Red (Kart)", [[0, _kartDir + "kart_01_base_red_co.paa"]]] - ] - ], - [ // MH-9 colors - "Heli_Light_01_base_F", - [ - ["AAF Camo (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_indp_co.paa"]]], - ["Blue 'n White (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_blue_co.paa"]]], - ["Blueline (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_blueline_co.paa"]]], - ["Cream Gravy (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_co.paa"]]], - ["Digital (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_digital_co.paa"]]], - ["Elliptical (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_elliptical_co.paa"]]], - ["Furious (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_furious_co.paa"]]], - ["Graywatcher (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_graywatcher_co.paa"]]], - ["ION (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_ion_co.paa"]]], - ["Jeans (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_jeans_co.paa"]]], - ["Light (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_light_co.paa"]]], - ["Shadow (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_shadow_co.paa"]]], - ["Sheriff (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_sheriff_co.paa"]]], - ["Speedy (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_speedy_co.paa"]]], - ["Sunset (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_sunset_co.paa"]]], - ["Vrana (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_vrana_co.paa"]]], - ["Wasp (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_wasp_co.paa"]]], - ["Wave (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_wave_co.paa"]]] - ] - ], - [ // Mohawk colors - "Heli_Transport_02_base_F", - [ - ["Dahoman (Mohawk)", [ - [0, _mohawkDir + "Skins\heli_transport_02_1_dahoman_co.paa"], - [1, _mohawkDir + "Skins\heli_transport_02_2_dahoman_co.paa"], - [2, _mohawkDir + "Skins\heli_transport_02_3_dahoman_co.paa"] - ]], - ["ION (Mohawk)", [ - [0, _mohawkDir + "Skins\heli_transport_02_1_ion_co.paa"], - [1, _mohawkDir + "Skins\heli_transport_02_2_ion_co.paa"], - [2, _mohawkDir + "Skins\heli_transport_02_3_ion_co.paa"] - ]] - ] - ], - [ // Taru base colors - "Heli_Transport_04_base_F", - [ - ["Black (Taru)", [ - [0, _taruDir + "heli_transport_04_base_01_black_co.paa"], - [1, _taruDir + "heli_transport_04_base_02_black_co.paa"], - [2, _taruDir + "heli_transport_04_pod_ext01_black_co.paa"], - [3, _taruDir + "heli_transport_04_pod_ext02_black_co.paa"] - ]] - ] - ], - [ // Taru bench colors - "O_Heli_Transport_04_bench_F", - [ - ["Black (Taru)", [[2, _taruDir + "heli_transport_04_bench_black_co.paa"]]] - ] - ], - [ // Taru fuel colors - "O_Heli_Transport_04_fuel_F", - [ - ["Black (Taru)", [[2, _taruDir + "heli_transport_04_fuel_black_co.paa"]]] - ] - ] -]; - -//General Store Item List -//Display Name, Class Name, Description, Picture, Buy Price, Sell Price. -// ["Medical Kit", "medkits", localize "STR_WL_ShopDescriptions_MedKit", "client\icons\medkit.paa", 400, 200], // not needed since there are First Ait Kits -customPlayerItems = compileFinal str -[ - ["Water Bottle", "water", localize "STR_WL_ShopDescriptions_Water", "client\icons\waterbottle.paa", 30, 15], - ["Canned Food", "cannedfood", localize "STR_WL_ShopDescriptions_CanFood", "client\icons\cannedfood.paa", 30, 15], - ["Repair Kit", "repairkit", localize "STR_WL_ShopDescriptions_RepairKit", "client\icons\briefcase.paa", 500, 250], - ["Jerry Can (Full)", "jerrycanfull", localize "STR_WL_ShopDescriptions_fuelFull", "client\icons\jerrycan.paa", 150, 75], - ["Jerry Can (Empty)", "jerrycanempty", localize "STR_WL_ShopDescriptions_fuelEmpty", "client\icons\jerrycan.paa", 50, 25], - ["Spawn Beacon", "spawnbeacon", localize "STR_WL_ShopDescriptions_spawnBeacon", "client\icons\spawnbeacon.paa", 1500, 750], - ["Camo Net", "camonet", localize "STR_WL_ShopDescriptions_Camo", "client\icons\camonet.paa", 200, 100], - ["Syphon Hose", "syphonhose", localize "STR_WL_ShopDescriptions_SyphonHose", "client\icons\syphonhose.paa", 200, 100], - ["Energy Drink", "energydrink", localize "STR_WL_ShopDescriptions_Energy_Drink", "client\icons\energydrink.paa", 100, 50], - ["Warchest", "warchest", localize "STR_WL_ShopDescriptions_Warchest", "client\icons\warchest.paa", 1000, 500] -]; - -call compile preprocessFileLineNumbers "mapConfig\storeOwners.sqf"; - -storeConfigDone = compileFinal "true"; +// ****************************************************************************************** +// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com * +// ****************************************************************************************** +/*********************************************************# +# @@ScriptName: storeConfig.sqf +# @@Author: His_Shadow, AgentRev +# @@Create Date: 2013-09-16 20:40:58 +#*********************************************************/ + +// This tracks which store owner the client is interacting with +currentOwnerName = ""; + +// Gunstore Weapon List - Gun Store Base List +// Text name, classname, buy cost + +// empty name = name is extracted from class config + +pistolArray = compileFinal str +[ + // Handguns + ["P07 Pistol", "hgun_P07_F", 50], + ["Rook-40 Pistol", "hgun_Rook40_F", 50], + ["ACP-C2 Pistol", "hgun_ACPC2_F", 75], + ["Zubr Revolver", "hgun_Pistol_heavy_02_F", 75], + ["4-Five Pistol", "hgun_Pistol_heavy_01_F", 100] +]; + +smgArray = compileFinal str +[ + ["PDW2000 SMG", "hgun_PDW2000_F", 100], + ["Sting SMG", "SMG_02_F", 125], + ["Vermin SMG", "SMG_01_F", 125] +]; + +rifleArray = compileFinal str +[ + // Underwater Gun + ["SDAR Underwater Rifle", "arifle_SDAR_F", 100], + + // Assault Rifles + ["Mk20 Carbine", "arifle_Mk20C_plain_F", 150], + ["Mk20 Carbine (Camo)", "arifle_Mk20C_F", 150], + ["Mk20 Rifle", "arifle_Mk20_plain_F", 200], + ["Mk20 Rifle (Camo)", "arifle_Mk20_F", 200], + ["Mk20 EGLM Rifle", "arifle_Mk20_GL_plain_F", 250], + ["Mk20 EGLM Rifle (Camo)", "arifle_Mk20_GL_F", 250], + + ["TRG-20 Carbine", "arifle_TRG20_F", 150], + ["TRG-21 Rifle ", "arifle_TRG21_F", 200], + ["TRG-21 EGLM Rifle", "arifle_TRG21_GL_F", 250], + + ["Katiba Carbine", "arifle_Katiba_C_F", 150], + ["Katiba Rifle", "arifle_Katiba_F", 200], + ["Katiba GL Rifle", "arifle_Katiba_GL_F", 250], + + ["MX Carbine", "arifle_MXC_F", 150], + ["MX Carbine (Black)", "arifle_MXC_Black_F", 175], + ["MX Rifle", "arifle_MX_F", 200], + ["MX Rifle (Black)", "arifle_MX_Black_F", 225], + ["MX 3GL Rifle", "arifle_MX_GL_F", 250], + ["MX 3GL Rifle (Black)", "arifle_MX_GL_Black_F", 275], + + // Markman Rifles + ["MXM Rifle", "arifle_MXM_F", 300], + ["MXM Rifle (Black)", "arifle_MXM_Black_F", 325], + ["DMR Rifle", "srifle_DMR_01_F", 375], + ["Mk18 ABR Rifle", "srifle_EBR_F", 450], + + // DLC + ["Mk14 Rifle (Camo) [DLC]", "srifle_DMR_06_camo_F", 450], + ["Mk14 Rifle (Olive) [DLC]", "srifle_DMR_06_olive_F", 450], + ["Mk-I EMR Rifle [DLC]", "srifle_DMR_03_F", 500], + ["Mk-I EMR Rifle (Camo) [DLC]", "srifle_DMR_03_multicam_F", 550], + ["Mk-I EMR Rifle (Khaki) [DLC]", "srifle_DMR_03_khaki_F", 550], + ["Mk-I EMR Rifle (Sand) [DLC]", "srifle_DMR_03_tan_F", 550], + ["Mk-I EMR Rifle (Woodland) [DLC]", "srifle_DMR_03_woodland_F", 550], + ["MAR-10 Rifle [DLC]", "srifle_DMR_02_F", 950], + ["MAR-10 Rifle (Camo) [DLC]", "srifle_DMR_02_camo_F", 1000], + ["MAR-10 Rifle (Sand) [DLC]", "srifle_DMR_02_sniper_F", 1000], + ["Cyrus Rifle [DLC]", "srifle_DMR_05_blk_F", 1000], + ["Cyrus Rifle (Hex) [DLC]", "srifle_DMR_05_hex_F", 1050], + ["Cyrus Rifle (Tan) [DLC]", "srifle_DMR_05_tan_f", 1050], + + // Sniper Rifles + ["M320 LRR Sniper", "srifle_LRR_LRPS_F", 1600], + ["M320 LRR Sniper (Camo)", "srifle_LRR_camo_LRPS_F", 1700], + ["ASP-1 Kir Rifle [DLC]", "srifle_DMR_04_F", 1700], + ["ASP-1 Kir Rifle (Tan) [DLC]", "srifle_DMR_04_tan_F", 1800], + ["GM6 Lynx Sniper", "srifle_GM6_LRPS_F", 1900], + ["GM6 Lynx Sniper (Camo)", "srifle_GM6_camo_LRPS_F", 2000] +]; + +lmgArray = compileFinal str +[ + ["MX SW LMG", "arifle_MX_SW_F", 300], + ["MX SW LMG (Black)", "arifle_MX_SW_Black_F", 325], + ["Mk200 LMG", "LMG_Mk200_F", 400], + ["Zafir LMG", "LMG_Zafir_F", 500], + ["Navid MMG (Tan) [DLC]", "MMG_01_tan_F", 750], + ["Navid MMG (Hex) [DLC]", "MMG_01_hex_F", 750], + ["SPMG MMG (Sand) [DLC]", "MMG_02_sand_F", 750], + ["SPMG MMG (MTP) [DLC]", "MMG_02_camo_F", 750], + ["SPMG MMG (Black) [DLC]", "MMG_02_black_F", 800] +]; + +launcherArray = compileFinal str +[ + ["RPG-42 Alamut", "launch_RPG32_F", 400], + ["PCML", "launch_NLAW_F", 1000], + ["Titan MPRL Compact (Tan)", "launch_Titan_short_F", 1100], + ["Titan MPRL Compact (Brown)", "launch_O_Titan_short_F", 1100], + ["Titan MPRL Compact (Olive)", "launch_I_Titan_short_F", 1100], + ["Titan MPRL AA (Desert)", "launch_Titan_F", 1450], + ["Titan MPRL AA (Hex)", "launch_O_Titan_F", 1450], + ["Titan MPRL AA (Digi)", "launch_I_Titan_F", 1450] +]; + +allGunStoreFirearms = compileFinal str (call pistolArray + call smgArray + call rifleArray + call lmgArray + call launcherArray); + +staticGunsArray = compileFinal str +[ + // ["Vehicle Ammo Crate", "Box_NATO_AmmoVeh_F", 2500], + ["Static Titan AT 4Rnd (NATO)", "B_static_AT_F", 3000], // Static launchers only have 4 ammo, hence the low price + ["Static Titan AT 4Rnd (CSAT)", "O_static_AT_F", 3000], + ["Static Titan AT 4Rnd (AAF)", "I_static_AT_F", 3000], + ["Static Titan AA 4Rnd (NATO)", "B_static_AA_F", 3000], + ["Static Titan AA 4Rnd (CSAT)", "O_static_AA_F", 3000], + ["Static Titan AA 4Rnd (AAF)", "I_static_AA_F", 3000], + ["Mk30 HMG .50 Low tripod (NATO)", "B_HMG_01_F", 2000], + ["Mk30 HMG .50 Low tripod (CSAT)", "O_HMG_01_F", 2000], + ["Mk30 HMG .50 Low tripod (AAF)", "I_HMG_01_F", 2000], + // ["Mk30A HMG .50 Sentry (NATO)", "B_HMG_01_A_F", 5000], // "A" = Autonomous = Overpowered + // ["Mk30A HMG .50 Sentry (CSAT)", "O_HMG_01_A_F", 5000], + // ["Mk30A HMG .50 Sentry (AAF)", "I_HMG_01_A_F", 5000], + ["Mk30 HMG .50 High tripod (NATO)", "B_HMG_01_high_F", 3000], + ["Mk30 HMG .50 High tripod (CSAT)", "O_HMG_01_high_F", 3000], + ["Mk30 HMG .50 High tripod (AAF)", "I_HMG_01_high_F", 3000], + ["Mk32 GMG 20mm Low tripod (NATO)", "B_GMG_01_F", 5000], + ["Mk32 GMG 20mm Low tripod (CSAT)", "O_GMG_01_F", 5000], + ["Mk32 GMG 20mm Low tripod (AAF)", "I_GMG_01_F", 5000], + // ["Mk32A GMG 20mm Sentry (NATO)", "B_GMG_01_A_F", 10000], + // ["Mk32A GMG 20mm Sentry (CSAT)", "O_GMG_01_A_F", 10000], + // ["Mk32A GMG 20mm Sentry (AAF)", "I_GMG_01_A_F", 10000], + ["Mk32 GMG 20mm High tripod (NATO)", "B_GMG_01_high_F", 6000], + ["Mk32 GMG 20mm High tripod (CSAT)", "O_GMG_01_high_F", 6000], + ["Mk32 GMG 20mm High tripod (AAF)", "I_GMG_01_high_F", 6000], + ["Mk6 Mortar (NATO)", "B_Mortar_01_F", 35000], + ["Mk6 Mortar (CSAT)", "O_Mortar_01_F", 35000], + ["Mk6 Mortar (AAF)", "I_Mortar_01_F", 35000] +]; + +throwputArray = compileFinal str +[ + ["Mini Grenade", "MiniGrenade", 50], + ["Frag Grenade", "HandGrenade", 100], + ["APERS Tripwire Mine", "APERSTripMine_Wire_Mag", 200], + ["APERS Bounding Mine", "APERSBoundingMine_Range_Mag", 250], + ["APERS Mine", "APERSMine_Range_Mag", 300], + ["Claymore Charge", "ClaymoreDirectionalMine_Remote_Mag", 350], + ["M6 SLAM Mine", "SLAMDirectionalMine_Wire_Mag", 350], + ["AT Mine", "ATMine_Range_Mag", 400], + ["Explosive Charge", "DemoCharge_Remote_Mag", 450], + ["Explosive Satchel", "SatchelCharge_Remote_Mag", 500], + ["Smoke Grenade (White)", "SmokeShell", 50], + ["Smoke Grenade (Purple)", "SmokeShellPurple", 50], + ["Smoke Grenade (Blue)", "SmokeShellBlue", 50], + ["Smoke Grenade (Green)", "SmokeShellGreen", 50], + ["Smoke Grenade (Yellow)", "SmokeShellYellow", 50], + ["Smoke Grenade (Orange)", "SmokeShellOrange", 50], + ["Smoke Grenade (Red)", "SmokeShellRed", 50] +]; + +//Gun Store Ammo List +//Text name, classname, buy cost +ammoArray = compileFinal str +[ + ["9mm 16Rnd Mag", "16Rnd_9x21_Mag", 10], + ["9mm 30Rnd Mag", "30Rnd_9x21_Mag", 15], + [".45 ACP 6Rnd Cylinder", "6Rnd_45ACP_Cylinder", 5], + [".45 ACP 9Rnd Mag", "9Rnd_45ACP_Mag", 10], + [".45 ACP 11Rnd Mag", "11Rnd_45ACP_Mag", 15], + [".45 ACP 30Rnd Vermin Mag", "30Rnd_45ACP_MAG_SMG_01", 20], + [".45 ACP 30Rnd Tracer (Green) Mag", "30Rnd_45ACP_Mag_SMG_01_tracer_green", 15], + ["5.56mm 20Rnd Underwater Mag", "20Rnd_556x45_UW_mag", 10], + ["5.56mm 30Rnd STANAG Mag", "30Rnd_556x45_Stanag", 20], + ["5.56mm 30Rnd Tracer (Green) Mag", "30Rnd_556x45_Stanag_Tracer_Green", 15], + ["5.56mm 30Rnd Tracer (Yellow) Mag", "30Rnd_556x45_Stanag_Tracer_Yellow", 15], + ["5.56mm 30Rnd Tracer (Red) Mag", "30Rnd_556x45_Stanag_Tracer_Red", 15], + ["6.5mm 30Rnd STANAG Mag", "30Rnd_65x39_caseless_mag", 20], + ["6.5mm 30Rnd Tracer (Red) Mag", "30Rnd_65x39_caseless_mag_Tracer", 15], + ["6.5mm 30Rnd Caseless Mag", "30Rnd_65x39_caseless_green", 20], + ["6.5mm 30Rnd Tracer (Green) Mag", "30Rnd_65x39_caseless_green_mag_Tracer", 15], + ["6.5mm 100Rnd Belt Case", "100Rnd_65x39_caseless_mag", 75], + ["6.5mm 100Rnd Tracer (Red) Belt Case", "100Rnd_65x39_caseless_mag_Tracer", 50], + ["6.5mm 200Rnd Belt Case", "200Rnd_65x39_cased_Box", 150], + ["6.5mm 200Rnd Tracer (Yellow) Belt Case", "200Rnd_65x39_cased_Box_Tracer", 125], + ["7.62mm 10Rnd Mag", "10Rnd_762x54_Mag", 20], + ["7.62mm 20Rnd Mag", "20Rnd_762x51_Mag", 25], + ["7.62mm 150Rnd Box", "150Rnd_762x54_Box", 125], + ["7.62mm 150Rnd Tracer (Green) Box", "150Rnd_762x54_Box_Tracer", 150], + [".338 LM 10Rnd Mag", "10Rnd_338_Mag", 125], + [".338 NM 130Rnd Belt", "130Rnd_338_Mag", 250], + ["9.3mm 10Rnd Mag", "10Rnd_93x64_DMR_05_Mag", 150], + ["9.3mm 150Rnd Belt", "150Rnd_93x64_Mag", 250], + [".408 7Rnd Cheetah Mag", "7Rnd_408_Mag", 100], + ["12.7mm 5Rnd Mag", "5Rnd_127x108_Mag", 100], + ["12.7mm 5Rnd Armor-Piercing Mag", "5Rnd_127x108_APDS_Mag", 150], + ["12.7mm 10Rnd Subsonic Mag", "10Rnd_127x54_Mag", 175], + ["RPG-42 Anti-Tank Rocket", "RPG32_F", 400], // Direct damage: high | Splash damage: low | Guidance: none + ["RPG-42 High-Explosive Rocket", "RPG32_HE_F", 350], // Direct damage: medium | Splash damage: medium | Guidance: none + ["PCML Anti-Tank Missile", "NLAW_F", 500], // Direct damage: very high | Splash damage: low | Guidance: laser, ground vehicles + //["Titan Anti-Tank Missile", "Titan_AT", 500], // Direct damage: high | Splash damage: low | Guidance: mouse, laser, ground vehicles + ["Titan AP Missile", "Titan_AP", 400], // Direct damage: low | Splash damage: high | Guidance: mouse, laser + ["Titan Anti-Air Missile", "Titan_AA", 550], // Direct damage: low | Splash damage: medium | Guidance: aircraft + ["40mm HE Grenade Round", "1Rnd_HE_Grenade_shell", 125], + ["40mm 3Rnd HE Grenades", "3Rnd_HE_Grenade_shell", 250], + ["40mm Smoke Round (White)", "1Rnd_Smoke_Grenade_shell", 50], + ["40mm Smoke Round (Purple)", "1Rnd_SmokePurple_Grenade_shell", 50], + ["40mm Smoke Round (Blue)", "1Rnd_SmokeBlue_Grenade_shell", 50], + ["40mm Smoke Round (Green)", "1Rnd_SmokeGreen_Grenade_shell", 50], + ["40mm Smoke Round (Yellow)", "1Rnd_SmokeYellow_Grenade_shell", 50], + ["40mm Smoke Round (Orange)", "1Rnd_SmokeOrange_Grenade_shell", 50], + ["40mm Smoke Round (Red)", "1Rnd_SmokeRed_Grenade_shell", 50], + ["40mm 3Rnd Smokes (White)", "3Rnd_Smoke_Grenade_shell", 100], + ["40mm 3Rnd Smokes (Purple)", "3Rnd_SmokePurple_Grenade_shell", 100], + ["40mm 3Rnd Smokes (Blue)", "3Rnd_SmokeBlue_Grenade_shell", 100], + ["40mm 3Rnd Smokes (Green)", "3Rnd_SmokeGreen_Grenade_shell", 100], + ["40mm 3Rnd Smokes (Yellow)", "3Rnd_SmokeYellow_Grenade_shell", 100], + ["40mm 3Rnd Smokes (Orange)", "3Rnd_SmokeOrange_Grenade_shell", 100], + ["40mm 3Rnd Smokes (Red)", "3Rnd_SmokeRed_Grenade_shell", 100], + ["40mm Flare Round (White)", "UGL_FlareWhite_F", 25], + ["40mm Flare Round (Green)", "UGL_FlareGreen_F", 25], + ["40mm Flare Round (Yellow)", "UGL_FlareYellow_F", 25], + ["40mm Flare Round (Red)", "UGL_FlareRed_F", 25], + ["40mm Flare Round (IR)", "UGL_FlareCIR_F", 25], + ["40mm 3Rnd Flares (White)", "3Rnd_UGL_FlareWhite_F", 50], + ["40mm 3Rnd Flares (Green)", "3Rnd_UGL_FlareGreen_F", 50], + ["40mm 3Rnd Flares (Yellow)", "3Rnd_UGL_FlareYellow_F", 50], + ["40mm 3Rnd Flares (Red)", "3Rnd_UGL_FlareRed_F", 50], + ["40mm 3Rnd Flares (IR)", "3Rnd_UGL_FlareCIR_F", 50] +]; + +//Gun Store item List +//Text name, classname, buy cost, item class +accessoriesArray = compileFinal str +[ + ["Suppressor 9mm", "muzzle_snds_L", 50, "item"], + ["Suppressor .45 ACP", "muzzle_snds_acp", 75, "item"], + ["Suppressor 5.56mm", "muzzle_snds_M", 100, "item"], + ["Suppressor 6.5mm", "muzzle_snds_H", 100, "item"], + ["Suppressor 6.5mm LMG", "muzzle_snds_H_MG", 125, "item"], + ["Suppressor 7.62mm", "muzzle_snds_B", 125, "item"], + ["Suppressor .338 [DLC]", "muzzle_snds_338_black", 150, "item"], + ["Suppressor .338 (Green) [DLC]", "muzzle_snds_338_green", 150, "item"], + ["Suppressor .338 (Sand) [DLC]", "muzzle_snds_338_sand", 175, "item"], + ["Suppressor 9.3mm [DLC]", "muzzle_snds_93mmg", 175, "item"], + ["Suppressor 9.3mm (Tan) [DLC]", "muzzle_snds_93mmg_tan", 175, "item"], + ["Bipod (NATO)", "bipod_01_F_blk", 250, "item"], + ["Bipod (CSAT)", "bipod_02_F_blk", 250, "item"], + ["Bipod (AAF)", "bipod_03_F_blk", 250, "item"], + ["Bipod (MTP)", "bipod_01_F_mtp", 250, "item"], + ["Bipod (Hex)", "bipod_02_F_hex", 250, "item"], + ["Bipod (Olive)", "bipod_03_F_oli", 250, "item"], + ["Bipod (Sand)", "bipod_01_F_snd", 250, "item"], + ["Bipod (Tan)", "bipod_02_F_tan", 250, "item"], + ["Flashlight", "acc_flashlight", 25, "item"], + ["IR Laser Pointer", "acc_pointer_IR", 25, "item"], + ["Yorris Sight (Zubr Revolver)", "optic_Yorris", 50, "item"], + ["MRD Sight (4-Five Pistol)", "optic_MRD", 50, "item"], + ["ACO (CQB)", "optic_aco_smg", 50, "item"], + ["Holosight (CQB)", "optic_Holosight_smg", 50, "item"], + ["ACO (Red)", "optic_Aco", 75, "item"], + ["ACO (Green)", "optic_Aco_grn", 75, "item"], + ["Holosight", "optic_Holosight", 75, "item"], + ["MRCO", "optic_MRCO", 100, "item"], + ["ARCO", "optic_Arco", 125, "item"], + ["RCO", "optic_Hamr", 150, "item"], + ["MOS", "optic_SOS", 150, "item"], + ["DMS", "optic_DMS", 175, "item"], + ["AMS [DLC]", "optic_AMS", 200, "item"], + ["AMS (Khaki) [DLC]", "optic_AMS_khk", 200, "item"], + ["AMS (Sand) [DLC]", "optic_AMS_snd", 200, "item"], + ["Kahlia [DLC]", "optic_KHS_blk", 250, "item"], + ["Kahlia (Hex) [DLC]", "optic_KHS_hex", 250, "item"], + ["Kahlia (Tan) [DLC]", "optic_KHS_tan", 250, "item"], + ["Kahlia (Old) [DLC]", "optic_KHS_old", 250, "item"], + ["LRPS", "optic_LRPS", 300, "item"], + ["NVS", "optic_NVS", 500, "item"], + ["TWS", "optic_tws", 5000, "item"], + ["TWS MG", "optic_tws_mg", 6000, "item"], + ["Nightstalker", "optic_Nightstalker", 7500, "item"] +]; + +// If commented, means the color/camo isn't implemented or is a duplicate of another hat +headArray = compileFinal str +[ + ["ECH", "H_HelmetB", 50, "hat"], + ["ECH (Ghillie)", "H_HelmetB_camo", 50, "hat"], + ["ECH (Light)", "H_HelmetB_light", 50, "hat"], + ["ECH (Spraypaint)", "H_HelmetB_paint", 50, "hat"], + ["SF Helmet", "H_HelmetSpecB", 50, "hat"], + ["SF Helmet (Black)", "H_HelmetSpecB_blk", 50, "hat"], + ["SF Helmet (Light Paint)", "H_HelmetSpecB_paint1", 50, "hat"], + ["SF Helmet (Dark Paint)", "H_HelmetSpecB_paint2", 50, "hat"], + ["Combat Helmet (Black)", "H_HelmetB_plain_blk", 50, "hat"], + ["Protector Helmet (Hex)", "H_HelmetO_ocamo", 50, "hat"], + ["Protector Helmet (Urban)", "H_HelmetO_oucamo", 50, "hat"], + ["Defender Helmet (Hex)", "H_HelmetLeaderO_ocamo", 50, "hat"], + ["Defender Helmet (Urban)", "H_HelmetLeaderO_oucamo", 50, "hat"], + // ["Assassin Helmet (Hex)", "H_HelmetSpecO_ocamo", 50, "hat"], + ["Assassin Helmet (Black)", "H_HelmetSpecO_blk", 50, "hat"], + ["MICH", "H_HelmetIA", 50, "hat"], + // ["MICH (Camo)", "H_HelmetIA_net", 50, "hat"], + // ["MICH 2 (Camo)", "H_HelmetIA_camo", 50, "hat"], + ["Heli Crew Helmet (NATO)", "H_CrewHelmetHeli_B", 50, "hat"], + ["Heli Crew Helmet (CSAT)", "H_CrewHelmetHeli_O", 50, "hat"], + ["Heli Crew Helmet (AAF)", "H_CrewHelmetHeli_I", 50, "hat"], + ["Heli Pilot Helmet (NATO)", "H_PilotHelmetHeli_B", 50, "hat"], + ["Heli Pilot Helmet (CSAT)", "H_PilotHelmetHeli_O", 50, "hat"], + ["Heli Pilot Helmet (AAF)", "H_PilotHelmetHeli_I", 50, "hat"], + ["Crew Helmet (NATO)", "H_HelmetCrew_B", 50, "hat"], + ["Crew Helmet (CSAT)", "H_HelmetCrew_O", 50, "hat"], + ["Crew Helmet (AAF)", "H_HelmetCrew_I", 50, "hat"], + ["Pilot Helmet (NATO)", "H_PilotHelmetFighter_B", 50, "hat"], + ["Pilot Helmet (CSAT)", "H_PilotHelmetFighter_O", 50, "hat"], + ["Pilot Helmet (AAF)", "H_PilotHelmetFighter_I", 50, "hat"], + ["Military Cap (Blue)", "H_MilCap_blue", 25, "hat"], + ["Military Cap (Gray)", "H_MilCap_gry", 25, "hat"], + ["Military Cap (Urban)", "H_MilCap_oucamo", 25, "hat"], + ["Military Cap (Russia)", "H_MilCap_rucamo", 25, "hat"], + ["Military Cap (MTP)", "H_MilCap_mcamo", 25, "hat"], + ["Military Cap (Hex)", "H_MilCap_ocamo", 25, "hat"], + ["Military Cap (AAF)", "H_MilCap_dgtl", 25, "hat"], + ["Rangemaster Cap", "H_Cap_headphones", 25, "hat"], + ["Bandanna (Coyote)", "H_Bandanna_cbr", 10, "hat"], + ["Bandanna (Camo)", "H_Bandanna_camo", 10, "hat"], + ["Bandanna (Gray)", "H_Bandanna_gry", 10, "hat"], + ["Bandanna (Khaki)", "H_Bandanna_khk", 10, "hat"], + ["Bandanna (MTP)", "H_Bandanna_mcamo", 10, "hat"], + ["Bandanna (Sage)", "H_Bandanna_sgg", 10, "hat"], + ["Bandanna (Surfer)", "H_Bandanna_surfer", 10, "hat"], + // ["Bandanna Mask (Black)", "H_BandMask_blk", 10, "hat"], + // ["Bandanna Mask (Demon)", "H_BandMask_demon", 10, "hat"], + // ["Bandanna Mask (Khaki)", "H_BandMask_khk", 10, "hat"], + // ["Bandanna Mask (Reaper)", "H_BandMask_reaper", 10, "hat"], + ["Beanie (Black)", "H_Watchcap_blk", 10, "hat"], + ["Beanie (Dark blue)", "H_Watchcap_sgg", 10, "hat"], + ["Beanie (Dark brown)", "H_Watchcap_cbr", 10, "hat"], + ["Beanie (Dark khaki)", "H_Watchcap_khk", 10, "hat"], + ["Beanie (Dark green)", "H_Watchcap_camo", 10, "hat"], + ["Beret (Black)", "H_Beret_blk", 10, "hat"], + ["Beret (Colonel)", "H_Beret_Colonel", 10, "hat"], + ["Beret (NATO)", "H_Beret_02", 10, "hat"], + // ["Beret (Green)", "H_Beret_grn", 10, "hat"], + // ["Beret (Police)", "H_Beret_blk_POLICE", 10, "hat"], + // ["Beret (Red)", "H_Beret_red", 10, "hat"], + // ["Beret (SAS)", "H_Beret_brn_SF", 10, "hat"], + // ["Beret (SF)", "H_Beret_grn_SF", 10, "hat"], + // ["Beret (RED)", "H_Beret_ocamo", 10, "hat"], + // ["Black Turban", "H_TurbanO_blk", 50, "hat"], + // ["Booniehat (Dirty)", "H_Booniehat_dirty", 10, "hat"], + // ["Booniehat (Green)", "H_Booniehat_grn", 10, "hat"], + // ["Booniehat (Khaki)", "H_Booniehat_indp", 10, "hat"], + ["Booniehat (Khaki)", "H_Booniehat_khk", 10, "hat"], + ["Booniehat (Tan)", "H_Booniehat_tan", 10, "hat"], + ["Booniehat (MTP)", "H_Booniehat_mcamo", 10, "hat"], + ["Booniehat (Digi)", "H_Booniehat_dgtl", 10, "hat"], + ["Fedora (Blue)", "H_Hat_blue", 10, "hat"], + ["Fedora (Brown)", "H_Hat_brown", 10, "hat"], + ["Fedora (Camo)", "H_Hat_camo", 10, "hat"], + ["Fedora (Checker)", "H_Hat_checker", 10, "hat"], + ["Fedora (Gray)", "H_Hat_grey", 10, "hat"], + ["Fedora (Tan)", "H_Hat_tan", 10, "hat"], + ["Cap (Black)", "H_Cap_blk", 10, "hat"], + ["Cap (Blue)", "H_Cap_blu", 10, "hat"], + ["Cap (Green)", "H_Cap_grn", 10, "hat"], + ["Cap (Olive)", "H_Cap_oli", 10, "hat"], + ["Cap (Red)", "H_Cap_red", 10, "hat"], + ["Cap (Tan)", "H_Cap_tan", 10, "hat"], + ["Cap (BI)", "H_Cap_grn_BI", 10, "hat"], + ["Cap (CMMG)", "H_Cap_blk_CMMG", 10, "hat"], + ["Cap (ION)", "H_Cap_blk_ION", 10, "hat"], + ["Cap (Raven Security)", "H_Cap_blk_Raven", 10, "hat"], + ["Cap (SAS)", "H_Cap_khaki_specops_UK", 10, "hat"], + ["Cap (SF)", "H_Cap_tan_specops_US", 10, "hat"], + ["Cap (SPECOPS)", "H_Cap_brn_SPECOPS", 10, "hat"], + ["Shemag (White)", "H_ShemagOpen_khk", 25, "hat"], + ["Shemag (Brown)", "H_ShemagOpen_tan", 25, "hat"], + ["Shemag mask (Khaki)", "H_Shemag_khk", 25, "hat"], + ["Shemag mask (Olive)", "H_Shemag_olive", 25, "hat"], + // ["Shemag mask (Tan)", "H_Shemag_tan", 25, "hat"], + ["Racing Helmet (Black)", "H_RacingHelmet_1_black_F", 25, "hat"], + ["Racing Helmet (Blue)", "H_RacingHelmet_1_blue_F", 25, "hat"], + ["Racing Helmet (Green)", "H_RacingHelmet_1_green_F", 25, "hat"], + ["Racing Helmet (Yellow)", "H_RacingHelmet_1_yellow_F", 25, "hat"], + ["Racing Helmet (Orange)", "H_RacingHelmet_1_orange_F", 25, "hat"], + ["Racing Helmet (Red)", "H_RacingHelmet_1_red_F", 25, "hat"], + ["Racing Helmet (White)", "H_RacingHelmet_1_white_F", 25, "hat"], + ["Racing Helmet (Fuel)", "H_RacingHelmet_1_F", 25, "hat"], + ["Racing Helmet (Bluking)", "H_RacingHelmet_2_F", 25, "hat"], + ["Racing Helmet (Redstone)", "H_RacingHelmet_3_F", 25, "hat"], + ["Racing Helmet (Vrana)", "H_RacingHelmet_4_F", 25, "hat"] +]; + +uniformArray = compileFinal str +[ + ["Ghillie Suit (NATO)", "U_B_GhillieSuit", 300, "uni"], + ["Ghillie Suit (CSAT)", "U_O_GhillieSuit", 300, "uni"], + ["Ghillie Suit (AAF)", "U_I_GhillieSuit", 300, "uni"], + ["Full Ghillie (Arid) (NATO)", "U_B_FullGhillie_ard", 2000, "uni"], + ["Full Ghillie (Arid) (CSAT)", "U_O_FullGhillie_ard", 2000, "uni"], + ["Full Ghillie (Arid) (AAF)", "U_I_FullGhillie_ard", 2000, "uni"], + ["Full Ghillie (Lush) (NATO)", "U_B_FullGhillie_lsh", 2000, "uni"], + ["Full Ghillie (Lush) (CSAT)", "U_O_FullGhillie_lsh", 2000, "uni"], + ["Full Ghillie (Lush) (AAF)", "U_I_FullGhillie_lsh", 2000, "uni"], + ["Full Ghillie (Semi-Arid) (NATO)", "U_B_FullGhillie_sard", 2000, "uni"], + ["Full Ghillie (Semi-Arid) (CSAT)", "U_O_FullGhillie_sard", 2000, "uni"], + ["Full Ghillie (Semi-Arid) (AAF)", "U_I_FullGhillie_sard", 2000, "uni"], + ["Wetsuit (NATO)", "U_B_Wetsuit", 200, "uni"], + ["Wetsuit (CSAT)", "U_O_Wetsuit", 200, "uni"], + ["Wetsuit (AAF)", "U_I_Wetsuit", 200, "uni"], + ["Default Uniform (NATO)", "U_B_CombatUniform_mcam", 50, "uni"], + ["Default Uniform (CSAT)", "U_O_CombatUniform_ocamo", 50, "uni"], + ["Default Uniform (AAF)", "U_I_CombatUniform", 50, "uni"], + ["Combat Fatigues (MTP) (Tee)", "U_B_CombatUniform_mcam_tshirt", 50, "uni"], + ["Recon Fatigues (MTP)", "U_B_CombatUniform_mcam_vest", 50, "uni"], + ["Recon Fatigues (Sage)", "U_B_SpecopsUniform_sgg", 50, "uni"], + ["CTRG Combat Uniform (UBACS)", "U_B_CTRG_1", 50, "uni"], + ["CTRG Combat Uniform (UBACS2)", "U_B_CTRG_2", 50, "uni"], + ["CTRG Combat Uniform (Tee)", "U_B_CTRG_3", 50, "uni"], + ["Recon Fatigues (Hex)", "U_O_SpecopsUniform_ocamo", 50, "uni"], + ["Fatigues (Urban)", "U_O_CombatUniform_oucamo", 50, "uni"], + ["Combat Fatigues Short (Digi)", "U_I_CombatUniform_shortsleeve", 50, "uni"], + ["Combat Fatigues Shirt (Digi)", "U_I_CombatUniform_tshirt", 50, "uni"], + ["Officer Fatigues (Hex)", "U_O_OfficerUniform_ocamo", 50, "uni"], + ["Officer Fatigues (Digi)", "U_I_OfficerUniform", 50, "uni"], + ["Pilot Coveralls (NATO)", "U_B_PilotCoveralls", 50, "uni"], + ["Pilot Coveralls (CSAT)", "U_O_PilotCoveralls", 50, "uni"], + ["Pilot Coveralls (AAF)", "U_I_pilotCoveralls", 50, "uni"], + ["Heli Pilot Coveralls (NATO)", "U_B_HeliPilotCoveralls", 50, "uni"], + ["Heli Pilot Coveralls (AAF)", "U_I_HeliPilotCoveralls", 50, "uni"], + ["Guerilla Smocks 1", "U_BG_Guerilla1_1", 25, "uni"], // BLUFOR + ["Guerilla Smocks 2", "U_BG_Guerilla2_1", 25, "uni"], + ["Guerilla Smocks 3", "U_BG_Guerilla2_2", 25, "uni"], + ["Guerilla Smocks 4", "U_BG_Guerilla2_3", 25, "uni"], + ["Guerilla Smocks 5", "U_BG_Guerilla3_1", 25, "uni"], + ["Guerilla Smocks 6", "U_BG_Guerilla3_2", 25, "uni"], + ["Guerilla Smocks 7", "U_BG_leader", 25, "uni"], + ["Guerilla Smocks 1", "U_OG_Guerilla1_1", 25, "uni"], // OPFOR + ["Guerilla Smocks 2", "U_OG_Guerilla2_1", 25, "uni"], + ["Guerilla Smocks 3", "U_OG_Guerilla2_2", 25, "uni"], + ["Guerilla Smocks 4", "U_OG_Guerilla2_3", 25, "uni"], + ["Guerilla Smocks 5", "U_OG_Guerilla3_1", 25, "uni"], + ["Guerilla Smocks 6", "U_OG_Guerilla3_2", 25, "uni"], + ["Guerilla Smocks 7", "U_OG_leader", 25, "uni"], + ["Guerilla Smocks 1", "U_IG_Guerilla1_1", 25, "uni"], // Independent + ["Guerilla Smocks 2", "U_IG_Guerilla2_1", 25, "uni"], + ["Guerilla Smocks 3", "U_IG_Guerilla2_2", 25, "uni"], + ["Guerilla Smocks 4", "U_IG_Guerilla2_3", 25, "uni"], + ["Guerilla Smocks 5", "U_IG_Guerilla3_1", 25, "uni"], + ["Guerilla Smocks 6", "U_IG_Guerilla3_2", 25, "uni"], + ["Guerilla Smocks 7", "U_IG_leader", 25, "uni"], + /*["Worker Coveralls", "U_C_WorkerCoveralls", 25, "uni"], // can only be worn by civilian units + ["T-Shirt (Blue)", "U_C_Poor_1", 25, "uni"], + ["Polo (Red/white)", "U_C_Poloshirt_redwhite", 25, "uni"], + ["Polo (Salmon)", "U_C_Poloshirt_salmon", 25, "uni"], + ["Polo (Tri-color)", "U_C_Poloshirt_tricolour", 25, "uni"], + ["Polo (Navy)", "U_C_Poloshirt_blue", 25, "uni"], + ["Polo (Burgundy)", "U_C_Poloshirt_burgundy", 25, "uni"], + ["Polo (Blue/green)", "U_C_Poloshirt_stripped", 25, "uni"],*/ + ["Polo (Competitor)", "U_Competitor", 25, "uni"], + ["Polo (Rangemaster)", "U_Rangemaster", 25, "uni"], + /*["Racing Suit (Black)", "U_C_Driver_1_black", 25, "uni"], // can only be worn by civilian units + ["Racing Suit (Blue)", "U_C_Driver_1_blue", 25, "uni"], + ["Racing Suit (Green)", "U_C_Driver_1_green", 25, "uni"], + ["Racing Suit (Yellow)", "U_C_Driver_1_yellow", 25, "uni"], + ["Racing Suit (Orange)", "U_C_Driver_1_orange", 25, "uni"], + ["Racing Suit (Red)", "U_C_Driver_1_red", 25, "uni"], + ["Racing Suit (White)", "U_C_Driver_1_white", 25, "uni"], + ["Racing Suit (Fuel)", "U_C_Driver_1", 25, "uni"], + ["Racing Suit (Bluking)", "U_C_Driver_2", 25, "uni"], + ["Racing Suit (Redstone)", "U_C_Driver_3", 25, "uni"], + ["Racing Suit (Vrana)", "U_C_Driver_4", 25, "uni"],*/ + ["Tron Light Suit (Blue)", "U_B_Protagonist_VR", 5000, "uni"], + ["Tron Light Suit (Red)", "U_O_Protagonist_VR", 5000, "uni"], + ["Tron Light Suit (Green)", "U_I_Protagonist_VR", 5000, "uni"] +]; + +vestArray = compileFinal str +[ + ["Rebreather (NATO)", "V_RebreatherB", 200, "vest"], + ["Rebreather (CSAT)", "V_RebreatherIR", 200, "vest"], + ["Rebreather (AAF)", "V_RebreatherIA", 200, "vest"], + ["Carrier Lite (Green)", "V_PlateCarrier1_rgr", -1, "vest"], + ["Carrier Lite (Black)", "V_PlateCarrier1_blk", -1, "vest"], + ["Carrier Rig (Green)", "V_PlateCarrier3_rgr", -1, "vest"], + ["Carrier GL Rig (Green)", "V_PlateCarrierGL_rgr", -1, "vest"], + ["Carrier GL Rig (Black)", "V_PlateCarrierGL_blk", -1, "vest"], + ["Carrier GL Rig (MTP)", "V_PlateCarrierGL_mtp", -1, "vest"], + ["Carrier Special Rig (Green)", "V_PlateCarrierSpec_rgr", -1, "vest"], + ["Carrier Special Rig (Black)", "V_PlateCarrierSpec_blk", -1, "vest"], + ["Carrier Special Rig (MTP)", "V_PlateCarrierSpec_mtp", -1, "vest"], + ["GA Carrier Lite (Digi)", "V_PlateCarrierIA1_dgtl", -1, "vest"], + ["GA Carrier Rig (Digi)", "V_PlateCarrierIA2_dgtl", -1, "vest"], + ["GA Carrier GL Rig (Digi)", "V_PlateCarrierIAGL_dgtl", -1, "vest"], + ["GA Carrier GL Rig (Olive)", "V_PlateCarrierIAGL_oli", -1, "vest"], + ["LBV Harness", "V_HarnessO_brn", -1, "vest"], + ["LBV Harness (Gray)", "V_HarnessO_gry", -1, "vest"], + ["LBV Grenadier Harness", "V_HarnessOGL_brn", -1, "vest"], + ["LBV Grenadier Harness (Gray)", "V_HarnessOGL_gry", -1, "vest"], + ["ELBV Harness", "V_HarnessOSpec_brn", -1, "vest"], + ["ELBV Harness (Gray)", "V_HarnessOSpec_gry", -1, "vest"], + ["Slash Bandolier (Black)", "V_BandollierB_blk", -1, "vest"], + ["Slash Bandolier (Coyote)", "V_BandollierB_cbr", -1, "vest"], + ["Slash Bandolier (Green)", "V_BandollierB_rgr", -1, "vest"], + ["Slash Bandolier (Khaki)", "V_BandollierB_khk", -1, "vest"], + ["Slash Bandolier (Olive)", "V_BandollierB_oli", -1, "vest"], + ["Chest Rig (Khaki)", "V_Chestrig_khk", -1, "vest"], + ["Chest Rig (Green)", "V_Chestrig_rgr", -1, "vest"], + ["Fighter Chestrig (Black)", "V_Chestrig_blk", -1, "vest"], + ["Fighter Chestrig (Olive)", "V_Chestrig_oli", -1, "vest"], + ["Tactical Vest (Black)", "V_TacVest_blk", -1, "vest"], + ["Tactical Vest (Brown)", "V_TacVest_brn", -1, "vest"], + ["Tactical Vest (Camo)", "V_TacVest_camo", -1, "vest"], + ["Tactical Vest (Khaki)", "V_TacVest_khk", -1, "vest"], + ["Tactical Vest (Olive)", "V_TacVest_oli", -1, "vest"], + ["Raven Night Vest", "V_TacVestIR_blk", -1, "vest"] +]; + +backpackArray = compileFinal str +[ + //["Parachute", "B_Parachute", 200, "backpack"], + + ["Assault Pack (Black)", "B_AssaultPack_blk", 150, "backpack"], + ["Assault Pack (Green)", "B_AssaultPack_rgr", 150, "backpack"], + ["Assault Pack (MTP)", "B_AssaultPack_mcamo", 150, "backpack"], + ["Assault Pack (Hex)", "B_AssaultPack_ocamo", 150, "backpack"], + + ["Field Pack (Black)", "B_FieldPack_blk", 200, "backpack"], + ["Field Pack (Coyote)", "B_FieldPack_cbr", 200, "backpack"], + ["Field Pack (Khaki)", "B_FieldPack_khk", 200, "backpack"], + ["Field Pack (Urban)", "B_FieldPack_oucamo", 200, "backpack"], + + ["Kitbag (Coyote)", "B_Kitbag_cbr", 350, "backpack"], + ["Kitbag (Green)", "B_Kitbag_rgr", 350, "backpack"], + ["Kitbag (MTP)", "B_Kitbag_mcamo", 350, "backpack"], + ["Kitbag (Sage)", "B_Kitbag_sgg", 350, "backpack"], + + ["Bergen (Black)", "B_Bergen_blk", 350, "backpack"], + ["Bergen (Green)", "B_Bergen_rgr", 350, "backpack"], + ["Bergen (MTP)", "B_Bergen_mcamo", 350, "backpack"], + ["Bergen (Sage)", "B_Bergen_sgg", 350, "backpack"], + + ["Carryall (Khaki)", "B_Carryall_khk", 500, "backpack"], + ["Carryall (MTP)", "B_Carryall_mcamo", 500, "backpack"], + ["Carryall (Olive)", "B_Carryall_oli", 500, "backpack"], + ["Carryall (Urban)", "B_Carryall_oucamo", 500, "backpack"] +]; + +genItemArray = compileFinal str +[ + ["UAV Terminal (NATO)", "B_UavTerminal", 150, "gps"], + ["UAV Terminal (CSAT)", "O_UavTerminal", 150, "gps"], + ["UAV Terminal (AAF)", "I_UavTerminal", 150, "gps"], + ["Quadrotor UAV (NATO)", "B_UAV_01_backpack_F", 500, "backpack"], + ["Quadrotor UAV (CSAT)", "O_UAV_01_backpack_F", 500, "backpack"], + ["Quadrotor UAV (AAF)", "I_UAV_01_backpack_F", 500, "backpack"], + ["Remote Designator Bag (NATO) [DLC]", "B_Static_Designator_01_weapon_F", 1000, "backpack"], + ["Remote Designator Bag (CSAT) [DLC]", "O_Static_Designator_02_weapon_F", 1000, "backpack"], + ["GPS", "ItemGPS", 100, "gps"], + ["First Aid Kit", "FirstAidKit", 25, "item"], + ["Medikit", "Medikit", 150, "item"], + ["Toolkit", "ToolKit", 150, "item"], + ["Mine Detector", "MineDetector", 100, "item"], + ["NV Goggles", "NVGoggles", 100, "nvg"], + ["Diving Goggles", "G_Diving", 100, "gogg"], + ["Binoculars", "Binocular", 50, "binoc"], + ["Rangefinder", "Rangefinder", 150, "binoc"], + ["Laser Designator", "Laserdesignator", 1000, "binoc"], + ["Chemlight (Blue)", "Chemlight_blue", 25, "mag"], + ["Chemlight (Green)", "Chemlight_green", 25, "mag"], + ["Chemlight (Yellow)", "Chemlight_yellow", 25, "mag"], + ["Chemlight (Red)", "Chemlight_red", 25, "mag"] +]; + +allStoreMagazines = compileFinal str (call ammoArray + call throwputArray + call genItemArray); +allRegularStoreItems = compileFinal str (call allGunStoreFirearms + call allStoreMagazines + call accessoriesArray); +allStoreGear = compileFinal str (call headArray + call uniformArray + call vestArray + call backpackArray); + +genObjectsArray = compileFinal str +[ + ["Empty Ammo Crate", "Box_NATO_Ammo_F", 200, "ammocrate"], + //["Metal Barrel", "Land_MetalBarrel_F", 25, "object"], + //["Toilet Box", "Land_ToiletBox_F", 25, "object"], + ["Lamp Post (Harbour)", "Land_LampHarbour_F", 100, "object"], + ["Lamp Post (Shabby)", "Land_LampShabby_F", 100, "object"], + ["Boom Gate", "Land_BarGate_F", 150, "object"], + ["Pipes", "Land_Pipes_Large_F", 200, "object"], + ["Concrete Frame", "Land_CncShelter_F", 200, "object"], + ["Highway Guardrail", "Land_Crash_barrier_F", 200, "object"], + ["Concrete Barrier", "Land_CncBarrier_F", 200, "object"], + ["Concrete Barrier (Medium)", "Land_CncBarrierMedium_F", 350, "object"], + ["Concrete Barrier (Long)", "Land_CncBarrierMedium4_F", 500, "object"], + ["HBarrier (1 block)", "Land_HBarrier_1_F", 150, "object"], + ["HBarrier (3 blocks)", "Land_HBarrier_3_F", 200, "object"], + ["HBarrier (5 blocks)", "Land_HBarrier_5_F", 250, "object"], + ["HBarrier Big", "Land_HBarrierBig_F", 500, "object"], + ["HBarrier Wall (4 blocks)", "Land_HBarrierWall4_F", 400, "object"], + ["HBarrier Wall (6 blocks)", "Land_HBarrierWall6_F", 500, "object"], + ["HBarrier Watchtower", "Land_HBarrierTower_F", 600, "object"], + ["Concrete Wall", "Land_CncWall1_F", 400, "object"], + ["Concrete Military Wall", "Land_Mil_ConcreteWall_F", 400, "object"], + ["Concrete Wall (Long)", "Land_CncWall4_F", 600, "object"], + ["Military Wall (Big)", "Land_Mil_WallBig_4m_F", 600, "object"], + //["Shoot House Wall", "Land_Shoot_House_Wall_F", 180, "object"], + ["Canal Wall (Small)", "Land_Canal_WallSmall_10m_F", 400, "object"], + ["Canal Stairs", "Land_Canal_Wall_Stairs_F", 500, "object"], + ["Bag Fence (Corner)", "Land_BagFence_Corner_F", 150, "object"], + ["Bag Fence (End)", "Land_BagFence_End_F", 150, "object"], + ["Bag Fence (Long)", "Land_BagFence_Long_F", 200, "object"], + ["Bag Fence (Round)", "Land_BagFence_Round_F", 150, "object"], + ["Bag Fence (Short)", "Land_BagFence_Short_F", 150, "object"], + ["Bag Bunker (Small)", "Land_BagBunker_Small_F", 250, "object"], + ["Bag Bunker (Large)", "Land_BagBunker_Large_F", 500, "object"], + ["Bag Bunker Tower", "Land_BagBunker_Tower_F", 1000, "object"], + ["Military Cargo Post", "Land_Cargo_Patrol_V1_F", 800, "object"], + ["Military Cargo Tower", "Land_Cargo_Tower_V1_F", 10000, "object"], + ["Concrete Ramp", "Land_RampConcrete_F", 350, "object"], + ["Concrete Ramp (High)", "Land_RampConcreteHigh_F", 500, "object"], + ["Scaffolding", "Land_Scaffolding_F", 250, "object"] +]; + +allGenStoreVanillaItems = compileFinal str (call genItemArray + call genObjectsArray + call allStoreGear); + +//Text name, classname, buy cost, spawn type, sell price (selling not implemented) or spawning color +landArray = compileFinal str +[ + ["Kart", "C_Kart_01_F", 500, "vehicle"], + + ["Quadbike (Civilian)", "C_Quadbike_01_F", 600, "vehicle"], + ["Quadbike (NATO)", "B_Quadbike_01_F", 650, "vehicle"], + ["Quadbike (CSAT)", "O_Quadbike_01_F", 650, "vehicle"], + ["Quadbike (AAF)", "I_Quadbike_01_F", 650, "vehicle"], + ["Quadbike (FIA)", "B_G_Quadbike_01_F", 650, "vehicle"], + + ["Hatchback", "C_Hatchback_01_F", 800, "vehicle"], + ["Hatchback Sport", "C_Hatchback_01_sport_F", 1000, "vehicle"], + ["SUV", "C_SUV_01_F", 1100, "vehicle"], + ["Offroad", "C_Offroad_01_F", 1100, "vehicle"], + ["Offroad Camo", "B_G_Offroad_01_F", 1250, "vehicle"], + ["Offroad Repair", "C_Offroad_01_repair_F", 1500, "vehicle"], + ["Offroad Repair Camo", "B_G_Offroad_01_repair_F", 1750, "vehicle"], + ["Offroad HMG", "B_G_Offroad_01_armed_F", 2500, "vehicle"], + + ["Truck", "C_Van_01_transport_F", 700, "vehicle"], + ["Truck (Camo)", "B_G_Van_01_transport_F", 800, "vehicle"], + ["Truck Box", "C_Van_01_box_F", 900, "vehicle"], + ["Fuel Truck", "C_Van_01_fuel_F", 2000, "vehicle"], + ["Fuel Truck (Camo)", "B_G_Van_01_fuel_F", 2100, "vehicle"], + + ["HEMTT Resupply", "B_Truck_01_ammo_F", 5000, "vehicle"], + ["HEMTT Tractor", "B_Truck_01_mover_F", 4000, "vehicle"], + ["HEMTT Box", "B_Truck_01_box_F", 5000, "vehicle"], + ["HEMTT Transport", "B_Truck_01_transport_F", 6000, "vehicle"], + ["HEMTT Covered", "B_Truck_01_covered_F", 7500, "vehicle"], + ["HEMTT Fuel", "B_Truck_01_fuel_F", 9000, "vehicle"], + ["HEMTT Medical", "B_Truck_01_medical_F", 10000, "vehicle"], + ["HEMTT Repair", "B_Truck_01_Repair_F", 12500, "vehicle"], + + ["Tempest Resupply", "O_Truck_03_ammo_F", 5000, "vehicle"], + ["Tempest Device", "O_Truck_03_device_F", 4000, "vehicle"], + ["Tempest Transport", "O_Truck_03_transport_F", 6000, "vehicle"], + ["Tempest Covered", "O_Truck_03_covered_F", 7500, "vehicle"], + ["Tempest Fuel", "O_Truck_03_fuel_F", 9000, "vehicle"], + ["Tempest Medical", "O_Truck_03_medical_F", 10000, "vehicle"], + ["Tempest Repair", "O_Truck_03_repair_F", 12500, "vehicle"], + + ["Zamak Resupply", "I_Truck_02_ammo_F", 4000, "vehicle"], + ["Zamak Transport", "I_Truck_02_transport_F", 4000, "vehicle"], + ["Zamak Covered", "I_Truck_02_covered_F", 5000, "vehicle"], + ["Zamak Fuel", "I_Truck_02_fuel_F", 7500, "vehicle"], + ["Zamak Medical", "I_Truck_02_medical_F", 9000, "vehicle"], + ["Zamak Repair", "I_Truck_02_box_F", 10000, "vehicle"], + + ["UGV Stomper (NATO)", "B_UGV_01_F", 2500, "vehicle"], + ["UGV Stomper RCWS (NATO)", "B_UGV_01_rcws_F", 20000, "vehicle"], + ["UGV Stomper (AAF)", "I_UGV_01_F", 2500, "vehicle"], + ["UGV Stomper RCWS (AAF)", "I_UGV_01_rcws_F", 20000, "vehicle"], + ["UGV Saif (CSAT)", "O_UGV_01_F", 2500, "vehicle"], + ["UGV Saif RCWS (CSAT)", "O_UGV_01_rcws_F", 20000, "vehicle"] +]; + +armoredArray = compileFinal str +[ + ["Hunter", "B_MRAP_01_F", 4000, "vehicle"], + ["Hunter HMG", "B_MRAP_01_hmg_F", 15000, "vehicle"], + ["Hunter GMG", "B_MRAP_01_gmg_F", 17500, "vehicle"], + ["Ifrit", "O_MRAP_02_F", 4500, "vehicle"], + ["Ifrit HMG", "O_MRAP_02_hmg_F", 15500, "vehicle"], + ["Ifrit GMG", "O_MRAP_02_gmg_F", 18000, "vehicle"], + ["Strider", "I_MRAP_03_F", 5000, "vehicle"], + ["Strider HMG", "I_MRAP_03_hmg_F", 16000, "vehicle"], + ["Strider GMG", "I_MRAP_03_gmg_F", 18500, "vehicle"], + ["MSE-3 Marid", "O_APC_Wheeled_02_rcws_F", 22500, "vehicle"], + ["AMV-7 Marshall", "B_APC_Wheeled_01_cannon_F", 27500, "vehicle"], + ["AFV-4 Gorgon", "I_APC_Wheeled_03_cannon_F", 30000, "vehicle"] +]; + +tanksArray = compileFinal str +[ + ["CRV-6e Bobcat", "B_APC_Tracked_01_CRV_F", 32500, "vehicle"], + ["IFV-6c Panther", "B_APC_Tracked_01_rcws_F", 35000, "vehicle"], + ["FV-720 Mora", "I_APC_tracked_03_cannon_F", 37500, "vehicle"], + ["BTR-K Kamysh", "O_APC_Tracked_02_cannon_F", 40000, "vehicle"], + ["IFV-6a Cheetah AA", "B_APC_Tracked_01_AA_F", 40000, "vehicle"], + ["ZSU-39 Tigris AA", "O_APC_Tracked_02_AA_F", 40000, "vehicle"], + ["M2A1 Slammer", "B_MBT_01_cannon_F", 50000, "vehicle"], + ["M2A4 Slammer HMG", "B_MBT_01_TUSK_F", 50000, "vehicle"], // Commander gun variant + ["T-100 Varsuk", "O_MBT_02_cannon_F", 50000, "vehicle"], + ["MBT-52 Kuma", "I_MBT_03_cannon_F", 50000, "vehicle"] +]; + + +helicoptersArray = compileFinal str +[ + ["M-900 Civilian", "C_Heli_Light_01_civil_F", 4000, "vehicle"], // MH-6, no flares + ["MH-9 Hummingbird", "B_Heli_Light_01_F", 5000, "vehicle"], // MH-6 + ["PO-30 Orca (Black)", "O_Heli_Light_02_unarmed_F", 7000, "vehicle"], // Ka-60 + ["WY-55 Hellcat (Green)", "I_Heli_light_03_unarmed_F", 7000, "vehicle"], // AW159 + + ["Mi-290 Taru (Resupply) [DLC]", "O_Heli_Transport_04_ammo_F", 7500, "vehicle"], + ["Mi-290 Taru (Crane) [DLC]", "O_Heli_Transport_04_F", 7500, "vehicle"], // CH-54 + ["Mi-290 Taru (Box) [DLC]", "O_Heli_Transport_04_box_F", 8000, "vehicle"], + ["Mi-290 Taru (Fuel) [DLC]", "O_Heli_Transport_04_fuel_F", 8500, "vehicle"], + ["Mi-290 Taru (Bench) [DLC]", "O_Heli_Transport_04_bench_F", 9000, "vehicle"], + ["Mi-290 Taru (Transport) [DLC]", "O_Heli_Transport_04_covered_F", 9500, "vehicle"], + ["CH-67 Huron (Black) [DLC]", "B_Heli_Transport_03_unarmed_F", 10000, "vehicle"], // CH-47 + ["CH-49 Mohawk", "I_Heli_Transport_02_F", 10000, "vehicle"], // AW101 + + ["Mi-290 Taru (Medical) [DLC]", "O_Heli_Transport_04_medevac_F",12500, "vehicle"], + ["Mi-290 Taru (Repair) [DLC]", "O_Heli_Transport_04_repair_F", 15000, "vehicle"], + + ["UH-80 Ghost Hawk (Black)", "B_Heli_Transport_01_F", 25000, "vehicle"], // UH-60 Stealth with 2 side miniguns + ["UH-80 Ghost Hawk (Green)", "B_Heli_Transport_01_camo_F", 25000, "vehicle"], // UH-60 Stealth with 2 side miniguns (green camo) + ["CH-67 Huron (Armed) [DLC]", "B_Heli_Transport_03_F", 30000, "vehicle"], // CH-47 with 2 side miniguns + ["AH-9 Pawnee", "B_Heli_Light_01_armed_F", 30000, "vehicle"], // Armed AH-6 + ["PO-30 Orca (Armed, Black)", "O_Heli_Light_02_v2_F", 35000, "vehicle"], // Armed Ka-60 with orca paintjob + ["PO-30 Orca (Armed, Hex)", "O_Heli_Light_02_F", 35000, "vehicle"], // Armed Ka-60 + ["WY-55 Hellcat (Armed)", "I_Heli_light_03_F", 40000, "vehicle"], // Armed AW159 + ["AH-99 Blackfoot", "B_Heli_Attack_01_F", 50000, "vehicle"], // RAH-66 with gunner + ["Mi-48 Kajman (Hex)", "O_Heli_Attack_02_F", 60000, "vehicle"], // Mi-28 with gunner + ["Mi-48 Kajman (Black)", "O_Heli_Attack_02_black_F", 60000, "vehicle"] // Mi-28 with gunner (black camo) +]; + +planesArray = compileFinal str +[ + ["A-143 Buzzard AA", "I_Plane_Fighter_03_AA_F", 40000, "vehicle"], + ["A-143 Buzzard CAS", "I_Plane_Fighter_03_CAS_F", 45000, "vehicle"], + ["A-164 Wipeout CAS", "B_Plane_CAS_01_F", 55000, "vehicle"], + ["To-199 Neophron CAS", "O_Plane_CAS_02_F", 55000, "vehicle"], + ["MQ4A Greyhawk ATGM UAV", "B_UAV_02_F", 25000, "vehicle"], + ["MQ4A Greyhawk Bomber UAV", "B_UAV_02_CAS_F", 20000, "vehicle"], // Bomber UAVs are a lot harder to use, hence why they are cheaper than ATGMs + ["K40 Ababil-3 ATGM UAV (CSAT)", "O_UAV_02_F", 25000, "vehicle"], + ["K40 Ababil-3 Bomber UAV (CSAT)", "O_UAV_02_CAS_F", 20000, "vehicle"], + ["K40 Ababil-3 ATGM UAV (AAF)", "I_UAV_02_F", 25000, "vehicle"], + ["K40 Ababil-3 Bomber UAV (AAF)", "I_UAV_02_CAS_F", 20000, "vehicle"] +]; + +boatsArray = compileFinal str +[ + ["Rescue Boat", "C_Rubberboat", 500, "boat"], + ["Rescue Boat (NATO)", "B_Lifeboat", 500, "boat"], + ["Rescue Boat (CSAT)", "O_Lifeboat", 500, "boat"], + ["Assault Boat (NATO)", "B_Boat_Transport_01_F", 600, "boat"], + ["Assault Boat (CSAT)", "O_Boat_Transport_01_F", 600, "boat"], + ["Assault Boat (AAF)", "I_Boat_Transport_01_F", 600, "boat"], + ["Assault Boat (FIA)", "B_G_Boat_Transport_01_F", 600, "boat"], + ["Motorboat", "C_Boat_Civil_01_F", 1000, "boat"], + //["Motorboat Rescue", "C_Boat_Civil_rescue_01_F", 900, "boat"], + //["Motorboat Police", "C_Boat_Civil_police_01_F", 1250, "boat"], + ["Speedboat HMG (CSAT)", "O_Boat_Armed_01_hmg_F", 4000, "boat"], + ["Speedboat Minigun (NATO)", "B_Boat_Armed_01_minigun_F", 4000, "boat"], + ["Speedboat Minigun (AAF)", "I_Boat_Armed_01_minigun_F", 4000, "boat"], + ["SDV Submarine (NATO)", "B_SDV_01_F", 1000, "submarine"], + ["SDV Submarine (CSAT)", "O_SDV_01_F", 1000, "submarine"], + ["SDV Submarine (AAF)", "I_SDV_01_F", 1000, "submarine"] +]; + +allVehStoreVehicles = compileFinal str (call landArray + call armoredArray + call tanksArray + call helicoptersArray + call planesArray + call boatsArray); + +uavArray = compileFinal str +[ + "UAV_02_base_F", + "UGV_01_base_F" +]; + +noColorVehicles = compileFinal str +[ + // Deprecated +]; + +rgbOnlyVehicles = compileFinal str +[ + // Deprecated +]; + +_color = "#(rgb,1,1,1)color"; +_texDir = "client\images\vehicleTextures\"; +_kartDir = "\A3\soft_f_kart\Kart_01\Data\"; +_mh9Dir = "\A3\air_f\Heli_Light_01\Data\"; +_mohawkDir = "\A3\air_f_beta\Heli_Transport_02\Data\"; +_taruDir = "\A3\air_f_heli\Heli_Transport_04\Data\"; + +colorsArray = compileFinal str +[ + [ // Main colors + "All", + [ + ["Black", _color + "(0.01,0.01,0.01,1)"], // #(argb,8,8,3)color(0.1,0.1,0.1,0.1) + ["Gray", _color + "(0.15,0.151,0.152,1)"], // #(argb,8,8,3)color(0.5,0.51,0.512,0.3) + ["White", _color + "(0.75,0.75,0.75,1)"], // #(argb,8,8,3)color(1,1,1,0.5) + ["Dark Blue", _color + "(0,0.05,0.15,1)"], // #(argb,8,8,3)color(0,0.3,0.6,0.05) + ["Blue", _color + "(0,0.03,0.5,1)"], // #(argb,8,8,3)color(0,0.2,1,0.75) + ["Teal", _color + "(0,0.3,0.3,1)"], // #(argb,8,8,3)color(0,1,1,0.15) + ["Green", _color + "(0,0.5,0,1)"], // #(argb,8,8,3)color(0,1,0,0.15) + ["Yellow", _color + "(0.5,0.4,0,1)"], // #(argb,8,8,3)color(1,0.8,0,0.4) + ["Orange", _color + "(0.4,0.09,0,1)"], // #(argb,8,8,3)color(1,0.5,0,0.4) + ["Red", _color + "(0.45,0.005,0,1)"], // #(argb,8,8,3)color(1,0.1,0,0.3) + ["Pink", _color + "(0.5,0.03,0.3,1)"], // #(argb,8,8,3)color(1,0.06,0.6,0.5) + ["Purple", _color + "(0.1,0,0.3,1)"], // #(argb,8,8,3)color(0.8,0,1,0.1) + ["NATO Tan", _texDir + "nato.paa"], // #(argb,8,8,3)color(0.584,0.565,0.515,0.3) + ["CSAT Brown", _texDir + "csat.paa"], // #(argb,8,8,3)color(0.624,0.512,0.368,0.3) + ["AAF Green", _texDir + "aaf.paa"], // #(argb,8,8,3)color(0.546,0.59,0.363,0.2) + ["Bloodshot", _texDir + "bloodshot.paa"], + ["Carbon", _texDir + "carbon.paa"], + ["Confederate", _texDir + "confederate.paa"], + //["Denim", _texDir + "denim.paa"], + ["Digital", _texDir + "digi.paa"], + ["Digital Black", _texDir + "digi_black.paa"], + ["Digital Desert", _texDir + "digi_desert.paa"], + ["Digital Woodland", _texDir + "digi_wood.paa"], + ["Doritos", _texDir + "doritos.paa"], + ["Drylands", _texDir + "drylands.paa"], + ["Hello Kitty", _texDir + "hellokitty.paa"], + ["Hex", _texDir + "hex.paa"], + ["Hippie", _texDir + "hippie.paa"], + ["ISIS", _texDir + "isis.paa"], + ["Leopard", _texDir + "leopard.paa"], + ["Mountain Dew", _texDir + "mtndew.paa"], + ["'Murica", _texDir + "murica.paa"], + ["Nazi", _texDir + "nazi.paa"], + ["Orange Camo", _texDir + "camo_orange.paa"], + ["Pink Camo", _texDir + "camo_pink.paa"], + ["Pride", _texDir + "pride.paa"], + //["Psych", _texDir + "psych.paa"], + ["Red Camo", _texDir + "camo_red.paa"], + ["Rusty", _texDir + "rusty.paa"], + ["Sand", _texDir + "sand.paa"], + ["Snake", _texDir + "snake.paa"], + ["Stripes", _texDir + "stripes.paa"], + ["Stripes 2", _texDir + "stripes2.paa"], + ["Stripes 3", _texDir + "stripes3.paa"], + ["Swamp", _texDir + "swamp.paa"], + ["Tiger", _texDir + "tiger.paa"], + //["Trippy", _texDir + "rainbow.paa"], + ["Union Jack", _texDir + "unionjack.paa"], + ["Urban", _texDir + "urban.paa"], + ["Weed", _texDir + "weed.paa"], + ["Woodland", _texDir + "woodland.paa"], + ["Woodland Dark", _texDir + "wooddark.paa"], + ["Woodland Tiger", _texDir + "woodtiger.paa"] + ] + ], + [ // Kart colors + "Kart_01_Base_F", + [ + ["Black (Kart)", [[0, _kartDir + "kart_01_base_black_co.paa"]]], + ["White (Kart)", [[0, _kartDir + "kart_01_base_white_co.paa"]]], + ["Blue (Kart)", [[0, _kartDir + "kart_01_base_blue_co.paa"]]], + ["Green (Kart)", [[0, _kartDir + "kart_01_base_green_co.paa"]]], + ["Yellow (Kart)", [[0, _kartDir + "kart_01_base_yellow_co.paa"]]], + ["Orange (Kart)", [[0, _kartDir + "kart_01_base_orange_co.paa"]]], + ["Red (Kart)", [[0, _kartDir + "kart_01_base_red_co.paa"]]] + ] + ], + [ // MH-9 colors + "Heli_Light_01_base_F", + [ + ["AAF Camo (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_indp_co.paa"]]], + ["Blue 'n White (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_blue_co.paa"]]], + ["Blueline (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_blueline_co.paa"]]], + ["Cream Gravy (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_co.paa"]]], + ["Digital (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_digital_co.paa"]]], + ["Elliptical (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_elliptical_co.paa"]]], + ["Furious (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_furious_co.paa"]]], + ["Graywatcher (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_graywatcher_co.paa"]]], + ["ION (MH-9)", [[0, _mh9Dir + "heli_light_01_ext_ion_co.paa"]]], + ["Jeans (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_jeans_co.paa"]]], + ["Light (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_light_co.paa"]]], + ["Shadow (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_shadow_co.paa"]]], + ["Sheriff (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_sheriff_co.paa"]]], + ["Speedy (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_speedy_co.paa"]]], + ["Sunset (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_sunset_co.paa"]]], + ["Vrana (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_vrana_co.paa"]]], + ["Wasp (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_wasp_co.paa"]]], + ["Wave (MH-9)", [[0, _mh9Dir + "Skins\heli_light_01_ext_wave_co.paa"]]] + ] + ], + [ // Mohawk colors + "Heli_Transport_02_base_F", + [ + ["Dahoman (Mohawk)", [ + [0, _mohawkDir + "Skins\heli_transport_02_1_dahoman_co.paa"], + [1, _mohawkDir + "Skins\heli_transport_02_2_dahoman_co.paa"], + [2, _mohawkDir + "Skins\heli_transport_02_3_dahoman_co.paa"] + ]], + ["ION (Mohawk)", [ + [0, _mohawkDir + "Skins\heli_transport_02_1_ion_co.paa"], + [1, _mohawkDir + "Skins\heli_transport_02_2_ion_co.paa"], + [2, _mohawkDir + "Skins\heli_transport_02_3_ion_co.paa"] + ]] + ] + ], + [ // Taru base colors + "Heli_Transport_04_base_F", + [ + ["Black (Taru)", [ + [0, _taruDir + "heli_transport_04_base_01_black_co.paa"], + [1, _taruDir + "heli_transport_04_base_02_black_co.paa"], + [2, _taruDir + "heli_transport_04_pod_ext01_black_co.paa"], + [3, _taruDir + "heli_transport_04_pod_ext02_black_co.paa"] + ]] + ] + ], + [ // Taru bench colors + "O_Heli_Transport_04_bench_F", + [ + ["Black (Taru)", [[2, _taruDir + "heli_transport_04_bench_black_co.paa"]]] + ] + ], + [ // Taru fuel colors + "O_Heli_Transport_04_fuel_F", + [ + ["Black (Taru)", [[2, _taruDir + "heli_transport_04_fuel_black_co.paa"]]] + ] + ] +]; + +//General Store Item List +//Display Name, Class Name, Description, Picture, Buy Price, Sell Price. +// ["Medical Kit", "medkits", localize "STR_WL_ShopDescriptions_MedKit", "client\icons\medkit.paa", 400, 200], // not needed since there are First Ait Kits +customPlayerItems = compileFinal str +[ + ["Water Bottle", "water", localize "STR_WL_ShopDescriptions_Water", "client\icons\waterbottle.paa", 30, 15], + ["Canned Food", "cannedfood", localize "STR_WL_ShopDescriptions_CanFood", "client\icons\cannedfood.paa", 30, 15], + ["Repair Kit", "repairkit", localize "STR_WL_ShopDescriptions_RepairKit", "client\icons\briefcase.paa", 500, 250], + ["Jerry Can (Full)", "jerrycanfull", localize "STR_WL_ShopDescriptions_fuelFull", "client\icons\jerrycan.paa", 150, 75], + ["Jerry Can (Empty)", "jerrycanempty", localize "STR_WL_ShopDescriptions_fuelEmpty", "client\icons\jerrycan.paa", 50, 25], + ["Syphon Hose", "syphonhose", localize "STR_WL_ShopDescriptions_SyphonHose", "client\icons\syphonhose.paa", 200, 100], + ["Camo Net", "camonet", localize "STR_WL_ShopDescriptions_Camo", "client\icons\camonet.paa", 500, 100], + ["Spawn Beacon", "spawnbeacon", localize "STR_WL_ShopDescriptions_spawnBeacon", "client\icons\spawnbeacon.paa", 1500, 750], + //["Energy Drink", "energydrink", localize "STR_WL_ShopDescriptions_Energy_Drink", "client\icons\energydrink.paa", 100, 50], + //["Warchest", "warchest", localize "STR_WL_ShopDescriptions_Warchest", "client\icons\warchest.paa", 1000, 500], + + ["LSD", "lsd", localize "STR_WL_ShopDescriptions_LSD", "client\icons\lsd.paa", 3500, 3000], + ["Marijuana", "marijuana", localize "STR_WL_ShopDescriptions_Marijuana", "client\icons\marijuana.paa", 3500, 3000], + ["Cocaine", "cocaine", localize "STR_WL_ShopDescriptions_Cocaine", "client\icons\cocaine.paa", 3500, 3000], + ["Heroin", "heroin", localize "STR_WL_ShopDescriptions_Heroin", "client\icons\heroin.paa", 3500, 3000], + + ["IP/Net Camera", "cctv_camera", localize "STR_WL_ShopDescriptions_CCTV_Camera", "addons\cctv\icons\camcorder.paa", 850, 500], + ["Camera Terminal", "cctv_base", localize "STR_WL_ShopDescriptions_CCTV_Base", "addons\cctv\icons\laptop.paa", 500, 300], + ["Boomerang Terminal", "boomerang_terminal", localize "STR_WL_ShopDescriptions_Boomerang_Terminal", "addons\boomerang\icons\terminal.paa", 850, 500], + ["Boomerang Station", "boomerang_station", localize "STR_WL_ShopDescriptions_Boomerang_Station", "addons\boomerang\icons\antenna.paa", 850, 500] + + +]; + +call compile preprocessFileLineNumbers "mapConfig\storeOwners.sqf"; + +storeConfigDone = compileFinal "true"; diff --git a/stringtable.xml b/stringtable.xml index f493ba697..4e957511b 100644 --- a/stringtable.xml +++ b/stringtable.xml @@ -22,10 +22,10 @@ - You have been punished for teamkilling twice during this server session. Your inventory has been wiped, and you are now locked to the Independent side. + You have been punished for teamkilling during this server session. Your inventory has been wiped, and you are now locked to the Independent side. - You are restricted to the Independent side, due to having done 2 or more teamkills during this server session. + You are restricted to the Independent side, due to a teamkill during this server session. You have played as %1 for too long and cannot switch to the other team. You can still play as Independent. (or if online, ask an admin to unlock you) @@ -33,7 +33,7 @@ - <t color='#FF8000' size='2.5' >A3Wasteland Altis v1.1b </t> + <t color='#FF8000' size='2.5' >A3Wasteland Altis v1.2 </t> <t color='#FFFFFF' size='1.5' >* You are in <img size="1.5" image="%1"/> <t color="%2">%3</t> team.<br/>* Attacking or stealing from other %4 players is <t color="#FF1111">FORBIDDEN</t><br/>* <t color="#FF1111">NO VOICE IN GLOBAL</t><br/>* You can find the Server Rules in the map menu.<br/>* Server restarts are done at the admin's discretion.<br/>* You will be locked to your team after 3 minutes.</t> @@ -90,6 +90,36 @@ A safe to store your team's money. + + This is a remote networked camera that transmits a video signal via Internet Protocol (IP). + + + This is a computer terminal that receives video signals from one or more remote networked cameras via Internet Protocol (IP). + + + This is a portable terminal for the Boomerang shot detection system. This terminal connects to any Boomerang base station installed in nearby vehicles. + + + This is the base station for the Boomerang shot detection system. You can install it in vehicles by clicking ""Use"" while inside the vehicle. All players inside the vehicle can use the Boomerang system without a portable terminal. + + + A synthetic crystalline compound, lysergic acid diethylamide, that is a potent hallucinogenic drug. + + + Often consumed for its psychoactive and physiological effects, which can include heightened mood or euphoria, relaxation, and an increase in appetite. + + + An addictive drug derived from coca or prepared synthetically, used as an illegal stimulant and sometimes medicinally as a local anesthetic. + + + A highly addictive analgesic drug derived from morphine, often used illicitly as a narcotic producing euphoria. + + + This is a remote networked camera that transmits a video signal via Internet Protocol (IP). + + + This is a computer terminal that receives video signals from one or more remote networked cameras via Internet Protocol (IP). + diff --git a/territory/server/monitorTerritories.sqf b/territory/server/monitorTerritories.sqf index 5a4a3d51c..7ec3b2902 100644 --- a/territory/server/monitorTerritories.sqf +++ b/territory/server/monitorTerritories.sqf @@ -624,5 +624,5 @@ while {true} do sleep BASE_SLEEP_INTERVAL; _realLoopTime = diag_tickTime - _initTime; - diag_log format["TERRITORY SYSTEM: _realLoopTime was %1", _realLoopTime]; + //diag_log format["TERRITORY SYSTEM: _realLoopTime was %1", _realLoopTime]; };