From 11f26d8951ae078db32fa4de2a635558ba9c4efd Mon Sep 17 00:00:00 2001 From: ante <49555217+ante185@users.noreply.github.com> Date: Wed, 17 Apr 2024 19:20:32 +0200 Subject: [PATCH 1/4] Update fn_vehiclePrice.sqf --- .../core/functions/REINF/fn_vehiclePrice.sqf | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf index b1b6469a72..57a1cd02d8 100644 --- a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf +++ b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf @@ -3,11 +3,21 @@ FIX_LINE_NUMBERS() params ["_typeX"]; -private _costs = server getVariable _typeX; +_costs = 0; + +if (isNil "_typeX") then +{ + Error_1("Vehicle does not exist."); + _costs = 0; +} +else +{ + _costs = server getVariable _typeX; +}; if (isNil "_costs") then { - Error_1("Invalid vehicle price :%1.", _typeX); + Error_1("Invalid vehicle price :%1.", _typeX); _costs = 0; } else From 870263022790b5340c8f9cde431b759f2abd0369 Mon Sep 17 00:00:00 2001 From: ante <49555217+ante185@users.noreply.github.com> Date: Thu, 18 Apr 2024 19:36:03 +0200 Subject: [PATCH 2/4] Update fn_vehiclePrice.sqf --- .../core/functions/REINF/fn_vehiclePrice.sqf | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf index 57a1cd02d8..aeba96650d 100644 --- a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf +++ b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf @@ -3,9 +3,9 @@ FIX_LINE_NUMBERS() params ["_typeX"]; -_costs = 0; +private _costs = 0; -if (isNil "_typeX") then +if (isNil "_typeX") then { Error_1("Vehicle does not exist."); _costs = 0; @@ -16,26 +16,22 @@ else }; if (isNil "_costs") then - { +{ Error_1("Invalid vehicle price :%1.", _typeX); _costs = 0; - } +} else +{ + if (count seaports > 3) then + { + private _numFriendlySeaports = ({sidesX getVariable [_x,sideUnknown] == teamPlayer} count seaports) min 6; + _costs = round (_costs - (_costs * 0.05 * _numFriendlySeaports)); + } + else { - if (count seaports > 3) then { - private _numFriendlySeaports = ({sidesX getVariable [_x,sideUnknown] == teamPlayer} count seaports) min 6; - _costs = round (_costs - (_costs * 0.05 * _numFriendlySeaports)); - } else { - _discount = switch (true) do { - case (tierWar in [1,2]): { 0 }; - case (tierWar in [3,4]): { 0 }; - case (tierWar in [5,6]): { 1 }; - case (tierWar in [7,8]): { 2 }; - case (tierWar in [9,10]): { 3 }; - default { 0 }; - }; - _costs = round (_costs - (_costs * 0.1 * _discount)); - }; + _discount = 0 max ((tierWar - 4) * 0.5); + _costs = round (_costs - (_costs * 0.1 * _discount)); }; +}; _costs From a82a5d04614746df1be279b1e2be7e460aa68d2c Mon Sep 17 00:00:00 2001 From: ante <49555217+ante185@users.noreply.github.com> Date: Thu, 18 Apr 2024 19:40:25 +0200 Subject: [PATCH 3/4] Update fn_vehiclePrice.sqf --- A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf index aeba96650d..b6c7f78309 100644 --- a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf +++ b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf @@ -29,7 +29,7 @@ else } else { - _discount = 0 max ((tierWar - 4) * 0.5); + _discount = 0 max ((tierWar - 4) * 0.5); //4 is the last war tier before discounts, the 0.5 makes the discount go from 0-3 instead of 0-6. _costs = round (_costs - (_costs * 0.1 * _discount)); }; }; From 67096cf4c1bf8df4f8b2a211783ebc8eeb8598da Mon Sep 17 00:00:00 2001 From: ante <49555217+ante185@users.noreply.github.com> Date: Mon, 22 Apr 2024 21:04:45 +0200 Subject: [PATCH 4/4] round to 5 --- A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf index b6c7f78309..fe524f1ffb 100644 --- a/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf +++ b/A3A/addons/core/functions/REINF/fn_vehiclePrice.sqf @@ -30,7 +30,7 @@ else else { _discount = 0 max ((tierWar - 4) * 0.5); //4 is the last war tier before discounts, the 0.5 makes the discount go from 0-3 instead of 0-6. - _costs = round (_costs - (_costs * 0.1 * _discount)); + _costs = 5 * round ((_costs - (_costs * 0.1 * _discount))/5); //Applies the discount, rounds to the nearest 5€ }; };