Introduced Virtual Garage

This commit is contained in:
Bjanski 2016-04-28 13:31:00 +02:00
parent 5f135e486c
commit 3c0739710d
37 changed files with 1267 additions and 5 deletions

View File

@ -0,0 +1 @@
exad_vg

View File

@ -0,0 +1,52 @@
/*
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_objVehNetId","_objVeh","_flagNetId","_flag","_objVehId","_flagId","_data","_extDB2Message","_vehList"];
_objId = [_this,0,"",[""]] call BIS_fnc_param;
_flagNetId = [_this,1,"",[""]] call BIS_fnc_param;
_playerNetId = [_this,2,"",[""]] call BIS_fnc_param;
_flag = objectFromNetId _flagNetId;
_requestFrom = owner (objectFromNetId _playerNetId);
_proceed = false;
_vehList = _flag getVariable ["ExAdVGVeh", []];
{
if((format["%1",_x select 0]) isEqualTo _objId)exitWith{
_vehList deleteAt _forEachIndex;
_proceed = true;
}
}forEach _vehList;
if(!_proceed)exitWith{[_requestFrom, "notificationRequest", ["Whoops", ["They vehicle is not available anymore"]]] call ExileServer_system_network_send_to};
_flag setVariable ["ExAdVGVeh", _vehList, true];
_vehObj = (parseNumber _objId) call ExileServer_object_vehicle_database_load;
_extDB2Message = ["loadVehFromVG", [parseNumber _objId]] call ExileServer_util_extDB2_createMessage;
_extDB2Message call ExileServer_system_database_query_fireAndForget;
if(ExAd_VG_SHOW_ADVHINT)then{
[["advancedHint", ["VGLoad",[_vehObj getVariable["ExileAccessCode",""]]]], _requestFrom] call ExAdServer_fnc_clientDispatch;
};
_pos = getPosATL _vehObj;
_pos set [2, (_pos select 2) + 0.1];
_vehObj setPosATL _pos;
true

View File

@ -0,0 +1,62 @@
/*
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_objVehNetId","_objVeh","_flagNetId","_flag","_owner","_objVehId","_flagId","_data","_extDB2Message","_vehList"];
_objVehNetId = [_this,0,"",[""]] call BIS_fnc_param;
_objVeh = objectFromNetId _objVehNetId;
_flagNetId = [_this,1,"",[""]] call BIS_fnc_param;
_flag = objectFromNetId _flagNetId;
_owner = owner _objVeh;
if!(_objVeh getVariable ["ExileIsPersistent", false])exitWith{(localize "STR_VG_STORE_NOTPERSISTENT") remoteExec ["hint", _owner]; false};
if!(_objVeh setOwner 2)exitWith{format["Get out of the vehicle before storing it."] remoteExec ["hint", _owner]; false};
if!(isNil "ExAd_VG_CLEAN_ON_STORE")then{
if(ExAd_VG_CLEAN_ON_STORE)then{
clearBackpackCargoGlobal _objVeh;
clearItemCargoGlobal _objVeh;
clearMagazineCargoGlobal _objVeh;
clearWeaponCargoGlobal _objVeh;
}
};
_objVeh call ExileServer_object_vehicle_database_update;
_objVehId = _objVeh getVariable ["ExileDatabaseID",-1];
_flagId = _flag getVariable ["ExileDatabaseID", -1];
if(_objVehId > -1 && _flagId > -1)then{
_data = [_flagId, _objVehId];
_extDB2Message = ["loadVehToVG", _data] call ExileServer_util_extDB2_createMessage;
_extDB2Message call ExileServer_system_database_query_fireAndForget;
_objVeh call ExileServer_system_vehicleSaveQueue_removeVehicle;
_objVeh call ExileServer_system_simulationMonitor_removeVehicle;
deleteVehicle _objVeh;
_vehList = _flag getVariable ["ExAdVGVeh", []];
_vehList pushBack [_objVehId, typeOf _objVeh];
_flag setVariable ["ExAdVGVeh", _vehList, true];
if(ExAd_VG_SHOW_ADVHINT)then{
[["advancedHint", ["VGStore",[]]], _owner] call EXOServer_fnc_clientDispatch;
};
};
true

View File

@ -0,0 +1,40 @@
/*
fn_requestVGDetailInfo.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_objVehNetId","_objVeh","_flagNetId","_flag","_objVehId","_flagId","_data","_extDB2Message","_vehList"];
_objId = [_this,0,"",[""]] call BIS_fnc_param;
_flagNetId = [_this,1,"",[""]] call BIS_fnc_param;
_streamFriendlyUI = [_this,2,0,[0]] call BIS_fnc_param;
_playerNetId = [_this,3,"",[""]] call BIS_fnc_param;
_ctrl = [_this,4,-1,[0]] call BIS_fnc_param;
_flag = objectFromNetId _flagNetId;
_requestFrom = owner (objectFromNetId _playerNetId);
/*Check if vehicle is in flag - avoid cheaters fishing for pin codes*/
_data = format ["loadVehicle:%1", _objId] call ExileServer_system_database_query_selectSingle;
_displayName = getText(ConfigFile >> "CfgVehicles" >> (_data select 1) >> "displayName");
_pinCode = if(_streamFriendlyUI == 0)then{_data select 20}else{"XXXX"};
_text = format["%1 <br/>Pin code: %2<br/>",_displayName, _pinCode];
[_text,_ctrl] remoteExec ["ExAd_fnc_loadVGDetailView", _requestFrom];
true

View File

@ -0,0 +1 @@
exad_vg

View File

