Revert "Revert "Merge branch 'master' of https://github.com/EpochModTeam/DayZ-Epoch""

This reverts commit 109ec5c9a3.
This commit is contained in:
seelenapparat
2021-08-24 15:47:06 +02:00
parent c801365a1f
commit d1abb66e9f
145 changed files with 9200 additions and 627 deletions

View File

@@ -0,0 +1,42 @@
// Written by icomrade (https://github.com/icomrade)
private ["_hasAccess","_heliPad","_objectID","_objectUID","_plotCheck"];
closeDialog 0;
_itemText = if (Z_SingleCurrency) then {CurrencyName} else {[vg_maintainCost,true] call z_calcCurrency};
_enoughMoney = false;
_moneyInfo = [false, [], [], [], 0];
if (Z_SingleCurrency) then {
_wealth = player getVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),0];
_enoughMoney = (_wealth >= vg_maintainCost);
} else {
Z_Selling = false;
_moneyInfo = vg_maintainCost call Z_canAfford;
_enoughMoney = _moneyInfo select 0;
};
_success = true;
if (vg_maintainCost > 0) then {
_success = if (Z_SingleCurrency) then {_enoughMoney} else {[player,vg_maintainCost,_moneyInfo,false,0] call Z_payDefault};
};
if (!_success && _enoughMoney) exitWith {systemChat localize "STR_EPOCH_TRADE_GEAR_AND_BAG_FULL";};
if (_enoughMoney || vg_maintainCost < 1) then {
if (Z_SingleCurrency) then {
player setVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),(_wealth - vg_maintainCost),true];
};
localize "STR_CL_VG_MAINTAINSUCCESS" call dayz_rollingMessages;
PVDZE_maintainGarage = if (vg_tiedToPole) then {
_plotCheck = [player,false] call FNC_find_plots;
_ownerPUID = if (_plotCheck select 1 > 0) then {(_plotCheck select 2) getVariable ["ownerPUID","0"]} else {dayz_playerUID};
[player,_ownerPUID]
} else {
[player]
};
publicVariableServer "PVDZE_maintainGarage";
} else {
localize "STR_CL_VG_MAINTAINFAIL" call dayz_rollingMessages;
};

View File

