Add toggleable vehicle key changer by salival

This commit is contained in:
A Man
2021-08-18 21:30:48 +02:00
parent cc1babf570
commit e6eb94197d
11 changed files with 833 additions and 16 deletions

View File

@@ -0,0 +1,315 @@
class vkc_RscText {
idc = -1;
x = 0;
y = 0;
h = 0.037;
w = 0.3;
type = 0;
style = 0;
shadow = 2;
colorShadow[] = {0, 0, 0, 0.5};
font = "Zeppelin32";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
colorText[] = {1, 1, 1, 1.0};
colorBackground[] = {0, 0, 0, 0};
linespacing = 1;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class vkc_RscTitle : vkc_RscText {
idc = -1;
style = 0;
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {0.95, 0.95, 0.95, 1};
};
class vkc_RscShortcutButton {
idc = -1;
style = 0;
default = 0;
shadow = 2;
w = 0.183825;
h = "((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
color[] = {1,1,1,1.0};
colorFocused[] = {1,1,1,1.0};
color2[] = {0.95,0.95,0.95,1};
colorDisabled[] = {1,1,1,0.25};
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1};
colorBackgroundFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1};
colorBackground2[] = {1,1,1,1};
animTextureDefault = "gza\scripts\gold\gui\normal_ca.paa";
animTextureNormal = "gza\scripts\gold\gui\normal_ca.paa";
animTextureDisabled = "gza\scripts\gold\gui\normal_ca.paa";
animTextureOver = "gza\scripts\gold\gui\over_ca.paa";
animTextureFocused = "gza\scripts\gold\gui\focus_ca.paa";
animTexturePressed = "gza\scripts\gold\gui\down_ca.paa";
periodFocus = 1.2;
periodOver = 0.8;
class HitZone {
left = 0.0;
top = 0.0;
right = 0.0;
bottom = 0.0;
};
class ShortcutPos {
left = 0;
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
};
class TextPos {
left = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
right = 0.005;
bottom = 0.0;
};
period = 0.4;
font = "Zeppelin32";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
text = "";
action = "";
class Attributes {
font = "Zeppelin32";
color = "#E5E5E5";
align = "left";
shadow = 1;
};
class AttributesImage {
font = "Zeppelin32";
color = "#E5E5E5";
align = "left";
};
soundPush[] = { "", 0, 1 };
soundEnter[] ={ "", 0, 1 };
soundClick[] ={ "", 0, 1 };
soundEscape[] ={ "", 0, 1 };
sound[] ={ "", 0, 1 };
};
class vkc_RscButtonMenu : vkc_RscShortcutButton {
idc = -1;
type = 16;
style = "0x02 + 0xC0";
default = 0;
shadow = 0;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
colorBackground[] = {0,0,0,0.8};
colorBackgroundFocused[] = {1,1,1,1};
colorBackground2[] = {0.75,0.75,0.75,1};
color[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
color2[] = {0,0,0,1};
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
period = 1.2;
periodFocus = 1.2;
periodOver = 1.2;
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class TextPos {
left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
right = 0.005;
bottom = 0.0;
};
class Attributes {
font = "Zeppelin32";
color = "#E5E5E5";
align = "center";
shadow = 0;
};
class ShortcutPos {
left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005";
top = 0.005;
w = 0.0225;
h = 0.03;
};
textureNoShortcut = "";
};
class vkc_RscListBox {
style = 16;
idc = -1;
type = 5;
w = 0.275;
h = 0.04;
font = "Zeppelin32";
colorSelect[] = {0.11,0.686,0.831,1};
colorText[] = {1, 1, 1, 1};
colorBackground[] = {0.28,0.28,0.28,0.28};
colorSelect2[] = {1, 1, 1, 1};
colorSelectBackground[] = {0.95, 0.95, 0.95, 0.5};
colorSelectBackground2[] = {1, 1, 1, 0.5};
colorScrollbar[] = {0.2, 0.2, 0.2, 1};
arrowFull = "\ca\ui\data\igui_arrow_top_active_ca.paa";
arrowEmpty = "\ca\ui\data\igui_arrow_top_ca.paa";
wholeHeight = 0.45;
rowHeight = 0.04;
color[] = {0.7, 0.7, 0.7, 1};
colorActive[] = {0,0,0,1};
colorDisabled[] = {0,0,0,0.3};
sizeEx = 0.023;
maxHistoryDelay = 1;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class ScrollBar {
color[] = {1, 1, 1, 0.6};
colorActive[] = {1, 1, 1, 1};
colorDisabled[] = {1, 1, 1, 0.3};
thumb = "\ca\ui\data\igui_scrollbar_thumb_ca.paa";
arrowFull = "\ca\ui\data\igui_arrow_top_active_ca.paa";
arrowEmpty = "\ca\ui\data\igui_arrow_top_ca.paa";
border = "\ca\ui\data\igui_border_scroll_ca.paa";
};
soundPush[] = { "", 0, 1 };
soundEnter[] ={ "", 0, 1 };
soundClick[] ={ "", 0, 1 };
soundEscape[] ={ "", 0, 1 };
sound[] ={ "", 0, 1 };
soundSelect[] = { "", 0, 1 };
};
class vkc_RscStructuredText {
type = 13;
style = 0;
x = 0;
y = 0;
h = 0.035;
w = 0.1;
text = "";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {1, 1, 1, 1.0};
shadow = 1;
class Attributes {
font = "Zeppelin32";
color = "#ffffff";
align = "left";
shadow = 1;
};
};
class vkc {
idd = 4800;
name="vkc";
onload = "player setVariable['isBusy',true,true];";
onUnload = "player setVariable['isBusy',false,true];";
movingEnabled = 0;
enableSimulation = 1;
class controlsBackground {
class vkc_RscTitleBackground : vkc_RscText {
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"};
idc = -1;
x = 0.1;
y = 0.2;
w = 0.8;
h = (1 / 25);
};
class MainBackground : vkc_RscText {
colorBackground[] = {0,0,0,0.7};
idc = -1;
x = 0.1;
y = 0.2 + (11 / 250);
w = 0.8;
h = 0.7 - (22 / 250);
};
class Title : vkc_RscTitle {
idc = 4801;
text = $STR_CL_VKC_TITLE;
x = 0.1;
y = 0.2;
w = 0.8;
h = (1 / 25);
};
class VehicleInfoHeader : vkc_RscText {
idc = 4830;
text = $STR_CL_VKC_INFO;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"};
x = 0.47; y = 0.26;
w = 0.42;
h = (1 / 25);
};
class CloseBtn : vkc_RscButtonMenu {
idc = -1;
text = $STR_UI_CLOSE;
onButtonClick = "closeDialog 2;";
x = -0.06 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.9 - (1 / 25);
w = (6.25 / 40);
h = (1 / 25);
};
};
class controls {
class VehicleList : vkc_RscListBox {
idc = 4802;
text = "";
sizeEx = 0.04;
colorBackground[] = {0.1,0.1,0.1,0.9};
onLBSelChanged = "vkc_charID = (vkc_keyList select 0) select (lbCurSel 4802);vkc_keyName = (vkc_keyList select 1) select (lbCurSel 4802);";
x = 0.11; y = 0.302;
w = 0.35; h = 0.49;
};
class VehicleTitleBox : vkc_RscText {
idc = 4804;
text = $STR_CL_VKC_KEYS;
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"};
x = 0.11; y = 0.26;
w = 0.35;
h = (1 / 25);
};
class claimVehicle : vkc_RscButtonMenu {
idc = 4850;
text = $STR_CL_VKC_CLAIM;
onButtonClick = "vkc_isOk = true;closeDialog 0;";
x = 0.1 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.9 - (1 / 25);
w = (6.25 / 20);
h = (1 / 25);
};
class changeKey : vkc_RscButtonMenu {
idc = 4851;
text = $STR_CL_VKC_CHANGE;
onButtonClick = "vkc_isOk = true;closeDialog 0;";
x = 0.1 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
y = 0.9 - (1 / 25);
w = (6.25 / 20);
h = (1 / 25);
};
class vehicleInfomationList : vkc_RscStructuredText {
idc = 4803;
text = "";
sizeEx = 0.035;
x = 0.47; y = 0.3;
w = 0.41; h = 0.5;
};
};
};

View 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];