@ -0,0 +1,51 @@
/*
config.cpp
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
class CfgPatches {
class ExAd_VG {
requiredVersion = 0.1;
requiredAddons[] = {"ExAd_Core"};
};
};
class CfgFunctions {
class ExAdServer {
class VG {
file = "exad_vg\Functions";
class requestVGDetailInfo {};
class VGLoad {};
class VGStore {};
};
};
};
class CfgNetworkMessages
{
class VGStore
{
parameters[] = {"STRING","STRING","STRING"};
};
class VGLoad
{
parameters[] = {"STRING","STRING","STRING"};
};
class requestVGDetailInfo
{
parameters[] = {"STRING","STRING","SCALAR","STRING","SCALAR"};
};
};

View File

@ -0,0 +1,29 @@
;1. Find [loadVehicleIdPage] and replace the section with this;
[loadVehicleIdPage]
;SQL1_1 = SELECT id FROM vehicle LIMIT ?,?
SQL1_1 = SELECT id FROM vehicle WHERE territory_id IS NULL LIMIT ?,?
Number Of Inputs = 2
SQL1_INPUTS = 1,2
OUTPUT = 1
;2. Add all below in the end of the file.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Virtual Garage related queries | ADDED BY [ExAd]Jan
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[loadTerritoryVehicles]
SQL1_1 = SELECT id, class FROM vehicle WHERE territory_id = ?
Number Of Inputs = 1
SQL1_INPUTS = 1
OUTPUT = 1,2-STRING
[loadVehFromVG]
SQL1_1 = UPDATE vehicle SET territory_id = NULL WHERE id = ?
Number Of Inputs = 1
SQL1_INPUTS = 1
[loadVehToVG]
SQL1_1 = UPDATE vehicle SET territory_id = ? WHERE id = ?
Number Of Inputs = 2
SQL1_INPUTS = 1,2

2
BattlEye/remoteexec.txt Normal file
View File

@ -0,0 +1,2 @@
//new
7 "" !="exadserver_fnc_clientrequest.*"

View File

@ -0,0 +1 @@
#Examples

View File

@ -0,0 +1,48 @@
# Installation
Remember for this plugin to work you first need to install
* [Core](https://github.com/Bjanski/ExAd/blob/Core/docs/core/installation.md)
* [XM8 Apps Improved](https://github.com/vitalymind/XM8_apps_improved)
## Client
* Place the folder "VirtualGarage" into "mpmissions\exile.<MAP>\ExAdClient\"
* Goto "mpmissions\exile.<MAP>\ExAd\CfgFunctions" and uncomment
_From_
```cpp
//#include "VirtualGarage\CfgFunctions.cpp"
```
_To_
```cpp
#include "VirtualGarage\CfgFunctions.cpp"
```
* Repeat last step for "CfgHints"
* In "config.cpp" in the mission root folder, find class CfgExileCustomCode and add the following row
```js
ExileServer_system_territory_database_load = "EXOClient\CustomCode\ExileServer_system_territory_database_load.sqf";
```
* In "config.cpp" you can also add the ("CfgInteractionMenus" >> "Flag" >> "VG") class if you want to be able to fast load the app through your flag pole.
* Now you can go into "mpmissions\exile.<MAP>\ExAdClient\VirtualGarage\customize.sqf" and change to desirable settings.
### XM8 App
* Copy over "XM8_apps\apps\XM8_VG"
* Add the app inside "XM8_apps\XM8_apps_config.sqf"
* Add "mainVGSlide" in "XM8_apps\XM8_apps\XM8_apps_sliders.hpp"
## Server
* Copy over and pack "@ExileServer\addons\exad_vg" into a pbo.
## Database
* Run the following sql command in you database.
```sql
ALTER TABLE `vehicle` ADD `territory_id` INT(11) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `vehicle` ADD CONSTRAINT `vehicle_ibfk_2` FOREIGN KEY (`territory_id`) REFERENCES `territory`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
```
* Copy over content from "@ExileServer\extDB\sql_custom_v2\exile.ini" - Follow the instructions in the file.

View File

@ -28,11 +28,18 @@ class CfgFunctions
#include "SOMEOTHER_ADDON\CfgFunctions.cpp"
};
```
* Copy over "Core" from "mpmissions\Exile.Altis\ExAd\Core"
* Copy over "Core" from "mpmissions\Exile.Altis\ExAdClient\"
* Copy over all files in "mpmissions\Exile.Altis\ExAdClient\"
These files includes the installation requirements for all other ExAd plugins
E.g in "mpmissions\Exile.Altis\ExAdClient\CfgFunctions.cpp" you can see that there are alot of lines commented out some of these need to be uncommented for plugins to work. Each plugin will describe more in detail which ones need to be adjusted.
## Server
* Navigate to "@ExileServer\addons\"
* Copy "exad_core"
* Pack exad_core into a .pbo file.
## BattlEye
I've put all plugins battleye exceptions in "BattlEye"
Check the files and append appropriate exceptions into your BattlEye files.

View File

@ -15,6 +15,8 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
//#include "VirtualGarage\CfgHints.cpp"
class ExAd
{
displayName = "ExAd Virtual Garage";
#include "VirtualGarage\CfgHints.cpp"
};

View File

@ -0,0 +1,28 @@
/*
CfgFunctions.cpp
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
class VirtualGarage
{
file = "ExAdClient\VirtualGarage\Functions";
class allowVGStore {};
class fillVGList {};
class loadVGDetailView {};
class onBtnClickVG {};
class postInit {file = "ExAdClient\VirtualGarage\postInit.sqf"; postInit = 1;};
};

View File

@ -0,0 +1,38 @@
/*
CfgHints.cpp
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
class VGStore
{
displayName = "Vehicle stored";
/*displayNameShort = "Your vehicle has been stored and is available through the Virtual Garage interface";*/
description = "Your vehicle has been stored and is only available through the territory it has been stored at. ";
image = "ExAdClient\Icons\logo.paa";
noImage = false;
tip = "";
arguments[] = {};
};
class VGLoad
{
displayName = "Vehicle loaded to world";
description = "%1Your vehicle has been loaded to the world, the pin code is %11";
image = "EXOClient\Icons\logo.paa";
noImage = false;
tip = "";
arguments[] = {"VGLoad select 0"};
parameters[] = {"STRING"};
};

View File