@@ -0,0 +1,69 @@
// Developed by [GZA] David for German Zombie Apocalypse Servers (https://zombieapo.eu/)
// Rewritten by salival (https://github.com/oiad)
private ["_backPack","_charID","_dir","_heliPad","_inventory","_isNearPlot","_keyID","_keyName","_location","_plotCheck","_sign","_vehicle"];
closeDialog 0;
_vehicle = (call compile format["%1",lbData[2802,(lbCurSel 2802)]]);
if (vg_removeKey && {_vehicle select 3 != 0} && {({getNumber (configFile >> "CfgWeapons" >> _x >> "type") == 131072} count (weapons player)) == 12}) exitWith {localize "str_epoch_player_107" call dayz_rollingMessages;};
_dir = round(random 360);
_backPack = [];
_plotCheck = [player,false] call FNC_find_plots;
_isNearPlot = (_plotCheck select 1) > 0;
_heliPad = nearestObjects [if (_isNearPlot) then {_plotCheck select 2} else {player},vg_heliPads,if (_isNearPlot) then {DZE_maintainRange} else {Z_VehicleDistance}];
if ((count _heliPad == 0) && ((_vehicle select 1) isKindOf "Air")) exitWith {localize "STR_CL_VG_NEED_HELIPAD" call dayz_rollingMessages;};
if (count _heliPad > 0) then {
_location = [(_heliPad select 0)] call FNC_GetPos;
} else {
_location = [(position player),0,400,10,0,2000,0] call BIS_fnc_findSafePos;
_location set [2,0];
};
_sign = "Sign_arrow_down_large_EP1" createVehicleLocal [0,0,0];
_sign setPos _location;
if (surfaceIsWater _location && {count (_location nearEntities ["Ship",8]) > 0}) then {
deleteVehicle _sign;
localize "STR_EPOCH_TRADE_OBSTRUCTED" call dayz_rollingMessages;
} else {
[_vehicle select 1,_sign] call fn_waitForObject;
};
PVDZE_spawnVehicle = [[_dir,_location],player,_vehicle select 0];
publicVariableServer "PVDZE_spawnVehicle";
waitUntil {!isNil "PVDZE_spawnVehicleResult"};
if (PVDZE_spawnVehicleResult != "0") then {
_keyID = "";
_charID = parseNumber PVDZE_spawnVehicleResult;
if ((_charID > 0) && (_charID <= 2500)) then {_keyID = format["ItemKeyGreen%1",_charID];};
if ((_charID > 2500) && (_charID <= 5000)) then {_keyID = format["ItemKeyRed%1",_charID-2500];};
if ((_charID > 5000) && (_charID <= 7500)) then {_keyID = format["ItemKeyBlue%1",_charID-5000];};
if ((_charID > 7500) && (_charID <= 10000)) then {_keyID = format["ItemKeyYellow%1",_charID-7500];};
if ((_charID > 10000) && (_charID <= 12500)) then {_keyID = format["ItemKeyBlack%1",_charID-10000];};
_keyName = getText(configFile >> "CfgWeapons" >> _keyID >> "displayName");
if (vg_removeKey) then {
_inventory = weapons player;
dayz_myBackpack = unitBackpack player;
if (!isNull dayz_myBackpack) then {_backPack = (getWeaponCargo dayz_myBackpack) select 0;};
if (_keyID in (_inventory+_backPack)) then {
if (_keyID in _inventory) then {format[localize "STR_CL_VG_IN_INVENTORY",_keyName] call dayz_rollingMessages;};
if (_keyID in _backPack) then {format[localize "STR_CL_VG_IN_BACKPACK",_keyName] call dayz_rollingMessages;};
} else {
player addWeapon _keyID;
format[localize "STR_CL_VG_ADDED_INVENTORY",_keyName] call dayz_rollingMessages;
};
};
};
PVDZE_spawnVehicle = nil;
PVDZE_spawnVehicleResult = nil;
vg_vehicleList = nil;
localize "STR_CL_VG_VEHICLE_SPAWNED" call dayz_rollingMessages;

View File

@@ -0,0 +1,24 @@
// Written by salival (https://github.com/oiad)
private ["_hasAccess","_objectID","_objectUID","_plotCheck"];
closeDialog 0;
_plotCheck = [player, false] call FNC_find_plots;
_hasAccess = [player,_plotCheck select 2] call FNC_check_access;
if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4)) then {
{
_objectID = _x getVariable ["ObjectID","0"];
_objectUID = _x getVariable ["ObjectUID","0"];
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_x,dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy";
deleteVehicle _x;
systemChat format[localize "STR_CL_VG_HELIPAD_REMOVED",typeOf _x];
} count (nearestObjects [_plotCheck select 2,vg_heliPads,Z_VehicleDistance]);
} else {
systemChat localize "STR_EPOCH_PLAYER_134";
};

View File

