From 48e6e5618d83eeadeb02dd7eed0b0e92070d16da Mon Sep 17 00:00:00 2001 From: AirwavesMan Date: Sun, 13 Sep 2020 17:24:08 +0200 Subject: [PATCH] Add coins on zombies Coins on zombies and the value can be handled with ZSC_ZombieCoins now. The coins for zombies will be handled directly in check wallet. Also add a PVE check to disable check wallet if the player is not the owner of the body or in the group with the owner of the body. --- SQF/dayz_code/actions/zsc/checkWallet.sqf | 31 +++++++++++++++--- SQF/dayz_code/configVariables.sqf | 39 +++++++++++++---------- SQF/dayz_code/init/compiles.sqf | 21 ++++++++++++ SQF/dayz_code/stringtable.xml | 4 +++ 4 files changed, 73 insertions(+), 22 deletions(-) diff --git a/SQF/dayz_code/actions/zsc/checkWallet.sqf b/SQF/dayz_code/actions/zsc/checkWallet.sqf index 151e7fa32..f322e4342 100644 --- a/SQF/dayz_code/actions/zsc/checkWallet.sqf +++ b/SQF/dayz_code/actions/zsc/checkWallet.sqf @@ -1,25 +1,46 @@ -private ["_body","_playerNear","_name","_hisMoney","_myMoney"]; - if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; +private ["_body","_playerNear","_name","_hisMoney","_myMoney","_isZombie","_notAllowed"]; + _body = _this select 3; -if (isNull _body) exitWith {dayz_actionInProgress = false; systemChat "cursorTarget isNull!";}; +if (isNull _body) exitWith {dayz_actionInProgress = false; systemChat localize "str_cursorTargetNotFound";}; _playerNear = {isPlayer _x} count ((getPosATL _body) nearEntities ["CAManBase", 10]) > 1; if (_playerNear) exitWith {dayz_actionInProgress = false;localize "str_pickup_limit_5" call dayz_rollingMessages;}; -_name = _body getVariable ["bodyName","unknown"]; +_isZombie = _body isKindOf "zZombie_Base"; +_notAllowed = false; + +if (DZE_PVE_Mode && !_isZombie) then { + _notAllowed = [player,_body] call DZE_PVE_Group_Check; +}; + +if (_notAllowed) exitWith {dayz_actionInProgress = false;localize "STR_EPOCH_PVE_ACTIVE_CANNOT_CHECK_WALLET" call dayz_rollingMessages;}; + _hisMoney = _body getVariable ["cashMoney",0]; +if (_isZombie) then { + _name = getText(configFile >> "CfgVehicles" >> (typeOf _body) >> "displayname"); + + if (ZSC_ZombieCoins select 0 && {_hisMoney != -1}) then { + private "_values"; + + _values = ZSC_ZombieCoins select 1; + _hisMoney = ceil(random (_values select 1)) max (_values select 0); + }; +} else { + _name = _body getVariable ["bodyName","unknown"]; +}; + if (isNil "_hisMoney") then {_hisMoney = 0;}; if (!(typeName _hisMoney == "SCALAR") || {_hisMoney < 1}) exitWith {dayz_actionInProgress = false; format[localize "STR_CL_ZSC_NO_COINS",_name,CurrencyName] call dayz_rollingMessages}; _myMoney = player getVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),0]; _myMoney = _myMoney + _hisMoney; -_body setVariable ["cashMoney",0,true]; +_body setVariable ["cashMoney",-1,true]; player setVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),_myMoney,true]; systemChat format[localize "STR_CL_ZSC_TAKE_COINS",[_hisMoney] call BIS_fnc_numberText,CurrencyName,_name]; diff --git a/SQF/dayz_code/configVariables.sqf b/SQF/dayz_code/configVariables.sqf index fd6eb085d..892cb5db7 100644 --- a/SQF/dayz_code/configVariables.sqf +++ b/SQF/dayz_code/configVariables.sqf @@ -20,6 +20,9 @@ if (isServer) then { dayz_POIs = false; //Enable POI's dayz_enableGhosting = false; dayz_ghostTimer = 120; + + // ZSC + Z_globalBankingTraders = false; // Enable banking NPCs at trader cities. }; // Client @@ -138,9 +141,26 @@ if (!isDedicated) then { dayz_markBody = 0; // Players can see their corpse position on the map 0=never, 1=always, 2=With GPS only dayz_requireRadio = false; // Require players to have a radio on their toolbelt to create a group, be in a group and receive invites. - //Humanity System + // Humanity System DZE_Hero = 5000; // Defines the value at how much humanity the player is classed as a hero. - DZE_Bandit = -5000; // Defines the value at how much humanity the player is classed as a bandit. + DZE_Bandit = -5000; // Defines the value at how much humanity the player is classed as a bandit. + + // ZSC + Z_showCurrencyUI = true; // Show the currency icon on the screen when Z_SingleCurrency is enabled. + Z_showBankUI = true; // Show the banking icon on the screen when Z_globalBanking is enabled. + ZSC_bankTraders = ["Functionary1_EP1_DZ"]; // Array of trader classnames that are available for banking (i.e Functionary1_EP1_DZ) + ZSC_limitOnBank = true; // Have a limit on the bank? (i.e true or false) limits the global banking to the number below. + ZSC_bankObjects = [""]; // Array of objects that are available for banking i.e: ["Suitcase","Info_Board_EP1","Laptop_EP1","SatPhone"] + ZSC_maxBankMoney = 500000; // Default limit for bank objects. + ZSC_defaultStorageMultiplier = 200; // Default magazine count for bank objects that don't have storage slots i.e: ["Suitcase","Info_Board_EP1","Laptop_EP1","SatPhone"] + ZSC_MaxMoneyInStorageMultiplier = 5000; // Multiplier for how much money a bank object can hold, example: 200 magazine slots in the object (or the default value above ^^) multiplied by the 5000 multiplier is 1 million coin storage. (200 * 5000 = 1,000,000 coins) + ZSC_ZombieCoins = [false,[0,1000]]; // First value activate coins on zombies, second value from 0 - 1000 coins on each zombie. Coin for zombies are handled directly in check wallet. + + // Loot system + dayz_toolBreaking = false; //Sledgehammer, crowbar and pickaxe have a chance to break when used. + dayz_knifeDulling = false; // Enable knife dulling. Knives need to be sharpened after so many uses. + dayz_matchboxCount = false; // Enable match stick count. After five uses matches run out and must be replaced. + dayz_waterBottleBreaking = false; // Water bottles have a chance to break when boiling and require duct tape to fix }; // Both @@ -157,12 +177,6 @@ dayz_spawnselection = 0; //(Chernarus only) Turn on spawn selection 0 = random o dayz_classicBloodBagSystem = false; // disable blood types system and use the single classic ItemBloodbag dayz_enableFlies = true; // Enable flies on dead bodies (negatively impacts FPS). -// Loot system -dayz_toolBreaking = false; //Sledgehammer, crowbar and pickaxe have a chance to break when used. -dayz_knifeDulling = false; // Enable knife dulling. Knives need to be sharpened after so many uses. -dayz_matchboxCount = false; // Enable match stick count. After five uses matches run out and must be replaced. -dayz_waterBottleBreaking = false; // Water bottles have a chance to break when boiling and require duct tape to fix - // Death Messages DZE_DeathMsgChat = "none"; //"none","global","side","system" Display death messages in selected chat channel. DZE_DeathMsgDynamicText = false; // Display death messages as dynamicText in the top left with weapon icons. @@ -171,20 +185,11 @@ DZE_DeathMsgRolling = false; // Display death messages as rolling messages in bo // ZSC Z_SingleCurrency = false; // Enable single currency system. Z_globalBanking = false; // Enable global banking system. -Z_globalBankingTraders = false; // Enable banking NPCs at trader cities. Z_persistentMoney = false; // Enabling this stores currency to player_data instead of character_data. Currency transfers to a new character after death. For PVE servers only. Formerly called "GlobalMoney". Z_VehicleDistance = 40; // Max distance a vehicle can be sold or accessed from at a trader. -Z_showCurrencyUI = true; // Show the currency icon on the screen when Z_SingleCurrency is enabled. -Z_showBankUI = true; // Show the banking icon on the screen when Z_globalBanking is enabled. CurrencyName = "Coins"; // If using single currency this is the currency display name. -ZSC_bankObjects = [""]; // Array of objects that are available for banking i.e: ["Suitcase","Info_Board_EP1","Laptop_EP1","SatPhone"] -ZSC_bankTraders = ["Functionary1_EP1_DZ"]; // Array of trader classnames that are available for banking (i.e Functionary1_EP1_DZ) -ZSC_limitOnBank = true; // Have a limit on the bank? (i.e true or false) limits the global banking to the number below. -ZSC_maxBankMoney = 500000; // Default limit for bank objects. DZE_MoneyStorageClasses = ["VaultStorage","VaultStorage2","VaultStorageLocked","VaultStorage2Locked","LockboxStorageLocked","LockboxStorage2Locked","LockboxStorage","LockboxStorage2","LockboxStorageWinterLocked","LockboxStorageWinter2Locked","LockboxStorageWinter","LockboxStorageWinter2"]; // If using single currency this is an array of object classes players can store coins in. E.g.: ["GunRack_DZ","WoodCrate_DZ"] ZSC_VehicleMoneyStorage = true; // Allow players to store money in vehicles. If vehicles are destroyed the money is also destroyed. -ZSC_defaultStorageMultiplier = 200; // Default magazine count for bank objects that don't have storage slots i.e: ["Suitcase","Info_Board_EP1","Laptop_EP1","SatPhone"] -ZSC_MaxMoneyInStorageMultiplier = 5000; // Multiplier for how much money a bank object can hold, example: 200 magazine slots in the object (or the default value above ^^) multiplied by the 5000 multiplier is 1 million coin storage. (200 * 5000 = 1,000,000 coins) // Plot Management and Plot for Life DZE_permanentPlot = true; // Plot ownership saves after death. Enables Plot for Life by @RimBlock and Plot Management by @DevZupa. diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 4166ff50f..5a398016f 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -694,6 +694,27 @@ if (!isDedicated) then { _ret }; + + DZE_PVE_Group_Check = { + private ["_player", "_body", "_nameBody", "_ingroup", "_name"]; + + _player = _this select 0; + _body = _this select 1; + _name = name _player; + _nameBody = _body getVariable ["bodyName","unknown"]; + _ingroup = false; + + { + if (_nameBody == name _x) exitwith { + _ingroup = true; + }; + } count (units group _player); + + if ((_nameBody != "unknown") && !(_name == _nameBody) && !_ingroup) exitwith { + true + }; + false + }; DZ_KeyDown_EH = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\keyboard.sqf"; dayz_EjectPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_ejectPlayer.sqf"; diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index cf264e6a0..d5a5ff7d3 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -30270,6 +30270,10 @@ PVE Mode PVE-Modus + + You cannot check the wallet of another player who is not in your group while the PVE Mode is active! + Du kannst die Brieftasche eines anderen Spielers, der nicht in deiner Gruppe ist, nicht durchsuchen, solange der PVE Modus aktiv ist. +