@ -0,0 +1,55 @@
/**
* ExileServer_system_territory_database_load
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_territoryID","_data","_id","_owner","_position","_radius","_level","_flagTexture","_flagStolen","_flagStolenBy","_flagStealMessage","_lastPayed","_buildRights","_moderators","_flagObject"];
_territoryID = _this;
_data = format ["loadTerritory:%1", _territoryID] call ExileServer_system_database_query_selectSingle;
_id = _data select 0;
_owner = _data select 1;
_name = _data select 2;
_position =
[
_data select 3,
_data select 4,
_data select 5
];
_radius = _data select 6;
_level = _data select 7;
_flagTexture = _data select 8;
_flagStolen = _data select 9;
_flagStolenBy = _data select 10;
_flagStealMessage = _data select 11;
_lastPayed = _data select 12;
_buildRights = _data select 13;
_moderators = _data select 14;
_flagObject = createVehicle ["Exile_Construction_Flag_Static",_position, [], 0, "CAN_COLLIDE"];
_flagObject setFlagTexture _flagTexture;
ExileLocations pushBack _flagObject;
_flagObject setVariable ["ExileTerritoryName", _name, true];
_flagObject setVariable ["ExileDatabaseID", _id];
_flagObject setVariable ["ExileOwnerUID", _owner, true];
_flagObject setVariable ["ExileTerritorySize", _radius, true];
_flagObject setVariable ["ExileTerritoryBuildRights", _buildRights, true];
_flagObject setVariable ["ExileTerritoryModerators", _moderators, true];
_flagObject setVariable ["ExileTerritoryLevel", _level, true];
_flagObject setVariable ["ExileTerritoryLastPayed", _lastPayed];
_flagObject call ExileServer_system_territory_maintenance_recalculateDueDate;
_flagObject setVariable ["ExileTerritoryNumberOfConstructions", _data select 15, true];
////////////////////////
///// ExAd START /////
////////////////////////
_vehicles = format ["loadTerritoryVehicles:%1", _territoryID] call ExileServer_system_database_query_selectFull;
_flagObject setVariable ["ExAdVGVeh", _vehicles, true];
////////////////////////
///// ExAd END /////
////////////////////////
true

View File

@ -0,0 +1,28 @@
/*
fn_allowVGStore.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_res","_flag"];
if(isNil "ExAdCurFlagNetId")exitWith{diag_log "ExAdClient: allowVGStore - ExAdCurFlagNetId is nil";false};
_flag = objectFromNetId ExAdCurFlagNetId;
_allowedVeh = ExAd_VG_MIN_ALLOWED_VEH + ExAd_VG_ALLOWED_VEH_MULTIPLE_FACTOR * (_flag getVariable ["ExileTerritoryLevel", 1]);
_storedVeh = count (_flag getVariable ["ExAdVGVeh", []]);
_res = if(_allowedVeh > _storedVeh)then{true}else{false};
_res

View File

@ -0,0 +1,36 @@
/*
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_list","_idc","_vehClass","_data","_name","_index","_pic"];
_list = _this select 0;
_idc = _this select 1;
{
_vehClass = if(typeName _x isEqualTo "ARRAY")then{_x select 1}else{typeOf _x};
_data = if(typeName _x isEqualTo "ARRAY")then{format["%1",_x select 0]}else{netId _x};
_name = getText(configFile >> "CfgVehicles" >> _vehClass >> "displayName");
_index = lbAdd[_idc,_name];
_pic = getText(configFile >> "CfgVehicles" >> _vehClass >> "picture");
lbSetPicture [_idc, _index, _pic];
lbSetPictureColor [_idc, _index, [1,1,1,1]];
lbSetData [_idc, _index, _data];
lbSetTooltip [_idc, _index, _vehClass];
}forEach _list;
true

View File

@ -0,0 +1,27 @@
/*
fn_loadVGDetailView.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
params ["_text","_idc"];
disableSerialization;
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
if(isNull _display)exitWith{false};
(_display displayCtrl _idc) ctrlSetStructuredText parseText _text;
true

View File

@ -0,0 +1,40 @@
/*
fn_onBtnClickVG.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_fnc","_idc","_data"];
_fnc = [_this,0,nil] call BIS_fnc_param;
_idc = [_this,1,nil] call BIS_fnc_param;
diag_log str _this;
if(isNil "ExAdCurFlagNetId" || isNil "_fnc" || isNil "_idc")exitWith{false};
_data = lbData [_idc, lbCurSel _idc];
diag_log str _data;
if(count _data == 0)then{
['Whoops', ["You have to choose a vehicle in the proper list!!"]] call ExileClient_gui_notification_event_addNotification;
}else{
[_fnc, [_data, ExAdCurFlagNetId, netId player]] call ExAd_fnc_serverDispatch;
closeDialog 0;
};
disableUserInput false;
true

View File

@ -0,0 +1,27 @@
/*
customize.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
ExAd_VG_MIN_ALLOWED_VEH = 5; //SCALAR - Minimun allowed vehicles in the virtual garage.
ExAd_VG_ALLOWED_VEH_MULTIPLE_FACTOR = 3;//SCALAR - How many extra vehicle slots for each territory level.
ExAd_VG_ACCESS_LEVEL = 1; //SCALAR - Lowest level that can access the Virtual Garage --> 1|2|3 -> Pleb|Moderator|Owner.
ExAd_VG_CLEAN_ON_STORE = true; //BOOLEAN - If vehicle inventory should reset when stored.
ExAd_VG_SHOW_ADVHINT = false //BOOLEAN - If the virtual garage should display an Advanced hint upon store and fetch.

View File

@ -0,0 +1,20 @@
/*
postInit.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
execVM "ExAdClient\VirtualGarage\customize.sqf";

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
/*
Improved XM8 apps by vitaly'mind'chizhikov
Official forum thread:
Original idea by Shix.
*/
XM8_apps_app1 = [
"ExAd Virtual Garage",
"XM8_apps\apps\XM8_VG\Icons\apps_icon.paa",
{call XM8_VG_checkNearByFlags},
TRUE,
"XM8_apps\apps\XM8_VG\scripts\XM8_VG_init.sqf"
];

View File

@ -0,0 +1,14 @@
class CfgXM8 {
//This slide use IDCs from 104140 to 104156
class sideApps {
controlID = 104140;
title = "XM8 Apps";
onLoadScript = "";
};
//This slide use IDCs from 352500 to
class mainVGSlide {
controlID = 352500;
title = "Virtual Garage";
onLoadScript = "XM8_apps\apps\XM8_VG\scripts\XM8_VG_mainVGSlide_onLoad.sqf";
};
};

View File

@ -0,0 +1,20 @@
/*
XM8 VG app by Jan Babor
file: XM8_emptyApp\XM8_emptyApp_config.sqf
function: no function
This is configuration file for VG app.
*/
XM8_VG_elChanged = {
params ["_listCtrl","_picCtrl","_strCtrl","_ref","_data","_pic"];
_ref = _listCtrl lbData (lbCurSel _listCtrl);
_data = {if(str (_x select 0) == _ref)exitWith{_x}}forEach ((objectFromNetId ExAdCurFlagNetId) getVariable["ExAdVGVeh",[]]);
_pic = getText(configFile >> "CfgVehicles" >> (_data select 1) >> "picture");
ctrlSetText [_picCtrl, _pic];
["requestVGDetailInfo", [_ref, ExAdCurFlagNetId, (profileNamespace getVariable["ExAd_StreamFriendlyUI",0]), netId player, _strCtrl]] call ExAd_fnc_serverDispatch;
};

View File