@@ -0,0 +1,209 @@
// Developed by [GZA] David for German Zombie Apocalypse Servers (https://zombieapo.eu/)
// Rewritten by salival (https://github.com/oiad)
private ["_amount","_backPackCount","_backPackGear","_cargoAmount","_charID","_control","_counter","_display","_enoughMoney","_gearCount","_hasKey","_isLimitArray","_itemText","_items","_keyName","_limit","_magazineCount","_matchedCount","_moneyInfo","_name","_overLimit","_storedVehicles","_success","_typeName","_typeOf","_vehicle","_vehicleID","_vehicleUID","_wealth","_weaponsCount","_woGear","_playerNear","_ownerPUID","_plotCheck"];
disableSerialization;
_display = findDisplay 2800;
_control = ((findDisplay 2800) displayCtrl 2802);
_vehicle = vg_vehicleList select (lbCurSel _control);
_typeOf = typeOf _vehicle;
_isLimitArray = typeName vg_limit == "ARRAY";
_overLimit = false;
_matchedCount = 0;
_storedVehicles = [];
{if (_typeOf isKindOf _x) exitWith {_overLimit = true;}} count vg_blackListed;
if (_overLimit) exitWith {localize "STR_CL_VG_BLACKLISTED" call dayz_rollingMessages;};
{
if (typeName _x == "ARRAY") then {
_storedVehicles set [count _storedVehicles,_x select 1];
};
} count vg_vehicleList;
_gearCount = {
private ["_counter"];
_counter = 0;
{_counter = _counter + _x;} count _this;
_counter
};
if (_isLimitArray) then {
{
_typeName = _x select 0;
_limit = _x select 1;
if (typeName _x == "ARRAY") then {
if (_typeOf isKindOf _typeName) then {
{
if (_x isKindOf _typeName) then {_matchedCount = _matchedCount +1};
if (_matchedCount >= _limit) then {_overLimit = true;};
} count _storedVehicles;
};
};
if (_overLimit) exitWith {};
} count vg_limit;
} else {
if (count _storedVehicles >= vg_limit) then {_overLimit = true;};
};
if (_overLimit) exitWith {
if (_isLimitArray) then {
systemChat localize "STR_CL_VG_LIMIT_ARRAY";
} else {
systemChat localize "STR_CL_VG_LIMIT_NUMBER";
};
};
vg_vehicleList = nil;
_woGear = _this select 0;
closeDialog 0;
if (!vg_storeWithGear && !_woGear) exitWith {localize "STR_CL_VG_NOSTOREWITHGEAR" call dayz_rollingMessages;};
_charID = _vehicle getVariable ["CharacterID","0"];
_vehicleID = _vehicle getVariable ["ObjectID","0"];
_vehicleUID = _vehicle getVariable ["ObjectUID","0"];
_weaponsCount = ((getWeaponCargo _vehicle) select 1) call _gearCount;
_magazineCount = ((getMagazineCargo _vehicle) select 1) call _gearCount;
_backPackCount = ((getBackpackCargo _vehicle) select 1) call _gearCount;
_cargoAmount = (_weaponsCount + _magazineCount + _backPackCount);
if (_vehicleID == "1" || _vehicleUID == "1") exitWith {localize "STR_CL_VG_STORE_MISSION" call dayz_rollingMessages;};
if (isNull DZE_myVehicle || !local DZE_myVehicle) exitWith {localize "STR_EPOCH_PLAYER_245" call dayz_rollingMessages;};
_hasKey = false;
_items = items player;
dayz_myBackpack = unitBackpack player;
if (!isNull dayz_myBackpack) then {
_backPackGear = (getWeaponCargo dayz_myBackpack) select 0;
_items = _items + _backPackGear;
};
if (_charID != "0") then {
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in DZE_itemKeys) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == _charID) then {
_keyName = _x;
_hasKey = true;
};
};
} count _items;
} else {
if (vg_store_keyless_vehicles) then {
_hasKey = true;
};
};
if (vg_requireKey && {!_hasKey}) exitWith {localize "STR_CL_VG_REQUIRE_KEY" call dayz_rollingMessages;};
_name = getText(configFile >> "cfgVehicles" >> _typeOf >> "displayName");
{
if (_typeOf isKindOf (_x select 0)) exitWith {_amount = _x select 1};
} forEach vg_price;
if (_cargoAmount > 0) then {_amount = _amount + (_cargoAmount * vg_pricePer);};
if (!isNil "sk_dualCurrency") then {_amount = if (z_singleCurrency) then {_amount * 10} else {_amount};};
/*
_playerNear = {isPlayer _x && (_x != player)} count (([_vehicle] call FNC_GetPos) nearEntities ["CAManBase", 15]) > 0;
if (_playerNear) exitWith {localize "STR_CL_VG_PLAYERNEARVEHICLE" call dayz_rollingMessages;};
*/
if (count (crew _vehicle) > 0) exitWith {localize "STR_CL_VG_PLAYERINVEHICLE" call dayz_rollingMessages;};
_enoughMoney = false;
_moneyInfo = [false,[],[],[],0];
if (Z_SingleCurrency) then {
_wealth = player getVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),0];
_enoughMoney = (_wealth >= _amount);
} else {
Z_Selling = false;
if (Z_AllowTakingMoneyFromVehicle) then {false call Z_checkCloseVehicle};
_moneyInfo = _amount call Z_canAfford;
_enoughMoney = _moneyInfo select 0;
};
_success = if (Z_SingleCurrency) then {true} else {[player,_amount,_moneyInfo,true,0] call Z_payDefault};
if (!_success && {_enoughMoney}) exitWith {systemChat localize "STR_EPOCH_TRADE_GEAR_AND_BAG_FULL"};
if (_enoughMoney) then {
_success = if (Z_SingleCurrency) then {_amount <= _wealth} else {[player,_amount,_moneyInfo,false,0] call Z_payDefault};
if (_success) then {
if (Z_SingleCurrency) then {player setVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),(_wealth - _amount),true];};
[_vehicle,true] call local_lockUnlock;
DZE_myVehicle = objNull;
PVDZE_storeVehicle = if (vg_tiedToPole) then {
_plotCheck = [player,false] call FNC_find_plots;
_ownerPUID = if (_plotCheck select 1 > 0) then {(_plotCheck select 2) getVariable ["ownerPUID","0"]} else {dayz_playerUID};
[_vehicle,player,_woGear,_ownerPUID]
} else {
[_vehicle,player,_woGear]
};
publicVariableServer "PVDZE_storeVehicle";
waitUntil {!isNil "PVDZE_storeVehicleResult"};
PVDZE_storeVehicle = nil;
PVDZE_storeVehicleResult = nil;
format[localize "STR_CL_VG_VEHICLE_STORED",_name] call dayz_rollingMessages;
if (vg_removeKey && {_charID != "0"}) then {
if (_keyName in (items player)) then {
[player,_keyName,1] call BIS_fnc_invRemove;
} else {
private ["_weparray", "_qtyarray", "_arraycnt","_newwepqty","_newwep","_newarray","_cntarray","_weapon","_weaponqty"];
_weparray = [];
_qtyarray = [];
_arraycnt = -1;
_backPackGear = getWeaponCargo dayz_myBackpack;
{
_arraycnt = _arraycnt + 1;
if (_x == _keyName) then {
} else {
_newwep = (_backPackGear select 0) select _arraycnt;
_newwepqty = (_backPackGear select 1) select _arraycnt;
_weparray set [count _weparray, _newwep];
_qtyarray set [count _qtyarray,_newwepqty];
};
} forEach (_backPackGear select 0);
_newarray = [];
_newarray = [_weparray] + [_qtyarray];
clearWeaponCargoGlobal dayz_myBackpack;
_cntarray = count _weparray;
for "_i" from 0 to (_cntarray-1) do {
_weapon = (_newarray select 0) select _i;
_weaponqty = (_newarray select 1) select _i;
dayz_myBackpack addWeaponCargoGlobal [_weapon,_weaponqty];
};
};
};
} else {
systemChat localize "STR_EPOCH_TRADE_DEBUG";
};
} else {
_itemText = if (Z_SingleCurrency) then {CurrencyName} else {[_amount,true] call z_calcCurrency};
if (Z_SingleCurrency) then {
systemChat format[localize "STR_CL_VG_NEED_COINS",[_amount] call BIS_fnc_numberText,_itemText,_name];
} else {
systemChat format[localize "STR_CL_VG_NEED_BRIEFCASES",_itemText,_name];
};
};

