mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-25 19:26:08 +03:00
Add upgradable safes and lockboxes
- Safes and lockboxes can be upgraded now. - A winter lockbox version was added too. The current model and icon will be replaced later for the new lockbox. - Calling Child 308 on the DB has no room for storing coins, this is why we need to update coins and gear after swaping the object. Same for upgrade vehicle
This commit is contained in:
@@ -123,10 +123,13 @@ call {
|
||||
_holder addMagazineCargoGlobal [getText(configFile >> "CfgVehicles" >> _packedClass >> "seedItem"),1];
|
||||
[_weapons,_magazines,_backpacks,_holder] call fn_addCargo;
|
||||
if (Z_singleCurrency && {_coins > 0}) then {
|
||||
private "_displayName";
|
||||
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
|
||||
_wealth = _player getVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),0];
|
||||
_player setVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),_wealth + _coins,true];
|
||||
|
||||
RemoteMessage = ["systemChat",["STR_CL_ZSC_PACK_WARNING",_type,[_coins] call BIS_fnc_numberText,CurrencyName]];
|
||||
RemoteMessage = ["systemChat",["STR_CL_ZSC_PACK_WARNING",_displayName,[_coins] call BIS_fnc_numberText,CurrencyName]];
|
||||
(owner _player) publicVariableClient "RemoteMessage";
|
||||
};
|
||||
|
||||
@@ -137,11 +140,11 @@ call {
|
||||
|
||||
if (_status < 4) then {
|
||||
_type = call {
|
||||
if (_type == "VaultStorageLocked" || _type == "VaultStorage") exitwith {
|
||||
if (_type in ["VaultStorageLocked","VaultStorage","VaultStorage2Locked","VaultStorage2"]) exitwith {
|
||||
if (_ownerID == _playerUID) then {_lockCode = format["%1 - Owner",_lockCode];};
|
||||
"Safe"
|
||||
};
|
||||
if (_type == "LockboxStorage" || _type == "LockboxStorageLocked") exitwith {
|
||||
if (_type in ["LockboxStorage","LockboxStorageLocked","LockboxStorage2","LockboxStorage2Locked"]) exitwith {
|
||||
if (_ownerID == _playerUID) then {
|
||||
_lockCode = _charID call fnc_lockCode;
|
||||
_lockCode = format["%1 - Owner",_lockCode];
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
private ["_activatingPlayer","_object","_worldspace","_location","_dir","_class","_uid","_key","_keySelected","_characterID","_donotusekey","_result","_outcome","_oid","_objectID","_objectUID","_newobject","_weapons","_magazines","_backpacks","_clientKey","_exitReason","_playerUID"];
|
||||
private ["_inv","_coins","_activatingPlayer","_object","_worldspace","_location","_dir","_class","_uid","_key","_keySelected","_characterID","_result","_outcome","_oid","_objectID","_objectUID","_newobject","_weapons","_magazines","_backpacks","_clientKey","_exitReason","_playerUID"];
|
||||
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
|
||||
|
||||
if (count _this < 7) exitWith {
|
||||
if (count _this < 6) exitWith {
|
||||
diag_log "Server_PublishVehicle3 error: Wrong parameter format";
|
||||
dze_waiting = "fail";
|
||||
(owner (_this select 5)) publicVariableClient "dze_waiting";
|
||||
(owner (_this select 4)) publicVariableClient "dze_waiting";
|
||||
};
|
||||
|
||||
_object = _this select 0;
|
||||
_worldspace = _this select 1;
|
||||
_class = _this select 2;
|
||||
_donotusekey = _this select 3;
|
||||
_keySelected = _this select 4;
|
||||
_activatingPlayer = _this select 5;
|
||||
_clientKey = _this select 6;
|
||||
_object = _this select 0;
|
||||
_worldspace = _this select 1;
|
||||
_class = _this select 2;
|
||||
_keySelected = _this select 3;
|
||||
_activatingPlayer = _this select 4;
|
||||
_clientKey = _this select 5;
|
||||
_playerUID = getPlayerUID _activatingPlayer;
|
||||
_characterID = _keySelected;
|
||||
|
||||
@@ -34,7 +33,7 @@ if (!(isClass(configFile >> "CfgVehicles" >> _class)) || isNull _object) exitWit
|
||||
diag_log ("PUBLISH: Attempt " + str(_object));
|
||||
#endif
|
||||
|
||||
_dir = _worldspace select 0;
|
||||
_dir = _worldspace select 0;
|
||||
_location = _worldspace select 1;
|
||||
_uid = _worldspace call dayz_objectUID2;
|
||||
|
||||
@@ -44,8 +43,8 @@ diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
#endif
|
||||
|
||||
_key call server_hiveWrite;
|
||||
_objectID = _object getVariable ["ObjectID","0"];
|
||||
_objectUID = _object getVariable ["ObjectUID","0"];
|
||||
_objectID = _object getVariable ["ObjectID","0"];
|
||||
_objectUID = _object getVariable ["ObjectUID","0"];
|
||||
_location = [_object] call fnc_getPos;
|
||||
|
||||
// GET DB ID
|
||||
@@ -72,12 +71,17 @@ if (_outcome != "PASS") then {
|
||||
_weapons = getWeaponCargo _object;
|
||||
_magazines = getMagazineCargo _object;
|
||||
_backpacks = getBackpackCargo _object;
|
||||
_inv = [_weapons,_magazines,_backpacks];
|
||||
|
||||
if (Z_SingleCurrency && ZSC_VehicleMoneyStorage) then {
|
||||
_coins = _object getVariable ["cashMoney",0];
|
||||
};
|
||||
|
||||
deleteVehicle _object;
|
||||
[_objectID,_objectUID,_object] call server_deleteObjDirect;
|
||||
|
||||
uiSleep 3;
|
||||
|
||||
|
||||
_newobject = _class createVehicle [0,0,0];
|
||||
|
||||
// switch var to new vehicle at this point.
|
||||
@@ -98,6 +102,12 @@ if (_outcome != "PASS") then {
|
||||
|
||||
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
|
||||
|
||||
if (Z_SingleCurrency && ZSC_VehicleMoneyStorage && {_coins > 0}) then {
|
||||
_object setVariable ["cashMoney",_coins,true];
|
||||
_key = format["CHILD:309:%1:",_uid] + str _inv + ":" + str _coins + ":";
|
||||
_key call server_hiveWrite;
|
||||
};
|
||||
|
||||
_object call fnc_veh_ResetEH;
|
||||
// for non JIP users this should make sure everyone has eventhandlers for vehicles.
|
||||
PVDZE_veh_Init = _object;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
private ["_class","_uid","_charID","_object","_worldspace","_key","_allowed","_obj","_inv","_objectID","_objectUID","_proceed","_activatingplayer","_clientKey","_exitReason","_playerUID","_weapons","_magazines","_backpacks"];
|
||||
private ["_gearClasses","_coins","_class","_uid","_charID","_object","_worldspace","_key","_allowed","_obj","_inv","_objectID","_objectUID","_proceed","_activatingplayer","_clientKey","_exitReason","_playerUID","_weapons","_magazines","_backpacks"];
|
||||
|
||||
if (count _this < 8) exitWith {diag_log format ["Server_SwapObject error: Wrong parameter format from player %1",_this select 5];};
|
||||
|
||||
_charID = _this select 0;
|
||||
_object = _this select 1;
|
||||
_charID = _this select 0;
|
||||
_object = _this select 1;
|
||||
_worldspace = _this select 2;
|
||||
_class = _this select 3;
|
||||
_obj = _this select 4;
|
||||
_class = _this select 3;
|
||||
_obj = _this select 4;
|
||||
_activatingplayer = _this select 5;
|
||||
_inv = _this select 6;
|
||||
_clientKey = _this select 7;
|
||||
@@ -20,18 +20,28 @@ if (_exitReason != "") exitWith {diag_log _exitReason};
|
||||
|
||||
if (!isNull(_obj)) then {
|
||||
// Find objectID
|
||||
_objectID = _obj getVariable ["ObjectID","0"];
|
||||
_objectID = _obj getVariable ["ObjectID","0"];
|
||||
// Find objectUID
|
||||
_objectUID = _obj getVariable ["ObjectUID","0"];
|
||||
_objectUID = _obj getVariable ["ObjectUID","0"];
|
||||
if !(DZE_GodModeBase) then {
|
||||
_obj removeAllMPEventHandlers "MPKilled";
|
||||
};
|
||||
if (_class isKindOf "Land_A_tent" || {_class in DZE_isNewStorage}) then {
|
||||
if ((_class isKindOf "Land_A_tent" || {_class in DZE_isNewStorage}) && !(_class in DZE_isLockedStorageUpgrade)) then {
|
||||
_weapons = getWeaponCargo _obj;
|
||||
_magazines = getMagazineCargo _obj;
|
||||
_backpacks = getBackpackCargo _obj;
|
||||
_inv = [_weapons,_magazines,_backpacks];
|
||||
};
|
||||
if (_class in DZE_isLockedStorageUpgrade) then {
|
||||
_weapons = _obj getVariable ["WeaponCargo",[]];
|
||||
_magazines = _obj getVariable ["MagazineCargo",[]];
|
||||
_backpacks = _obj getVariable ["BackpackCargo",[]];
|
||||
_inv = [_weapons,_magazines,_backpacks];
|
||||
};
|
||||
if (Z_SingleCurrency && {_class in DZE_MoneyStorageClasses}) then {
|
||||
_coins = _obj getVariable ["cashMoney",0];
|
||||
};
|
||||
|
||||
// Remove old object
|
||||
deleteVehicle _obj;
|
||||
|
||||
@@ -42,7 +52,7 @@ if (isNull(_object)) then {
|
||||
_proceed = false;
|
||||
};
|
||||
|
||||
if(_objectID == "0" && {_objectUID == "0"}) then {
|
||||
if (_objectID == "0" && {_objectUID == "0"}) then {
|
||||
_proceed = false;
|
||||
} else {
|
||||
[_objectID,_objectUID,_obj] call server_deleteObjDirect;
|
||||
@@ -68,8 +78,7 @@ _object setVariable ["OEMPos",(_worldspace select 1),true];
|
||||
_uid = _worldspace call dayz_objectUID2;
|
||||
|
||||
//Send request
|
||||
//_key = str formatText["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0, _charID, _worldspace, [], [], 0,_uid];
|
||||
_key = str formatText["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0, _charID, _worldspace call AN_fnc_formatWorldspace, _inv, [], 0,_uid]; // Precise Base Building 1.0.5
|
||||
_key = str formatText["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0, _charID, _worldspace call AN_fnc_formatWorldspace, _inv, [], 0,_uid];
|
||||
|
||||
//diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
_key call server_hiveWrite;
|
||||
@@ -83,13 +92,26 @@ if (DZE_GodModeBase && {!(_class in DZE_GodModeBaseExclude)}) then {
|
||||
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
|
||||
};
|
||||
|
||||
if (count _inv > 0 && {_class in ["Wooden_shed2_DZ","WoodShack2_DZ","StorageShed2_DZ","GunRack2_DZ","WoodCrate2_DZ","VaultStorage2Locked","LockboxStorage2Locked","TentStorage0","TentStorage1","TentStorage2","TentStorage3","TentStorage4""DomeTentStorage0","DomeTentStorage1","DomeTentStorage2","DomeTentStorage3","DomeTentStorage4","DesertTentStorage0","DesertTentStorage1","DesertTentStorage2","DesertTentStorage3","DesertTentStorage4","StashSmall1","StashSmall2","StashSmall3","StashSmall4","StashMedium","StashMedium1","StashMedium2","StashMedium3","StashMedium4"]}) then {
|
||||
_gearClasses = ["Wooden_shed2_DZ","WoodShack2_DZ","StorageShed2_DZ","GunRack2_DZ","WoodCrate2_DZ","TentStorage0","TentStorage1","TentStorage2","TentStorage3","TentStorage4""DomeTentStorage0","DomeTentStorage1","DomeTentStorage2","DomeTentStorage3","DomeTentStorage4","DesertTentStorage0","DesertTentStorage1","DesertTentStorage2","DesertTentStorage3","DesertTentStorage4","StashSmall1","StashSmall2","StashSmall3","StashSmall4","StashMedium","StashMedium1","StashMedium2","StashMedium3","StashMedium4"];
|
||||
|
||||
if (count _inv > 0 && {_class in _gearClasses}) then {
|
||||
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
|
||||
};
|
||||
if (_class in DZE_isLockedStorageUpgrade) then {
|
||||
_object setVariable ["WeaponCargo",_weapons,false];
|
||||
_object setVariable ["MagazineCargo",_magazines,false];
|
||||
_object setVariable ["BackpackCargo",_backpacks,false];
|
||||
};
|
||||
|
||||
// Test disabling simulation server side on buildables only.
|
||||
_object enableSimulation false;
|
||||
|
||||
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
|
||||
|
||||
if (Z_SingleCurrency && {(_coins > 0) && {_class in DZE_MoneyStorageClasses}}) then {
|
||||
_object setVariable ["cashMoney",_coins,true];
|
||||
_key = format["CHILD:309:%1:",_uid] + str _inv + ":" + str _coins + ":";
|
||||
_key call server_hiveWrite;
|
||||
};
|
||||
|
||||
diag_log format["PUBLISH: Player %1(%2) upgraded or downgraded object to %3 with UID:%4 @%5",(_activatingPlayer call fa_plr2str),_playerUID,_class,_uid,((_worldspace select 1) call fa_coor2str)];
|
||||
|
||||
Reference in New Issue
Block a user