@ -0,0 +1,30 @@
/*
function: XM8_VG_checkNearByFlags
file: XM8_VG\scripts\XM8_VG_checkNearByFlags.sqf
XM8 VG By Jan Babor
Part of the ExAd Virtual Garage script
*/
private ["_flags","_flag"];
_flags = nearestObjects [player,["Exile_Construction_Flag_Static"],150];
if(count _flags == 0)exitWith{
["Whoops", ["No connetion to a Virtual Garage"]] call ExileClient_gui_notification_event_addNotification;
["sideApps", 1] call ExileClient_gui_xm8_slide
};
_flag = _flags select 0;
if((player distance _flag) > (_flag getVariable ["ExileTerritorySize", 50]))exitWith{
["Whoops", ["No connetion to a Virtual Garage"]] call ExileClient_gui_notification_event_addNotification;
["sideApps", 1] call ExileClient_gui_xm8_slide
};
if((([_flag, getPlayerUID player] call ExileClient_util_territory_getAccessLevel) select 0) >= ExAd_VG_ACCESS_LEVEL)then{
ExAdCurFlagNetId = netId _flag;
["mainVGSlide", 0] call ExileClient_gui_xm8_slide;
call XM8_VG_loadContent;
}
else
{
["Whoops", ["You aren't eligible to access this virtual garage!"]] call ExileClient_gui_notification_event_addNotification;
}

View File

@ -0,0 +1,27 @@
/*
XM8 VG app by Jan Babor
file: XM8_VG\scripts\XM8_VG_init.sqf
This script will be executed once, when player login. It is executed straight from initLocalPlayer.sqf.
This is best place to compile functions, define global variables and read gonfiguration files used in app.
*/
params ["_pathToAppFolder"];
XM8_VG_mainVGSlideIDCmap = [];
{
if (isNil _x) then {
private ["_code"];
_code = compileFinal (preprocessFileLineNumbers (format (["%1scripts\%2.sqf",_pathToAppFolder,_x])));
if (isNil "_code") then {_code = compileFinal ""};
missionNamespace setVariable [_x, _code];
};
} forEach [
"XM8_VG_mainVGSlide_onLoad",
"XM8_VG_checkNearByFlags",
"XM8_VG_loadContent"
];
call compile preProcessFileLineNumbers format ["%1XM8_VG_config.sqf",_pathToAppFolder];

View File

@ -0,0 +1,43 @@
/*
function: XM8_VG_loadContent
file: XM8_VG\scripts\XM8_VG_loadContent.sqf
XM8 VG by Jan Babor
Part of the ExAd Virtual Garage script
*/
private ["_display","_error","_slides","_getControl","_flag","_allowedVeh","_storedVeh","_strTxtVehCntColor","_strTxtVehCnt"];
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
if (isNull _display) exitWith {_error = "Error loading XM8 VG app, display is null"; systemChat _error; diag_log _error;};
_slides = _display displayCtrl 4007;
if (isNull _slides) exitWith {_error = "Error loading XM8 VG app, slides control is null"; systemChat _error; diag_log _error;};
_getControl = {
params ["_key"];
private ["_ctrl","_idc","_index","_slideClassName"];
_ctrl = controlNull;
_slideClassName = "mainVGSlide"; //Classname of your slide
_map = XM8_VG_mainVGSlideIDCmap; //Variable name of IDC map of slide
_index = _map find _key;
if (_index != -1) then {
_idc = ((getNumber (missionConfigFile >> "CfgXM8" >> _slideClassName >> "controlID")) + _index);
_ctrl = _display displayCtrl _idc;
};
_ctrl;
};
_flag = if(typeName ExAdCurFlagNetId == "STRING")then{objectFromNetId ExAdCurFlagNetId}else{ExAdCurFlagNetId};
_allowedVeh = ExAd_VG_MIN_ALLOWED_VEH + ExAd_VG_ALLOWED_VEH_MULTIPLE_FACTOR * (_flag getVariable ["ExileTerritoryLevel", 1]);
_storedVeh = count (_flag getVariable ["ExAdVGVeh", []]);
_strTxtVehCntColor = if(_allowedVeh > _storedVeh)then{"#FFFFFF"}else{"#B22400"};
_strTxtVehCnt = "SubTitle1Cnt" call _getControl;
_strTxtVehCnt ctrlSetStructuredText parseText format ["<t size='1' align='right' color='%1'>%2/%3</t>",_strTxtVehCntColor,_storedVeh,_allowedVeh];
[(objectFromNetId ExAdCurFlagNetId) getVariable ["ExAdVGVeh", []],ctrlIDC ("StoreVehList" call _getControl)] call ExAd_fnc_fillVGList;
[[_flag, ["Car","Air"],_flag getVariable ["ExileTerritorySize", 50]] call ExAd_fnc_getNearByLocalVeh,ctrlIDC ("NearVehicleList" call _getControl)] call ExAd_fnc_fillVGList;
("InfoCB" call _getControl) cbSetChecked ((profileNamespace getVariable["ExAd_StreamFriendlyUI",0]) == 1);

View File