View File

@@ -0,0 +1,110 @@
// Developed by [GZA] David for German Zombie Apocalypse Servers (https://zombieapo.eu/)
// Rewritten by salival (https://github.com/oiad)
private ["_backPackCount","_backPackSlots","_cargoAmount","_control","_counter","_DateStored","_formattedText","_index","_inventory","_localVehicle","_magazineCount","_magazineSlots","_name","_picture","_price","_typeOf","_vehicle","_weaponSlots","_weaponsCount","_MaintainDays","_DateMaintained"];
disableSerialization;
_control = (_this select 0) select 0;
_index = (_this select 0) select 1;
_localVehicle = typeName (vg_vehicleList select _index) == "OBJECT";
_DateMaintained = "";
_MaintainDays = -1;
_gearCount = {
private ["_counter"];
_counter = 0;
{_counter = _counter + _x;} count _this;
_counter;
};
if (_localVehicle) then {
_vehicle = vg_vehicleList select _index;
_typeOf = typeOf _vehicle;
_weaponsCount = ((getWeaponCargo _vehicle) select 1) call _gearCount;
_magazineCount = ((getMagazineCargo _vehicle) select 1) call _gearCount;
_backPackCount = ((getBackpackCargo _vehicle) select 1) call _gearCount;
ctrlShow[2852,false]; // getVehicle
ctrlShow[2850,true]; // storeVehicle
ctrlShow[2851,true]; // storeVehicleWithGear
} else {
_vehicle = (vg_vehicleList select _index) select 1;
_inventory = (vg_vehicleList select _index) select 2;
_DateStored = (vg_vehicleList select _index) select 4;
_DateMaintained = (vg_vehicleList select _index) select 5;
_MaintainDays = (vg_vehicleList select _index) select 6;
_typeOf = _vehicle;
_weaponsCount = _inventory select 0;
_magazineCount = _inventory select 1;
_backPackCount = _inventory select 2;
ctrlShow[2852,true]; // getVehicle
ctrlShow[2850,false]; // storeVehicle
ctrlShow[2851,false]; // storeVehicleWithGear
};
_weaponSlots = getNumber(configFile >> "CfgVehicles" >> _typeOf >> "transportMaxWeapons");
_magazineSlots = getNumber(configFile >> "CfgVehicles" >> _typeOf >> "transportMaxMagazines");
_backPackSlots = getNumber(configFile >> "CfgVehicles" >> _typeOf >> "transportmaxbackpacks");
_name = getText(configFile >> "CfgVehicles" >> _typeOf >> "displayName");
_picture = getText (configFile >> 'CfgVehicles' >> _typeOf >> 'picture');
_cargoAmount = (_weaponsCount + _magazineCount + _backPackCount);
if (_localVehicle) then {
{
if (_typeOf isKindOf (_x select 0)) exitWith {_price = _x select 1;};
} forEach vg_price;
if (_cargoAmount > 0) then {
_price = _price + (_cargoAmount * vg_pricePer);
ctrlShow[2850,false];
} else {
ctrlShow[2851,false];
};
_price = if (_price == 0) then {localize "strwffree"} else {
if (!isNil "sk_dualCurrency") then {_price = if (z_singleCurrency) then {_price * 10} else {_price};};
if (z_singleCurrency) then {
format ["%1 %2",[_price] call BIS_fnc_numberText,currencyName]
} else {
[_price,true] call z_calcCurrency
};
};
};
_formattedText = format [
"<img image='%1' size='3' align='center'/><br />" +
"<t color='#33BFFF' size='0.7'>%2: </t><t color='#ffffff' size='0.7'>%3</t><br />" +
"<t color='#33BFFF' size='0.7'>%4: </t><t color='#ffffff' size='0.7'>%5</t><br />" +
"<t color='#33BFFF' size='0.7'>%6: </t><t color='#ffffff' size='0.7'><img image='%7'/> %13/%10 <img image='%8'/> %14/%11 <img image='%9'/> %15/%12</t><br />",
_picture,
localize "STR_EPOCH_NAME",
_name,
localize "STR_EPOCH_CLASS",
_typeOf,
localize "STR_EPOCH_CARGO_SPACE",
"\z\addons\dayz_code\gui\gear\gear_ui_slots_weapons_white.paa",
"\z\addons\dayz_code\gui\gear\gear_ui_slots_items_white.paa",
"\z\addons\dayz_code\gui\gear\gear_ui_slots_backPacks_white.paa",
_weaponSlots,
_magazineSlots,
_backPackSlots,
_weaponsCount,
_magazineCount,
_backPackCount
];
if (_localVehicle) then {_formattedText = _formattedText + format ["<t color='#33BFFF' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2</t><br />",localize "STR_CL_VG_PRICE",_price];};
if (!_localVehicle) then {
if (_DateStored != "old") then {
_formattedText = _formattedText + format ["<t color='#33BFFF' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2</t><br />",localize "STR_CL_VG_STOREDATE",_DateStored];
if (_MaintainDays >= 0) then {
_formattedText = _formattedText + format ["<t color='#33BFFF' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2</t><br /><t color='#33BFFF' size='0.7'>%3: </t><t color='#ffffff' size='0.7'>%4</t><br />",localize "STR_CL_VG_MAINTAINDATE",_DateMaintained,localize "STR_CL_VG_MAINTAININTERVAL",_MaintainDays];
};
} else {
_formattedText = _formattedText + format ["<t color='#33BFFF' size='0.7'>%1: </t><t color='#ffffff' size='0.7'>%2</t><br />",localize "STR_CL_VG_STOREDATE",localize "STR_CL_VG_STOREDATE_INVALID"];
};
};
((findDisplay 2800) displayCtrl 2803) ctrlSetStructuredText parseText _formattedText;
ctrlShow [2803,true];
ctrlShow [2830,true];