View 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;

View File

@@ -234,6 +234,7 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
local _weaponsPlayer = weapons player;
local _hasCrowbar = "ItemCrowbar" in _itemsPlayer || "MeleeCrowbar" in _weaponsPlayer || dayz_onBack == "MeleeCrowbar";
local _hasToolbox = "ItemToolbox" in _itemsPlayer;
local _hasKeymakerskit = "ItemKeyKit" in _itemsPlayer;
local _isAlive = alive _cursorTarget;
local _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
local _isPlant = _typeOfCursorTarget in Dayz_plants;
@@ -568,11 +569,12 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
// Allow Owner to lock and unlock vehicle
if (_player_lockUnlock_crtl) then {
local _totalKeys = call epoch_tempKeys;
local _temp_keys = _totalKeys select 0;
local _temp_keys_names = _totalKeys select 1;
local _hasKey = _characterID in _temp_keys;
if (s_player_lockUnlock_crtl < 0) then {
local _totalKeys = call epoch_tempKeys;
local _temp_keys = _totalKeys select 0;
local _temp_keys_names = _totalKeys select 1;
local _hasKey = _characterID in _temp_keys;
local _oldOwner = (_characterID == _uid);
local _unlock = [];
@@ -598,9 +600,18 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
};
};
};
if (DZE_VehicleKey_Changer) then {
if (s_player_copyToKey < 0) then {
if ((_hasKeymakerskit && _hasKey && !_isLocked && {(count _temp_keys) > 1}) || {_cursorTarget getVariable ["hotwired",false]}) then {
s_player_copyToKey = player addAction [format["<t color='#0059FF'>%1</t>",localize "STR_CL_VKC_CHANGE_ACTION"],"\z\addons\dayz_code\actions\vkc\vehicleKeyChanger.sqf",[_cursorTarget,_characterID,if (_cursorTarget getVariable ["hotwired",false]) then {"claim"} else {"change"}],5,false,true];
};
};
};
} else {
{player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
s_player_lockUnlock_crtl = -1;
player removeAction s_player_copyToKey;
s_player_copyToKey = -1;
};
if (DZE_Hide_Body && {_isMan && !_isAlive}) then {
@@ -809,6 +820,20 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
player removeAction s_player_fillgen;
s_player_fillgen = -1;
};
if (DZE_VehicleKey_Changer) then {
if (_hasKeymakerskit && _isVehicle && !_isMan && _isAlive && {_characterID == "0"}) then {
if (s_player_claimVehicle < 0) then {
_totalKeys = call epoch_tempKeys;
if (count (_totalKeys select 0) > 0) then {
s_player_claimVehicle = player addAction [format["<t color='#0059FF'>%1</t>",format[localize "STR_CL_VKC_CLAIM_ACTION",_text]],"\z\addons\dayz_code\actions\vkc\vehicleKeyChanger.sqf",[_cursorTarget,_characterID,"claim"],5,false,true];
};
};
} else {
player removeAction s_player_claimVehicle;
s_player_claimVehicle = -1;
};
};
if (!_isAlive && _isMan && !_isZombie && {!(_cursorTarget isKindOf "Animal")}) then {
if (DZE_Take_Clothes) then {
@@ -1123,7 +1148,11 @@ if (!isNull _cursorTarget && {!_inVehicle && !_isPZombie && _canDo && player dis
player removeAction s_player_bury_human;
s_player_bury_human = -1;
player removeAction s_player_butcher_human;
s_player_butcher_human = -1;
s_player_butcher_human = -1;
player removeAction s_player_copyToKey;
s_player_copyToKey = -1;
player removeAction s_player_claimVehicle;
s_player_claimVehicle = -1;
};
//Dog actions on player self

View File

@@ -130,6 +130,7 @@ class DefaultEventhandlers {
#include "Configs\RscDisplay\doorManagement\doorAccess.hpp"
#include "Configs\RscDisplay\zscDialogs.hpp"
#include "Configs\RscDisplay\remoteVehicle.hpp"
#include "Configs\RscDisplay\vehicleKeyChanger.hpp"
//#include "Configs\RscDisplay\tradermenu.hpp"
class CfgTasks

View File

@@ -36,6 +36,9 @@ if (Z_SingleCurrency) then {
Z_VehicleDistance = 40; // Max distance a vehicle can be sold or accessed from at a trader.
// Vehicle Key Changer
DZE_VehicleKey_Changer = true; // Enable Vehicle Key Changer. Create or change the key for a vehicle.
// Plot Management and Plot for Life
DZE_permanentPlot = true; // Plot ownership saves after death. Enables Plot for Life by @RimBlock and Plot Management by @DevZupa.
DZE_isRemovable = ["Plastic_Pole_EP1_DZ"]; //Items that can be removed with a crowbar with no ownership or access required. To forbid base take overs remove plot pole from this list and add it to DZE_restrictRemoval. It is not necessary to add wrecks or items that inherit from 'BuiltItems' to this list.
@@ -100,6 +103,11 @@ if (isServer) then {
// Safe Zone Relocating
DZE_SafeZone_Relocate = false; //Enables relocating of vehicles left in Safe Zones over a server restart.
if (DZE_VehicleKey_Changer) then {
vkc_clearAmmo = true; // Clear the ammo of vehicles after they have been rekeyed/claimed? (stops users getting a free rearm)
vkc_disableThermal = [""]; // Array of vehicle config classes as well as vehicle classnames to disable thermal on when being spawned. i.e: ["All","Land","Air","Ship","StaticWeapon","AH1Z","MTVR"];
};
};
// Client
@@ -240,6 +248,7 @@ if (!isDedicated) then {
dayz_matchboxCount = false; // Enable match stick count. After five uses matches run out and must be replaced.
dayz_waterBottleBreaking = false; // Water bottles have a chance to break when boiling and require duct tape to fix
// Bury and Butcher Bodies
if (DZE_Bury_Body) then {
DZE_Bury_Body_Value = 30;// Amount of humanity to gain for burying a body.
};
@@ -290,6 +299,11 @@ if (!isDedicated) then {
];
};
if (DZE_VehicleKey_Changer) then {
vkc_claimPrice = 1000; // Amount in worth for claiming a vehicle. See the top of this script for an explanation.
vkc_changePrice = 5000; // Amount in worth for changing the key for a vehicle. See the top of this script for an explanation.
};
// Bloodsuckers
DZE_Bloodsuckers = false; // Enable bloodsucker spawning.
@@ -439,4 +453,4 @@ if (!isDedicated) then {
Variables that are map specific or frequently changed should be included in init.sqf by default
with a corresponding if(isNil)then{}; in variables.sqf.
*/
*/

View File

@@ -208,6 +208,10 @@ if (!isDedicated) then {
locateVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\locateVehicle.sqf";
};
if (DZE_VehicleKey_Changer) then {
vkc_vehicleInfo = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vkc\vehicleInfo.sqf";
};
if (DZE_Service_Points) then {
execVM "\z\addons\dayz_code\actions\servicePoints\init.sqf";
};
@@ -217,7 +221,7 @@ if (!isDedicated) then {
player_mutantAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_mutantAttack.sqf";
mutant_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\mutant_generate.sqf";
mutant_findTarget = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\mutant_findTarget.sqf";
};
};
// Weather
if (DZE_Weather in [3,4]) then {

View File

@@ -211,7 +211,9 @@ if (!isDedicated) then {
s_player_gdoor_opener = [];
s_player_gdoor_opener_ctrl = -1;
s_player_bury_human = -1;
s_player_butcher_human = -1;
s_player_butcher_human = -1;
s_player_copyToKey = -1;
s_player_claimVehicle = -1;
};
call dayz_resetSelfActions;

View File

@@ -0,0 +1,205 @@
private ["_coins","_activatingPlayer","_object","_worldspace","_location","_dir","_class","_uid","_key","_keySelected"
,"_characterID","_result","_outcome","_oid","_objectID","_objectUID","_newobject","_weapons","_magazines","_backpacks"
,"_clientKey","_exitReason","_playerUID","_isAir","_fuel","_selection","_dam","_hitpoints","_newHitpoints","_damage"
,"_hit","_inv","_action","_clearTurrets","_message"];
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
if (count _this < 6) exitWith {
diag_log "Server_PublishVehicle3 error: Wrong parameter format";
dze_waiting = "fail";
(owner (_this select 4)) publicVariableClient "dze_waiting";
};
_object = _this select 0;
_worldspace = _this select 1;
_class = _this select 2;
_keySelected = _this select 3;
_activatingPlayer = _this select 4;
_clientKey = _this select 5;
_action = if (count _this > 6) then {_this select 6} else {""};
_playerUID = getPlayerUID _activatingPlayer;
_characterID = _keySelected;
_exitReason = [_this,"PublishVehicle3",(_worldspace select 1),_clientKey,_playerUID,_activatingPlayer] call server_verifySender;
if (_exitReason != "") exitWith {
diag_log _exitReason;
dze_waiting = "fail";
(owner _activatingPlayer) publicVariableClient "dze_waiting";
};
if (!(isClass(configFile >> "CfgVehicles" >> _class)) || isNull _object) exitWith {
diag_log ("HIVE-PublishVehicle3 Error: Vehicle does not exist: "+ str(_class));
dze_waiting = "fail";
(owner _activatingPlayer) publicVariableClient "dze_waiting";
};
_objectID = _object getVariable ["ObjectID","0"];
_objectUID = _object getVariable ["ObjectUID","0"];
_location = [_object] call fnc_getPos;
_fuel = fuel _object;
_hitpoints = _object call vehicle_getHitpoints;
_newHitpoints = [];
_damage = damage _object;
// add items from previous vehicle here
_weapons = getWeaponCargo _object;
_magazines = getMagazineCargo _object;
_backpacks = getBackpackCargo _object;
_inv = [_weapons,_magazines,_backpacks];
if (Z_SingleCurrency && {ZSC_VehicleMoneyStorage}) then {
_coins = _object getVariable ["cashMoney",0];
};
{
_hit = [_object,_x] call object_getHit;
if ((_hit select 0) > 0) then {
_newHitpoints set [count _newHitpoints,[(_hit select 1),(_hit select 0)]];
} else {
_newHitpoints set [count _newHitpoints,[(_hit select 1),0]];
};
} count _hitpoints;
#ifdef OBJECT_DEBUG
diag_log ("PUBLISH: Attempt " + str(_object));
#endif
_dir = _worldspace select 0;
_uid = _worldspace call dayz_objectUID2;
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _characterID, _worldspace, _inv, _newHitpoints, _fuel,_uid];
#ifdef OBJECT_DEBUG
diag_log ("HIVE: WRITE: "+ str(_key));
#endif
_key call server_hiveWrite;
// GET DB ID
_key = format["CHILD:388:%1:",_uid];
#ifdef OBJECT_DEBUG
diag_log ("HIVE: WRITE: "+ str(_key));
#endif
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if (_outcome != "PASS") then {
diag_log("HIVE-pv3: failed to get id for : " + str(_uid));
_key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite;
dze_waiting = "fail";
(owner _activatingPlayer) publicVariableClient "dze_waiting";
} else {
_oid = _result select 1;
#ifdef OBJECT_DEBUG
diag_log("CUSTOM: Selected " + str(_oid));
#endif
_colour = _object getVariable ["Colour","0"];
_colour2 = _object getVariable ["Colour2","0"];
deleteVehicle _object;
[_objectID,_objectUID,_object] call server_deleteObjDirect;
uiSleep 3;
_newobject = _class createVehicle [0,0,0];
// switch var to new vehicle at this point.
_object = _newobject;
_object setVariable ["ObjectID", _oid, true];
_object setVariable ["lastUpdate",diag_tickTime];
_object setVariable ["CharacterID", _characterID, true];
if (Z_SingleCurrency && {ZSC_VehicleMoneyStorage && {_coins > 0}}) then {
_object setVariable ["cashMoney",_coins,true];
};
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
clearBackpackCargoGlobal _object;
_object setDir _dir;
_object setPosATL _location;
_object setVectorUp surfaceNormal _location;
_object setDamage _damage;
if (_colour != "0") then {
_object setVariable ["Colour",_colour,true];
_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
};
if (_colour2 != "0") then {
_object setVariable ["Colour2",_colour2,true];
_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
};
processInitCommands;
[_weapons,_magazines,_backpacks,_object] call fn_addCargo;
_clearTurrets = {
//By denvdmj (probably, I found it on the biki)
private ["_weaponArray","_findRecurse","_class","_obj","_turret","_mags"];
_obj = _this;
_weaponArray = [];
_weaponArray set [count _weaponArray,[-1]];
_findRecurse = {
private ["_root", "_class", "_path", "_currentPath", "_thisThis"];
_root = (_this select 0);
_path = +(_this select 1);
_thisThis = _this select 2;
for "_i" from 0 to count _root -1 do {
_class = _root select _i;
if (isClass _class) then {
_currentPath = _path + [_i];
{_weaponArray set [count _weaponArray, _currentPath];} count getArray (_class >> "weapons");
_class = _class >> "turrets";
if (isClass _class) then {[_class, _currentPath, _thisThis] call _findRecurse;};
};
};
};
[configFile >> "CfgVehicles" >> typeOf (_obj) >> "turrets", [], _this] call _findRecurse;
{
_turret = _x;
_mags = _obj magazinesTurret _turret;
{_obj removeMagazinesTurret[_x,_turret];} count _mags;
} forEach _weaponArray;
};
_isAir = _object isKindOf "Air";
{
_selection = _x select 0;
_dam = [_x select 1,(_x select 1) min 0.8] select (!_isAir && {_selection in dayZ_explosiveParts});
_object setHit [_selection,_dam];
} count _newHitpoints;
_object setFuel _fuel;
[_object,"all",true] call server_updateObject;
_object call fnc_veh_ResetEH;
// for non JIP users this should make sure everyone has eventhandlers for vehicles.
PVDZE_veh_Init = _object;
publicVariable "PVDZE_veh_Init";
{if (_object isKindOf _x) exitWith {_object disableTIEquipment true;}} count vkc_disableThermal;
if (vkc_clearAmmo) then {_object call _clearTurrets;};
dze_waiting = "success";
(owner _activatingPlayer) publicVariableClient "dze_waiting";
if (_action == "") then {
_message = format["PUBLISH: %1(%2) upgraded %3 with UID %4 @%5",(_activatingPlayer call fa_plr2str),_playerUID,_class,_uid,(_location call fa_coor2str)];
} else {
_message = format["PUBLISH: %1(%2) %6 %3 with UID %4 @%5",(_activatingPlayer call fa_plr2str),_playerUID,_class,_uid,(_location call fa_coor2str),_action];
};
diag_log _message;
};

View File

@@ -39,7 +39,11 @@ server_verifySender = compile preprocessFileLineNumbers "\z\addons\dayz_server\c
server_swapObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_swapObject.sqf"; //Used to downgrade and upgrade Epoch buildables
server_publishVeh = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf"; //Used to spawn random vehicles by server
server_publishVeh2 = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle2.sqf"; //Used to purchase vehicles at traders
server_publishVeh3 = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle3.sqf"; //Used for car upgrades
if (DZE_VehicleKey_Changer) then {
server_publishVeh3 = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle3_vkc.sqf"; //Used for car upgrades
} else {
server_publishVeh3 = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle3.sqf"; //Used for car upgrades
};
server_tradeObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_tradeObject.sqf";
server_deaths = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDeaths.sqf";
server_maintainArea = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_maintainArea.sqf";

File diff suppressed because one or more lines are too long