@ -0,0 +1,154 @@
/*
XM8 VG app by Jan Babor
Virtual Garage app that works with the ExAd Virtual Garage plugin.
file: XM8_emptyApp\scripts\XM8_VG_mainVGSlide_onLoad.sqf
function: XM8_VG_mainVGSlide_onLoad
*/
private ["_makeButton","_makeBackground","_makeStructuredText","_makePicture","_makeList","_getNextIDC","_pW","_pH","_display","_slides","_unloadScript","_error","_thisSlide"];
_makeButton = {
params ["_parent","_idc","_position","_action","_text","_tooltip"];
private ["_ctrl"];
_ctrl = _display ctrlCreate ["RscButtonMenu",_idc,_parent];
_ctrl ctrlSetPosition _position;
_ctrl ctrlSetText _text;
_ctrl ctrlSetEventHandler ["ButtonClick",_action];
_ctrl ctrlSetTooltip _tooltip;
_ctrl ctrlCommit 0;
_ctrl;
};
_makeBackgroundGUI = {
params ["_parent","_idc","_position"];
private ["_ctrl"];
_ctrl = _display ctrlCreate ["RscBackgroundGUI", _idc, _parent];
_ctrl ctrlSetPosition _position;
_ctrl ctrlCommit 0;
_ctrl ctrlSetBackgroundColor [0,0,0,0.5];
_ctrl;
};
_makeFrame = {
params ["_parent","_idc","_position"];
private ["_ctrl"];
_ctrl = _display ctrlCreate ["RscFrame", _idc, _parent];
_ctrl ctrlSetPosition _position;
_ctrl ctrlEnable false;
_ctrl ctrlCommit 0;
_ctrl;
};
_makeStructuredText = {
params ["_parent","_idc","_position","_text","_font","_size","_color","_align","_shadow"];
private ["_ctrl"];
_ctrl = _display ctrlCreate ["RscStructuredText", _idc, _parent];
_ctrl ctrlSetPosition _position;
_ctrl ctrlSetStructuredText (parseText format ["<t shadow='%6' font='%5' align='%4' size='%2' color='%3'>%1</t>", _text,_size,_color, _align,_font,_shadow]);
_ctrl ctrlEnable false;
_ctrl ctrlCommit 0;
_ctrl;
};
_makePicture = {
params ["_parent","_idc","_position","_picture","_color","_enable","_keepAspect","_tooltip"];
private ["_ctrl"];
_ctrl = _display ctrlCreate [(if (_keepAspect) then {"RscPictureKeepAspect"} else {"RscPicture"}), _idc, _parent];
_ctrl ctrlSetPosition _position;
_ctrl ctrlSetText _picture;
_ctrl ctrlSetTextColor _color;
_ctrl ctrlEnable _enable;
_ctrl ctrlSetTooltip _tooltip;
_ctrl ctrlCommit 0;
_ctrl;
};
_makeList = {
params ["_parent","_idc","_position","_actionOnSelChanged","_tooltip"];
private ["_ctrl"];
_ctrl = _display ctrlCreate ["RscListBox",_idc,_parent];
_ctrl ctrlSetPosition _position;
_ctrl ctrlSetEventHandler ["LBSelChanged",_actionOnSelChanged];
_ctrl ctrlSetTooltip _tooltip;
_ctrl ctrlCommit 0;
_ctrl;
};
_makeCheckBox = {
params ["_parent","_idc","_position","_actionOnSelChanged","_tooltip"];
private ["_ctrl"];
_ctrl = _display ctrlCreate ["RscCheckBox",_idc,_parent];
_ctrl ctrlSetPosition _position;
_ctrl ctrlSetEventHandler ["CheckedChanged",_actionOnSelChanged];
_ctrl ctrlSetTooltip _tooltip;
_ctrl ctrlCommit 0;
_ctrl;
};
_getNextIDC = {
params ["_key"];
private ["_slideClassName","_baseIDC","_result","_map"];
_slideClassName = "mainVGSlide";
_map = XM8_VG_mainVGSlideIDCmap;
_baseIDC = getNumber (missionConfigFile >> "CfgXM8" >> _slideClassName >> "controlID");
_result = _baseIDC + (_map pushBack _key);
_result;
};
_pW = 0.025;
_pH = 0.04;
_leftCol = 1;
_leftColW = 12.8;
_rightCol = _leftCol + _leftColW + 2;
_rightColW = _leftColW + 3;
_margin = 0.2;
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
if (isNull _display) exitWith {_error = "Error loading XM8 VG app, display is null"; systemChat _error; diag_log _error;};
_slides = _display displayCtrl 4007;
if (isNull _slides) exitWith {_error = "Error loading XM8 VG app, slides control is null"; systemChat _error; diag_log _error;};
_unloadScript = '
ExAd_Cur_Flag_NetId = nil;
';
_display displayAddEventHandler ["unload",_unloadScript];
XM8_VG_mainVGSlideIDCmap = [];
_thisSlide = _display ctrlCreate ["RscExileXM8Slide",("mainVGSlide" call _getNextIDC),_slides];
[_thisSlide,("backButton" call _getNextIDC),[27.6 * _pW, 17.7 * _pH, 6 * _pW, 1 * _pH],'["sideApps", 1] call ExileClient_gui_xm8_slide;',"GO BACK",""] call _makeButton;
/*Stored Vehicle Details*/
[_thisSlide,("InfoTitle" call _getNextIDC),[_rightCol * _pW, 2.75 * _pH, _rightColW * _pW, 1 * _pH],"Stored Vehicle Detail","PuristaMedium",1.2,"#ffffff","left",1] call _makeStructuredText;
[_thisSlide,("InfoBgBox" call _getNextIDC),[_rightCol * _pW, 4 * _pH, _rightColW * _pW, 13.5 * _pH]] call _makeBackgroundGUI;
_idcInfoPic = "InfoPic" call _getNextIDC;
[_thisSlide,_idcInfoPic,[(_rightCol + 9) * _pW, 4 * _pH, 6.75 * _pW, 5.5 * _pH],"",[1,1,1,1],false,true,""] call _makePicture;
_idcInfoStr = "InfoVehStr" call _getNextIDC;
[_thisSlide,_idcInfoStr,[(_rightCol + _margin) * _pW, (4 + _margin) * _pH, (_rightColW - 2 * _margin) * _pW, (13.5 - 2 * _margin) * _pH],"","PuristaMedium",0.75,"#ffffff","left",1] call _makeStructuredText;
[_thisSlide,("InfoCBStr" call _getNextIDC),[(_rightCol + _margin + 0.4) * _pW, (16.5 - _margin + 0.25 ) * _pH, (_rightColW - 2 * _margin) * _pW, (13.5 - 2 * _margin) * _pH],"Stream friendly UI","PuristaMedium",0.65,"#ffffff","left",1] call _makeStructuredText;
[_thisSlide,("InfoCB" call _getNextIDC),[(_rightCol + _margin) * _pW, (16.5 - _margin + 0.2) * _pH, 0.75 * _pW, 0.75 * _pH],'profileNamespace setVariable["ExAd_StreamFriendlyUI",_this select 1]',"Toogle - Stream friendly UI"] call _makeCheckBox;
/*Stored Vehicles*/
[_thisSlide,("SubTitle1" call _getNextIDC),[_leftCol * _pW, 2.75 * _pH, _leftColW * _pW, 1 * _pH],"Stored","PuristaMedium",1.2,"#ffffff","left",1] call _makeStructuredText;
[_thisSlide,("SubTitle1Cnt" call _getNextIDC),[_leftCol * _pW, 3 * _pH, _leftColW * _pW, 1 * _pH],"","PuristaMedium",1,"#ffffff","right",1] call _makeStructuredText;
_idcStoredVehList = "StoreVehList" call _getNextIDC;
[_thisSlide,_idcStoredVehList,[_leftCol * _pW, 4 * _pH, _leftColW * _pW, 5 * _pH],format["[_this select 0,%1,%2] call XM8_VG_elChanged",_idcInfoPic,_idcInfoStr],""] call _makeList;
[_thisSlide,("fetchButton" call _getNextIDC),[_leftCol*_pW, 9*_pH, _leftColW*_pW, 1*_pH],format["disableUserInput true;['VGLoad', %1] call ExAd_fnc_onBtnClickVG",_idcStoredVehList],"Fetch",""] call _makeButton;
/*Nearby vehicles*/
[_thisSlide,("SubTitle2" call _getNextIDC),[_leftCol * _pW, 10.25 * _pH, _leftColW * _pW, 1 * _pH],"In Radius","PuristaMedium",1.2,"#ffffff","left",1] call _makeStructuredText;
_idcNearVehList = "NearVehicleList" call _getNextIDC;
[_thisSlide,_idcNearVehList,[_leftCol * _pW, 11.5 * _pH, _leftColW * _pW, 5 * _pH],"",""] call _makeList;
[_thisSlide,("storeButton" call _getNextIDC),[_leftCol * _pW, 16.5 * _pH, _leftColW * _pW, 1 * _pH],format["if(call ExAd_fnc_allowVGStore)then{disableUserInput true;['VGStore', %1] call ExAd_fnc_onBtnClickVG}else{['Whoops', ['%2']] call ExileClient_gui_notification_event_addNotification}",_idcNearVehList,localize "STR_ExAd_VIRTUALGARAGE_NOTI_FULL"],"Store",""] call _makeButton;

