mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-17 21:52:56 +03:00
Revert "Revert "Merge branch 'master' of https://github.com/EpochModTeam/DayZ-Epoch""
This reverts commit 109ec5c9a3.
This commit is contained in:
@@ -135,6 +135,7 @@ if (Z_SellingFrom == 2) then {
|
||||
if (_type == "trade_weapons") then {_name = configFile >> "CfgWeapons" >> _name;};
|
||||
if (_x select 0 == dayz_onBack) then {
|
||||
dayz_onBack = ""; // Remove from back
|
||||
player setVariable ["dayz_onBack",dayz_onBack,true];
|
||||
_localResult = 1;
|
||||
} else {
|
||||
_localResult = [player,_name,1] call BIS_fnc_invRemove; // Use config for BIS_fnc_invRemove
|
||||
|
||||
85
SQF/dayz_code/actions/buryActions.sqf
Normal file
85
SQF/dayz_code/actions/buryActions.sqf
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Bury/Butcher body script by salival (https://github.com/oiad)
|
||||
*/
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_action","_backPackMag","_backPackWpn","_crate","_corpse","_cross","_gain","_isBury","_grave","_name","_playerNear","_backPack","_position","_sound","_notOnRoad"];
|
||||
|
||||
_corpse = (_this select 3) select 0;
|
||||
if (isNull _corpse) exitWith {dayz_actionInProgress = false; systemChat localize "str_cursorTargetNotFound";};
|
||||
|
||||
_playerNear = {isPlayer _x} count (([_corpse] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
|
||||
_action = (_this select 3) select 1;
|
||||
_notOnRoad = false; // Restrict burying/butchering on roads?
|
||||
|
||||
player removeAction s_player_bury_human;
|
||||
s_player_bury_human = -1;
|
||||
player removeAction s_player_butcher_human;
|
||||
s_player_butcher_human = -1;
|
||||
|
||||
_position = getPosATL _corpse;
|
||||
_isBury = _action == "bury";
|
||||
|
||||
if (_notOnRoad && {isOnRoad _position}) exitWith {dayz_actionInProgress = false; format[localize "STR_CL_BA_ROAD",if (_isBury) then {localize "STR_CL_BA_BURY1"} else {"STR_CL_BA_BUTCHER1"}] call dayz_rollingMessages;};
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (!_finished) exitWith {dayz_actionInProgress = false;localize "str_epoch_player_26" call dayz_rollingMessages;};
|
||||
|
||||
_corpse setVariable["isBuried",true,true];
|
||||
|
||||
_backPack = typeOf (unitBackPack _corpse);
|
||||
|
||||
_crate = createVehicle ["DZ_AmmoBoxSmallUS",_position,[],0,"CAN_COLLIDE"];
|
||||
_crate setPosATL [(_position select 0)+1,(_position select 1)+1.5,_position select 2];
|
||||
_crate setVariable ["permaLoot",true,true];
|
||||
_crate setVariable ["bury",true,true];
|
||||
|
||||
_grave = createVehicle ["Grave",_position,[],0,"CAN_COLLIDE"];
|
||||
_grave setPosATL [(_position select 0)+1,_position select 1,_position select 2];
|
||||
_grave setVariable ["bury",true,true];
|
||||
|
||||
if (_isBury) then {
|
||||
_name = _corpse getVariable["bodyName","unknown"];
|
||||
_cross = createVehicle ["GraveCross1",_position,[],0,"CAN_COLLIDE"];
|
||||
_cross setPosATL [(_position select 0)+1,(_position select 1)-1.2,_position select 2];
|
||||
_cross setVariable ["bury",true,true];
|
||||
};
|
||||
|
||||
{_crate addWeaponCargoGlobal [_x,1]} forEach weapons _corpse;
|
||||
{_crate addMagazineCargoGlobal [_x,1]} forEach magazines _corpse;
|
||||
|
||||
if (_backPack != "") then {
|
||||
_backPackWpn = getWeaponCargo unitBackpack _corpse;
|
||||
_backPackMag = getMagazineCargo unitBackpack _corpse;
|
||||
|
||||
if (count _backPackWpn > 0) then {{_crate addWeaponCargoGlobal [_x,(_backPackWpn select 1) select _forEachIndex]} forEach (_backPackWpn select 0);};
|
||||
if (count _backPackMag > 0) then {{_crate addMagazineCargoGlobal [_x,(_backPackMag select 1) select _forEachIndex]} forEach (_backPackMag select 0);};
|
||||
|
||||
_crate addBackpackCargoGlobal [_backPack,1];
|
||||
};
|
||||
|
||||
_sound = _corpse getVariable ["sched_co_fliesSource",nil];
|
||||
if (!isNil "_sound") then {
|
||||
detach _sound;
|
||||
deleteVehicle _sound;
|
||||
};
|
||||
|
||||
deleteVehicle _corpse;
|
||||
|
||||
if (_isBury) then {
|
||||
if (_name != "unknown") then {
|
||||
format[localize "STR_CL_BA_RIP",_name] call dayz_rollingMessages;
|
||||
} else {
|
||||
localize "STR_CL_BA_RIP_UNKNOWN" call dayz_rollingMessages;
|
||||
};
|
||||
} else {
|
||||
["knives",0.2] call fn_dynamicTool;
|
||||
};
|
||||
|
||||
_gain = if (_isBury) then {DZE_Bury_Body_Value} else {DZE_Butcher_Body_Value};
|
||||
_gain call player_humanityChange;
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
70
SQF/dayz_code/actions/garageDoorOpener.sqf
Normal file
70
SQF/dayz_code/actions/garageDoorOpener.sqf
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Garage door opener script by salival (https://github.com/oiad)
|
||||
*/
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_door","_typeof","_state"];
|
||||
|
||||
_door = _this select 3;
|
||||
_typeof = typeof _door;
|
||||
_state = 5;
|
||||
|
||||
if (isNull _door) exitWith {dayz_actionInProgress = false; systemChat localize "str_cursorTargetNotFound";};
|
||||
|
||||
{DZE_myVehicle removeAction _x} count s_player_gdoor_opener;s_player_gdoor_opener = [];
|
||||
s_player_gdoor_opener_ctrl = 1;
|
||||
|
||||
call {
|
||||
if (_typeof in ["WoodenGate_1_DZ","WoodenGate_2_DZ","WoodenGate_3_DZ","WoodenGate_4_DZ"]) exitwith {
|
||||
if (_door animationPhase "DoorR" == 0) then {
|
||||
systemChat localize "STR_CL_GDO_DOOR_OPEN";
|
||||
_door animate ["DoorR",1];
|
||||
_door animate ["DoorL",1];
|
||||
} else {
|
||||
systemChat localize "STR_CL_GDO_DOOR_CLOSE";
|
||||
_door animate ["DoorR",0];
|
||||
_door animate ["DoorL",0];
|
||||
_state = 4;
|
||||
};
|
||||
};
|
||||
if (_typeof in ["CinderGarageOpenTopLocked_DZ","Land_DZE_WoodOpenTopGarageLocked"]) exitwith {
|
||||
if (_door animationPhase "doorl" == 0) then {
|
||||
systemChat localize "STR_CL_GDO_DOOR_OPEN";
|
||||
_door animate ["doorR",1];
|
||||
_door animate ["doorl",1];
|
||||
} else {
|
||||
systemChat localize "STR_CL_GDO_DOOR_CLOSE";
|
||||
_door animate ["doorR",0];
|
||||
_door animate ["doorl",0];
|
||||
_state = 4;
|
||||
};
|
||||
};
|
||||
if (_typeof in ["CinderGateLocked_DZ","Land_DZE_WoodGateLocked"]) exitwith {
|
||||
if (_door animationPhase "Open_door" == 0) then {
|
||||
systemChat localize "STR_CL_GDO_DOOR_OPEN";
|
||||
_door animate ["Open_door",1];
|
||||
_door animate ["Open_doorR",1];
|
||||
} else {
|
||||
systemChat localize "STR_CL_GDO_DOOR_CLOSE";
|
||||
_door animate ["Open_door",0];
|
||||
_door animate ["Open_doorR",0];
|
||||
_state = 4;
|
||||
};
|
||||
};
|
||||
if (_door animationPhase "Open_door" == 0) then {
|
||||
systemChat localize "STR_CL_GDO_DOOR_OPEN";
|
||||
_door animate ["Open_door",1];
|
||||
} else {
|
||||
systemChat localize "STR_CL_GDO_DOOR_CLOSE";
|
||||
_door animate ["Open_door",0];
|
||||
_state = 4;
|
||||
};
|
||||
};
|
||||
|
||||
PVDZE_handleSafeGear = [player,_door,_state,"DoorOpener"];
|
||||
publicVariableServer "PVDZE_handleSafeGear";
|
||||
|
||||
s_player_gdoor_opener_ctrl = -1;
|
||||
dayz_actionInProgress = false;
|
||||
@@ -1,27 +1,27 @@
|
||||
private ["_item","_type","_hasHarvested","_knifeArray","_PlayerNear","_isListed","_activeKnife","_text","_qty","_string","_isZombie","_humanity","_finished"];
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
_item = _this;
|
||||
_type = typeOf _item;
|
||||
_isZombie = _type isKindOf "zZombie_base";
|
||||
_hasHarvested = _item getVariable["meatHarvested",false];
|
||||
local _body = _this;
|
||||
if (isNull _body) exitWith {dayz_actionInProgress = false; systemChat localize "str_cursorTargetNotFound";};
|
||||
if (_body getVariable["meatHarvested",false]) exitWith {dayz_actionInProgress = false;}; // Exit the script if the meat has already been harvested.
|
||||
if ({isPlayer _x} count ((getPosATL _body) nearEntities ["CAManBase", 12]) > 1) exitWith {dayz_actionInProgress = false;localize "str_pickup_limit_5" call dayz_rollingMessages;}; // Exit the script if another player is near to prevent duping.
|
||||
|
||||
_knifeArray = [];
|
||||
local _type = typeOf _body;
|
||||
local _isZombie = _type isKindOf "zZombie_base";
|
||||
local _isMutant = _type == "z_bloodsucker";
|
||||
local _knives = [];
|
||||
local _string = "";
|
||||
|
||||
_PlayerNear = {isPlayer _x} count ((getPosATL _item) nearEntities ["CAManBase", 12]) > 1;
|
||||
if (_PlayerNear) exitWith {localize "str_pickup_limit_5" call dayz_rollingMessages; dayz_actionInProgress = false;};
|
||||
|
||||
//Count how many active tools the player has
|
||||
// Count how many knives the player has
|
||||
{
|
||||
if (_x IN items player) then {
|
||||
_knifeArray set [count _knifeArray, _x];
|
||||
if (_x in items player) then {
|
||||
_knives set [count _knives, _x];
|
||||
};
|
||||
} count Dayz_Gutting;
|
||||
|
||||
if ((count _knifeArray) < 1) exitWith {
|
||||
if (_isZombie) then {
|
||||
// Exit the script if the player doesn't have a knife
|
||||
if ((count _knives) < 1) exitWith {
|
||||
if (_isZombie || _isMutant) then {
|
||||
format[localize "str_missing_to_do_this",localize "STR_EQUIP_NAME_4"] call dayz_rollingMessages;
|
||||
} else {
|
||||
localize "str_cannotgut" call dayz_rollingMessages;
|
||||
@@ -29,48 +29,48 @@ if ((count _knifeArray) < 1) exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
if ((count _knifeArray > 0) and !_hasHarvested) then {
|
||||
//Use sharpest knife player has
|
||||
_activeKnife = _knifeArray select 0;
|
||||
[player,(getPosATL player),10,"gut"] spawn fnc_alertZombies;
|
||||
|
||||
//Get Animal Type
|
||||
_isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type);
|
||||
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
|
||||
local _finished = ["Medic",1] call fn_loopAction;
|
||||
if (!_finished) exitWith {dayz_actionInProgress = false;};
|
||||
|
||||
[player,(getPosATL player),10,"gut"] spawn fnc_alertZombies;
|
||||
// Added Nutrition-Factor for work
|
||||
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (!_finished) exitWith {};
|
||||
//Get Animal Type
|
||||
local _isListed = isClass (configFile >> "CfgSurvival" >> "Meat" >> _type);
|
||||
local _text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
|
||||
|
||||
// Added Nutrition-Factor for work
|
||||
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
||||
_body setVariable ["meatHarvested",true,true];
|
||||
local _qty = if (_isListed) then {getNumber (configFile >> "CfgSurvival" >> "Meat" >> _type >> "yield")} else {2};
|
||||
if ((_knives select 0) == "ItemKnifeBlunt") then {_qty = round(_qty / 2);};
|
||||
|
||||
_item setVariable ["meatHarvested",true,true];
|
||||
|
||||
_qty = if (_isListed) then {getNumber (configFile >> "CfgSurvival" >> "Meat" >> _type >> "yield")} else {2};
|
||||
if (_activeKnife == "ItemKnifeBlunt") then { _qty = round(_qty / 2); };
|
||||
|
||||
if (local _item) then {
|
||||
[_item,_qty] spawn local_gutObject; //leave as spawn (sleeping in loops will work but can freeze the script)
|
||||
} else {
|
||||
PVCDZ_obj_GutBody =[_item,_qty];
|
||||
publicVariable "PVCDZ_obj_GutBody";
|
||||
};
|
||||
|
||||
["knives",0.2] call fn_dynamicTool;
|
||||
|
||||
if (_isZombie) then {
|
||||
// Reduce humanity for gutting zeds
|
||||
_humanity = player getVariable ["humanity",0];
|
||||
_humanity = _humanity - 10;
|
||||
player setVariable ["humanity",_humanity,true];
|
||||
_string = format[localize "str_success_gutted_zombie",_text]; //%1 has been gutted, zombie parts are now on the carcass
|
||||
} else {
|
||||
_string = format[localize "str_success_gutted_animal",_text,_qty];
|
||||
};
|
||||
closeDialog 0;
|
||||
uiSleep 0.02;
|
||||
_string call dayz_rollingMessages;
|
||||
if (local _body) then {
|
||||
[_body,_qty] spawn local_gutObject; //leave as spawn (sleeping in loops will work but can freeze the script)
|
||||
} else {
|
||||
PVCDZ_obj_GutBody =[_body,_qty];
|
||||
publicVariable "PVCDZ_obj_GutBody";
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
["knives",0.2] call fn_dynamicTool;
|
||||
|
||||
call {
|
||||
if (_isZombie) exitWith {
|
||||
// Reduce humanity for gutting zeds
|
||||
local _humanity = player getVariable ["humanity",0];
|
||||
player setVariable ["humanity",(_humanity - 10),true];
|
||||
_string = format[localize "str_success_gutted_zombie",_text]; //%1 has been gutted, zombie parts are now on the carcass
|
||||
};
|
||||
|
||||
if (_isMutant) exitWith {
|
||||
_string = format[localize "str_success_gutted_mutant",_text];
|
||||
};
|
||||
|
||||
_string = format[localize "str_success_gutted_animal",_text,_qty]; // default is gut animal
|
||||
};
|
||||
|
||||
closeDialog 0;
|
||||
uiSleep 0.02;
|
||||
_string call dayz_rollingMessages;
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
57
SQF/dayz_code/actions/locateVehicle.sqf
Normal file
57
SQF/dayz_code/actions/locateVehicle.sqf
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
locateVehicle by salival (https://github.com/oiad)
|
||||
*/
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_characterID","_found","_i","_keyID","_keyIDS","_keyList","_keyName","_keyNames","_locateMarkerDelete","_locateMarkerTime","_marker","_name","_position","_vehicle"];
|
||||
|
||||
_keyList = call epoch_tempKeys;
|
||||
_keyIDS = _keyList select 0;
|
||||
_keyNames = _keyList select 1;
|
||||
|
||||
_locateMarkerDelete = true; // Delete markers after a certain amount of time to avoid cluttering the map?
|
||||
_locateMarkerTime = 60; // Time in seconds before markers are deleted if enabled above.
|
||||
|
||||
_i = 0;
|
||||
for "_i" from 0 to 60 do {deleteMarkerLocal ("vehicleMarker"+ (str _i));};
|
||||
|
||||
if (count _keyIDS < 1) exitWith {dayz_actionInProgress = false; systemChat localize "STR_CL_LV_NO_KEYS";};
|
||||
|
||||
_i = 0;
|
||||
{
|
||||
_keyID = parseNumber (_keyIDS select _forEachIndex);
|
||||
_keyName = _keyNames select _forEachIndex;
|
||||
_found = 0;
|
||||
{
|
||||
_vehicle = typeOf _x;
|
||||
_characterID = parseNumber (_x getVariable ["CharacterID","0"]);
|
||||
if ((_characterID == _keyID) && {_vehicle isKindOf "Air" || {_vehicle isKindOf "LandVehicle"} || {_vehicle isKindOf "Ship"}}) then {
|
||||
_found = _found +1;
|
||||
_i = _i +1;
|
||||
_position = getPos _x;
|
||||
_name = getText (configFile >> "CfgVehicles" >> _vehicle >> "displayName");
|
||||
_marker = createMarkerLocal ["vehicleMarker" + (str _i),[_position select 0,_position select 1]];
|
||||
_marker setMarkerShapeLocal "ICON";
|
||||
_marker setMarkerTypeLocal "DOT";
|
||||
_marker setMarkerColorLocal "ColorOrange";
|
||||
_marker setMarkerSizeLocal [1.0, 1.0];
|
||||
_marker setMarkerTextLocal format ["%1",_name];
|
||||
systemChat format[localize "STR_CL_LV_BELONGS",_keyName,_name,if (!alive _x) then {toLower (format [" (%1)",localize "str_artdlg_destroyed"])} else {""}];
|
||||
};
|
||||
} forEach vehicles;
|
||||
if (_found == 0) then {systemChat format[localize "STR_CL_LV_NO_VEHICLES",_keyName]};
|
||||
} forEach _keyIDS;
|
||||
|
||||
if (_i > 0) then {
|
||||
systemChat format[localize "STR_CL_LV_FOUND",_i];
|
||||
if (_locateMarkerDelete) then {
|
||||
_locateMarkerTime spawn {
|
||||
uiSleep _this;
|
||||
for "_i" from 0 to 60 do {deleteMarkerLocal ("vehicleMarker"+ (str _i));};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
@@ -38,6 +38,7 @@ call gear_ui_init;
|
||||
|
||||
if (_item == dayz_onBack && carryClick) then {
|
||||
dayz_onBack = "";
|
||||
player setVariable ["dayz_onBack",dayz_onBack,true];
|
||||
carryClick = false;
|
||||
((findDisplay 106) displayCtrl 1209) ctrlSetText "";
|
||||
_removed = true;
|
||||
|
||||
@@ -17,13 +17,12 @@ call gear_ui_init;
|
||||
if (_item in ["ItemHatchet","ItemCrowbar","ItemMachete","ItemFishingPole","ItemSledge"]) then {
|
||||
//free primary slot for new melee (remember item to add after)
|
||||
call {
|
||||
if (_item == "ItemHatchet") exitwith {player removeWeapon "ItemHatchet"; dayz_onBack = "MeleeHatchet";};
|
||||
if (_item == "ItemCrowbar") exitwith {player removeWeapon "ItemCrowbar"; dayz_onBack = "MeleeCrowbar";};
|
||||
if (_item == "ItemMachete") exitwith {player removeWeapon "ItemMachete"; dayz_onBack = "MeleeMachete";};
|
||||
if (_item == "ItemFishingPole") exitwith {player removeWeapon "ItemFishingPole"; dayz_onBack = "MeleeFishingPole";};
|
||||
if (_item == "ItemSledge") exitwith {player removeWeapon "ItemSledge"; dayz_onBack = "MeleeSledge";};
|
||||
if (_item == "ItemHatchet") exitwith {player removeWeapon "ItemHatchet"; dayz_onBack = "MeleeHatchet";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
if (_item == "ItemCrowbar") exitwith {player removeWeapon "ItemCrowbar"; dayz_onBack = "MeleeCrowbar";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
if (_item == "ItemMachete") exitwith {player removeWeapon "ItemMachete"; dayz_onBack = "MeleeMachete";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
if (_item == "ItemFishingPole") exitwith {player removeWeapon "ItemFishingPole"; dayz_onBack = "MeleeFishingPole";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
if (_item == "ItemSledge") exitwith {player removeWeapon "ItemSledge"; dayz_onBack = "MeleeSledge";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
};
|
||||
disableSerialization;
|
||||
[[(findDisplay 106)],"onLBSelChanged"] spawn fn_handleGear; //update back
|
||||
|
||||
};
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_item","_config","_onLadder","_consume","_bag","_droppedType"];
|
||||
|
||||
disableSerialization;
|
||||
@@ -8,23 +11,22 @@ _droppedType = getText (_config >> "droppeditem");
|
||||
//Make sure the player still has the tool this script was spawned with
|
||||
if ((dayz_onBack != _item && carryClick) or (!(player hasWeapon _item) && !carryClick)) exitWith {
|
||||
format[localize "str_player_30",getText (_config >> "displayName")] call dayz_rollingMessages;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
|
||||
if (_onLadder) exitWith { localize "str_player_21" call dayz_rollingMessages; };
|
||||
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
|
||||
dayz_actionInProgress = true;
|
||||
if (_onLadder) exitWith {dayz_actionInProgress = false; localize "str_player_21" call dayz_rollingMessages; };
|
||||
|
||||
call gear_ui_init;
|
||||
|
||||
_consume = ([] + getArray (_config >> "magazines")) select 0;
|
||||
|
||||
if (_item == dayz_onBack && carryClick) then {
|
||||
switch DayZ_onBack do {
|
||||
case "MeleeHatchet": {_item = "ItemHatchet"; dayz_onBack = "";};
|
||||
case "MeleeCrowbar": {_item = "ItemCrowbar"; dayz_onBack = "";};
|
||||
case "MeleeMachete": {_item = "ItemMachete"; dayz_onBack = "";};
|
||||
case "MeleeSledge": {_item = "ItemSledge"; dayz_onBack = "";};
|
||||
call {
|
||||
if (dayZ_onBack == "MeleeHatchet") exitWith {_item = "ItemHatchet"; dayz_onBack = ""; player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
if (dayZ_onBack == "MeleeCrowbar") exitWith {_item = "ItemCrowbar"; dayz_onBack = "";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
if (dayZ_onBack == "MeleeMachete") exitWith {_item = "ItemMachete"; dayz_onBack = "";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
if (dayZ_onBack == "MeleeSledge") exitWith {_item = "ItemSledge"; dayz_onBack = "";player setVariable ["dayz_onBack",dayz_onBack,true];};
|
||||
};
|
||||
carryClick = false;
|
||||
((findDisplay 106) displayCtrl 1209) ctrlSetText "";
|
||||
|
||||
@@ -110,7 +110,7 @@ while {_isOk} do {
|
||||
} else {
|
||||
call gear_ui_init;
|
||||
//Remove melee magazines (BIS_fnc_invAdd fix)
|
||||
{player removeMagazines _x} forEach MeleeMagazines;
|
||||
false call dz_fn_meleeMagazines;
|
||||
_result = [player,_itemOut] call BIS_fnc_invAdd;
|
||||
if (_result) then {
|
||||
//Let the player know what he caught
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_mineChance","_breaking","_counter","_rocks","_findNearestRock","_objName","_countOut","_isOk","_proceed","_finished","_itemOut","_weapons"];
|
||||
|
||||
_item = _this;
|
||||
call gear_ui_init;
|
||||
closeDialog 1;
|
||||
|
||||
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
// allowed rocks list move this later
|
||||
_rocks = ["r2_boulder1.p3d","r2_boulder2.p3d","r2_rock1.p3d","r2_rock2.p3d","r2_rocktower.p3d","r2_rockwall.p3d","r2_stone.p3d"];
|
||||
_findNearestRock = objNull;
|
||||
@@ -37,7 +37,7 @@ if (!isNull _findNearestRock) then {
|
||||
_weapons set [count _weapons,dayz_onBack];
|
||||
|
||||
//Make sure player did not drop pickaxe
|
||||
if (!_finished or !("MeleePickaxe" in _weapons or ("ItemPickaxe" in _weapons))) exitWith {
|
||||
if (!_finished || !("ItemPickaxe" in _weapons)) exitWith {
|
||||
_isOk = false;
|
||||
_proceed = false;
|
||||
};
|
||||
@@ -48,18 +48,9 @@ if (!isNull _findNearestRock) then {
|
||||
_breaking = false;
|
||||
if (dayz_toolBreaking && _mineChance) then {
|
||||
_breaking = true;
|
||||
if ("MeleePickaxe" in weapons player) then {
|
||||
player removeWeapon "MeleePickaxe";
|
||||
} else {
|
||||
if ("ItemPickaxe" in weapons player) then {
|
||||
player removeWeapon "ItemPickaxe";
|
||||
} else {
|
||||
if (dayz_onBack == "MeleePickaxe") then {
|
||||
dayz_onBack = "";
|
||||
if (!isNull findDisplay 106) then {findDisplay 106 displayCtrl 1209 ctrlSetText "";};
|
||||
};
|
||||
};
|
||||
};
|
||||
if ("ItemPickaxe" in weapons player) then {
|
||||
player removeWeapon "ItemPickaxe";
|
||||
};
|
||||
if (!("ItemPickaxeBroken" in weapons player)) then {
|
||||
player addWeapon "ItemPickaxeBroken";
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@ if (_canDo && !DZE_Surrender && !(player isKindOf "PZombie_VB")) then {
|
||||
if (dayz_onBack != "") then {
|
||||
[dayz_onBack,2,1] call fn_dropItem;
|
||||
dayz_onBack = ""; // Remove from back
|
||||
player setVariable ["dayz_onBack",dayz_onBack,true];
|
||||
if (!isNull findDisplay 106) then {findDisplay 106 displayCtrl 1209 ctrlSetText "";};
|
||||
};
|
||||
call player_forceSave;
|
||||
|
||||
@@ -151,6 +151,8 @@ dz_fn_switchWeapon_swap = {
|
||||
dayz_onBack = [primaryWeapon player,player removeWeapon primaryWeapon player,player addWeapon dayz_onBack] select 0;
|
||||
};
|
||||
|
||||
player setVariable ["dayz_onBack",dayz_onBack,true];
|
||||
|
||||
if (_this) then {
|
||||
player selectWeapon primaryWeapon player;
|
||||
if (IS_MELEE(primaryWeapon player)) then {
|
||||
|
||||
152
SQF/dayz_code/actions/remoteVehicle/remoteVehicle.sqf
Normal file
152
SQF/dayz_code/actions/remoteVehicle/remoteVehicle.sqf
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
Remote vehicle script by salival (https://github.com/oiad)
|
||||
*/
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_characterID","_checkDistance","_display","_distance","_fuel","_group","_vehicleFound","_keyID","_keyName","_option","_time","_vehicle","_vehicleType","_index","_control","_keyDisplay","_exit"];
|
||||
|
||||
_keyName = _this select 0;
|
||||
_option = _this select 1;
|
||||
|
||||
_checkDistance = true; // Check to see if the player is too far away from the remote
|
||||
_distance = 300; // Maximum distance the player can be away from the vehicle to be able to use the remote.
|
||||
|
||||
disableSerialization;
|
||||
|
||||
_exit = {
|
||||
dayz_actionInProgress = false;
|
||||
rv_vehicleList = nil;
|
||||
rv_selected = nil;
|
||||
};
|
||||
|
||||
_display = findDisplay 106;
|
||||
_display closeDisplay 0;
|
||||
|
||||
_keyList = call epoch_tempKeys;
|
||||
_keyID = 0;
|
||||
|
||||
_keyID = (_keyList select 0) select ((_keyList select 2) find _keyName);
|
||||
_foundPos = (_keyList select 0) find _keyID;
|
||||
|
||||
if (_foundPos >= 0) then {
|
||||
_keyDisplay = (_keyList select 1) select _foundPos;
|
||||
};
|
||||
|
||||
if (_foundPos == -1) exitWith {systemChat localize "STR_CL_RV_NO_KEYS"; call _exit;};
|
||||
|
||||
rv_vehicleList = [];
|
||||
_vehicleFound = false;
|
||||
{
|
||||
_vehicleType = typeOf _x;
|
||||
_characterID = _x getVariable ["CharacterID","0"];
|
||||
if ((_characterID == _keyID) && {_vehicleType isKindOf "Air" || _vehicleType isKindOf "LandVehicle" || _vehicleType isKindOf "Ship"}) then {
|
||||
_vehicleFound = true;
|
||||
rv_vehicleList set [count rv_vehicleList,_x];
|
||||
};
|
||||
} count vehicles;
|
||||
|
||||
if (count rv_vehicleList > 1) then {
|
||||
rv_isOk = false;
|
||||
|
||||
createDialog "remoteVehicle";
|
||||
|
||||
_display = uiNamespace getVariable["rv_dialog", displayNull];
|
||||
_display displayCtrl 8801 ctrlSetText(format[localize "STR_CL_RV_TITLE",_keyDisplay]);
|
||||
|
||||
_control = ((findDisplay 8800) displayCtrl 8802);
|
||||
lbClear _control;
|
||||
{
|
||||
_control lbAdd getText(configFile >> "CfgVehicles" >> typeOf _x >> "displayName");
|
||||
if (!isNull DZE_myVehicle && {local DZE_myVehicle} && {alive DZE_myVehicle} && {DZE_myVehicle == _x}) then {
|
||||
_control lbSetColor [(lbSize _control)-1,[0, 1, 0, 1]];
|
||||
};
|
||||
} count rv_vehicleList;
|
||||
_control lbSetCurSel 0;
|
||||
|
||||
waitUntil {!dialog};
|
||||
|
||||
} else {
|
||||
rv_selected = rv_vehicleList select 0;
|
||||
rv_isOk = true;
|
||||
};
|
||||
|
||||
if (!rv_isOk) exitWith {call _exit;};
|
||||
|
||||
if (!_vehicleFound) exitWith {systemChat localize "STR_CL_RV_NO_VEHICLES"; call _exit;};
|
||||
|
||||
_vehicleType = typeOf rv_selected;
|
||||
_displayName = getText(configFile >> "CfgVehicles" >> _vehicleType >> "displayName");
|
||||
|
||||
if (!alive rv_selected) exitWith {systemChat localize "STR_CL_RV_DESTROYED"; call _exit;};
|
||||
if (_checkDistance && {(player distance rv_selected) >= _distance}) exitWith {format[localize "STR_CL_RV_RANGE_FAIL",_displayName] call dayz_rollingMessages; call _exit;};
|
||||
|
||||
if (_option == 1) then {
|
||||
_group = units group player;
|
||||
|
||||
systemChat format[localize "STR_CL_RV_EJECT",_displayName];
|
||||
{
|
||||
if !(_x in _group) then {
|
||||
_x action ["eject",rv_selected];
|
||||
systemChat format[localize "STR_CL_RV_EJECT_PLAYER",name _x];
|
||||
};
|
||||
} forEach (crew rv_selected);
|
||||
};
|
||||
|
||||
if (_option == 2) then {
|
||||
systemChat format[localize "STR_CL_RV_ENGINE",if (isEngineOn rv_selected) then {localize "strwfoff"} else {localize "strwfon"},_displayName];
|
||||
if (isEngineOn rv_selected) then {
|
||||
if (rv_selected isKindOf "Helicopter") then { // This is needed because dayz_engineSwitch won't turn off the engine for a helicopter.
|
||||
_fuel = fuel rv_selected;
|
||||
rv_selected setFuel 0;
|
||||
player action ["engineOff",rv_selected];
|
||||
uiSleep 4.5;
|
||||
rv_selected setFuel _fuel;
|
||||
} else {
|
||||
[rv_selected,false] call dayz_engineSwitch;
|
||||
};
|
||||
} else {
|
||||
[rv_selected,true] call dayz_engineSwitch;
|
||||
};
|
||||
};
|
||||
|
||||
if (_option == 3) then {
|
||||
systemChat format[localize "STR_BLD_UNLOCKED",_displayName];
|
||||
PVDZE_veh_Lock = [rv_selected,false];
|
||||
_time = diag_tickTime;
|
||||
|
||||
if (local rv_selected) then {
|
||||
PVDZE_veh_Lock call local_lockUnlock;
|
||||
} else {
|
||||
publicVariable "PVDZE_veh_Lock";
|
||||
waitUntil {uiSleep 0.1;(!locked rv_selected or (diag_tickTime - _time > 4))};
|
||||
};
|
||||
};
|
||||
|
||||
if (_option == 4) then {
|
||||
systemChat format[localize "STR_EPOCH_PLAYER_117",_displayName];
|
||||
PVDZE_veh_Lock = [rv_selected,true];
|
||||
_time = diag_tickTime;
|
||||
|
||||
if (local rv_selected) then {
|
||||
PVDZE_veh_Lock call local_lockUnlock;
|
||||
} else {
|
||||
publicVariable "PVDZE_veh_Lock";
|
||||
waitUntil {uiSleep 0.1;(locked rv_selected or (diag_tickTime - _time > 4))};
|
||||
};
|
||||
};
|
||||
|
||||
if (_option == 5) then {
|
||||
if !(rv_selected getVariable["vehicleLights",false]) then {
|
||||
player action ["lightOn", rv_selected];
|
||||
systemChat format[localize "STR_CL_RV_LIGHTS",localize "strwfon",_vehicleType];
|
||||
rv_selected setVariable ["vehicleLights",true,true];
|
||||
} else {
|
||||
player action ["lightOff", rv_selected];
|
||||
systemChat format[localize "STR_CL_RV_LIGHTS",localize "strwfoff",_vehicleType];
|
||||
rv_selected setVariable ["vehicleLights",false,true];
|
||||
};
|
||||
};
|
||||
|
||||
call _exit;
|
||||
54
SQF/dayz_code/actions/remoteVehicle/vehicleInfo.sqf
Normal file
54
SQF/dayz_code/actions/remoteVehicle/vehicleInfo.sqf
Normal file
@@ -0,0 +1,54 @@
|
||||
private ["_backPackCount","_backPackCount_raw","_backPackSlots","_formattedText","_gearCount","_magazineCount","_magazineCount_raw","_magazineSlots","_name","_picture","_price","_text","_typeOf","_weaponSlots","_weaponsCount","_weaponsCount_raw","_control","_index"];
|
||||
|
||||
_gearCount = {
|
||||
private ["_counter"];
|
||||
_counter = 0;
|
||||
{_counter = _counter + _x;} count _this;
|
||||
_counter
|
||||
};
|
||||
|
||||
_control = (_this select 0) select 0;
|
||||
_index = (_this select 0) select 1;
|
||||
|
||||
rv_selected = rv_vehicleList select _index;
|
||||
_typeOf = typeOf rv_selected;
|
||||
|
||||
_weaponsCount_raw = getWeaponCargo rv_selected;
|
||||
_magazineCount_raw = getMagazineCargo rv_selected;
|
||||
_backPackCount_raw = getBackpackCargo rv_selected;
|
||||
|
||||
_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');
|
||||
|
||||
_weaponsCount = (_weaponsCount_raw select 1) call _gearCount;
|
||||
_magazineCount = (_magazineCount_raw select 1) call _gearCount;
|
||||
_backPackCount = (_backPackCount_raw select 1) call _gearCount;
|
||||
|
||||
_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,
|
||||
_text
|
||||
];
|
||||
|
||||
((findDisplay 8800) displayCtrl 8803) ctrlSetStructuredText parseText _formattedText;
|
||||
ctrlShow [8803,true];
|
||||
@@ -137,6 +137,7 @@ if (_brokenTool) then {
|
||||
} else {
|
||||
if (dayz_onBack == "MeleeCrowbar") then {
|
||||
dayz_onBack = ""; // Remove
|
||||
player setVariable ["dayz_onBack",dayz_onBack,true];
|
||||
_success = true;
|
||||
if (!isNull (findDisplay 106)) then {((findDisplay 106) displayCtrl 1209) ctrlSetText "";};
|
||||
};
|
||||
|
||||
176
SQF/dayz_code/actions/servicePoints/init.sqf
Normal file
176
SQF/dayz_code/actions/servicePoints/init.sqf
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
Vehicle Service Point by Axe Cop
|
||||
Rewritten for single currency, gems, briefcase support and 1.0.7 epoch compatibility by salival - https://github.com/oiad/
|
||||
|
||||
Requires DayZ Epoch 1.0.7
|
||||
|
||||
This version adds support for both single currency and gems (from the epoch 1.0.7 update) as well as the original epoch briefcase currency system.
|
||||
Instead of pricing things like the original way, prices are now done on a "worth" similar to how coins are done. The price value of items are below.
|
||||
|
||||
1 silver = 1 worth
|
||||
1 10oz silver = 10 worth
|
||||
1 gold = 100 worth
|
||||
1 10oz gold = 1,000 worth
|
||||
1 briefcase = 10,000 worth
|
||||
|
||||
Please see dayz_code\configVariables.sqf for the value of gems (DZE_GemWorthArray) and their relevant worth if they are enabled.
|
||||
|
||||
Example config settings for DZE_SP_Refuel_Costs, DZE_SP_Repair_Costs and DZE_SP_Rearm_Costs:
|
||||
|
||||
All 3 sections can either be made free, disabled or a specifc price with the following examples:
|
||||
|
||||
["Air",localize "strwffree"] will make the vehicle config class of "Air" free for the specific action.
|
||||
["Air",localize "str_temp_param_disabled"] will make the vehicle config class of "Air" disabled for the specific action.
|
||||
["Air",2000] will make the vehicle config class of "Air" have a worth of 2000 for the specific action.
|
||||
["Armored_SUV_PMC",2000] will make the specific vehicle have a worth of 2000 for the specific action.
|
||||
["Armored_SUV_PMC",localize "strwffree"] will make the specific vehicle be free for the specific action.
|
||||
["Armored_SUV_PMC",localize "str_temp_param_disabled"] will make the specific vehicle be disabled for the specific action.
|
||||
|
||||
Valid vehicle config classes as an example: "Air", "AllVehicles", "All", "APC", "Bicycle", "Car", "Helicopter", "Land", "Motorcycle", "Plane", "Ship", "Tank"
|
||||
*/
|
||||
|
||||
private ["_folder","_actionTitleFormat","_actionCostsFormat","_message","_messageShown","_lastVehicle","_lastRole","_fnc_removeActions","_fnc_getCostsWep","_fnc_getCostsWep","_fnc_actionTitle","_fnc_isArmed","_fnc_getWeapons","_cycleTime","_servicePoints","_vehicle","_role","_costs","_actionTitle","_weapons","_weaponName"];
|
||||
|
||||
// general settings
|
||||
_folder = "\z\addons\dayz_code\actions\servicePoints\"; // folder where the service point scripts are saved, relative to the mission file
|
||||
_actionTitleFormat = "%1 (%2)"; // text of the vehicle menu, %1 = action name (Refuel, Repair, Rearm), %2 = costs (see format below)
|
||||
_actionCostsFormat = "%2 %1"; // %1 = item name, %2 = item count
|
||||
_message = localize "STR_CL_SP_MESSAGE"; // This is translated from your stringtable.xml in your mission folder root. Set to "" to disable
|
||||
_cycleTime = 5; // Time in sections for how often the action menu will be refreshed and how often it will search for a nearby fuel station (setting this too low can make a lot of lag)
|
||||
|
||||
_lastVehicle = objNull;
|
||||
_lastRole = [];
|
||||
_messageShown = false;
|
||||
|
||||
SP_refuel_action = -1;
|
||||
SP_repair_action = -1;
|
||||
SP_rearm_actions = [];
|
||||
|
||||
_fnc_removeActions = {
|
||||
if (isNull _lastVehicle) exitWith {};
|
||||
_lastVehicle removeAction SP_refuel_action;
|
||||
SP_refuel_action = -1;
|
||||
_lastVehicle removeAction SP_repair_action;
|
||||
SP_repair_action = -1;
|
||||
{
|
||||
_lastVehicle removeAction _x;
|
||||
} forEach SP_rearm_actions;
|
||||
SP_rearm_actions = [];
|
||||
_lastVehicle = objNull;
|
||||
_lastRole = [];
|
||||
};
|
||||
|
||||
_fnc_getCosts = {
|
||||
private ["_getVehicle","_getCosts","_cost","_getTypeName"];
|
||||
_getVehicle = _this select 0;
|
||||
_getCosts = _this select 1;
|
||||
_cost = [];
|
||||
{
|
||||
_getTypeName = _x select 0;
|
||||
if (_getVehicle isKindOf _getTypeName) exitWith {
|
||||
_cost = _x select 1;
|
||||
};
|
||||
} forEach _getCosts;
|
||||
_cost
|
||||
};
|
||||
|
||||
_fnc_getCostsWep = {
|
||||
private ["_weapon","_getCostsWep","_returnCostWep","_typeName"];
|
||||
_weapon = _this select 0;
|
||||
_getCostsWep = _this select 1;
|
||||
_returnCostWep = DZE_SP_Rearm_Defaultcost;
|
||||
{
|
||||
_typeName = _x select 0;
|
||||
if (_weapon == _typeName) exitWith {
|
||||
_returnCostWep = _x select 1;
|
||||
};
|
||||
} forEach _getCostsWep;
|
||||
_returnCostWep
|
||||
};
|
||||
|
||||
_fnc_actionTitle = {
|
||||
private ["_actionName","_actionCosts","_costsText","_return"];
|
||||
_actionName = _this select 0;
|
||||
_actionCosts = _this select 1;
|
||||
if (typeName _actionCosts == "STRING") then {
|
||||
_costsText = _actionCosts;
|
||||
} else {
|
||||
_costsText = if (Z_SingleCurrency) then {format ["%1 %2",[_actionCosts] call BIS_fnc_numberText,CurrencyName]} else {format ["%1",[_actionCosts,true] call z_calcCurrency]};
|
||||
};
|
||||
_return = format [_actionTitleFormat,_actionName,_costsText];
|
||||
_return
|
||||
};
|
||||
|
||||
_fnc_getWeapons = {
|
||||
private ["_gWeaponsVehicle","_gWeaponsRole","_gWeapons","_gWeaponName","_gTurret","_gWeaponsTurret"];
|
||||
_gWeaponsVehicle = _this select 0;
|
||||
_gWeaponsRole = _this select 1;
|
||||
_gWeapons = [];
|
||||
if (count _gWeaponsRole > 1) then {
|
||||
_gTurret = _gWeaponsRole select 1;
|
||||
_gWeaponsTurret = _gWeaponsVehicle weaponsTurret _gTurret;
|
||||
{
|
||||
_gWeaponName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
|
||||
if !(_gWeaponName in DZE_SP_Rearm_Ignore) then {
|
||||
_gWeapons set [count _gWeapons, [_x,_gWeaponName,_gTurret]];
|
||||
};
|
||||
} forEach _gWeaponsTurret;
|
||||
};
|
||||
_gWeapons
|
||||
};
|
||||
|
||||
while {1==1} do {
|
||||
_vehicle = vehicle player;
|
||||
if (_vehicle != player) then {
|
||||
_servicePoints = (nearestObjects [getPosATL _vehicle,DZE_SP_Classes,DZE_SP_MaxDistance]) - [_vehicle];
|
||||
if (count _servicePoints > 0) then {
|
||||
if (assignedDriver _vehicle == player) then {
|
||||
_role = ["Driver", [-1]];
|
||||
} else {
|
||||
_role = assignedVehicleRole player;
|
||||
};
|
||||
if (((str _role) != (str _lastRole)) || {_vehicle != _lastVehicle}) then {
|
||||
call _fnc_removeActions;
|
||||
};
|
||||
_lastVehicle = _vehicle;
|
||||
_lastRole = _role;
|
||||
if (DZE_SP_Refuel_Enable) then {
|
||||
if (SP_refuel_action < 0) then {
|
||||
_costs = [_vehicle,DZE_SP_Refuel_Costs] call _fnc_getCosts;
|
||||
_actionTitle = [localize "config_depot.sqf8",_costs] call _fnc_actionTitle;
|
||||
SP_refuel_action = _vehicle addAction [_actionTitle,_folder + "servicePointActions.sqf",["refuel",_costs,DZE_SP_Refuel_UpdateInterval,DZE_SP_Refuel_Amount],-1,false,true];
|
||||
};
|
||||
};
|
||||
if (DZE_SP_Repair_Enable) then {
|
||||
if (SP_repair_action < 0) then {
|
||||
_costs = [_vehicle,DZE_SP_Repair_Costs] call _fnc_getCosts;
|
||||
_actionTitle = [localize "config_depot.sqf1",_costs] call _fnc_actionTitle;
|
||||
SP_repair_action = _vehicle addAction [_actionTitle,_folder + "servicePointActions.sqf",["repair",_costs,DZE_SP_Repair_RepairTime],-1,false,true];
|
||||
};
|
||||
};
|
||||
if (DZE_SP_Rearm_Enable) then {
|
||||
if ((count _role > 1) && {count SP_rearm_actions == 0}) then {
|
||||
_weapons = [_vehicle,_role] call _fnc_getWeapons;
|
||||
{
|
||||
_weaponName = _x select 1;
|
||||
_costs = [_weaponName,DZE_SP_Rearm_Costs] call _fnc_getCostsWep;
|
||||
_actionTitle = [format["%1 %2",localize "config_depot.sqf5",_weaponName],_costs] call _fnc_actionTitle;
|
||||
SP_rearm_action = _vehicle addAction [_actionTitle,_folder + "servicePointActions.sqf",["rearm",_costs,DZE_SP_Rearm_MagazineCount,_x],-1,false,true];
|
||||
SP_rearm_actions set [count SP_rearm_actions, SP_rearm_action];
|
||||
} forEach _weapons;
|
||||
};
|
||||
};
|
||||
if (!_messageShown && {_message != ""}) then {
|
||||
_messageShown = true;
|
||||
_vehicle vehicleChat _message;
|
||||
};
|
||||
} else {
|
||||
call _fnc_removeActions;
|
||||
_messageShown = false;
|
||||
};
|
||||
} else {
|
||||
call _fnc_removeActions;
|
||||
_messageShown = false;
|
||||
};
|
||||
uiSleep _cycleTime;
|
||||
};
|
||||
143
SQF/dayz_code/actions/servicePoints/servicePointActions.sqf
Normal file
143
SQF/dayz_code/actions/servicePoints/servicePointActions.sqf
Normal file
@@ -0,0 +1,143 @@
|
||||
// Vehicle Service Point (Rearm) by Axe Cop
|
||||
// Rewritten for single currency, gems, briefcase support and 1.0.7 epoch compatibility by salival - https://github.com/oiad/
|
||||
// Requires DayZ Epoch 1.0.7 for gem support.
|
||||
|
||||
private ["_vehicle","_costs","_fuel","_magazineCount","_weapon","_type","_name","_weaponType","_weaponName","_turret","_magazines","_ammo","_textMissing","_pos","_message","_action","_damage","_selection","_strH","_disabled","_amount","_enoughMoney","_moneyInfo","_wealth","_success","_reason","_cmpt"];
|
||||
|
||||
_vehicle = _this select 0;
|
||||
|
||||
_ammo = "";
|
||||
_reason = "";
|
||||
|
||||
_action = (_this select 3) select 0;
|
||||
|
||||
_type = typeOf _vehicle;
|
||||
_disabled = false;
|
||||
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
|
||||
|
||||
_amount = (_this select 3) select 1;
|
||||
|
||||
if (_action == "rearm") then {
|
||||
_magazineCount = (_this select 3) select 2;
|
||||
_weapon = (_this select 3) select 3;
|
||||
|
||||
_weaponType = _weapon select 0;
|
||||
_weaponName = _weapon select 1;
|
||||
_turret = _weapon select 2;
|
||||
};
|
||||
|
||||
if (typeName _amount == "STRING") then {
|
||||
if (_amount == (localize "str_temp_param_disabled")) then {
|
||||
if (_action == "rearm") then {_reason = format[localize "STR_CL_SP_UNABLE_REARM",_weaponName]; _disabled = true};
|
||||
if (_action == "repair") then {_reason = format[localize "STR_CL_SP_UNABLE_REPAIR",_name]; _disabled = true};
|
||||
if (_action == "refuel") then {_reason = format[localize "STR_CL_SP_UNABLE_REFUEL",_name]; _disabled = true};
|
||||
};
|
||||
if (_amount == (localize "strwffree")) then {_amount = 0};
|
||||
};
|
||||
|
||||
if (_disabled) exitWith {[_reason,1] call dayz_rollingMessages};
|
||||
|
||||
_enoughMoney = false;
|
||||
_moneyInfo = [false, [], [], [], 0];
|
||||
_wealth = player getVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),0];
|
||||
|
||||
if (Z_SingleCurrency) then {
|
||||
_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"}; // Not enough room in gear or bag to accept change
|
||||
|
||||
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];
|
||||
};
|
||||
|
||||
[player,(getPosATL player),50,"refuel"] spawn fnc_alertZombies;
|
||||
_vehicle engineOn false;
|
||||
if (_action == "refuel") then {
|
||||
[format[localize "STR_CL_SP_REFUELING",_name],1] call dayz_rollingMessages;
|
||||
|
||||
while {vehicle player == _vehicle} do {
|
||||
if ([0,0,0] distance (velocity _vehicle) > 1) exitWith {[format[localize "STR_CL_SP_REFUELING_STOPPED",_name],1] call dayz_rollingMessages};
|
||||
_fuel = (fuel _vehicle) + ((_this select 3) select 3);
|
||||
if (_fuel > 0.99) exitWith {
|
||||
_vehicle setFuel 1;
|
||||
[format[localize "STR_CL_SP_REFUEL_OK",_name],1] call dayz_rollingMessages;
|
||||
};
|
||||
_vehicle setFuel _fuel;
|
||||
uiSleep ((_this select 3) select 2);
|
||||
};
|
||||
};
|
||||
if (_action == "repair") then {
|
||||
[player,(getPosATL player),50,"repair"] spawn fnc_alertZombies;
|
||||
|
||||
_hitpoints = _vehicle call vehicle_getHitpoints;
|
||||
_allRepaired = true;
|
||||
{
|
||||
if ((vehicle player != _vehicle) || {[0,0,0] distance (velocity _vehicle) > 1}) exitWith {
|
||||
_allRepaired = false;
|
||||
[format[localize "STR_CL_SP_REPAIRING_STOPPED",_name],1] call dayz_rollingMessages;
|
||||
};
|
||||
_hits = [_vehicle,_x] call object_getHit;
|
||||
_damage = _hits select 0;
|
||||
if (_damage > 0) then {
|
||||
_cmpt = [];
|
||||
{
|
||||
if (_forEachIndex > 2) then {_cmpt set [count _cmpt,_x]};
|
||||
} forEach toArray (_x);
|
||||
_cmpt = toString _cmpt;
|
||||
[format[localize "STR_CL_SP_REPAIRING",_cmpt],1] call dayz_rollingMessages;
|
||||
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _x >> "name");
|
||||
_strH = "hit_" + (_selection);
|
||||
_vehicle setHit[_selection,0];
|
||||
_vehicle setVariable [_strH,0,true];
|
||||
uiSleep ((_this select 3) select 2);
|
||||
};
|
||||
} forEach _hitpoints;
|
||||
PVDZ_veh_Save = [_vehicle,"repair",true];
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
|
||||
if (_allRepaired) then {
|
||||
_vehicle setDamage 0;
|
||||
_vehicle setVelocity [0,0,1];
|
||||
[format[localize "STR_CL_SP_REPAIR_OK",_name],1] call dayz_rollingMessages;
|
||||
};
|
||||
};
|
||||
|
||||
if (_action == "rearm") then {
|
||||
_magazines = getArray (configFile >> "CfgWeapons" >> _weaponType >> "magazines");
|
||||
_ammo = _magazines select 0;
|
||||
|
||||
if (_weaponType == "CMFlareLauncher") then {
|
||||
_vehicle removeWeaponTurret ["CMFlareLauncher",_turret];
|
||||
for "_i" from 1 to _magazineCount do {_vehicle addMagazineTurret [_ammo,_turret];};
|
||||
_vehicle addWeaponTurret ["CMFlareLauncher",_turret];
|
||||
} else {
|
||||
{_vehicle removeMagazinesTurret [_x,_turret];} forEach _magazines;
|
||||
|
||||
for "_i" from 1 to _magazineCount do {_vehicle addMagazineTurret [_ammo,_turret];};
|
||||
};
|
||||
|
||||
[format[localize "STR_CL_SP_REARMED",_weaponName,_name],1] call dayz_rollingMessages;
|
||||
};
|
||||
call player_forceSave;
|
||||
} 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_SP_FAIL_COINS",[_amount] call BIS_fnc_numberText,_itemText,_action,_name];
|
||||
} else {
|
||||
systemChat format[localize "STR_CL_SP_FAIL_BRIEFCASES",_itemText,_action,_name];
|
||||
};
|
||||
};
|
||||
45
SQF/dayz_code/actions/takeClothes.sqf
Normal file
45
SQF/dayz_code/actions/takeClothes.sqf
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Originally by Zabn
|
||||
Modified for DayZ Epoch 1.0.7+ by salival (https://github.com/oiad)
|
||||
*/
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_body","_clothesTaken","_finished","_itemNew","_itemNewName","_okSkin","_playerNear","_result","_skin"];
|
||||
|
||||
_body = _this select 3;
|
||||
|
||||
player removeAction s_player_clothes;
|
||||
s_player_clothes = -1;
|
||||
|
||||
if (isNull _body) exitWith {dayz_actionInProgress = false; systemChat localize "str_cursorTargetNotFound";};
|
||||
|
||||
_playerNear = {isPlayer _x} count (([_body] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
|
||||
_clothesTaken = _body getVariable["clothesTaken",false];
|
||||
if (_clothesTaken) exitWith {dayz_actionInProgress = false; localize "STR_CL_TC_ALREADY_TAKEN" call dayz_rollingMessages;};
|
||||
|
||||
_skin = typeOf _body;
|
||||
_itemNew = _skin;
|
||||
_itemNew = "Skin_" + _itemNew;
|
||||
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);
|
||||
|
||||
if (!_okSkin || _skin in DZE_Disable_Take_Clothes) exitWith {dayz_actionInProgress = false; format[localize "STR_CL_TC_NOT_SUPPORTED",_skin] call dayz_rollingMessages;};
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (_finished) then {
|
||||
_itemNewName = getText (configFile >> "CfgMagazines" >> _itemNew >> "displayName");
|
||||
_result = [player,_itemNew] call BIS_fnc_invAdd;
|
||||
if (_result) then {
|
||||
_body setVariable["clothesTaken",true,true];
|
||||
format[localize "STR_CL_TC_ADD_OK",_itemNewName] call dayz_rollingMessages;
|
||||
} else {
|
||||
format[localize "STR_CL_TC_ADD_FAIL",_itemNewName] call dayz_rollingMessages;
|
||||
};
|
||||
} else {
|
||||
localize "str_epoch_player_26" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
42
SQF/dayz_code/actions/virtualGarage/player_MaintainVG.sqf
Normal file
42
SQF/dayz_code/actions/virtualGarage/player_MaintainVG.sqf
Normal 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;
|
||||
};
|
||||
69
SQF/dayz_code/actions/virtualGarage/player_getVehicle.sqf
Normal file
69
SQF/dayz_code/actions/virtualGarage/player_getVehicle.sqf
Normal 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;
|
||||
24
SQF/dayz_code/actions/virtualGarage/player_removePad.sqf
Normal file
24
SQF/dayz_code/actions/virtualGarage/player_removePad.sqf
Normal 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";
|
||||
};
|
||||
209
SQF/dayz_code/actions/virtualGarage/player_storeVehicle.sqf
Normal file
209
SQF/dayz_code/actions/virtualGarage/player_storeVehicle.sqf
Normal 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];
|
||||
};
|
||||
};
|
||||
110
SQF/dayz_code/actions/virtualGarage/vehicleInfo.sqf
Normal file
110
SQF/dayz_code/actions/virtualGarage/vehicleInfo.sqf
Normal 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];
|
||||
64
SQF/dayz_code/actions/virtualGarage/virtualGarage.sqf
Normal file
64
SQF/dayz_code/actions/virtualGarage/virtualGarage.sqf
Normal 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"]];
|
||||
68
SQF/dayz_code/actions/vkc/vehicleInfo.sqf
Normal file
68
SQF/dayz_code/actions/vkc/vehicleInfo.sqf
Normal file
@@ -0,0 +1,68 @@
|
||||
private ["_backPackCount","_backPackCount_raw","_backPackSlots","_formattedText","_gearCount","_magazineCount","_magazineCount_raw","_magazineSlots","_name","_picture","_price","_text","_typeOf","_weaponSlots","_weaponsCount","_weaponsCount_raw"];
|
||||
|
||||
_gearCount = {
|
||||
private ["_counter"];
|
||||
_counter = 0;
|
||||
{_counter = _counter + _x;} count _this;
|
||||
_counter
|
||||
};
|
||||
|
||||
if (vkc_action == "claim") then {
|
||||
ctrlShow[4850,true];
|
||||
_text = localize "STR_CL_VKC_CLAIM";
|
||||
_price = vkc_claimPrice;
|
||||
} else {
|
||||
ctrlShow[4851,true];
|
||||
_text = localize "STR_CL_VKC_CHANGE";
|
||||
_price = vkc_changePrice;
|
||||
};
|
||||
|
||||
_typeOf = typeOf vkc_cursorTarget;
|
||||
_weaponsCount_raw = getWeaponCargo vkc_cursorTarget;
|
||||
_magazineCount_raw = getMagazineCargo vkc_cursorTarget;
|
||||
_backPackCount_raw = getBackpackCargo vkc_cursorTarget;
|
||||
|
||||
_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');
|
||||
|
||||
_weaponsCount = (_weaponsCount_raw select 1) call _gearCount;
|
||||
_magazineCount = (_magazineCount_raw select 1) call _gearCount;
|
||||
_backPackCount = (_backPackCount_raw select 1) call _gearCount;
|
||||
|
||||
if (!isNil "sk_dualCurrency") then {if (z_singleCurrency) then {_price = _price * 10};};
|
||||
|
||||
_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 />" +
|
||||
"<t color='#33BFFF' size='0.7'>Price to %16: </t><t color='#ffffff' size='0.7'>%17</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,
|
||||
toLower (_text),
|
||||
_price
|
||||
];
|
||||
|
||||
((findDisplay 4800) displayCtrl 4803) ctrlSetStructuredText parseText _formattedText;
|
||||
ctrlShow [4803,true];
|
||||
175
SQF/dayz_code/actions/vkc/vehicleKeyChanger.sqf
Normal file
175
SQF/dayz_code/actions/vkc/vehicleKeyChanger.sqf
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
Vehicle Key Changer by salival (https://github.com/oiad)
|
||||
|
||||
This version adds support for both single currency and gems (from the epoch 1.0.6 update) as well as the original epoch briefcase currency system.
|
||||
Instead of pricing things like the original way, prices are now done on a "worth" similar to how coins are done. The price value of items are below.
|
||||
If you are using coins, I would recommend using the _currencyModifier variable since coins typically are 10x the value of briefcase based currency (1 brief == 100,000 coins)
|
||||
|
||||
1 silver = 1 worth
|
||||
1 10oz silver = 10 worth
|
||||
1 gold = 100 worth
|
||||
1 10oz gold = 1,000 worth
|
||||
1 briefcase = 10,000 worth
|
||||
|
||||
Please see dayz_code\configVariables.sqf for the value of gems (DZE_GemWorthArray) and their relevant worth if they are enabled.
|
||||
*/
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
disableSerialization;
|
||||
private ["_amount","_characterID","_control","_currencyModifier","_enoughMoney","_exit","_foundPos","_index","_itemText","_message","_moneyInfo","_name","_playerNear","_position","_success","_typeOf","_vehicleID","_vehicleUID","_wealth"];
|
||||
|
||||
vkc_cursorTarget = (_this select 3) select 0;
|
||||
_characterID = (_this select 3) select 1;
|
||||
vkc_action = (_this select 3) select 2;
|
||||
|
||||
vkc_isOk = false;
|
||||
|
||||
player removeAction s_player_claimVehicle;
|
||||
s_player_claimVehicle = 1;
|
||||
player removeAction s_player_copyToKey;
|
||||
s_player_copyToKey = 1;
|
||||
|
||||
_exit = {
|
||||
vkc_action = nil;
|
||||
vkc_keyList = nil;
|
||||
vkc_keyName = nil;
|
||||
vkc_charID = nil;
|
||||
vkc_isOk = nil;
|
||||
vkc_cursorTarget = nil;
|
||||
s_player_copyToKey = -1;
|
||||
s_player_claimVehicle = -1;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
if (isNull vkc_cursorTarget) exitWith {call _exit; systemChat localize "str_cursorTargetNotFound";};
|
||||
|
||||
_playerNear = {isPlayer _x} count (([vkc_cursorTarget] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
|
||||
if (_playerNear) exitWith {call _exit; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
|
||||
if !(vkc_cursorTarget isKindOf "Air" || {vkc_cursorTarget isKindOf "LandVehicle"} || {vkc_cursorTarget isKindOf "Ship"}) exitWith {call _exit; localize "STR_CL_VKC_FAIL_CURSOR" call dayz_rollingMessages;};
|
||||
|
||||
if (isNull DZE_myVehicle || {!(alive DZE_myVehicle)} || {!(local DZE_myVehicle)}) exitWith {call _exit; localize "str_epoch_player_245" call dayz_rollingMessages;};
|
||||
|
||||
_vehicleID = vkc_cursorTarget getVariable ["ObjectID","0"];
|
||||
_vehicleUID = vkc_cursorTarget getVariable ["ObjectUID","0"];
|
||||
|
||||
_typeOf = typeOf vkc_cursorTarget;
|
||||
_name = getText(configFile >> "cfgVehicles" >> _typeOf >> "displayName");
|
||||
|
||||
if ((_vehicleID == "0" && {_vehicleUID == "0"}) || {_vehicleID == "1" || _vehicleUID == "1"}) exitWith {call _exit; format[localize "STR_CL_VKC_FAIL_SUPPORT",_name] call dayz_rollingMessages;};
|
||||
|
||||
if (_vehicleUID == "0") then {
|
||||
_vehicleUID = "";
|
||||
{
|
||||
_x = _x * 10;
|
||||
if (_x < 0) then {_x = _x * -10};
|
||||
_vehicleUID = _vehicleUID + str(round(_x));
|
||||
} forEach getPosATL vkc_cursorTarget;
|
||||
_vehicleUID = _vehicleUID + str(round((getDir vkc_cursorTarget) + time));
|
||||
vkc_cursorTarget setVariable["ObjectUID",_vehicleUID,true];
|
||||
};
|
||||
|
||||
vkc_keyList = call epoch_tempKeys;
|
||||
|
||||
if (vkc_action == "change") then {
|
||||
_amount = vkc_changePrice;
|
||||
_message = [localize "STR_CL_VKC_CHANGE_MESSAGE_1",localize "STR_CL_VKC_CHANGE_MESSAGE_2",localize "STR_CL_VKC_CHANGE_MESSAGE_3"];
|
||||
_foundPos = (vkc_keyList select 0) find _characterID;
|
||||
if (_foundPos >= 0) then {
|
||||
vkc_keyList set [0,(vkc_keyList select 0) - [(vkc_keyList select 0) select _foundPos]];
|
||||
vkc_keyList set [1,(vkc_keyList select 1) - [(vkc_keyList select 1) select _foundPos]];
|
||||
vkc_keyList set [2,(vkc_keyList select 2) - [(vkc_keyList select 2) select _foundPos]];
|
||||
} else {
|
||||
vkc_keyList = [[],[]];
|
||||
};
|
||||
} else {
|
||||
_amount = vkc_claimPrice;
|
||||
_message = [localize "STR_CL_VKC_CLAIM_MESSAGE_1",localize "STR_CL_VKC_CLAIM_MESSAGE_2",localize "STR_CL_VKC_CLAIM_MESSAGE_3"];
|
||||
};
|
||||
|
||||
if (count (vkc_keyList select 0) == 0) exitWith {systemChat localize "STR_CL_VKC_FAIL_KEYS"; call _exit;};
|
||||
|
||||
if (!isNil "sk_dualCurrency") then {if (z_singleCurrency) then {_amount = _amount * 10};};
|
||||
|
||||
_itemText = if (Z_SingleCurrency) then {format ["%1 %2",[_amount] call BIS_fnc_numberText,CurrencyName]} else {[_amount,true] call z_calcCurrency};
|
||||
|
||||
createDialog "vkc";
|
||||
{ctrlShow [_x,false]} count [4803,4850,4851];
|
||||
|
||||
call vkc_vehicleInfo;
|
||||
|
||||
_control = ((findDisplay 4800) displayCtrl 4802);
|
||||
lbClear _control;
|
||||
|
||||
{
|
||||
_index = _control lbAdd ((vkc_keyList select 1) select _forEachIndex);
|
||||
_control lbSetPicture [_index,getText(configFile >> "CfgWeapons" >> ((vkc_keyList select 2) select _index) >> "picture")];
|
||||
} forEach (vkc_keyList select 0);
|
||||
|
||||
_control lbSetCurSel 0;
|
||||
|
||||
waitUntil {!dialog};
|
||||
|
||||
if (!vkc_isOk) exitWith {call _exit;};
|
||||
|
||||
if (isNull DZE_myVehicle || {!(alive DZE_myVehicle)} || {!(local DZE_myVehicle)}) exitWith {call _exit; localize "str_epoch_player_245" 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 {call _exit;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];};
|
||||
|
||||
vkc_cursorTarget setVehicleLock "LOCKED";
|
||||
player playActionNow "Medic";
|
||||
|
||||
_position = [vkc_cursorTarget] call FNC_GetPos;
|
||||
|
||||
[_typeOf,objNull] call fn_waitForObject;
|
||||
dze_waiting = nil;
|
||||
|
||||
PVDZE_veh_Upgrade = [vkc_cursorTarget,[getDir vkc_cursorTarget,_position],_typeOf,vkc_charID,player,dayz_authKey,if (vkc_action == "change") then {"changed the key for"} else {"claimed"}];
|
||||
publicVariableServer "PVDZE_veh_Upgrade";
|
||||
|
||||
localize "STR_CL_VKC_WAIT" call dayz_rollingMessages;
|
||||
|
||||
waitUntil {!isNil "dze_waiting"};
|
||||
|
||||
if (dze_waiting == "fail") then {
|
||||
systemChat format[localize "STR_CL_VKC_FAIL_UPGRADE",_name];
|
||||
if (z_singleCurrency) then {
|
||||
player setVariable [(["cashMoney","globalMoney"] select Z_persistentMoney),_wealth,true];
|
||||
} else {
|
||||
Z_Selling = true;
|
||||
_success = [_amount,0,false,0,[],[],false] call Z_returnChange;
|
||||
};
|
||||
} else {
|
||||
{player reveal _x;} count (player nearEntities [["LandVehicle"],10]);
|
||||
[format[_message select 0,_name,vkc_keyName],1] call dayz_rollingMessages;
|
||||
};
|
||||
} else {
|
||||
systemChat localize "STR_EPOCH_TRADE_DEBUG";
|
||||
};
|
||||
} else {
|
||||
systemChat format[localize "STR_CL_VKC_FAIL_MONEY",_itemText,_message select 1,_name];
|
||||
};
|
||||
|
||||
call _exit;
|
||||
Reference in New Issue
Block a user