View File

@@ -0,0 +1,64 @@
// Developed by [GZA] David for German Zombie Apocalypse Servers (https://zombieapo.eu/)
// Rewritten by salival (https://github.com/oiad)
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_class","_control","_displayName","_heliPad","_isNearPlot","_itemText","_localVehicles","_plotCheck","_storedVehicles","_vgDisplCtl"];
disableSerialization;
vg_hasRun = false;
createDialog "virtualGarage";
{ctrlShow [_x,false]} count [2803,2830,2850,2851,2852,2853];
_plotCheck = [player,false] call FNC_find_plots;
_isNearPlot = (_plotCheck select 1) > 0;
PVDZE_queryVehicle = if (vg_tiedToPole) then {
[player,if (_isNearPlot) then {(_plotCheck select 2) getVariable ["ownerPUID","0"]} else {dayz_playerUID}]
} else {
[player]
};
publicVariableServer "PVDZE_queryVehicle";
waitUntil {!isNil "PVDZE_queryVehicleResult"};
_storedVehicles = PVDZE_queryVehicleResult;
PVDZE_queryVehicle = nil;
PVDZE_queryVehicleResult = nil;
_localVehicles = ([player] call FNC_getPos) nearEntities [["Air","LandVehicle","Ship"],Z_VehicleDistance];
_heliPad = nearestObjects [if (_isNearPlot) then {_plotCheck select 2} else {player},vg_heliPads,if (_isNearPlot) then {DZE_maintainRange} else {Z_VehicleDistance}];
if (count _heliPad > 0 && {_isNearPlot}) then {ctrlShow[2853,true];};
_control = ((findDisplay 2800) displayCtrl 2802);
lbClear _control;
if (count _storedVehicles == 0 && {isNull DZE_myVehicle || {!(alive DZE_myVehicle)} || {!(local DZE_myVehicle)}}) exitWith {ctrlSetText[2811,localize "STR_CL_VG_NO_VEHICLES"];};
vg_vehicleList = [];
{
_displayName = getText(configFile >> "CfgVehicles" >> (_x select 1) >> "displayName");
_control lbAdd _displayName;
_control lbSetData [(lbSize _control)-1,str(_x)];
vg_vehicleList set [count vg_vehicleList,_x];
} count _storedVehicles;
{
if (!isNull DZE_myVehicle && {local DZE_myVehicle} && {alive DZE_myVehicle} && {DZE_myVehicle == _x}) then {
_class = typeOf _x;
_displayName = getText(configFile >> "CfgVehicles" >> _class >> "displayName");
_control lbAdd _displayName;
_control lbSetData [(lbSize _control)-1,_class];
_control lbSetColor [(lbSize _control)-1,[0, 1, 0, 1]];
vg_vehicleList set [count vg_vehicleList,_x];
};
} count _localVehicles;
ctrlShow[2810,false];
ctrlShow[2811,false];
ctrlSetText [2804, format ["%1 (%2 %3)",localize "STR_CL_VG_YOUR_VEHICLES",count (_storedVehicles),localize "STR_CL_VG_VEHICLES"]];