View File

@ -0,0 +1,175 @@
/**
* ExileClient_gui_xm8_show
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
/*
XM8 apps Imporeved by vitaly'mind'chizhikov
Based on idea XM8 apps by Shix. see http://www.exilemod.com/topic/9040-xm8-apps/?page=1
Original function from Exile 0.9.6
*/
private["_display","_control","_slideControlID","_slideName","_slideTitle","_slideControl","_titleControl","_toSlideOpenFunction","_hideSideApps"];
disableSerialization;
createDialog "RscExileXM8";
ExileClientXM8IsVisible = true;
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
if (ExileClientXM8IsPowerOn) then {
_control = _display displayCtrl 4002;
_control ctrlSetFade 1;
_control ctrlCommit 0;
} else {
{
_control = _display displayCtrl _x;
_control ctrlSetFade 1;
_control ctrlCommit 0;
} forEach [4002,4003,4004,4005,4007,4001,4010,4030,4020];
};
true call ExileClient_gui_postProcessing_toggleDialogBackgroundBlur;
if (ExileClientXM8CurrentSlide isEqualTo "party") then {
if (ExileClientPartyID isEqualTo -1) then {
ExileClientXM8CurrentSlide = "apps";
};
};
private ["_sliders","_appSlide","_newTerritoryBut","_newTerritoryPic","_sideAppsBut","_sideAppsPic","_newSliderIDC","_newSlider","_buttonBack",
"_makeButtonCtrl","_pW","_pH"];
_pW = 0.025;
_pH = 0.04;
_sliders = _display displayCtrl 4007;
_appSlide = _sliders controlsGroupCtrl 4040;
//Lets create XM8_apps slide manually, as we are unable to change RscExileXM8 directly in config.
_newSliderIDC = getNumber (missionConfigFile >> "CfgXM8" >> "sideApps" >> "controlID");
_newSlider = _display ctrlCreate ["RscExileXM8Slide", _newSliderIDC, _sliders];
//Lets fill our slider with contents. First lets make go back button
_buttonBack = _display ctrlCreate ["RscButtonMenu",_newSliderIDC + 1,_newSlider];
_buttonBack ctrlSetPosition [27.6*_pW,17.7*_pH,6*_pW,1*_pH];
_buttonBack ctrlSetText "GO BACK";
_buttonBack ctrlSetEventHandler ["ButtonClick","['apps', 1] call ExileClient_gui_xm8_slide"];
_buttonBack ctrlCommit 0;
//We hide sideApps in order to be compatible with legacy apps.
_hideSideApps = '
disableSerialization;
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
_sliders = _display displayCtrl 4007;
_sideAppsIDC = getNumber (missionConfigFile >> "CfgXM8" >> "sideApps" >> "controlID");
_appSlide = _display displayCtrl _sideAppsIDC;
_appSlide ctrlShow false;
_appSlide ctrlCommit 0;
';
//We make app buttons with this function
_makeButtonCtrl = {
params ["_idc","_pos","_text","_script","_parent","_pic","_compatible"];
private ["_ctrl"];
_ctrl = _display ctrlCreate ["RscExileXM8AppButton1x1",_idc,_parent];
_ctrl ctrlSetPosition [_pos select 0,_pos select 1,6 * _pW, 4.8 * _pH];
_ctrl ctrlSetText _text;
if (!_compatible) then {
_ctrl ctrlSetEventHandler ["ButtonClick",_hideSideApps];
} else {
_ctrl ctrlSetEventHandler ["ButtonClick",""];
};
_ctrl ctrlAddEventHandler ["ButtonClick",format ["call %1",_script]];
_ctrl ctrlCommit 0;
_ctrl = _display ctrlCreate ["RscPictureKeepAspect",-1,_parent];
_ctrl ctrlSetText _pic;
_ctrl ctrlSetPosition [_pos select 0,(_pos select 1) + 0.01,6 * _pW, 2.8 * _pH];
_ctrl ctrlEnable false;
_ctrl ctrlCommit 0;
};
//Lets try to create 15 buttons, if some buttons in XM8_apps_config are commented, they will be scipped
for "_i" from 1 to 15 do {
private ["_pos", "_data"];
if (!isNil (format ["XM8_apps_app%1", _i])) then {
_data = call compile format ["XM8_apps_app%1", _i];
_pos = [0,0];
if (_i in [1,2,3,4,5]) then {
_pos set [0, (0.4 + ((_i-1) * 6.8)) * _pW];
_pos set [1, 2 * _pH];
};
if (_i in [6,7,8,9,10]) then {
_pos set [0, (0.4 + (((_i-1) - 5) * 6.8)) * _pW];
_pos set [1, 7.2 * _pH];
};
if (_i in [11,12,13,14,15]) then {
_pos set [0, (0.4 + (((_i-1) - 10) * 6.8)) * _pW];
_pos set [1, 12.4 * _pH];
};
[(_newSliderIDC + 1 + _i) ,_pos,(_data select 0),str(_data select 2),_newSlider,(_data select 1),(_data select 3)] call _makeButtonCtrl;
};
};
/*
We need some space to put XM8_apps button, for that lets cut territory button in half.
In fact we cant re-possition button as it will render picture (textureNoShortcut) incorrectly.
So lets make new 'territory' button, smaller then original one.
We will hide old button in ExileClient_gui_xm8_slide_apps_onOpen and ExileClient_gui_xm8_slide
*/
_newTerritoryBut = _display ctrlCreate ["RscExileXM8AppButton1x1",(_newSliderIDC + 15),_appSlide];
_newTerritoryBut ctrlSetPosition [(23.5 - 3) * _pW,(9.5 - 2) * _pH,6 * _pW, 5 * _pH];
_newTerritoryBut ctrlSetText getText (configFile >> "CfgXM8" >> "territory" >> "title");
_newTerritoryBut ctrlSetEventHandler ["ButtonClick","['territory', 0] call ExileClient_gui_xm8_slide"];
_newTerritoryBut ctrlCommit 0;
_newTerritoryPic = _display ctrlCreate ["RscPictureKeepAspect",(_newSliderIDC + 17),_appSlide];
_newTerritoryPic ctrlSetText "\exile_assets\texture\ui\xm8_app_territory_ca.paa";
_newTerritoryPic ctrlSetPosition [(25 - 3) * _pW,(10 - 2) * _pH,(6 * _pW) * 0.5, (5 * _pH) * 0.5];
_newTerritoryPic ctrlEnable false;
_newTerritoryPic ctrlCommit 0;
//Now lets make New button for XM8_apps inside app slider.
_sideAppsBut = _display ctrlCreate ["RscExileXM8AppButton1x1",(_newSliderIDC + 16),_appSlide];
_sideAppsBut ctrlSetPosition [(30 - 3) * _pW,(9.5 - 2) * _pH,6 * _pW, 5 * _pH];
_sideAppsBut ctrlSetText getText (missionConfigFile >> "CfgXM8" >> "sideApps" >> "title");
_sideAppsBut ctrlSetEventHandler ["ButtonClick","['sideApps', 0] call ExileClient_gui_xm8_slide"];
_sideAppsBut ctrlCommit 0;
_sideAppsPic = _display ctrlCreate ["RscPictureKeepAspect",(_newSliderIDC + 18),_appSlide];
_sideAppsPic ctrlSetText format ["%1%2",XM8_apps_folderPath, "XM8_apps\icons\apps_icon.paa"];
_sideAppsPic ctrlSetPosition [(31.5 - 3) * _pW,(10 - 2) * _pH,(6 * _pW) * 0.5, (5 * _pH) * 0.5];
_sideAppsPic ctrlEnable false;
_sideAppsPic ctrlCommit 0;
{
//We dont have configured slides, thus we create it via scripting. We do that by executing slide creating scripts.
_slideOnLoadScript = getText (_x >> "onLoadScript");
if (!isNil "_slideOnLoadScript") then {
call compile preprocessFileLineNumbers _slideOnLoadScript;
};
_slideControlID = getNumber (_x >> "controlID");
_slideName = configName _x;
_slideTitle = getText (_x >> "title");
_slideControl = _display displayCtrl _slideControlID;
if (_slideName isEqualTo ExileClientXM8CurrentSlide) then {
_titleControl = _display displayCtrl 4004;
_titleControl ctrlSetStructuredText (parseText (format ["<t align='center' font='RobotoMedium'>%1</t>", _slideTitle]));
_slideControl ctrlSetPosition [(0 * 0.05), (0 * 0.05)];
_slideControl ctrlCommit 0;
_slideControl ctrlShow true;
_toSlideOpenFunction = missionNamespace getVariable [format ["ExileClient_gui_xm8_slide_%1_onOpen", _slideName], ""];
if !(_toSlideOpenFunction isEqualTo "") then
{
call _toSlideOpenFunction;
};
} else {
_slideControl ctrlShow false;
};
} forEach (("true" configClasses (configFile >> "CfgXM8")) + ("true" configClasses (missionConfigFile >> "CfgXM8")));
/*
Lets read missionConfigFile as well, as we may have custom slides added.
forEach ("true" configClasses (configFile >> "CfgXM8")); //Original line
*/
ExileXM8ThreadHandle = [10, ExileClient_gui_xm8_thread_update, [], true] call ExileClient_system_thread_addtask;
call ExileClient_gui_xm8_thread_update;

