Update trading files

Fix again the trading dupe. Thx to loooooool(TEMA) from discord.
Also add the correct backpack and vehicle names if buy, sell or select.
This commit is contained in:
AirwavesMan
2020-11-27 08:48:42 +01:00
parent 662caa797e
commit 5f441615c2
4 changed files with 39 additions and 30 deletions

View File

@@ -1,7 +1,9 @@
private ["_activatingPlayer","_bTotal","_backpack","_backpacksToBuy","_buyVehicle","_buyingType","_canBuy","_count","_dir","_enoughMoney","_hasPrimary","_helipad","_isKeyOK","_item2Add","_itemsToLog","_keySelected","_location","_moneyInfo","_wealth","_parentClasses","_part_out","_pistolMagsToBuy","_priceToBuy","_primaryToBuy","_regularMagsToBuy","_sidearmToBuy","_sign","_success","_tCost","_toolAmounts","_toolClasses","_toolsToBuy","_vehiclesToBuy","_weaponsToBuy","_keyNumber"];
private ["_buyingArray","_activatingPlayer","_bTotal","_backpack","_backpacksToBuy","_buyVehicle","_buyingType","_canBuy","_count","_dir","_enoughMoney","_hasPrimary","_helipad","_isKeyOK","_item2Add","_itemsToLog","_keySelected","_location","_moneyInfo","_wealth","_parentClasses","_part_out","_pistolMagsToBuy","_priceToBuy","_primaryToBuy","_regularMagsToBuy","_sidearmToBuy","_sign","_success","_tCost","_toolAmounts","_toolClasses","_toolsToBuy","_vehiclesToBuy","_weaponsToBuy","_keyNumber","_vehName","_backpackName"];
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
_buyingArray = Z_BuyingArray;
Z_BuyingArray = [];
_pistolMagsToBuy = 0;
_regularMagsToBuy = 0;
_weaponsToBuy = 0;
@@ -52,7 +54,7 @@ if (Z_SingleCurrency) then {
_itemsToLog set [0, (_itemsToLog select 0) + [_x select 0]];
_itemsToLog set [1, (_itemsToLog select 1) + [_x select 9]];
_itemsToLog set [2, (_itemsToLog select 2) + [((_x select 9)*(_x select 2))]];
} count Z_BuyingArray;
} count _buyingArray;
} else {
{
if (_x select 1 == "trade_weapons") then {
@@ -90,7 +92,7 @@ if (Z_SingleCurrency) then {
_itemsToLog set [0, (_itemsToLog select 0) + [_x select 0]];
_itemsToLog set [1, (_itemsToLog select 1) + [_x select 9]];
_itemsToLog set [2, (_itemsToLog select 2) + [((_x select 11)*(_x select 2)*(_x select 9))]];
} count Z_BuyingArray;
} count _buyingArray;
};
_canBuy = [_weaponsToBuy,[_pistolMagsToBuy,_regularMagsToBuy],_backpacksToBuy,_toolsToBuy,_sidearmToBuy,_primaryToBuy,_vehiclesToBuy,_toolClasses,_toolAmounts] call Z_allowBuying;
@@ -178,11 +180,12 @@ if (_enoughMoney) then {
};
};
_bTotal = _bTotal + (_x select 9);
} count Z_BuyingArray;
} count _buyingArray;
_backpackName = getText(configFile >> "CfgVehicles" >> typeOf _backpack >> "displayname");
if (_item2Add != "0") then {
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_BACKPACK",(Z_BuyingArray select 0) select 3];
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_BACKPACK",(_buyingArray select 0) select 3,_backpackName];
} else {
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal];
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_BACKPACK",_bTotal,_backpackName];
};
};
@@ -204,11 +207,12 @@ if (_enoughMoney) then {
};
};
_bTotal = _bTotal + (_x select 9);
} count Z_BuyingArray;
} count _buyingArray;
_vehName = getText(configFile >> "CfgVehicles" >> typeOf DZE_myVehicle >> "displayname");
if (_item2Add != "0") then {
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_VEHICLE",(Z_BuyingArray select 0) select 3,typeOf (DZE_myVehicle)];
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_VEHICLE",(_buyingArray select 0) select 3,_vehName];
} else {
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,typeOf DZE_myVehicle];
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_VEHICLE",_bTotal,_vehName];
};
};
@@ -243,9 +247,9 @@ if (_enoughMoney) then {
};
};
_bTotal = _bTotal + (_x select 9);
} count Z_BuyingArray;
} count _buyingArray;
if (_item2Add != "0") then {
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_GEAR",(Z_BuyingArray select 0) select 3];
systemChat format[localize "STR_EPOCH_TRADE_BUY_VEH_IN_GEAR",(_buyingArray select 0) select 3];
} else {
systemChat format[localize "STR_EPOCH_TRADE_BUY_IN_GEAR",_bTotal];
};

View File

@@ -1,4 +1,4 @@
private ["_list","_result","_pos"];
private ["_list","_result","_pos","_vehName"];
_result = false;
_pos = [player] call FNC_GetPos;
@@ -7,11 +7,12 @@ _list = _pos nearEntities [["Air","LandVehicle","Ship"],Z_VehicleDistance];
if (!isNull DZE_myVehicle && {local DZE_myVehicle} && {alive DZE_myVehicle} && {DZE_myVehicle in _list}) then {
_result = true;
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 DZE_myVehicle];
_vehName = getText(configFile >> "CfgVehicles" >> typeOf DZE_myVehicle >> "displayname");
systemChat format[localize "STR_EPOCH_TRADE_SELECTED",_vehName];
if (Z_Selling) then {
[format[localize "STR_EPOCH_TRADE_SELLING_FROM", typeOf DZE_myVehicle]] call Z_fillTradeTitle;
[format[localize "STR_EPOCH_TRADE_SELLING_FROM",_vehName]] call Z_fillTradeTitle;
} else {
[format[localize "STR_EPOCH_TRADE_BUYING_IN", typeOf DZE_myVehicle]] call Z_fillTradeTitle;
[format[localize "STR_EPOCH_TRADE_BUYING_IN",_vehName]] call Z_fillTradeTitle;
};
};
};

