mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Fix storage coins bug
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
changeCode - Safe, Lockbox and Door code changing script by salival (https://github.com/oiad)
|
||||
*/
|
||||
|
||||
private ["_backpacks","_charID","_characterID","_clientID","_coins","_dir","_holder","_inventory","_key","_lockedClass","_magazines","_message","_name","_object","_objectID","_objectUID","_ownerID","_ownerPUID","_player","_playerUID","_pos","_typeOf","_vector","_weapons","_worldSpace","_clientKey","_exitReason"];
|
||||
private ["_isZSC","_backpacks","_charID","_characterID","_clientID","_coins","_dir","_holder","_inventory","_key","_lockedClass","_magazines","_message","_name","_object","_objectID","_objectUID","_ownerID","_ownerPUID","_player","_playerUID","_pos","_typeOf","_vector","_weapons","_worldSpace","_clientKey","_exitReason"];
|
||||
|
||||
if (count _this < 4) exitWith {diag_log "server_changeCode error: Improper parameter format";};
|
||||
|
||||
@@ -35,7 +35,11 @@ if (_exitReason != "") exitWith {diag_log _exitReason};
|
||||
_weapons = getWeaponCargo _object;
|
||||
_magazines = getMagazineCargo _object;
|
||||
_backpacks = getBackpackCargo _object;
|
||||
if (Z_singleCurrency) then {_coins = _object getVariable ["cashMoney",0];};
|
||||
_isZSC = false;
|
||||
if (Z_singleCurrency) then {
|
||||
_isZSC = _typeOf in DZE_MoneyStorageClasses && _lockedClass in DZE_MoneyStorageClasses;
|
||||
};
|
||||
if (_isZSC) then {_coins = _object getVariable ["cashMoney",0];};
|
||||
|
||||
[_objectID,_objectUID,_object] call server_deleteObjDirect;
|
||||
|
||||
@@ -55,7 +59,7 @@ if (DZE_permanentPlot) then {
|
||||
_worldSpace = [_dir,_pos];
|
||||
};
|
||||
|
||||
if (Z_singleCurrency) then {_holder setVariable ["cashMoney",_coins,true];};
|
||||
if (_isZSC) then {_holder setVariable ["cashMoney",_coins,true];};
|
||||
|
||||
_objectUID = _worldSpace call dayz_objectUID2;
|
||||
_holder setVariable ["ObjectUID",_objectUID,true];
|
||||
@@ -69,7 +73,7 @@ _holder setVariable ["BackpackCargo",_backpacks,false];
|
||||
|
||||
[_characterID,_holder,_worldSpace,_inventory,_player,_clientKey] call server_publishObj;
|
||||
|
||||
if (Z_singleCurrency) then {
|
||||
if (_isZSC) then {
|
||||
_key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":" + str _coins + ":";
|
||||
_key call server_hiveWrite;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_exitReason","_clientKey","_backpacks","_charID","_clientID","_dir","_holder","_lockCode","_lockedClass","_magazines","_name","_obj","_objectID","_objectUID","_ownerID","_packedClass","_player","_playerUID","_pos","_status","_statusText","_type","_unlockedClass","_vector","_weapons","_message","_suppliedCode","_damage","_coins","_wealth"];
|
||||
private ["_isZSC","_exitReason","_clientKey","_backpacks","_charID","_clientID","_dir","_holder","_lockCode","_lockedClass","_magazines","_name","_obj","_objectID","_objectUID","_ownerID","_packedClass","_player","_playerUID","_pos","_status","_statusText","_type","_unlockedClass","_vector","_weapons","_message","_suppliedCode","_damage","_coins","_wealth"];
|
||||
|
||||
_player = _this select 0;
|
||||
_obj = _this select 1;
|
||||
@@ -51,12 +51,16 @@ if !(_type in DZE_DoorsLocked) then {
|
||||
if (_exitReason != "") exitWith {diag_log _exitReason};
|
||||
|
||||
call {
|
||||
_isZSC = false;
|
||||
if (Z_singleCurrency) then {
|
||||
_isZSC = _type in DZE_MoneyStorageClasses;
|
||||
};
|
||||
if (_status == 0) exitwith { //Unlocking
|
||||
_unlockedClass = getText (configFile >> "CfgVehicles" >> _type >> "unlockedClass");
|
||||
_weapons = _obj getVariable ["WeaponCargo",[]];
|
||||
_magazines = _obj getVariable ["MagazineCargo",[]];
|
||||
_backpacks = _obj getVariable ["BackpackCargo",[]];
|
||||
if (Z_singleCurrency) then {_coins = _obj getVariable ["cashMoney",0];};
|
||||
if (_isZSC && {_unlockedClass in DZE_MoneyStorageClasses}) then {_coins = _obj getVariable ["cashMoney",0];};
|
||||
_damage = damage _obj;
|
||||
|
||||
// Create new unlocked safe, then delete old locked safe
|
||||
@@ -71,7 +75,7 @@ call {
|
||||
_holder setVariable ["OEMPos",_pos,true];
|
||||
_holder setDamage _damage;
|
||||
if (DZE_permanentPlot) then {_holder setVariable ["ownerPUID",_ownerID,true];};
|
||||
if (Z_singleCurrency) then {_holder setVariable ["cashMoney",_coins,true];};
|
||||
if (_isZSC && {_unlockedClass in DZE_MoneyStorageClasses}) then {_holder setVariable ["cashMoney",_coins,true];};
|
||||
deleteVehicle _obj;
|
||||
|
||||
[_weapons,_magazines,_backpacks,_holder] call fn_addCargo;
|
||||
@@ -84,7 +88,7 @@ call {
|
||||
_weapons = getWeaponCargo _obj;
|
||||
_magazines = getMagazineCargo _obj;
|
||||
_backpacks = getBackpackCargo _obj;
|
||||
if (Z_singleCurrency) then {_coins = _obj getVariable ["cashMoney",0];};
|
||||
if (_isZSC && {_lockedClass in DZE_MoneyStorageClasses}) then {_coins = _obj getVariable ["cashMoney",0];};
|
||||
_damage = damage _obj;
|
||||
|
||||
// Create new locked safe, then delete old unlocked safe
|
||||
@@ -99,7 +103,7 @@ call {
|
||||
_holder setVariable ["OEMPos",_pos,true];
|
||||
_holder setDamage _damage;
|
||||
if (DZE_permanentPlot) then {_holder setVariable ["ownerPUID",_ownerID,true];};
|
||||
if (Z_singleCurrency) then {_holder setVariable ["cashMoney",_coins,true];};
|
||||
if (_isZSC && {_lockedClass in DZE_MoneyStorageClasses}) then {_holder setVariable ["cashMoney",_coins,true];};
|
||||
deleteVehicle _obj;
|
||||
|
||||
// Local setVariable gear onto new locked safe for easy access on next unlock
|
||||
@@ -114,7 +118,7 @@ call {
|
||||
_weapons = getWeaponCargo _obj;
|
||||
_magazines = getMagazineCargo _obj;
|
||||
_backpacks = getBackpackCargo _obj;
|
||||
if (Z_singleCurrency) then {_coins = _obj getVariable ["cashMoney",0];};
|
||||
if (_isZSC && {_packedClass in DZE_MoneyStorageClasses}) then {_coins = _obj getVariable ["cashMoney",0];};
|
||||
|
||||
_holder = _packedClass createVehicle [0,0,0];
|
||||
deleteVehicle _obj;
|
||||
@@ -122,7 +126,7 @@ call {
|
||||
_holder setPosATL _pos;
|
||||
_holder addMagazineCargoGlobal [getText(configFile >> "CfgVehicles" >> _packedClass >> "seedItem"),1];
|
||||
[_weapons,_magazines,_backpacks,_holder] call fn_addCargo;
|
||||
if (Z_singleCurrency && {_coins > 0}) then {
|
||||
if (_isZSC && {{_packedClass in DZE_MoneyStorageClasses} && {_coins > 0}}) then {
|
||||
private "_displayName";
|
||||
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
|
||||
|
||||
@@ -48,7 +48,7 @@ server_obj_inv = {
|
||||
_key = format["CHILD:303:%1:",_objectID] + str _inventory + ":";
|
||||
};
|
||||
|
||||
if (Z_SingleCurrency) then {
|
||||
if (Z_SingleCurrency && {(_class in DZE_MoneyStorageClasses) || {ZSC_VehicleMoneyStorage && (_object isKindOf "AllVehicles") && !(_object isKindOf "StaticWeapon")}}) then {
|
||||
local _coins = _object getVariable ["cashMoney", -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
|
||||
_key = _key + str _coins + ":";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user