View File

@ -0,0 +1,87 @@
/**
* ExileClient_gui_xm8_slide
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
// XM8 apps Imporeved by vitaly'mind'chizhikov
// Based on idea XM8 apps by Shix. see http://www.exilemod.com/topic/9040-xm8-apps/?page=1
// Original function from Exile 0.9.6
private["_try","_toSlideName","_direction","_display","_toSlideControlID","_toSlideControl","_toSlideTitle","_titleControl","_toSlideOpenFunction","_fromSlideControlID","_fromSlideControl","_fromSlideCloseFunction"];
disableSerialization;
_toSlideName = _this select 0;
_direction = _this select 1;
_display = displayNull;
if !(ExileClientXM8CurrentSlide isEqualTo _toSlideName) then
{
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
_toSlideControlID = getNumber (configFile >> "CfgXM8" >> _toSlideName >> "controlID");
//Lets try read MissionConfig, maybe we have custom slide
_try = (missionConfigFile >> "CfgXM8" >> _toSlideName >> "controlID") call BIS_fnc_getCfgData;
if (!isNil "_try") then {_toSlideControlID = _try};
_toSlideControl = _display displayCtrl _toSlideControlID;
_toSlideTitle = getText (configFile >> "CfgXM8" >> _toSlideName >> "title");
//Lets try read MissionConfig, maybe we have custom slide
_try = (missionConfigFile >> "CfgXM8" >> _toSlideName >> "title") call BIS_fnc_getCfgData;
if (!isNil "_try") then {_toSlideTitle = _try};
_titleControl = _display displayCtrl 4004;
_titleControl ctrlSetStructuredText (parseText (format ["<t align='center' font='RobotoMedium'>%1</t>", _toSlideTitle]));
_toSlideOpenFunction = missionNamespace getVariable [format ["ExileClient_gui_xm8_slide_%1_onOpen", _toSlideName], ""];
if !(_toSlideOpenFunction isEqualTo "") then
{
call _toSlideOpenFunction;
};
_fromSlideControlID = getNumber (configFile >> "CfgXM8" >> ExileClientXM8CurrentSlide >> "controlID");
//Lets try read MissionConfig, maybe we have custom slide
_try = (missionConfigFile >> "CfgXM8" >> ExileClientXM8CurrentSlide >> "controlID") call BIS_fnc_getCfgData;
if (!isNil "_try") then {_fromSlideControlID = _try};
_fromSlideControl = _display displayCtrl _fromSlideControlID;
_fromSlideCloseFunction = missionNamespace getVariable [format ["ExileClient_gui_xm8_slide_%1_onClose", ExileClientXM8CurrentSlide], ""];
if !(_fromSlideCloseFunction isEqualTo "") then
{
call _fromSlideCloseFunction;
};
if (_direction isEqualTo 0) then
{
_toSlideControl ctrlSetPosition [(19 * 0.05), (0 * 0.05)];
_toSlideControl ctrlShow true;
_toSlideControl ctrlCommit 0;
_toSlideControl ctrlSetPosition [(0 * 0.05), (0 * 0.05)];
_toSlideControl ctrlCommit 0.25;
_fromSlideControl ctrlSetPosition [(-19 * 0.05), (0 * 0.05)];
_fromSlideControl ctrlCommit 0.25;
}
else
{
_toSlideControl ctrlSetPosition [(-19 * 0.05), (0 * 0.05)];
_toSlideControl ctrlShow true;
_toSlideControl ctrlCommit 0;
_toSlideControl ctrlSetPosition [(0 * 0.05), (0 * 0.05)];
_toSlideControl ctrlCommit 0.25;
_fromSlideControl ctrlSetPosition [(19 * 0.05), (0 * 0.05)];
_fromSlideControl ctrlCommit 0.25;
};
ExileClientXM8CurrentSlide = _toSlideName;
};
//Lets hide old territory button, as we already made new one early on in ExileClient_gui_xm8_show.
//Why we make new? Because if button is re-possition it will render picture (textureNoShortcut) incorrectly.
private ["_sliders","_appSlide","_oldTerritoryBut"];
_sliders = _display displayCtrl 4007;
_appSlide = _sliders controlsGroupCtrl 4040;
_oldTerritoryBut = _appSlide controlsGroupCtrl 1113;
_oldTerritoryBut ctrlShow false;
_oldTerritoryBut ctrlSetFade 0;
_oldTerritoryBut ctrlCommit 0;

View File

@ -0,0 +1,47 @@
/**
* ExileClient_gui_xm8_slide_apps_onOpen
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
// XM8 apps Imporeved by vitaly'mind'chizhikov
// Based on idea XM8 apps by Shix. see http://www.exilemod.com/topic/9040-xm8-apps/?page=1
// Original function from Exile 0.9.6
private["_display","_health","_popTabsValue","_popTabs","_respectValue","_respect"];
disableSerialization;
_display = uiNameSpace getVariable ["RscExileXM8", displayNull];
_health = _display displayCtrl 4057;
_health ctrlSetStructuredText parseText (format ["<t color='#00b2cd' font='OrbitronLight' size='1.6' valign='middle' align='center' shadow='0'><br/><br/><br/><t font='OrbitronMedium' size='3.5' color='#ffffff'>%1%2</t><br/>HEALTH</t>", round ((1 - damage player) * 100), "%"]);
_popTabsValue = ExileClientPlayerMoney;
if (_popTabsValue > 999) then
{
_popTabsValue = format ["%1k", floor (_popTabsValue / 1000)];
};
_popTabs = _display displayCtrl 4058;
_popTabs ctrlSetTooltip format["%1", ExileClientPlayerMoney];
_popTabs ctrlSetStructuredText parseText (format ["<t color='#00b2cd' font='OrbitronLight' size='1.6' valign='middle' align='center' shadow='0'><br/><br/><br/><t font='OrbitronMedium' size='3.5' color='#ffffff'>%1</t><br/>POP TABS</t>", _popTabsValue]);
_respectValue = ExileClientPlayerScore;
if (_respectValue > 999) then
{
_respectValue = format ["%1k", floor (_respectValue / 1000)];
};
_respect = _display displayCtrl 4059;
_respect ctrlSetTooltip format["%1", ExileClientPlayerScore];
_respect ctrlSetStructuredText parseText (format ["<t color='#00b2cd' font='OrbitronLight' size='1.6' valign='middle' align='center' shadow='0'><br/><br/><br/><t font='OrbitronMedium' size='3.5' color='#ffffff'>%1</t><br/>RESPECT</t>", _respectValue]);
//Lets hide old territory button, as we already made new one early on in ExileClient_gui_xm8_show.
//Why we make new? Because if button is re-possition it will render picture (textureNoShortcut) incorrectly.
private ["_sliders","_appSlide","_oldTerritoryBut"];
_sliders = _display displayCtrl 4007;
_appSlide = _sliders controlsGroupCtrl 4040;
_oldTerritoryBut = _appSlide controlsGroupCtrl 1113;
_oldTerritoryBut ctrlShow false;
_oldTerritoryBut ctrlSetFade 0;
_oldTerritoryBut ctrlCommit 0;

View File

@ -0,0 +1,28 @@
/*
Improved XM8 apps by vitaly'mind'chizhikov
Original idea by Shix.
*/
params ["_pathToFolder"];
//Setting path to app
XM8_apps_folderPath = _pathToFolder;
//Apply config
call compile preprocessFileLineNumbers format ["%1XM8_apps\XM8_apps_config.sqf",_pathToFolder];
//Run init scripts for those apps that made for Improved XM8 apps (not legacy apps)
for "_i" from 1 to 15 do {
private ["_pos", "_data"];
if (!isNil (format ["XM8_apps_app%1", _i])) then {
_data = call compile format ["XM8_apps_app%1", _i];
if (_data select 3) then {
_arr = (_data select 4) splitString "\";
_arr resize ((count _arr) - 2);
((_arr joinString "\") + "\") call compile preprocessFileLineNumbers (_data select 4);
} else {
};
};
};

View File

@ -0,0 +1,22 @@
class CfgExileCustomCode
{
ExileServer_system_territory_database_load = "ExAdClient\VirtualGarage\CustomCode\ExileServer_system_territory_database_load.sqf";
};
class CfgInteractionMenus
{
class Flag
{
targetType = 2;
target = "Exile_Construction_Flag_Static";
class Actions
{
class VG : ExileAbstractAction
{
title = "Virtual Garage";
condition = "(([_object, getPlayerUID player] call ExileClient_util_territory_getAccessLevel) select 0) >= ExAd_VG_ACCESS_LEVEL";
action = "call XM8_VG_checkNearByFlags";
};
};
};
};

View File

@ -18,4 +18,11 @@
</Key>
</Container>
</Package>
<Package name="VirtualGarage">
<Container name="Notifications">
<Key ID="STR_ExAd_VIRTUALGARAGE_NOTI_FULL">
<Original>You garage is full!</Original>
</Key>
</Container>
</Package>
</Project>