View File

@@ -1,9 +1,11 @@
private ["_sellVehicle","_outcome","_vehCheckArray","_vehArray","_weaponsArray","_itemsArray","_bpArray","_bpCheckArray","_weaponsCheckArray","_itemsCheckArray","_VehKey","_wA","_mA","_money","_itemData","_bag","_itemsToLog","_tCost","_tSold","_wealth"];
private ["_sellArray","_sellVehicle","_outcome","_vehCheckArray","_vehArray","_weaponsArray","_itemsArray","_bpArray","_bpCheckArray","_weaponsCheckArray","_itemsCheckArray","_VehKey","_wA","_mA","_money","_itemData","_bag","_itemsToLog","_tCost","_tSold","_wealth","_backpackName","_vehName"];
if (count Z_SellArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_SELL_NO_ITEMS"; };
if (Z_SellingFrom == 1 && (isNull DZE_myVehicle or !local DZE_myVehicle)) exitWith { systemChat localize "STR_EPOCH_PLAYER_245"; };
closeDialog 2;
_sellArray = Z_SellArray;
Z_SellArray = [];
_outcome = [];
_weaponsArray = [];
_itemsArray = [];
@@ -90,17 +92,19 @@ _sellVehicle = {
};
};
};
} forEach Z_SellArray;
} forEach _sellArray;
_tSold = _itemsArray + _weaponsArray + _bpArray + _vehArray;
if (Z_SellingFrom == 0) then {
_outcome = [unitBackpack player,_itemsArray,_weaponsArray, _vehArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_BACKPACK",count _tSold];
_backpackName = getText(configFile >> "CfgVehicles" >> typeOf (unitBackpack player) >> "displayname");
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_BACKPACK",count _tSold,_backpackName];
};
if (Z_SellingFrom == 1) then {
_outcome = [DZE_myVehicle,_itemsArray,_weaponsArray,_vehArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_VEHICLE",count _tSold,typeOf DZE_myVehicle];
_vehName = getText(configFile >> "CfgVehicles" >> typeOf DZE_myVehicle >> "displayname");
systemChat format[localize "STR_EPOCH_TRADE_SELL_IN_VEHICLE",count _tSold,_vehName];
};
_itemsToLog set [0,(_itemsArray + _weaponsArray + _bpArray + [typeOf DZE_myVehicle])];
@@ -150,7 +154,7 @@ if (Z_SellingFrom == 2) then {
};
};
};
} forEach Z_SellArray;
} forEach _sellArray;
_outcome set [0,_mA];
_outcome set [1,_wA];

View File

@@ -26541,9 +26541,9 @@
<Russian>Вы не можете купить рюкзак в рюкзак.</Russian>
</Key>
<Key ID="STR_EPOCH_TRADE_BUY_IN_BACKPACK">
<English>Purchased %1 items into your backpack</English>
<German>Du hast %1 Gegenstände in deinen Rucksack gekauft.</German>
<Russian>Куплено предметов в рюкзак: %1.</Russian>
<English>Purchased %1 items into your %2</English>
<German>Du hast %1 Gegenstände in deinen %2 gekauft.</German>
<Russian>Куплено предметов в %2: %1.</Russian>
</Key>
<Key ID="STR_EPOCH_TRADE_BUY_IN_VEHICLE">
<English>Purchased %1 items into %2</English>
@@ -26556,9 +26556,9 @@
<Russian>В ваше сняряжение куплено предметов: %1.</Russian>
</Key>
<Key ID="STR_EPOCH_TRADE_BUY_VEH_IN_BACKPACK">
<English>You purchased a %1, the key has been added into your backpack.</English>
<German>Du hast ein %1 gekauft, der Schlüssel wurde deinem Rucksack hinzugefügt.</German>
<Russian>Вы купили %1, ключ добавлен в рюкзак.</Russian>
<English>You purchased a %1, the key has been added into your %2.</English>
<German>Du hast ein %1 gekauft, der Schlüssel wurde deinem %2 hinzugefügt.</German>
<Russian>Вы купили %1, ключ добавлен в %2.</Russian>
</Key>
<Key ID="STR_EPOCH_TRADE_BUY_VEH_IN_VEHICLE">
<English>You purchased a %1, the key has been added into your %2.</English>
@@ -26571,12 +26571,12 @@
<Russian>Вы купили %1, ключ добавлен на ваш пояс.</Russian>
</Key>
<Key ID="STR_EPOCH_TRADE_SELL_IN_BACKPACK">
<English>Sold %1 items from your backpack</English>
<German>Du hast %1 Gegenstände aus deinem Rucksack verkauft.</German>
<Russian>Продано предметов из рюкзака: %1.</Russian>
<English>Sold %1 items from your %2.</English>
<German>Du hast %1 Gegenstände aus deinem %2 verkauft.</German>
<Russian>Продано предметов из %2: %1.</Russian>
</Key>
<Key ID="STR_EPOCH_TRADE_SELL_IN_VEHICLE">
<English>Sold %1 items from %2</English>
<English>Sold %1 items from %2.</English>
<German>Du hast %1 Gegenstände aus deinem %2 verkauft.</German>
<Russian>Продано предметов из %2: %1.</Russian>
</Key>