Consolidate ItemKeyXXX/Colors to arrays.

Tidies up scripts inside epoch and for script creators.
Moved z_at_buyItems to epoch_generateKey.
This commit is contained in:
oiad
2017-11-19 11:27:02 +13:00
parent 2f178d8978
commit 9b96ddd2c3
6 changed files with 16 additions and 18 deletions

View File

@@ -7,7 +7,7 @@ _containerFindKey = {
_keys = [];
_weapTypes = (_this select 1) select 0;
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]) then {
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in DZE_itemKeys) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == (_this select 0)) then {
_keys set [count _keys, _x];
};
@@ -21,7 +21,7 @@ if ((count _VehKey2) > 0) then {
_localResult2 = 1;
} else {
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]) then {
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in DZE_itemKeys) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == (_VehKey2 select 0)) then {
_localResult2 = [player,_x,1] call BIS_fnc_invRemove;
};

View File

@@ -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","_wealth","_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","_keySelected","_location","_moneyInfo","_wealth","_parentClasses","_part_out","_pistolMagsToBuy","_priceToBuy","_primaryToBuy","_regularMagsToBuy","_sidearmToBuy","_sign","_success","_tCost","_toolAmounts","_toolClasses","_toolsToBuy","_vehiclesToBuy","_weaponsToBuy","_result"];
if (count Z_BuyingArray < 1) exitWith { systemChat localize "STR_EPOCH_TRADE_BUY_NO_ITEMS"; };
@@ -123,10 +123,9 @@ if (_enoughMoney) then {
if (_buyingType in DZE_tradeVehicleKeyless) then {
_isKeyOK = true;
} else {
_keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;
_keyNumber = (floor(random 2500)) + 1;
_keySelected = format["ItemKey%1%2",_keyColor,_keyNumber];
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
_result = call epoch_generateKey;
_isKeyOK = _result select 0;
_keySelected = _result select 1;
};
if (!_isKeyOK) exitWith {localize "str_epoch_player_107" call dayz_rollingMessages; "";};
_activatingPlayer = player;

View File

@@ -1,4 +1,4 @@
private ["_sign","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_keyColor","_damage","_tireDmg","_tires","_okToSell","_temp_keys","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"];
private ["_sign","_location","_result","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_damage","_tireDmg","_tires","_okToSell","_temp_keys","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_canAfford","_trade_total","_total_currency","_return_change","_done"];
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;};
dayz_actionInProgress = true;
@@ -196,9 +196,8 @@ if (_finished) then {
// remove Key
_temp_keys = [];
_keyColor = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _keyColor) then {
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in DZE_itemKeys) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == _objectCharacterId) then {
[_activatingPlayer,_x] call BIS_fnc_invRemove;
};

View File

@@ -10,7 +10,7 @@
private ["_isKeyOK","_keyColor","_keyNumber","_keySelected"];
// First select key color
_keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;
_keyColor = DZE_keyColors call BIS_fnc_selectRandom;
// then select number from 1 - 2500
_keyNumber = (floor(random 2500)) + 1;

View File

@@ -4,7 +4,7 @@
Returns array: [["11148","1457"],["Black Key (2eb5)","Green Key (9c30)"],["ItemKeyBlack1148","ItemKeyGreen1457"]]
*/
private ["_temp_keys","_temp_keys_names","_key_colors","_ownerKeyId","_ownerKeyName","_items","_temp_keys_class"];
private ["_temp_keys","_temp_keys_names","_ownerKeyId","_ownerKeyName","_items","_temp_keys_class"];
_temp_keys = [];
_temp_keys_names = [];
@@ -16,10 +16,8 @@ if (!isNull dayz_myBackpack) then {
_items = _items + ((getWeaponCargo dayz_myBackpack) select 0);
};
_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in DZE_itemKeys) then {
_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
_ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
_temp_keys_names set [count _temp_keys_names,_ownerKeyName];

View File

@@ -508,6 +508,8 @@ DZE_isWreck = ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck
DZE_isWreckBuilding = ["Land_wreck_cinder","Land_wood_wreck_quarter","Land_wood_wreck_floor","Land_wood_wreck_third","Land_wood_wreck_frame","Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck","Land_ammo_supply_wreck"];
DZE_isNewStorage = ["VaultStorage","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","GunRack_DZ","WoodCrate_DZ"];
DZE_isDestroyableStorage = ["OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","GunRack_DZ","WoodCrate_DZ"];
DZE_itemKeys = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
DZE_keyColors = ["Green","Red","Blue","Yellow","Black"];
helperDetach = false;
DZE_snapExtraRange = 0;
DZE_tradeVehicle = ["trade_any_vehicle","trade_any_vehicle_free","trade_any_vehicle_old","trade_any_bicycle","trade_any_bicycle_old","trade_any_boat","trade_any_boat_old"];