mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Advanced trading modifications, maintain_area modifications (#1780)
* Advanced trading modifications, maintain_area modifications
This lot of changes brings forth the following:
Sets up a "default" set of compiles that are the minimum needed for
maintain_area.sqf and custom scripts to utilize the gem based currency
that @icomrade added.
maintain_area.sqf: This will now utilize the gem based currency system.
Removed the redundant Z_Vehicle and replaced it with the Epoch built in
DZE_myVehicle
z_at_buyItems: Code tidying and optimization
z_at_checkCloseVehicle: Tidied up the code since removing Z_Vehicle
allowed us to remove some now useless code.
z_at_getVehicleItems: Removed the nearestObjects check for your vehicle
since we now do z_checkCloseVehicle on Advanced trading start up.
* Advanced trading missed redundant variables
As per description
* Advanced trading rework
We don't need to check for close vehicle anymore now for backpack money
since we've made z_vehicle redundant.
* Revert "Advanced trading rework"
This reverts commit a589bd19b9.
* Advanced trading rework
We don't need to check for close vehicle anymore now for backpack money
since we've made z_vehicle redundant.
* Advanced trading rework
More rework
* Remove single currency add/remove coins functions
at request of @ebaydayz.
This commit is contained in:
35
SQF/dayz_code/actions/AdvancedTrading/defaultInit.sqf
Normal file
35
SQF/dayz_code/actions/AdvancedTrading/defaultInit.sqf
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
private ["_tempGemList","_tempWorthList","_largest","_LargestGem"];
|
||||||
|
|
||||||
|
Z_SellingFrom = 2;
|
||||||
|
DZE_GemList = [];
|
||||||
|
DZE_GemWorthList = [];
|
||||||
|
|
||||||
|
_tempGemList = [];
|
||||||
|
_tempWorthList = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
_tempGemList set [(count _tempGemList), (_x select 0)];
|
||||||
|
_tempWorthList set [(count _tempWorthList), (_x select 1)];
|
||||||
|
} count DZE_GemWorthArray;
|
||||||
|
|
||||||
|
for "_i" from 0 to ((count _tempGemList) - 1) do {
|
||||||
|
_largest = -1e9;
|
||||||
|
|
||||||
|
{
|
||||||
|
_largest = _largest max _x;
|
||||||
|
} forEach _tempWorthList;
|
||||||
|
|
||||||
|
_LargestGem = _tempGemList select (_tempWorthList find _largest);
|
||||||
|
_tempWorthList = _tempWorthList - [_largest];
|
||||||
|
_tempGemList = _tempGemList - [_LargestGem];
|
||||||
|
DZE_GemList set [(count DZE_GemList), _LargestGem];
|
||||||
|
DZE_GemWorthList set [(count DZE_GemWorthList), _largest];
|
||||||
|
};
|
||||||
|
|
||||||
|
Z_checkCloseVehicle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_checkCloseVehicle.sqf");
|
||||||
|
Z_canAfford = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_canAfford.sqf");
|
||||||
|
Z_calcFreeSpace = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcFreeSpace.sqf");
|
||||||
|
Z_returnChange = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_returnChange.sqf");
|
||||||
|
Z_payDefault = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_payDefault.sqf");
|
||||||
|
z_calcDefaultCurrencyNoImg = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcDefaultCurrencyNoImg.sqf");
|
||||||
|
ZUPA_fnc_removeWeaponsAndMagazinesCargo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\zupa_fnc_removeWeaponsAndMagazinesCargo.sqf");
|
||||||
@@ -38,7 +38,7 @@ if ((count _VehKey2) > 0) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
_vehicle = Z_vehicle;
|
_vehicle = DZE_myVehicle;
|
||||||
if (count _this > 2 && {isNull _vehicle}) then {
|
if (count _this > 2 && {isNull _vehicle}) then {
|
||||||
_vehicle = _this select 2;
|
_vehicle = _this select 2;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
private ["_player","_amount","_wealth","_newwealth", "_result"];
|
|
||||||
|
|
||||||
_player = _this select 0;
|
|
||||||
_amount = _this select 1;
|
|
||||||
_result = false;
|
|
||||||
_wealth = _player getVariable[Z_MoneyVariable,0];
|
|
||||||
_player setVariable[Z_MoneyVariable,_wealth + _amount, true];
|
|
||||||
// can't use (magazines _player), server_playerSync expects nested array with ammo counts from player_countMagazines
|
|
||||||
// also fourth parameter in PVDZ_plr_Save is now used for achievements
|
|
||||||
if (_player == player) then {call player_forceSave;};
|
|
||||||
_player setVariable ["moneychanged",1,true];
|
|
||||||
_newwealth = _player getVariable[Z_MoneyVariable,0];
|
|
||||||
if (_newwealth >= _wealth) then { _result = true; };
|
|
||||||
|
|
||||||
_result
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
private ["_player","_amount","_wealth","_newwealth", "_result"];
|
|
||||||
|
|
||||||
_player = _this select 0;
|
|
||||||
_amount = _this select 1;
|
|
||||||
_result = false;
|
|
||||||
_wealth = _player getVariable[Z_MoneyVariable,0];
|
|
||||||
if (_amount > 0) then {
|
|
||||||
if (_wealth < _amount) then {
|
|
||||||
_result = false;
|
|
||||||
} else {
|
|
||||||
_newwealth = _wealth - _amount;
|
|
||||||
_player setVariable[Z_MoneyVariable,_newwealth, true];
|
|
||||||
_player setVariable ["moneychanged",1,true];
|
|
||||||
_result = true;
|
|
||||||
// can't use (magazines _player), server_playerSync expects nested array with ammo counts from player_countMagazines
|
|
||||||
// also fourth parameter in PVDZ_plr_Save is now used for achievements
|
|
||||||
if (_player == player) then { call player_forceSave; };
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
_result = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
_result
|
|
||||||
@@ -105,8 +105,8 @@ if (_selection == 2) then { //gear
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_selection == 1) then { //vehicle
|
if (_selection == 1) then { //vehicle
|
||||||
if (!isNull Z_vehicle) then {
|
if (!isNull DZE_myVehicle) then {
|
||||||
_freeSpace = [Z_vehicle,0,0,0,0] call Z_calcFreeSpace;
|
_freeSpace = [DZE_myVehicle,0,0,0,0] call Z_calcFreeSpace;
|
||||||
_allowedMags = _freeSpace select 1;
|
_allowedMags = _freeSpace select 1;
|
||||||
_allowedWeapons = _freeSpace select 2;
|
_allowedWeapons = _freeSpace select 2;
|
||||||
_allowedBackpacks = _freeSpace select 3;
|
_allowedBackpacks = _freeSpace select 3;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
private ["_activatingPlayer","_bTotal","_backpack","_backpacksToBuy","_buyVehicle","_buyingType","_canBuy","_count","_dir","_enoughMoney","_hasPrimary","_helipad","_isKeyOK","_item2Add","_itemsToLog","_keyColor","_keyNumber","_keySelected","_location","_moneyInfo","_myMoney","_parentClasses","_part_out","_pistolMagsToBuy","_priceToBuy","_primaryToBuy","_regularMagsToBuy","_sidearmToBuy","_sign","_success","_tCost","_toolAmounts","_toolClasses","_toolsToBuy","_vehiclesToBuy","_weaponsToBuy"];
|
private ["_activatingPlayer","_bTotal","_backpack","_backpacksToBuy","_buyVehicle","_buyingType","_canBuy","_count","_dir","_enoughMoney","_hasPrimary","_helipad","_isKeyOK","_item2Add","_itemsToLog","_keyColor","_keyNumber","_keySelected","_location","_moneyInfo","_wealth","_parentClasses","_part_out","_pistolMagsToBuy","_priceToBuy","_primaryToBuy","_regularMagsToBuy","_sidearmToBuy","_sign","_success","_tCost","_toolAmounts","_toolClasses","_toolsToBuy","_vehiclesToBuy","_weaponsToBuy"];
|
||||||
|
|
||||||
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
|
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
|
||||||
|
|
||||||
@@ -96,18 +96,14 @@ if (Z_SingleCurrency) then {
|
|||||||
_canBuy = [_weaponsToBuy,[_pistolMagsToBuy,_regularMagsToBuy],_backpacksToBuy,_toolsToBuy,_sidearmToBuy,_primaryToBuy,_vehiclesToBuy,_toolClasses,_toolAmounts] call Z_allowBuying;
|
_canBuy = [_weaponsToBuy,[_pistolMagsToBuy,_regularMagsToBuy],_backpacksToBuy,_toolsToBuy,_sidearmToBuy,_primaryToBuy,_vehiclesToBuy,_toolClasses,_toolAmounts] call Z_allowBuying;
|
||||||
if (!_canBuy) exitWith {}; // Keep systemChat reasons for failure in Z_allowBuying for sanity
|
if (!_canBuy) exitWith {}; // Keep systemChat reasons for failure in Z_allowBuying for sanity
|
||||||
|
|
||||||
_myMoney = player getVariable[Z_MoneyVariable,0];
|
_wealth = player getVariable[Z_MoneyVariable,0];
|
||||||
|
|
||||||
_enoughMoney = false;
|
_enoughMoney = false;
|
||||||
|
|
||||||
_moneyInfo = [false, [], [], [], 0];
|
_moneyInfo = [false, [], [], [], 0];
|
||||||
|
|
||||||
if (Z_SingleCurrency) then {
|
if (Z_SingleCurrency) then {
|
||||||
if (_myMoney >= _priceToBuy) then {
|
_enoughMoney = if (_wealth >= _priceToBuy) then { true } else { false };
|
||||||
_enoughMoney = true;
|
|
||||||
} else {
|
|
||||||
_enoughMoney = false;
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
_moneyInfo = _priceToBuy call Z_canAfford;
|
_moneyInfo = _priceToBuy call Z_canAfford;
|
||||||
_enoughMoney = _moneyInfo select 0;
|
_enoughMoney = _moneyInfo select 0;
|
||||||
@@ -157,7 +153,6 @@ if (_enoughMoney) then {
|
|||||||
publicVariableServer "PVDZE_veh_Publish2";
|
publicVariableServer "PVDZE_veh_Publish2";
|
||||||
_keySelected;
|
_keySelected;
|
||||||
};
|
};
|
||||||
//systemChat localize "STR_EPOCH_PLAYER_105"; // "Stand still to complete trade". Medic animation loop no longer used.
|
|
||||||
|
|
||||||
closeDialog 2;
|
closeDialog 2;
|
||||||
_item2Add = "0";
|
_item2Add = "0";
|
||||||
@@ -189,26 +184,26 @@ if (_enoughMoney) then {
|
|||||||
if (Z_SellingFrom == 1) then { //vehicle
|
if (Z_SellingFrom == 1) then { //vehicle
|
||||||
{
|
{
|
||||||
if (_x select 1 == "trade_weapons") then {
|
if (_x select 1 == "trade_weapons") then {
|
||||||
Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9];
|
DZE_myVehicle addWeaponCargoGlobal [_x select 0, _x select 9];
|
||||||
};
|
};
|
||||||
if (_x select 1 == "trade_items") then {
|
if (_x select 1 == "trade_items") then {
|
||||||
Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9];
|
DZE_myVehicle addMagazineCargoGlobal [_x select 0, _x select 9];
|
||||||
};
|
};
|
||||||
if (_x select 1 == "trade_backpacks") then {
|
if (_x select 1 == "trade_backpacks") then {
|
||||||
Z_vehicle addBackpackCargoGlobal [_x select 0, _x select 9];
|
DZE_myVehicle addBackpackCargoGlobal [_x select 0, _x select 9];
|
||||||
};
|
};
|
||||||
if ((_x select 1) in DZE_tradeVehicle) then {
|
if ((_x select 1) in DZE_tradeVehicle) then {
|
||||||
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
_item2Add = [(_x select 0), (_x select 1)] call _buyVehicle;
|
||||||
if (_item2Add != "0") then {
|
if (_item2Add != "0") then {
|
||||||
Z_vehicle addWeaponCargoGlobal [_item2Add, 1];
|
DZE_myVehicle addWeaponCargoGlobal [_item2Add, 1];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
_bTotal = _bTotal + (_x select 9);
|
_bTotal = _bTotal + (_x select 9);
|
||||||
} count Z_BuyingArray;
|
} count Z_BuyingArray;
|
||||||
if (_item2Add != "0") then {
|
if (_item2Add != "0") then {
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_VEHICLE",(Z_BuyingArray select 0) select 3,typeOf (Z_vehicle)];
|
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_VEHICLE",(Z_BuyingArray select 0) select 3,typeOf (DZE_myVehicle)];
|
||||||
} else {
|
} else {
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf Z_vehicle];
|
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf DZE_myVehicle];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -250,29 +245,29 @@ if (_enoughMoney) then {
|
|||||||
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
|
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (!Z_SingleCurrency) then {
|
|
||||||
_success = [player,_priceToBuy,_moneyInfo,false,0] call Z_payDefault;
|
_success = if (Z_SingleCurrency) then {_priceToBuy <= _wealth} else {[player,_priceToBuy,_moneyInfo,false,0] call Z_payDefault};
|
||||||
|
|
||||||
if (_success) then {
|
if (_success) then {
|
||||||
|
if (Z_SingleCurrency) then {
|
||||||
|
player setVariable[Z_MoneyVariable,(_wealth - _priceToBuy),true];
|
||||||
|
systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_COINS",[_priceToBuy] call BIS_fnc_numberText,CurrencyName];
|
||||||
|
} else {
|
||||||
_tCost = "";
|
_tCost = "";
|
||||||
_tCost = _priceToBuy call z_calcDefaultCurrencyNoImg;
|
_tCost = _priceToBuy call z_calcDefaultCurrencyNoImg;
|
||||||
if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_BUY_SUCCESS",_tCost]; };
|
if (_tCost != "") then { systemChat format[localize "STR_EPOCH_TRADE_BUY_SUCCESS",_tCost]; };
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
systemChat localize "STR_EPOCH_TRADE_DEBUG";
|
systemChat localize "STR_EPOCH_TRADE_DEBUG";
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
_success = [player,_priceToBuy] call SC_fnc_removeCoins;
|
|
||||||
if (_success) then {
|
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_COINS",[_priceToBuy] call BIS_fnc_numberText,CurrencyName];
|
|
||||||
} else {
|
|
||||||
systemChat localize "STR_EPOCH_TRADE_DEBUG";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
_itemsToLog call Z_logTrade;
|
_itemsToLog call Z_logTrade;
|
||||||
call player_forceSave;
|
call player_forceSave;
|
||||||
if (Z_SellingFrom == 1) then {
|
if (Z_SellingFrom == 1) then {
|
||||||
PVDZ_veh_Save = [Z_vehicle,"gear"];
|
PVDZ_veh_Save = [DZE_myVehicle,"gear"];
|
||||||
publicVariableServer "PVDZ_veh_Save";
|
publicVariableServer "PVDZ_veh_Save";
|
||||||
};
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (Z_SingleCurrency) then {
|
if (Z_SingleCurrency) then {
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_NEED_COINS",[_priceToBuy] call BIS_fnc_numberText,CurrencyName];
|
systemChat format[localize "STR_EPOCH_TRADE_NEED_COINS",[_priceToBuy] call BIS_fnc_numberText,CurrencyName];
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ if (Z_AllowTakingMoneyFromBackpack) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (Z_AllowTakingMoneyFromVehicle) then {
|
if (Z_AllowTakingMoneyFromVehicle) then {
|
||||||
if (!isNull Z_vehicle) then {
|
if (!isNull DZE_myVehicle) then {
|
||||||
_mags = getMagazineCargo Z_vehicle;
|
_mags = getMagazineCargo DZE_myVehicle;
|
||||||
_vehicleMoney = [];
|
_vehicleMoney = [];
|
||||||
_kinds = _mags select 0;
|
_kinds = _mags select 0;
|
||||||
_amounts = _mags select 1;
|
_amounts = _mags select 1;
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ _vehTrade = false;
|
|||||||
_vehUpgraded = "";
|
_vehUpgraded = "";
|
||||||
|
|
||||||
if (false call Z_checkCloseVehicle) then {
|
if (false call Z_checkCloseVehicle) then {
|
||||||
_vehUpgraded = getText (configFile >> 'CfgVehicles' >> typeOf (Z_vehicle) >> 'original');
|
_vehUpgraded = getText (configFile >> 'CfgVehicles' >> typeOf (DZE_myVehicle) >> 'original');
|
||||||
_all = _weaps + _mags + _bags + [(typeOf Z_vehicle)];
|
_all = _weaps + _mags + _bags + [(typeOf DZE_myVehicle)];
|
||||||
_vehTrade = true;
|
_vehTrade = true;
|
||||||
} else {
|
} else {
|
||||||
_all = _weaps + _mags + _bags;
|
_all = _weaps + _mags + _bags;
|
||||||
@@ -56,7 +56,7 @@ _totalPrice = 0;
|
|||||||
if (isNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")) then {
|
if (isNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")) then {
|
||||||
_cat = format["Category_%1",getNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")];
|
_cat = format["Category_%1",getNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")];
|
||||||
};
|
};
|
||||||
if (_vehUpgraded != "" && _y == (typeOf Z_vehicle)) then { _y = _vehUpgraded; };
|
if (_vehUpgraded != "" && _y == (typeOf DZE_myVehicle)) then { _y = _vehUpgraded; };
|
||||||
_exists = isClass(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y);
|
_exists = isClass(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y);
|
||||||
if (_exists) exitWith {
|
if (_exists) exitWith {
|
||||||
_pic = "";
|
_pic = "";
|
||||||
@@ -84,9 +84,9 @@ _totalPrice = 0;
|
|||||||
|
|
||||||
if (isNil '_text') then { _text = _y; };
|
if (isNil '_text') then { _text = _y; };
|
||||||
_HasKey = true;
|
_HasKey = true;
|
||||||
if (_vehTrade && {(typeOf Z_vehicle) == _y}) then {
|
if (_vehTrade && {(typeOf DZE_myVehicle) == _y}) then {
|
||||||
if (!(_type in DZE_tradeVehicleKeyless) && DZE_SaleRequiresKey) then {
|
if (!(_type in DZE_tradeVehicleKeyless) && DZE_SaleRequiresKey) then {
|
||||||
_HasKey = [Z_vehicle, _all] call _HasKeyCheck;
|
_HasKey = [DZE_myVehicle, _all] call _HasKeyCheck;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (!_HasKey) exitWith {};
|
if (!_HasKey) exitWith {};
|
||||||
|
|||||||
@@ -1,25 +1,17 @@
|
|||||||
private ["_vehicle","_list","_result","_pos"];
|
private ["_list","_result","_pos"];
|
||||||
|
|
||||||
Z_vehicle = objNull;
|
_result = false;
|
||||||
_vehicle = objNull;
|
|
||||||
_pos = [player] call FNC_GetPos;
|
_pos = [player] call FNC_GetPos;
|
||||||
_list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance];
|
_list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance];
|
||||||
|
|
||||||
if (!isNull DZE_myVehicle && local DZE_myVehicle && alive DZE_myVehicle && DZE_myVehicle in _list) then {
|
if (!isNull DZE_myVehicle && {local DZE_myVehicle} && {alive DZE_myVehicle} && {DZE_myVehicle in _list}) then {
|
||||||
_vehicle = DZE_myVehicle;
|
|
||||||
};
|
|
||||||
|
|
||||||
_result = false;
|
|
||||||
|
|
||||||
if (!isNull _vehicle) then {
|
|
||||||
Z_vehicle = _vehicle;
|
|
||||||
_result = true;
|
_result = true;
|
||||||
if (_this) then { // Set trade title, don't set on menu start up since gear is selected initially.
|
if (_this) then { // Set trade title, don't set on menu start up since gear is selected initially.
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_SELECTED",typeOf Z_vehicle];
|
systemChat format[localize "STR_EPOCH_TRADE_SELECTED",typeOf DZE_myVehicle];
|
||||||
if (Z_Selling) then {
|
if (Z_Selling) then {
|
||||||
[format[localize "STR_EPOCH_TRADE_SELLING_FROM", typeOf Z_vehicle]] call Z_fillTradeTitle;
|
[format[localize "STR_EPOCH_TRADE_SELLING_FROM", typeOf DZE_myVehicle]] call Z_fillTradeTitle;
|
||||||
} else {
|
} else {
|
||||||
[format[localize "STR_EPOCH_TRADE_BUYING_IN", typeOf Z_vehicle]] call Z_fillTradeTitle;
|
[format[localize "STR_EPOCH_TRADE_BUYING_IN", typeOf DZE_myVehicle]] call Z_fillTradeTitle;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ if (_selection == 1) then { //vehicle
|
|||||||
_allowedWeapons = 0;
|
_allowedWeapons = 0;
|
||||||
_allowedBackpacks = 0;
|
_allowedBackpacks = 0;
|
||||||
|
|
||||||
if (!isNull Z_vehicle) then {
|
if (!isNull DZE_myVehicle) then {
|
||||||
_freeSpace = [Z_vehicle,0,0,0,0] call Z_calcFreeSpace;
|
_freeSpace = [DZE_myVehicle,0,0,0,0] call Z_calcFreeSpace;
|
||||||
_allowedMags = _freeSpace select 1;
|
_allowedMags = _freeSpace select 1;
|
||||||
_allowedWeapons = _freeSpace select 2;
|
_allowedWeapons = _freeSpace select 2;
|
||||||
_allowedBackpacks = _freeSpace select 3;
|
_allowedBackpacks = _freeSpace select 3;
|
||||||
|
|
||||||
_pic = getText (configFile >> "CfgVehicles" >> (typeOf Z_vehicle) >> "picture");
|
_pic = getText (configFile >> "CfgVehicles" >> (typeOf DZE_myVehicle) >> "picture");
|
||||||
|
|
||||||
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText format [
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText format [
|
||||||
"<img image='%1' size='3' align='center'/>"
|
"<img image='%1' size='3' align='center'/>"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ _typeOf = typeOf (unitBackPack player);
|
|||||||
_type = _x select 1;
|
_type = _x select 1;
|
||||||
_count = 0;
|
_count = 0;
|
||||||
|
|
||||||
if (_type in DZE_tradeVehicle && {_name == typeOf Z_vehicle}) then {
|
if (_type in DZE_tradeVehicle && {_name == typeOf DZE_myVehicle}) then {
|
||||||
_count = 1;
|
_count = 1;
|
||||||
};
|
};
|
||||||
if (_type == "trade_items") then {
|
if (_type == "trade_items") then {
|
||||||
|
|||||||
@@ -3,24 +3,15 @@
|
|||||||
*
|
*
|
||||||
* Gets all your items stored in your vehicle and initiates the selling list.
|
* Gets all your items stored in your vehicle and initiates the selling list.
|
||||||
**/
|
**/
|
||||||
private ["_vehicle","_pos","_list","_formattedText","_pic","_normalMags","_normalWeaps","_freeSpace"];
|
private ["_formattedText","_pic","_normalMags","_normalWeaps","_freeSpace"];
|
||||||
#include "defines.hpp"
|
#include "defines.hpp"
|
||||||
|
|
||||||
Z_vehicle = objNull;
|
|
||||||
call Z_clearLists;
|
call Z_clearLists;
|
||||||
Z_SellableArray = [];
|
Z_SellableArray = [];
|
||||||
Z_SellArray = [];
|
Z_SellArray = [];
|
||||||
_vehicle = objNull;
|
|
||||||
|
|
||||||
_pos = [player] call FNC_GetPos;
|
if (!isNull DZE_myVehicle) then {
|
||||||
_list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance];
|
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf DZE_myVehicle) >> 'picture');
|
||||||
|
|
||||||
if (!isNull DZE_myVehicle && local DZE_myVehicle && alive DZE_myVehicle && DZE_myVehicle in _list) then {
|
|
||||||
_vehicle = DZE_myVehicle;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!isNull _vehicle) then {
|
|
||||||
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> 'picture');
|
|
||||||
|
|
||||||
_formattedText = format [
|
_formattedText = format [
|
||||||
"<img image='%1' size='3' align='center'/>"
|
"<img image='%1' size='3' align='center'/>"
|
||||||
@@ -28,13 +19,12 @@ if (!isNull _vehicle) then {
|
|||||||
];
|
];
|
||||||
|
|
||||||
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText;
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText;
|
||||||
Z_vehicle = _vehicle;
|
_freeSpace = [DZE_myVehicle,0,0,0,0] call Z_calcFreeSpace;
|
||||||
_freeSpace = [_vehicle,0,0,0,0] call Z_calcFreeSpace;
|
|
||||||
_normalMags = _freeSpace select 5;
|
_normalMags = _freeSpace select 5;
|
||||||
_normalWeaps = _freeSpace select 6;
|
_normalWeaps = _freeSpace select 6;
|
||||||
//_normalBags = _freeSpace select 7;
|
//_normalBags = _freeSpace select 7;
|
||||||
// Don't allow selling backpacks from vehicles because we can not get backpack contents.
|
// Don't allow selling backpacks from vehicles because we can not get backpack contents.
|
||||||
// We can only remove all backpacks with clearBackpackCargo and then add back new empty backpacks for ones that weren't sold.
|
// We can only remove all backpacks with clearBackpackCargo and then add back new empty backpacks for ones that weren't sold.
|
||||||
|
|
||||||
[_normalWeaps,_normalMags,typeOf _vehicle,[]] call Z_checkArrayInConfig;
|
[_normalWeaps,_normalMags,typeOf DZE_myVehicle,[]] call Z_checkArrayInConfig;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ if (!_justChecking) then {
|
|||||||
if (count _moneyInBackpack > 0) then {
|
if (count _moneyInBackpack > 0) then {
|
||||||
_nil = [unitBackpack _player, _moneyInBackpack, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
_nil = [unitBackpack _player, _moneyInBackpack, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
||||||
};
|
};
|
||||||
if (!isNull Z_vehicle && count _moneyInVehicle > 0) then {
|
if (!isNull DZE_myVehicle && count _moneyInVehicle > 0) then {
|
||||||
_nil = [Z_vehicle, _moneyInVehicle, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
_nil = [DZE_myVehicle, _moneyInVehicle, [], []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
private ["_tempArray","_outcome","_vehCheckArray","_vehArray","_weaponsArray","_itemsArray","_bpArray","_bpCheckArray","_weaponsCheckArray","_itemsCheckArray","_VehKey","_wA","_mA","_money","_itemData","_success","_bag","_itemsToLog","_tCost","_tSold"];
|
private ["_tempArray","_outcome","_vehCheckArray","_vehArray","_weaponsArray","_itemsArray","_bpArray","_bpCheckArray","_weaponsCheckArray","_itemsCheckArray","_VehKey","_wA","_mA","_money","_itemData","_success","_bag","_itemsToLog","_tCost","_tSold","_wealth"];
|
||||||
|
|
||||||
if (count Z_SellArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_SELL_NO_ITEMS"; };
|
if (count Z_SellArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_SELL_NO_ITEMS"; };
|
||||||
if (Z_SellingFrom == 1 && (isNull Z_vehicle or !local Z_vehicle)) exitWith { systemChat localize "STR_EPOCH_PLAYER_245"; };
|
if (Z_SellingFrom == 1 && (isNull DZE_myVehicle or !local DZE_myVehicle)) exitWith { systemChat localize "STR_EPOCH_PLAYER_245"; };
|
||||||
|
|
||||||
_tempArray = Z_SellArray;
|
_tempArray = Z_SellArray;
|
||||||
closeDialog 2;
|
closeDialog 2;
|
||||||
@@ -17,15 +17,14 @@ _itemsCheckArray = [];
|
|||||||
_itemsToLog = [[],[],[],"sell"];
|
_itemsToLog = [[],[],[],"sell"];
|
||||||
|
|
||||||
_sellVehicle = {
|
_sellVehicle = {
|
||||||
private ["_distance","_damage","_tireDmg","_tires","_okToSell","_returnInfo","_obj","_hitpoints","_objectID","_objectUID","_objectCharacterId","_notSetup","_part_in","_qty_in","_activatingPlayer","_objects","_qty","_vehicle"];
|
private ["_damage","_tireDmg","_tires","_okToSell","_returnInfo","_obj","_hitpoints","_objectID","_objectUID","_objectCharacterId","_notSetup","_part_in","_qty_in","_activatingPlayer","_objects","_qty","_vehicle"];
|
||||||
_vehicle = _this select 0;
|
_vehicle = _this select 0;
|
||||||
_sellType = _this select 1;
|
_sellType = _this select 1;
|
||||||
_part_in = typeOf _vehicle;
|
_part_in = typeOf _vehicle;
|
||||||
_qty_in = 1;
|
_qty_in = 1;
|
||||||
_activatingPlayer = player;
|
_activatingPlayer = player;
|
||||||
_distance = Z_VehicleDistance;
|
|
||||||
_returnInfo = [];
|
_returnInfo = [];
|
||||||
_objects = nearestObjects [(getPosATL player), [_part_in], _distance];
|
_objects = nearestObjects [(getPosATL player), [_part_in], Z_VehicleDistance];
|
||||||
_qty = ({(typeOf _x) == _part_in} count _objects);
|
_qty = ({(typeOf _x) == _part_in} count _objects);
|
||||||
if (_qty >= _qty_in) then {
|
if (_qty >= _qty_in) then {
|
||||||
_obj = (_objects select 0);
|
_obj = (_objects select 0);
|
||||||
@@ -91,8 +90,8 @@ _sellVehicle = {
|
|||||||
};
|
};
|
||||||
case (_type in DZE_tradeVehicle) :
|
case (_type in DZE_tradeVehicle) :
|
||||||
{
|
{
|
||||||
if (local Z_vehicle) then {
|
if (local DZE_myVehicle) then {
|
||||||
_VehKey = [Z_vehicle, _type] call _sellVehicle;
|
_VehKey = [DZE_myVehicle, _type] call _sellVehicle;
|
||||||
if (count _VehKey > 0) then {
|
if (count _VehKey > 0) then {
|
||||||
_vehArray set [count(_vehArray),_VehKey];
|
_vehArray set [count(_vehArray),_VehKey];
|
||||||
_vehCheckArray set [count(_vehCheckArray),[_x select 2, _x select 11]];
|
_vehCheckArray set [count(_vehCheckArray),[_x select 2, _x select 11]];
|
||||||
@@ -111,11 +110,11 @@ if (Z_SellingFrom == 0) then {
|
|||||||
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_BACKPACK",count _tSold];
|
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_BACKPACK",count _tSold];
|
||||||
};
|
};
|
||||||
if (Z_SellingFrom == 1) then {
|
if (Z_SellingFrom == 1) then {
|
||||||
_outcome = [Z_vehicle,_itemsArray,_weaponsArray,_vehArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
_outcome = [DZE_myVehicle,_itemsArray,_weaponsArray,_vehArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_VEHICLE",count _tSold,typeOf Z_vehicle];
|
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_VEHICLE",count _tSold,typeOf DZE_myVehicle];
|
||||||
};
|
};
|
||||||
|
|
||||||
_itemsToLog set [0,(_itemsArray + _weaponsArray + _bpArray + [typeOf Z_vehicle])];
|
_itemsToLog set [0,(_itemsArray + _weaponsArray + _bpArray + [typeOf DZE_myVehicle])];
|
||||||
|
|
||||||
//gear
|
//gear
|
||||||
if (Z_SellingFrom == 2) then {
|
if (Z_SellingFrom == 2) then {
|
||||||
@@ -222,7 +221,8 @@ if (Z_SingleCurrency) then {
|
|||||||
|
|
||||||
if (typeName _money == "SCALAR") then {
|
if (typeName _money == "SCALAR") then {
|
||||||
if (Z_SingleCurrency) then {
|
if (Z_SingleCurrency) then {
|
||||||
_success = [player,_money] call SC_fnc_addCoins;
|
_wealth = player getVariable[Z_MoneyVariable,0];
|
||||||
|
player setVariable[Z_MoneyVariable,(_wealth + _money),true];
|
||||||
systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_CHANGE",[_money] call BIS_fnc_numberText,CurrencyName];
|
systemChat format[localize "STR_EPOCH_TRADE_SUCCESS_CHANGE",[_money] call BIS_fnc_numberText,CurrencyName];
|
||||||
} else {
|
} else {
|
||||||
_success = [_money,0,false,0,[],[],false] call Z_returnChange;
|
_success = [_money,0,false,0,[],[],false] call Z_returnChange;
|
||||||
@@ -233,7 +233,7 @@ if (typeName _money == "SCALAR") then {
|
|||||||
_itemsToLog call Z_logTrade;
|
_itemsToLog call Z_logTrade;
|
||||||
call player_forceSave;
|
call player_forceSave;
|
||||||
if (Z_SellingFrom == 1) then {
|
if (Z_SellingFrom == 1) then {
|
||||||
PVDZ_veh_Save = [Z_vehicle,"gear"];
|
PVDZ_veh_Save = [DZE_myVehicle,"gear"];
|
||||||
publicVariableServer "PVDZ_veh_Save";
|
publicVariableServer "PVDZ_veh_Save";
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,33 +10,11 @@ if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call da
|
|||||||
|
|
||||||
if (isNil "Z_AdvancedTradingInit") then {
|
if (isNil "Z_AdvancedTradingInit") then {
|
||||||
|
|
||||||
//#include "config.sqf"; // Moved to dayz_code/configVariables.sqf
|
|
||||||
#include "\z\addons\dayz_code\actions\AdvancedTrading\functions\defines.hpp"
|
#include "\z\addons\dayz_code\actions\AdvancedTrading\functions\defines.hpp"
|
||||||
|
|
||||||
/* Configs that needs to be defined but not changed in config file */
|
/* Configs that needs to be defined but not changed in config file */
|
||||||
|
|
||||||
_tempGemList = [];
|
|
||||||
_tempWorthList = [];
|
|
||||||
DZE_GemList = [];
|
|
||||||
DZE_GemWorthList = [];
|
|
||||||
{
|
|
||||||
_tempGemList set [(count _tempGemList), (_x select 0)];
|
|
||||||
_tempWorthList set [(count _tempWorthList), (_x select 1)];
|
|
||||||
} count DZE_GemWorthArray;
|
|
||||||
|
|
||||||
//sort the array
|
|
||||||
for "_i" from 0 to ((count _tempGemList) - 1) do {
|
|
||||||
_largest = _tempWorthList call BIS_fnc_greatestNum;
|
|
||||||
_LargestGem = _tempGemList select (_tempWorthList find _largest);
|
|
||||||
_tempWorthList = _tempWorthList - [_largest];
|
|
||||||
_tempGemList = _tempGemList - [_LargestGem];
|
|
||||||
DZE_GemList set [(count DZE_GemList), _LargestGem];
|
|
||||||
DZE_GemWorthList set [(count DZE_GemWorthList), _largest];
|
|
||||||
};
|
|
||||||
|
|
||||||
Z_Selling = true;
|
Z_Selling = true;
|
||||||
Z_SellingFrom = 2;
|
|
||||||
Z_vehicle = objNull;
|
|
||||||
Z_OriginalSellableArray = [];
|
Z_OriginalSellableArray = [];
|
||||||
Z_SellableArray = [];
|
Z_SellableArray = [];
|
||||||
Z_SellArray = [];
|
Z_SellArray = [];
|
||||||
@@ -46,8 +24,6 @@ if (isNil "Z_AdvancedTradingInit") then {
|
|||||||
|
|
||||||
/* end script config */
|
/* end script config */
|
||||||
|
|
||||||
ZUPA_fnc_removeWeaponsAndMagazinesCargo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\zupa_fnc_removeWeaponsAndMagazinesCargo.sqf");
|
|
||||||
|
|
||||||
Z_fillTradeTitle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillTradeTitle.sqf");
|
Z_fillTradeTitle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillTradeTitle.sqf");
|
||||||
Z_clearLists = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearLists.sqf");
|
Z_clearLists = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearLists.sqf");
|
||||||
Z_clearSellableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearSellableList.sqf");
|
Z_clearSellableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearSellableList.sqf");
|
||||||
@@ -84,15 +60,9 @@ if (isNil "Z_AdvancedTradingInit") then {
|
|||||||
Z_calcBuyableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcBuyableList.sqf");
|
Z_calcBuyableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcBuyableList.sqf");
|
||||||
Z_fillBuyableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillBuyableList.sqf");
|
Z_fillBuyableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillBuyableList.sqf");
|
||||||
Z_fillBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillBuyingList.sqf");
|
Z_fillBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillBuyingList.sqf");
|
||||||
Z_calcFreeSpace = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcFreeSpace.sqf");
|
|
||||||
Z_displayFreeSpace = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_displayFreeSpace.sqf");
|
Z_displayFreeSpace = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_displayFreeSpace.sqf");
|
||||||
Z_checkCloseVehicle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_checkCloseVehicle.sqf");
|
|
||||||
Z_allowBuying = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_allowBuying.sqf");
|
Z_allowBuying = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_allowBuying.sqf");
|
||||||
Z_canAfford = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_canAfford.sqf");
|
|
||||||
Z_returnChange = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_returnChange.sqf");
|
|
||||||
Z_payDefault = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_payDefault.sqf");
|
|
||||||
Z_calcDefaultCurrency = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcDefaultCurrency.sqf");
|
Z_calcDefaultCurrency = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcDefaultCurrency.sqf");
|
||||||
z_calcDefaultCurrencyNoImg = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcDefaultCurrencyNoImg.sqf");
|
|
||||||
DZE_deleteTradedVehicle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\DZE_deleteTradedVehicle.sqf");
|
DZE_deleteTradedVehicle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\DZE_deleteTradedVehicle.sqf");
|
||||||
|
|
||||||
Z_AdvancedTradingInit = true;
|
Z_AdvancedTradingInit = true;
|
||||||
|
|||||||
@@ -19,72 +19,63 @@ _requirements = [];
|
|||||||
_count = 0;
|
_count = 0;
|
||||||
|
|
||||||
_req = {
|
_req = {
|
||||||
private ["_count","_requirements","_type","_amount","_itemText","_wealth"];
|
private ["_count","_amount","_itemText"];
|
||||||
|
|
||||||
_count = _this;
|
_count = _this;
|
||||||
_wealth = 0;
|
|
||||||
|
|
||||||
_requirements = switch true do {
|
|
||||||
case (_count <= 10): {["ItemGoldBar10oz",1]};
|
|
||||||
case (_count <= 20): {["ItemGoldBar10oz",2]};
|
|
||||||
case (_count <= 35): {["ItemGoldBar10oz",3]};
|
|
||||||
case (_count <= 50): {["ItemGoldBar10oz",4]};
|
|
||||||
case (_count <= 75): {["ItemGoldBar10oz",6]};
|
|
||||||
case (_count <= 100): {["ItemBriefcase100oz",1]};
|
|
||||||
case (_count <= 175): {["ItemBriefcase100oz",2]};
|
|
||||||
case (_count <= 250): {["ItemBriefcase100oz",3]};
|
|
||||||
case (_count <= 325): {["ItemBriefcase100oz",4]};
|
|
||||||
case (_count <= 400): {["ItemBriefcase100oz",5]};
|
|
||||||
case (_count <= 475): {["ItemBriefcase100oz",6]};
|
|
||||||
case (_count <= 550): {["ItemBriefcase100oz",7]};
|
|
||||||
case (_count <= 625): {["ItemBriefcase100oz",8]};
|
|
||||||
case (_count > 625): {["ItemBriefcase100oz",9]};
|
|
||||||
};
|
|
||||||
|
|
||||||
_type = _requirements select 0;
|
|
||||||
_amount = _requirements select 1;
|
|
||||||
|
|
||||||
if (Z_SingleCurrency) then {
|
|
||||||
_amount = _count * 100;
|
_amount = _count * 100;
|
||||||
_itemText = CurrencyName;
|
_itemText = if (Z_SingleCurrency) then { CurrencyName } else { _amount call z_calcDefaultCurrencyNoImg };
|
||||||
_wealth = player getVariable[Z_MoneyVariable,0];
|
|
||||||
} else {
|
|
||||||
_itemText = getText(configFile >> "CfgMagazines" >> _type >> "displayName");
|
|
||||||
if ("ItemBriefcase100oz" == _type && _amount > 1) then {
|
|
||||||
_itemText = _itemText + "s";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
[_type,_amount,_itemText,_wealth]
|
[_amount,_itemText]
|
||||||
};
|
};
|
||||||
|
|
||||||
_maintain = {
|
_maintain = {
|
||||||
private ["_requirements","_count","_type","_amount","_itemText","_wealth","_success","_message1","_message2","_ctrl"];
|
private ["_requirements","_count","_amount","_itemText","_wealth","_success","_message1","_message2","_ctrl","_enoughMoney","_moneyInfo"];
|
||||||
|
|
||||||
_count = count (_this select 0);
|
_count = count (_this select 0);
|
||||||
_requirements = _count call _req;
|
_requirements = _count call _req;
|
||||||
|
|
||||||
_type = _requirements select 0;
|
_amount = _requirements select 0;
|
||||||
_amount = _requirements select 1;
|
_itemText = _requirements select 1;
|
||||||
_itemText = _requirements select 2;
|
|
||||||
_wealth = _requirements select 3;
|
|
||||||
|
|
||||||
_success = if (Z_SingleCurrency) then {_amount <= _wealth} else {[[[_type, _amount]],0] call epoch_returnChange};
|
_enoughMoney = false;
|
||||||
|
_moneyInfo = [false, [], [], [], 0];
|
||||||
if (_success) then {
|
_wealth = player getVariable[Z_MoneyVariable,0];
|
||||||
player playActionNow "Medic";
|
|
||||||
[player,DZE_maintainRange,true,(getPosATL player)] spawn player_alertZombies;
|
|
||||||
|
|
||||||
if (Z_SingleCurrency) then {
|
if (Z_SingleCurrency) then {
|
||||||
player setVariable[Z_MoneyVariable,(_wealth - _amount),true];
|
_enoughMoney = if (_wealth >= _amount) then { true } else { false };
|
||||||
|
} else {
|
||||||
|
Z_Selling = false; // Initialize gem currency before Z_canAfford.
|
||||||
|
_moneyInfo = _amount call Z_canAfford;
|
||||||
|
_enoughMoney = _moneyInfo select 0;
|
||||||
};
|
};
|
||||||
call player_forceSave;
|
|
||||||
|
_success = if (Z_SingleCurrency) then { true } else { [player,_amount,_moneyInfo,true,0] call Z_payDefault };
|
||||||
|
|
||||||
|
if (!_success && _enoughMoney) exitWith { systemChat localize "STR_EPOCH_TRADE_GEAR_AND_BAG_FULL"; }; // Not enough room in gear or bag to accept change
|
||||||
|
|
||||||
|
if (_enoughMoney) then {
|
||||||
|
_success = if (Z_SingleCurrency) then {_amount <= _wealth} else {[player,_amount,_moneyInfo,false,0] call Z_payDefault};
|
||||||
|
if (_success) then {
|
||||||
|
|
||||||
PVDZE_maintainArea = [player,1,_this select 0];
|
PVDZE_maintainArea = [player,1,_this select 0];
|
||||||
publicVariableServer "PVDZE_maintainArea";
|
publicVariableServer "PVDZE_maintainArea";
|
||||||
|
|
||||||
systemChat format[localize "STR_EPOCH_ACTIONS_4",_count];
|
systemChat format[localize "STR_EPOCH_ACTIONS_4",_count];
|
||||||
|
if (Z_SingleCurrency) then {
|
||||||
|
player setVariable[Z_MoneyVariable,(_wealth - _amount),true];
|
||||||
_message1 = format [localize "STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_SUCCESS",_count,[_amount] call BIS_fnc_numberText,_itemText];
|
_message1 = format [localize "STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_SUCCESS",_count,[_amount] call BIS_fnc_numberText,_itemText];
|
||||||
|
} else {
|
||||||
|
_message1 = format [localize "STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_SUCCESS",_count,_itemText,""];
|
||||||
|
};
|
||||||
_message2 = " ";
|
_message2 = " ";
|
||||||
|
call player_forceSave; // Call player_forceSave BEFORE the medic animation because it can override the animation and make it finish prematurely.
|
||||||
|
|
||||||
|
player playActionNow "Medic";
|
||||||
|
|
||||||
|
[player,"repair",0,false,20] call dayz_zombieSpeak;
|
||||||
|
[player,DZE_maintainRange,true,(getPosATL player)] spawn player_alertZombies;
|
||||||
|
["Working",0,[100,15,10,0]] call dayz_NutritionSystem;
|
||||||
|
|
||||||
if (DZE_permanentPlot) then {
|
if (DZE_permanentPlot) then {
|
||||||
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7012;
|
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7012;
|
||||||
_ctrl ctrlSetText _message1;
|
_ctrl ctrlSetText _message1;
|
||||||
@@ -94,7 +85,14 @@ _maintain = {
|
|||||||
_message1 call dayz_rollingMessages;
|
_message1 call dayz_rollingMessages;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
systemChat localize "STR_EPOCH_TRADE_DEBUG";
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (Z_SingleCurrency) then {
|
||||||
_message1 = format[localize "STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_FAILED",_count,[_amount] call BIS_fnc_numberText,_itemText];
|
_message1 = format[localize "STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_FAILED",_count,[_amount] call BIS_fnc_numberText,_itemText];
|
||||||
|
} else {
|
||||||
|
_message1 = format[localize "STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_FAILED",_count,_itemText,""];
|
||||||
|
};
|
||||||
_message2 = " ";
|
_message2 = " ";
|
||||||
if (DZE_permanentPlot) then {
|
if (DZE_permanentPlot) then {
|
||||||
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7012;
|
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7012;
|
||||||
@@ -137,7 +135,12 @@ switch _option do {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
_requirements = _count call _req;
|
_requirements = _count call _req;
|
||||||
_message1 = format [localize "STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_PRICE", _count,[_requirements select 1] call BIS_fnc_numberText,_requirements select 2];
|
|
||||||
|
if (Z_SingleCurrency) then {
|
||||||
|
_message1 = format [localize "STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_PRICE", _count,[_requirements select 0] call BIS_fnc_numberText,_requirements select 1];
|
||||||
|
} else {
|
||||||
|
_message1 = format [localize "STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_PRICE", _count,_requirements select 1,""];
|
||||||
|
};
|
||||||
if (DZE_permanentPlot) then {
|
if (DZE_permanentPlot) then {
|
||||||
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7012;
|
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7012;
|
||||||
_ctrl ctrlSetText _message1;
|
_ctrl ctrlSetText _message1;
|
||||||
@@ -146,7 +149,11 @@ switch _option do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
_requirements = count _objects call _req;
|
_requirements = count _objects call _req;
|
||||||
_message2 = format [localize "STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_FORCE",count _objects,[_requirements select 1] call BIS_fnc_numberText,_requirements select 2];
|
if (Z_SingleCurrency) then {
|
||||||
|
_message2 = format [localize "STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_FORCE",count _objects,[_requirements select 0] call BIS_fnc_numberText,_requirements select 1];
|
||||||
|
} else {
|
||||||
|
_message2 = format [localize "STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_FORCE",count _objects,_requirements select 1,""];
|
||||||
|
};
|
||||||
if (_count != count _objects) then {
|
if (_count != count _objects) then {
|
||||||
if (DZE_permanentPlot) then {
|
if (DZE_permanentPlot) then {
|
||||||
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7013;
|
_ctrl = (uiNamespace getVariable "PlotManagement") displayCtrl 7013;
|
||||||
|
|||||||
@@ -205,6 +205,9 @@ if (!isDedicated) then {
|
|||||||
player_enterCode = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\doorManagement\player_enterCode.sqf";
|
player_enterCode = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\doorManagement\player_enterCode.sqf";
|
||||||
FNC_check_access = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_check_access.sqf";
|
FNC_check_access = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_check_access.sqf";
|
||||||
|
|
||||||
|
// Advanced trading default inits for maintaining, Advanced Trading and custom scripts to utilize gem based currency.
|
||||||
|
call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\AdvancedTrading\defaultInit.sqf";
|
||||||
|
|
||||||
dayz_losChance = {
|
dayz_losChance = {
|
||||||
private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
|
private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
|
||||||
_agent = _this select 0;
|
_agent = _this select 0;
|
||||||
|
|||||||
@@ -15241,15 +15241,15 @@
|
|||||||
<German>Preis zum Instandsetzen von %1 Objekten: %2 %3</German>
|
<German>Preis zum Instandsetzen von %1 Objekten: %2 %3</German>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_SUCCESS">
|
<Key ID="STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_SUCCESS">
|
||||||
<English>Success! %1 objects maintained for %2 %3.</English>
|
<English>Success! %1 objects maintained for %2 %3</English>
|
||||||
<German>Du hast %1 Objekte erfolgreich instandgesetzt für %2 %3.</German>
|
<German>Du hast %1 Objekte erfolgreich instandgesetzt für %2 %3.</German>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_FORCE">
|
<Key ID="STR_EPOCH_PLOTMANAGEMENT_MAINTAIN_FORCE">
|
||||||
<English>Price to force maintain %1 objects: %2 %3.</English>
|
<English>Price to force maintain %1 objects: %2 %3</English>
|
||||||
<German>Instandsetzen erzwingen: Preis für %1 Objekten: %2 %3</German>
|
<German>Instandsetzen erzwingen: Preis für %1 Objekten: %2 %3</German>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_FAILED">
|
<Key ID="STR_EPOCH_PLOTMANAGEMENT_OBJECTS_MAINTAINED_FAILED">
|
||||||
<English>Failed to maintain %1 objects. You need %2 %3.</English>
|
<English>Failed to maintain %1 objects. You need %2 %3</English>
|
||||||
<German>Instandsetzen von %1 Objekten fehlgeschlagen. Du brauchst %2 %3</German>
|
<German>Instandsetzen von %1 Objekten fehlgeschlagen. Du brauchst %2 %3</German>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST">
|
<Key ID="STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST">
|
||||||
|
|||||||
Reference in New Issue
Block a user