diff --git a/A3A/addons/core/CfgFunctions.hpp b/A3A/addons/core/CfgFunctions.hpp
index 8446453d1e..eb13bcf356 100644
--- a/A3A/addons/core/CfgFunctions.hpp
+++ b/A3A/addons/core/CfgFunctions.hpp
@@ -135,6 +135,7 @@ class CfgFunctions
class getAggroLevelString {};
class getRecentDamage {};
class getVehiclesAirSupport {};
+ class getVehicleSellPrice {};
class getVehiclesGroundSupport {};
class getVehiclesGroundTransport {};
class vehicleBoxRestore {};
diff --git a/A3A/addons/core/Stringtable.xml b/A3A/addons/core/Stringtable.xml
index 89630fe386..f716713cf9 100644
--- a/A3A/addons/core/Stringtable.xml
+++ b/A3A/addons/core/Stringtable.xml
@@ -2378,7 +2378,7 @@
出售载具
- Vehicle Sold.
+ Vehicle sold.
Fahrzeuge verkauft
Veicolo Venduto.
Vehículo vendido.
diff --git a/A3A/addons/core/functions/Base/fn_getVehicleSellPrice.sqf b/A3A/addons/core/functions/Base/fn_getVehicleSellPrice.sqf
new file mode 100644
index 0000000000..750100dc70
--- /dev/null
+++ b/A3A/addons/core/functions/Base/fn_getVehicleSellPrice.sqf
@@ -0,0 +1,94 @@
+/*
+ Author: Tiny
+ Description
+ Get a valid sell price for a given vehicle
+
+ Arguments:
+ 0. Vehicle object / vehicle class
+
+ Return Value:
+ Sell price. 0 if invalid or otherwise not found.
+
+ Scope: Any
+ Environment: Any
+ Public: Yes
+ Dependencies:
+
+ Example: [_vehicle] call A3A_getVehicleSellPrice
+*/
+
+#include "..\..\script_component.hpp"
+FIX_LINE_NUMBERS()
+
+#define OccAndInv(VAR) (FactionGet(occ, VAR) + FactionGet(inv, VAR))
+
+params ["_veh"];
+
+/*
+Blacklisted Assets
+
+The array below contains classnames of assets which are not allowed to be sold within Antistasi.
+Reason for this is that those items are one or more of the following:
+- can be aquired by means that don't cost anything and the ability to sell those would be an infinite money exploit.
+- are no proper "statics" in terms of weaponized statics but for example the ACE spotting scoped
+- something else
+*/
+private _blacklistedAssets = [
+"ACE_I_SpottingScope","ACE_O_SpottingScope","ACE_O_T_SpottingScope","ACE_B_SpottingScope","ACE_B_T_SpottingScope","ACE_SpottingScopeObject",
+"O_Static_Designator_02_F","B_Static_Designator_01_F","B_W_Static_Designator_01_F",
+"vn_o_nva_spiderhole_01","vn_o_nva_spiderhole_02","vn_o_nva_spiderhole_03",
+"vn_o_pl_spiderhole_01","vn_o_pl_spiderhole_02","vn_o_pl_spiderhole_03",
+"vn_o_vc_spiderhole_01","vn_o_vc_spiderhole_02","vn_o_vc_spiderhole_03"];
+
+private _typeX = if (_veh isEqualType objNull) then {typeOf _veh} else {_veh};
+
+if (_typeX in _blacklistedAssets) exitWith {0};
+
+if (_veh isKindOf "StaticWeapon") exitWith {100}; // in case rebel static is same as enemy statics
+
+if (_typeX in FactionGet(all,"vehiclesReb")) exitWith { ([_typeX] call A3A_fnc_vehiclePrice) / 2 };
+
+if (
+ (_typeX in arrayCivVeh)
+ or (_typeX in civBoats)
+ or (_typeX in (FactionGet(reb,"vehiclesCivBoat") + FactionGet(reb,"vehiclesCivCar") + FactionGet(reb,"vehiclesCivTruck")))
+) exitWith {25};
+
+if (
+ (_typeX in FactionGet(all,"vehiclesLight"))
+ or (_typeX in OccAndInv("vehiclesTrucks"))
+ or (_typeX in OccAndInv("vehiclesCargoTrucks"))
+ or (_typeX in OccAndInv("vehiclesMilitiaTrucks"))
+ or (_typeX in FactionGet(reb,"vehiclesTruck"))
+) exitWith {100};
+
+if (
+ (_typeX in FactionGet(all,"vehiclesBoats"))
+ or (_typeX in FactionGet(all,"vehiclesLightAPCs"))
+ or (_typeX in OccAndInv("vehiclesAmmoTrucks"))
+ or (_typeX in OccAndInv("vehiclesRepairTrucks"))
+ or (_typeX in OccAndInv("vehiclesFuelTrucks"))
+ or (_typeX in OccAndInv("vehiclesMedical"))
+) exitWith {200};
+
+if (_typeX in (FactionGet(all,"vehiclesHelisLight") + FactionGet(reb,"vehiclesCivHeli"))) exitWith {500};
+
+if (
+ (_typeX in FactionGet(all,"vehiclesAPCs"))
+ || (_typeX in FactionGet(all,"vehiclesIFVs"))
+ || (_typeX in FactionGet(all,"vehiclesLightTanks"))
+ || (_typeX in FactionGet(all,"vehiclesHelisLightAttack"))
+ || (_typeX in FactionGet(all,"vehiclesTransportAir"))
+ || (_typeX in FactionGet(all,"vehiclesUAVs"))
+) exitWith {1000};
+
+if (
+ (_typeX in FactionGet(all,"vehiclesHelisAttack"))
+ or (_typeX in FactionGet(all,"vehiclesTanks"))
+ or (_typeX in FactionGet(all,"vehiclesAA"))
+ or (_typeX in FactionGet(all,"vehiclesArtillery"))
+) exitWith {3000};
+
+if (_typeX in (FactionGet(all,"vehiclesPlanesCAS") + FactionGet(all,"vehiclesPlanesAA"))) exitWith {4000};
+
+0;
\ No newline at end of file
diff --git a/A3A/addons/core/functions/Base/fn_sellVehicle.sqf b/A3A/addons/core/functions/Base/fn_sellVehicle.sqf
index 85fa9f6e67..bd18cede56 100644
--- a/A3A/addons/core/functions/Base/fn_sellVehicle.sqf
+++ b/A3A/addons/core/functions/Base/fn_sellVehicle.sqf
@@ -34,8 +34,6 @@ params [
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()
-#define OccAndInv(VAR) (FactionGet(occ, VAR) + FactionGet(inv, VAR))
-
private _titleStr = localize "STR_A3A_fn_base_sellveh_sell";
/*
@@ -69,50 +67,7 @@ if !(_owner isEqualTo "" || {getPlayerUID _player isEqualTo _owner}) exitWith {
if (_veh getVariable ["A3A_sellVehicle_inProgress",false]) exitWith {[_titleStr, localize "STR_A3A_fn_base_sellveh_progress"] remoteExecCall ["A3A_fnc_customHint",_player];};
_veh setVariable ["A3A_sellVehicle_inProgress",true,false]; // Only processed on the server. It is absolutely pointless trying to network this due to race conditions.
-private _typeX = typeOf _veh;
-private _costs = call {
- if (_typeX in _blacklistedAssets) exitWith {0};
- if (_veh isKindOf "StaticWeapon") exitWith {100}; // in case rebel static is same as enemy statics
- if (_typeX in FactionGet(all,"vehiclesReb")) exitWith { ([_typeX] call A3A_fnc_vehiclePrice) / 2 };
- if (
- (_typeX in arrayCivVeh)
- or (_typeX in civBoats)
- or (_typeX in (FactionGet(reb,"vehiclesCivBoat") + FactionGet(reb,"vehiclesCivCar") + FactionGet(reb,"vehiclesCivTruck")))
- ) exitWith {25};
- if (
- (_typeX in FactionGet(all,"vehiclesLight"))
- or (_typeX in OccAndInv("vehiclesTrucks"))
- or (_typeX in OccAndInv("vehiclesCargoTrucks"))
- or (_typeX in OccAndInv("vehiclesMilitiaTrucks"))
- or (_typeX in FactionGet(reb,"vehiclesTruck"))
- ) exitWith {100};
- if (
- (_typeX in FactionGet(all,"vehiclesBoats"))
- or (_typeX in FactionGet(all,"vehiclesLightAPCs"))
- or (_typeX in OccAndInv("vehiclesAmmoTrucks"))
- or (_typeX in OccAndInv("vehiclesRepairTrucks"))
- or (_typeX in OccAndInv("vehiclesFuelTrucks"))
- or (_typeX in OccAndInv("vehiclesMedical"))
- ) exitWith {200};
- if (_typeX in (FactionGet(all,"vehiclesHelisLight") + FactionGet(reb,"vehiclesCivHeli"))) exitWith {500};
- if (
- (_typeX in FactionGet(all,"vehiclesAPCs"))
- || (_typeX in FactionGet(all,"vehiclesIFVs"))
- || (_typeX in FactionGet(all,"vehiclesLightTanks"))
- || (_typeX in FactionGet(all,"vehiclesHelisLightAttack"))
- || (_typeX in FactionGet(all,"vehiclesTransportAir"))
- || (_typeX in FactionGet(all,"vehiclesUAVs"))
- ) exitWith {1000};
- if (
- (_typeX in FactionGet(all,"vehiclesHelisAttack"))
- or (_typeX in FactionGet(all,"vehiclesTanks"))
- or (_typeX in FactionGet(all,"vehiclesHeavyTanks"))
- or (_typeX in FactionGet(all,"vehiclesAA"))
- or (_typeX in FactionGet(all,"vehiclesArtillery"))
- ) exitWith {3000};
- if (_typeX in (FactionGet(all,"vehiclesPlanesCAS") + FactionGet(all,"vehiclesPlanesAA"))) exitWith {4000};
- 0;
-};
+private _costs = [_veh] call A3A_fnc_getVehicleSellPrice;
if (_costs == 0) exitWith {
_veh setVariable ["A3A_sellVehicle_inProgress",false,false];
diff --git a/A3A/addons/garage/CfgDefines.inc b/A3A/addons/garage/CfgDefines.inc
index a16c44306a..9b8651ac83 100644
--- a/A3A/addons/garage/CfgDefines.inc
+++ b/A3A/addons/garage/CfgDefines.inc
@@ -50,6 +50,7 @@
#define HR_GRG_IDC_tLock 170012
#define HR_GRG_IDC_Confirm 170013
#define HR_GRG_IDC_InfoPanel 170014
+#define HR_GRG_IDC_SellVeh 170015
#define HR_GRG_IDC_SourcePanelAmmo 1700141
#define HR_GRG_IDC_SourcePanelFuel 1700142
#define HR_GRG_IDC_SourcePanelRepair 1700143
diff --git a/A3A/addons/garage/CfgFunctions.hpp b/A3A/addons/garage/CfgFunctions.hpp
index 470db8c542..49aa619bfb 100644
--- a/A3A/addons/garage/CfgFunctions.hpp
+++ b/A3A/addons/garage/CfgFunctions.hpp
@@ -26,6 +26,8 @@ class CfgFunctions
class requestSelectionChange {};
class requestVehicle {};
class selectionChange {};
+ class sellVehGRG {};
+ class sellVehGRGLocal {};
class switchCategory {};
class toggleConfirmBttn {};
class toggleLock {};
diff --git a/A3A/addons/garage/Core/fn_onLoad.sqf b/A3A/addons/garage/Core/fn_onLoad.sqf
index 444053175c..4ce7d321b8 100644
--- a/A3A/addons/garage/Core/fn_onLoad.sqf
+++ b/A3A/addons/garage/Core/fn_onLoad.sqf
@@ -98,6 +98,12 @@ HR_GRG_Cats = [HR_GRG_IDC_CatCar,HR_GRG_IDC_CatArmored,HR_GRG_IDC_CatAir,HR_GRG_
} forEach HR_GRG_Cats;
[0] call HR_GRG_fnc_switchCategory;
+//sell button init
+
+if (HR_GRG_disableSellButton) then {
+ _disp displayCtrl HR_GRG_IDC_SellVeh ctrlEnable false;
+};
+
//extras list init
if (
!HR_GRG_Pylons_Enabled //Pylon editing disabled
diff --git a/A3A/addons/garage/Core/fn_removeFromPool.sqf b/A3A/addons/garage/Core/fn_removeFromPool.sqf
index d90d9f5446..086c176ac4 100644
--- a/A3A/addons/garage/Core/fn_removeFromPool.sqf
+++ b/A3A/addons/garage/Core/fn_removeFromPool.sqf
@@ -5,6 +5,8 @@
Arguments:
0. Client UID
+ 1. Player, for logging
+ 2. Whether or not to exclude mounts from removal (default false)
Return Value:
succesfull
@@ -20,21 +22,26 @@
*/
#include "defines.inc"
FIX_LINE_NUMBERS()
-params [["_UID", "", [""]], ["_player", objNull, [objNull]]];
+params [["_UID", "", [""]], ["_player", objNull, [objNull]], ["_removeMounts",false,[false]]];
Trace_1("Removing vehicles from garage with UID: %1", _UID);
if (_UID isEqualTo "") exitWith {false};
//find vehicles to remove
private _toRemove = [];
-{
- private _catIndex = _forEachIndex;
- private _hashMap = _x;
+if (!_removeMounts) then {
{
- _veh = _hashMap get _x;
- if ((_veh#3) isEqualTo _UID) then {_toRemove pushBack [_catIndex, _x, _veh]};
- } forEach keys _x;
-} forEach HR_GRG_Vehicles;
-
+ private _catIndex = _forEachIndex;
+ private _hashMap = _x;
+ {
+ _veh = _hashMap get _x;
+ if ((_veh#3) isEqualTo _UID) then {_toRemove pushBack [_catIndex, _x, _veh]};
+ } forEach keys _x;
+ } forEach HR_GRG_Vehicles;
+} else {
+ HR_GRG_SelectedVehicles params [["_catIndex", -1], ["_vehUID", -1], ["_class", ""]];
+ _toRemove pushBack [_catIndex, _vehUID, _class];
+};
+
//remove vehicles
{
//remove vehicle
diff --git a/A3A/addons/garage/Core/fn_requestSelectionChange.sqf b/A3A/addons/garage/Core/fn_requestSelectionChange.sqf
index f13b601a2a..9a36b86923 100644
--- a/A3A/addons/garage/Core/fn_requestSelectionChange.sqf
+++ b/A3A/addons/garage/Core/fn_requestSelectionChange.sqf
@@ -34,7 +34,7 @@ if (-1 in [_catIndex, _vehUID]) exitWith _exit;
private _cat = HR_GRG_Vehicles#_catIndex;
private _vehicle = _cat get _vehUID;
-if !( ((_vehicle#2) in ["", _UID]) || (_player call HR_GRG_isCmdClient) ) exitWith _exit;
+if !( ((_vehicle#2) in ["", _UID]) || (_player call HR_GRG_canOverrideLock) ) exitWith _exit;
if !((_vehicle#3) in ["", _UID] ) exitWith _exit;
[_UID] call HR_GRG_fnc_releaseAllVehicles;
diff --git a/A3A/addons/garage/Core/fn_sellVehGRG.sqf b/A3A/addons/garage/Core/fn_sellVehGRG.sqf
new file mode 100644
index 0000000000..7b87830caa
--- /dev/null
+++ b/A3A/addons/garage/Core/fn_sellVehGRG.sqf
@@ -0,0 +1,48 @@
+/*
+ Author: Tiny, parts of code ethically sourced from Håkon
+ [Description]
+ Attempts to sell currently selected vehicle
+
+ Arguments:
+ 0. player UID
+ 1. Player
+ 2. vehicle to sell (intended use with HR_GRG_SelectedVehicles)
+
+ Return Value:
+ n/A
+
+ Scope: Server
+ Environment: Unscheduled
+ Public: [No]
+ Dependencies:
+
+ Example: [HR_GRG_PlayerUID, player, HR_GRG_SelectedVehicles] remoteExecCall ["HR_GRG_fnc_sellVehGRG",2];
+
+ License: APL-ND
+*/
+
+#include "defines.inc"
+FIX_LINE_NUMBERS()
+params ["_UID", "_player", "_selectedVehicle"];
+
+if (!isServer) exitWith {Error("Not server executed")};
+if !(_player call HR_GRG_canSell) exitWith {["STR_HR_GRG_Feedback_sellVehicle_comOnly"] call HR_GRG_fnc_Hint;};
+_selectedVehicle params [["_catIndex", -1], ["_vehUID", -1], ["_class", ""]];
+if ( (_catIndex isEqualTo -1) || (_vehUID isEqualTo -1) ) exitWith {};
+Trace_2("Attempting to sell vehicle at cat: %1 | Vehicle ID: %2 | Classname: %3", _catIndex, _vehUID, _class);
+
+private _refund = [_class] call HR_GRG_getVehicleSellPrice;
+if (_refund == 0) exitWith {["STR_HR_GRG_Feedback_sellVehicle_noPrice"] call HR_GRG_fnc_Hint;};
+
+private _cat = HR_GRG_Vehicles#_catIndex;
+private _veh = _cat get _vehUID;
+private _lock = _veh#2;
+if !(_lock isEqualTo "") exitWith {["STR_HR_GRG_Feedback_sellVehicle_locked"] call HR_GRG_fnc_Hint;};
+
+[_UID,_player,true] remoteExecCall ["HR_GRG_fnc_removeFromPool",HR_GRG_Users];
+[] remoteExec ["HR_GRG_fnc_sellVehGRGLocal",_player];
+
+[_refund] spawn HR_GRG_addResources;
+
+["STR_HR_GRG_Feedback_sellVehicle_sold",[str _refund]] call HR_GRG_fnc_Hint;
+Info_3("Vehicle UID %1 sold by %2 for %3.", _vehUID, name _player, _refund);
diff --git a/A3A/addons/garage/Core/fn_sellVehGRGLocal.sqf b/A3A/addons/garage/Core/fn_sellVehGRGLocal.sqf
new file mode 100644
index 0000000000..6b7276a56b
--- /dev/null
+++ b/A3A/addons/garage/Core/fn_sellVehGRGLocal.sqf
@@ -0,0 +1,32 @@
+/*
+ Author: Tiny
+ [Description]
+ A helper script to fn_sellvehGRG, runs on the client to reset displays
+
+ Arguments:
+ 1. The category to change selection to (default = -1)
+ 2. The vehicle UID to change selection to (default = -1)
+ 3. The classname of the selected vehicle (default = "")
+
+
+ Return Value:
+
+
+ Scope: Client
+ Environment: Any
+ Public: [No]
+
+ License: APL-ND
+*/
+#include "defines.inc"
+FIX_LINE_NUMBERS()
+
+if (isNull player) exitWith {Error("fn_sellVehGRGLocal was not executed by a client")};
+params [["_catIndex",-1],["_vehUID",-1],["_class",""]];
+HR_GRG_SelectedVehicles = [_catIndex, _vehUID,_class];
+
+[] call HR_GRG_fnc_reloadPreview;
+[] call HR_GRG_fnc_reloadExtras;
+[0] call HR_GRG_fnc_switchExtrasMenu;
+[] call HR_GRG_fnc_reloadPylons;
+[] call HR_GRG_fnc_updateVehicleCount;
diff --git a/A3A/addons/garage/Core/fn_toggleLock.sqf b/A3A/addons/garage/Core/fn_toggleLock.sqf
index 6f8dd02184..3117123181 100644
--- a/A3A/addons/garage/Core/fn_toggleLock.sqf
+++ b/A3A/addons/garage/Core/fn_toggleLock.sqf
@@ -35,7 +35,7 @@ private _owner = _veh#5;
_success = call {
if ( _lock isEqualTo "" ) exitWith { true };
if ( _lock isEqualTo _UID) exitWith { _UID = ""; true };
- if (_player call HR_GRG_isCmdClient) exitWith { _UID = ""; Info_5("Commander unlock | Vehicle ID: %1 | Owner: %2 [%3] | Commander: %4 [%5]", _vehUID, _owner, _lock, name _player, _UID); true };
+ if (_player call HR_GRG_canOverrideLock) exitWith { _UID = ""; Info_5("Commander unlock | Vehicle ID: %1 | Owner: %2 [%3] | Commander: %4 [%5]", _vehUID, _owner, _lock, name _player, _UID); true };
false
};
if (!_success) exitWith { Trace("Failed to toggle lock") };
diff --git a/A3A/addons/garage/Dialogs.hpp b/A3A/addons/garage/Dialogs.hpp
index 4003652d26..1a67019d8d 100644
--- a/A3A/addons/garage/Dialogs.hpp
+++ b/A3A/addons/garage/Dialogs.hpp
@@ -220,7 +220,7 @@ class HR_GRG_VehicleSelect
x = SCREEN_RIGHT - 39 * GRID_NOUISCALE_W;
y = SCREEN_TOP + 4 * GRID_NOUISCALE_H;
w = 39 * GRID_NOUISCALE_W;
- h = safeZoneH - (56 * GRID_NOUISCALE_H); // Screen height - title and buttons height
+ h = safeZoneH - (63 * GRID_NOUISCALE_H); // Screen height - title and buttons height
size = TEXT_SIZE_MEDIUM;
rowHeight = 3 * GRID_NOUISCALE_H;
onMouseButtonClick = "_this call HR_GRG_fnc_requestMount;";
@@ -244,7 +244,7 @@ class HR_GRG_VehicleSelect
x = SCREEN_RIGHT - 39 * GRID_NOUISCALE_W;
y = SCREEN_TOP + 4 * GRID_NOUISCALE_H;
w = 39 * GRID_NOUISCALE_W;
- h = safeZoneH - (56 * GRID_NOUISCALE_H); // Screen height - title and buttons height
+ h = safeZoneH - (63 * GRID_NOUISCALE_H); // Screen height - title and buttons height
class controls
{
@@ -254,7 +254,7 @@ class HR_GRG_VehicleSelect
x = 0;
y = 0;
w = 39 * GRID_NOUISCALE_W;
- h = safeZoneH - (56 * GRID_NOUISCALE_H);
+ h = safeZoneH - (63 * GRID_NOUISCALE_H);
};
class HR_GRG_MirrorCheckbox: HR_GRG_RscCheckBox
@@ -292,7 +292,7 @@ class HR_GRG_VehicleSelect
x = 0;
y = 4 * GRID_NOUISCALE_H;
w = 38 * GRID_NOUISCALE_W;
- h = safeZoneH - (65 * GRID_NOUISCALE_H); // Screen height - title and buttons height 51
+ h = safeZoneH - (67 * GRID_NOUISCALE_H); // Screen height - title and buttons height 51
};
};
};
@@ -301,7 +301,7 @@ class HR_GRG_VehicleSelect
class HR_GRG_SourcePanel: HR_GRG_RscControlsGroup
{
x = SCREEN_RIGHT - 39 * GRID_NOUISCALE_W;
- y = SCREEN_BOTTOM - 52 * GRID_NOUISCALE_H;
+ y = SCREEN_BOTTOM - 59 * GRID_NOUISCALE_H;
w = 39 * GRID_NOUISCALE_W;
h = 7 * GRID_NOUISCALE_H;
size = TEXT_SIZE_MEDIUM;
@@ -350,7 +350,7 @@ class HR_GRG_VehicleSelect
class HR_GRG_InfoPanelWrapper: HR_GRG_RscControlsGroup
{
x = SCREEN_RIGHT - 39 * GRID_NOUISCALE_W;
- y = SCREEN_BOTTOM - 45 * GRID_NOUISCALE_H;
+ y = SCREEN_BOTTOM - 52 * GRID_NOUISCALE_H;
w = 39 * GRID_NOUISCALE_W;
h = 45 * GRID_NOUISCALE_H;
size = TEXT_SIZE_MEDIUM;
@@ -369,6 +369,30 @@ class HR_GRG_VehicleSelect
};
};
+ class HR_GRG_SellButtonWrapper: HR_GRG_RscControlsGroup
+ {
+ x = SCREEN_RIGHT - 39 * GRID_NOUISCALE_W;
+ y = SCREEN_BOTTOM - 7 * GRID_NOUISCALE_H;
+ w = 39 * GRID_NOUISCALE_W;
+ h = 7 * GRID_NOUISCALE_H;
+ size = TEXT_SIZE_LARGE;
+
+ class controls
+ {
+ class HR_GRG_SellVeh: HR_GRG_RscButton
+ {
+ idc = HR_GRG_IDC_SellVeh;
+ text = $STR_HR_GRG_Generic_SellVeh;
+ x = 0;
+ y = 0;
+ w = 39 * GRID_NOUISCALE_W;
+ h = 7 * GRID_NOUISCALE_H;
+ action = "if !(HR_GRG_SelectedVehicles isEqualTo [-1,-1,'']) then {[HR_GRG_PlayerUID, player, HR_GRG_SelectedVehicles] remoteExecCall ['HR_GRG_fnc_sellVehGRG',2];};";
+ sizeEx = TEXT_SIZE_LARGE;
+ };
+ };
+ };
+
// Camera controls hint
class HR_GRG_KeyBindHint: HR_GRG_RscStructuredText
{
diff --git a/A3A/addons/garage/Extras/fn_findMount.sqf b/A3A/addons/garage/Extras/fn_findMount.sqf
index 9c5c514c5e..119cc201ba 100644
--- a/A3A/addons/garage/Extras/fn_findMount.sqf
+++ b/A3A/addons/garage/Extras/fn_findMount.sqf
@@ -38,7 +38,7 @@ private _CheckedUID = ["",_UID] select (_newIconIndex isEqualTo 1);
//block checkout condition
if (
!((_mount#2) in ["",_UID]) //locked by someone else
- && !(_player call HR_GRG_isCmdClient) //cmd overwrite
+ && !(_player call HR_GRG_canOverrideLock) //cmd overwrite
) exitWith _failed;
if !((_mount#3) in ["", _UID]) exitWith _failed; //Checked out by someone else
diff --git a/A3A/addons/garage/Extras/fn_reloadExtras.sqf b/A3A/addons/garage/Extras/fn_reloadExtras.sqf
index fbd59b56f3..713868bd9d 100644
--- a/A3A/addons/garage/Extras/fn_reloadExtras.sqf
+++ b/A3A/addons/garage/Extras/fn_reloadExtras.sqf
@@ -25,8 +25,21 @@ private _class = HR_GRG_SelectedVehicles param [2, "", [""]];
Trace("Reloading Extras");
//Mounts
private _disp = findDisplay HR_GRG_IDD_Garage;
-private _ctrl = _disp displayCtrl HR_GRG_IDC_ExtraMounts;
-lbClear _ctrl;
+private _ctrlExtraMounts = _disp displayCtrl HR_GRG_IDC_ExtraMounts;
+lbClear _ctrlExtraMounts;
+private _ctrlExtraTexture = _disp displayCtrl HR_GRG_IDC_ExtraTexture;
+lbClear _ctrlExtraTexture;
+private _ctrlExtraAnim = _disp displayCtrl HR_GRG_IDC_ExtraAnim;
+lbClear _ctrlExtraAnim;
+private _ctrlSourcePanelAmmo = _disp displayCtrl HR_GRG_IDC_SourcePanelAmmo;
+private _ctrlSourcePanelFuel = _disp displayCtrl HR_GRG_IDC_SourcePanelFuel;
+private _ctrlSourcePanelRepair = _disp displayCtrl HR_GRG_IDC_SourcePanelRepair;
+private _ctrlInfoPanel = _disp displayCtrl HR_GRG_IDC_InfoPanel;
+
+if (!isClass (configFile >> "CfgVehicles" >> _class)) exitWith {
+ _ctrlInfoPanel ctrlSetStructuredText text "";
+};
+
private _nodeCfg = [HR_GRG_previewVeh] call A3A_Logistics_fnc_getNodeConfig;
private _vehNodes = [HR_GRG_previewVeh] call A3A_Logistics_fnc_getVehicleNodes;
private _vehModel = getText (configFile >> "CfgVehicles" >> typeOf HR_GRG_previewVeh >> "model");
@@ -53,15 +66,15 @@ if (_vehNodes isEqualType []) then {
//add entry
if ( (_allowed) && (_size != -1) && (_capacity >= _size) && !_block) then { //static is loadable and vehicle can fit it
- private _index = _ctrl lbAdd _displayName;
- _ctrl lbSetData [_index, _staticClass];
- _ctrl lbSetValue [_index, _x];
- _ctrl lbsetpicture [_index,checkboxTextures select (_checkedOut isEqualTo HR_GRG_PlayerUID)];
- _ctrl lbSetTextRight [_index, format ["Size: %1", _size]];
+ private _index = _ctrlExtraMounts lbAdd _displayName;
+ _ctrlExtraMounts lbSetData [_index, _staticClass];
+ _ctrlExtraMounts lbSetValue [_index, _x];
+ _ctrlExtraMounts lbsetpicture [_index,checkboxTextures select (_checkedOut isEqualTo HR_GRG_PlayerUID)];
+ _ctrlExtraMounts lbSetTextRight [_index, format ["Size: %1", _size]];
Trace_4("Mount Added to list | Class: %1 | UID: %2 | Checked: %3 | Size: %4", _staticClass, _x, (_checkedOut isEqualTo HR_GRG_PlayerUID), _type);
};
} forEach (HR_GRG_Vehicles#4);//statics
- lbSort _ctrl;
+ lbSort _ctrlExtraMounts;
};
if (_reloadMounts) then { [] call HR_GRG_fnc_reloadMounts };
@@ -69,62 +82,55 @@ private _customisation = [HR_GRG_previewVeh] call BIS_fnc_getVehicleCustomizatio
//textures
HR_GRG_curTexture = _customisation#0;
private _badInit = HR_GRG_curTexture isEqualTo [];
-private _ctrl = _disp displayCtrl HR_GRG_IDC_ExtraTexture;
-lbClear _ctrl;
{
private _displayName = getText (_x >> "displayName");
private _cfgName = configname _x;
if (_displayName != "" && {!(_displayName in HR_GRG_blackListCamo)}) then {
- private _index = _ctrl lbAdd _displayName;
- _ctrl lbsetdata [_index,_cfgName];
+ private _index = _ctrlExtraTexture lbAdd _displayName;
+ _ctrlExtraTexture lbsetdata [_index,_cfgName];
if (_badInit) then {
- _ctrl lbsetpicture [_index,checkboxTextures#0];
+ _ctrlExtraTexture lbsetpicture [_index,checkboxTextures#0];
} else {
- _ctrl lbsetpicture [_index,checkboxTextures select ((HR_GRG_curTexture#0) isEqualTo _cfgName)];
+ _ctrlExtraTexture lbsetpicture [_index,checkboxTextures select ((HR_GRG_curTexture#0) isEqualTo _cfgName)];
};
};
} foreach (configProperties [(configfile >> "CfgVehicles" >> _class >> "textureSources"),"isclass _x",true]);
-lbSort _ctrl;
+lbSort _ctrlExtraTexture;
//animations
-private _ctrl = _disp displayCtrl HR_GRG_IDC_ExtraAnim;
-lbClear _ctrl;
{
_configName = configname _x;
_displayName = getText (_x >> "displayName");
if (_displayName != "") then {
_textures = getArray (_x >> "textures");
- _index = _ctrl lbAdd _displayName;
- _ctrl lbSetData [_index,_configName];
+ _index = _ctrlExtraAnim lbAdd _displayName;
+ _ctrlExtraAnim lbSetData [_index,_configName];
private _phase = ceil (HR_GRG_PreviewVeh animationPhase _configName);
- _ctrl lbSetPicture [_index,checkboxTextures#_phase];
+ _ctrlExtraAnim lbSetPicture [_index,checkboxTextures#_phase];
};
} foreach (configProperties [(configfile >> "CfgVehicles" >> _class >> "animationSources"),"isclass _x",true]);
-lbSort _ctrl;
+lbSort _ctrlExtraAnim;
HR_GRG_curAnims = _customisation#1;
[HR_GRG_previewVeh, HR_GRG_curTexture, HR_GRG_curAnims] call BIS_fnc_initVehicle;
//update source panel
-private _ctrl = _disp displayCtrl HR_GRG_IDC_SourcePanelAmmo;
-_ctrl ctrlSetStructuredText composeText [" ", image RearmIcon, " ", image (checkboxTextures select (HR_GRG_hasAmmoSource && !HR_GRG_ServiceDisabled_Rearm))];
-_ctrl ctrlSetTooltip ([
+_ctrlSourcePanelAmmo ctrlSetStructuredText composeText [" ", image RearmIcon, " ", image (checkboxTextures select (HR_GRG_hasAmmoSource && !HR_GRG_ServiceDisabled_Rearm))];
+_ctrlSourcePanelAmmo ctrlSetTooltip ([
localize "STR_HR_GRG_SourcePanel_toolTip_Ammo_Unavailable"
, localize "STR_HR_GRG_SourcePanel_toolTip_Ammo_Available"
, localize "STR_HR_GRG_SourcePanel_toolTip_Ammo_Disabled"
] select (if (HR_GRG_ServiceDisabled_Rearm) then {2} else {HR_GRG_hasAmmoSource}));
-private _ctrl = _disp displayCtrl HR_GRG_IDC_SourcePanelFuel;
-_ctrl ctrlSetStructuredText composeText [" ", image RefuelIcon, " ", image (checkboxTextures select (HR_GRG_hasFuelSource && !HR_GRG_ServiceDisabled_Refuel))];
-_ctrl ctrlSetTooltip ([
+_ctrlSourcePanelFuel ctrlSetStructuredText composeText [" ", image RefuelIcon, " ", image (checkboxTextures select (HR_GRG_hasFuelSource && !HR_GRG_ServiceDisabled_Refuel))];
+_ctrlSourcePanelFuel ctrlSetTooltip ([
localize "STR_HR_GRG_SourcePanel_toolTip_Fuel_Unavailable"
, localize "STR_HR_GRG_SourcePanel_toolTip_Fuel_Available"
, localize "STR_HR_GRG_SourcePanel_toolTip_Fuel_Disabled"
] select (if (HR_GRG_ServiceDisabled_Refuel) then {2} else {HR_GRG_hasFuelSource}));
-private _ctrl = _disp displayCtrl HR_GRG_IDC_SourcePanelRepair;
-_ctrl ctrlSetStructuredText composeText [" ", image RepairIcon, " ", image (checkboxTextures select (HR_GRG_hasRepairSource && !HR_GRG_ServiceDisabled_Repair))];
-_ctrl ctrlSetTooltip ([
+_ctrlSourcePanelRepair ctrlSetStructuredText composeText [" ", image RepairIcon, " ", image (checkboxTextures select (HR_GRG_hasRepairSource && !HR_GRG_ServiceDisabled_Repair))];
+_ctrlSourcePanelRepair ctrlSetTooltip ([
localize "STR_HR_GRG_SourcePanel_toolTip_Repair_Unavailable"
, localize "STR_HR_GRG_SourcePanel_toolTip_Repair_Available"
, localize "STR_HR_GRG_SourcePanel_toolTip_Repair_Disabled"
@@ -132,7 +138,6 @@ _ctrl ctrlSetTooltip ([
if (isNull HR_GRG_previewVeh) exitWith {};
//update info panel
-private _ctrl = _disp displayCtrl HR_GRG_IDC_InfoPanel;
private _spacer = composeText [lineBreak, lineBreak];
private _topBar = composeText [
image cfgIcon(_class), " ", cfgDispName(_class)
@@ -151,6 +156,9 @@ private _typeSource = switch (_source find true) do {
default {localize "STR_HR_GRG_InfoPanel_isNotSource"};
};
+private _sellPrice = [HR_GRG_previewVeh] call HR_GRG_getVehicleSellPrice;
+_sellPrice = [str _sellPrice, localize "STR_HR_GRG_InfoPanel_cannotBeSold"] select (_sellPrice == 0);
+_sellPrice = [localize "STR_HR_GRG_InfoPanel_salePrice",_sellPrice] joinString " ";
//state indicator
private _getPercentageAmmo = {
@@ -271,4 +279,4 @@ _generalInfo = composeText [
,image MassIcon," ",localize "STR_HR_GRG_InfoPanel_Mass"," ", str _mass
];
-_ctrl ctrlSetStructuredText composeText [_topBar, lineBreak, _typeSource, _spacer, "Vehicle state:", lineBreak, _vehicleState,lineBreak,_refuelInfo, _spacer, _seatsInfo, _spacer, _cargoInfo, _spacer, _generalInfo];
+_ctrlInfoPanel ctrlSetStructuredText composeText [_topBar, lineBreak, _typeSource, lineBreak, _sellPrice, _spacer, "Vehicle state:", lineBreak, _vehicleState,lineBreak,_refuelInfo, _spacer, _seatsInfo, _spacer, _cargoInfo, _spacer, _generalInfo];
diff --git a/A3A/addons/garage/Public/config.inc b/A3A/addons/garage/Public/config.inc
index 40d6187432..8c879144f3 100644
--- a/A3A/addons/garage/Public/config.inc
+++ b/A3A/addons/garage/Public/config.inc
@@ -19,7 +19,7 @@
HR_GRG_Prefix = "Antistasi";
// Condition for whether the player can override garage locks
-HR_GRG_isCmdClient = {
+HR_GRG_canOverrideLock = {
(isServer && hasInterface && _this isEqualTo player) //Lan host
|| {admin owner _this > 0} //admin
|| {_this isEqualTo theBoss && _this call A3A_fnc_isMember } //member-commander
@@ -133,3 +133,23 @@ if (isClass (configfile >> "CBA_Extended_EventHandlers")) then {
}] call CBA_fnc_addSetting;
};
+
+// sell button
+HR_GRG_disableSellButton = false;
+
+HR_GRG_addResources = {
+ params ["_money"];
+ [0,_money] call A3A_fnc_resourcesFIA;
+};
+
+HR_GRG_canSell = {_this isEqualTo theBoss};
+
+HR_GRG_getVehicleSellPrice = {
+ private _disableSale = false;
+ if (_disableSale) exitWith {0};
+ params ["_veh"];
+ [_veh] call A3A_fnc_getVehicleSellPrice;
+};
+
+
+
diff --git a/A3A/addons/garage/Stringtable.xml b/A3A/addons/garage/Stringtable.xml
index e266126847..33fbd2d72b 100644
--- a/A3A/addons/garage/Stringtable.xml
+++ b/A3A/addons/garage/Stringtable.xml
@@ -436,6 +436,18 @@
Statik monte edilemez
无法装载固定式武器
+
+ Only the Commander can sell vehicles.
+
+
+ You cannot sell a locked vehicle. If this is your vehicle, make sure to unlock it first.
+
+
+ This vehicle is not suitable for our marketplace.
+
+
+ Vehicle sold for %1 €.
+
You have too many vehicles locked
Du hast zu viele Fahrzeuge abgeschlossen
@@ -661,6 +673,9 @@
Statikler
固定武器
+
+ Sell Vehicle
+
Texture
Textur
@@ -703,6 +718,9 @@
Mevcut:
可用:
+
+ Cannot be sold.
+
Capacity:
Kapazität:
@@ -815,6 +833,9 @@
Yığın:
重量:
+
+ Sell Price:
+
Seats:
Sitze: