mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
cleanup
This commit is contained in:
@@ -1,122 +0,0 @@
|
||||
private ["_activatingPlayer","_trader_id","_type","_name","_qty","_sell","_order","_tid","_out","_part","_cancel","_Display","_File","_textCurrency","_textPart","_btype","_stype","_header","_item","_buy","_bqty","_bname","_afile"];
|
||||
|
||||
if (TradeInprogress) exitWith {}; // Do not allow if any script is running.
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
|
||||
// [ _trader_id, _category, _action ];
|
||||
_activatingPlayer = player;
|
||||
|
||||
_trader_id = (_this select 3) select 0;
|
||||
// _category = (_this select 3) select 1;
|
||||
|
||||
PVDZE_plr_TradeMenuResult = call compile format["tcacheBuy_%1;",_trader_id];
|
||||
|
||||
if(isNil "PVDZE_plr_TradeMenuResult") then {
|
||||
//diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
//["PVDZE_plr_TradeMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||
PVDZE_plr_TradeMenu = [_activatingPlayer,_trader_id];
|
||||
publicVariableServer "PVDZE_plr_TradeMenu";
|
||||
waitUntil {!isNil "PVDZE_plr_TradeMenuResult"};
|
||||
};
|
||||
|
||||
//diag_log format["DEBUG Buy: %1", PVDZE_plr_TradeMenuResult];
|
||||
{
|
||||
_header = _x select 0; // "TRD"
|
||||
|
||||
// Trader Item name|type
|
||||
_item = _x select 1;
|
||||
_name = _item select 0;
|
||||
_type = _item select 1;
|
||||
switch(true)do{
|
||||
case (_type == 1): {
|
||||
_type = "CfgMagazines";
|
||||
};
|
||||
case (_type == 2): {
|
||||
_type = "CfgVehicles";
|
||||
};
|
||||
case (_type == 3): {
|
||||
_type = "CfgWeapons";
|
||||
};
|
||||
};
|
||||
// Display Name of item
|
||||
_textPart = getText(configFile >> _type >> _name >> "displayName");
|
||||
|
||||
// Total in stock
|
||||
_qty = _x select 2;
|
||||
|
||||
// Buy Data from array
|
||||
_buy = _x select 3;
|
||||
_bqty = _buy select 0;
|
||||
_bname = _buy select 1;
|
||||
_btype = _buy select 2;
|
||||
switch(true)do{
|
||||
case (_btype == 1): {
|
||||
_btype = "CfgMagazines";
|
||||
};
|
||||
case (_btype == 2): {
|
||||
_btype = "CfgVehicles";
|
||||
};
|
||||
case (_btype == 3): {
|
||||
_btype = "CfgWeapons";
|
||||
};
|
||||
};
|
||||
// Display Name of buy item
|
||||
_textCurrency = getText(configFile >> _btype >> _bname >> "displayName");
|
||||
|
||||
// Sell data from array
|
||||
_sell = _x select 4;
|
||||
//_sqty = _sell select 0;
|
||||
//_sname = _sell select 1;
|
||||
_stype = _sell select 2;
|
||||
switch(true)do{
|
||||
case (_stype == 1): {
|
||||
_stype = "CfgMagazines";
|
||||
};
|
||||
case (_stype == 2): {
|
||||
_stype = "CfgVehicles";
|
||||
};
|
||||
case (_stype == 3): {
|
||||
_stype = "CfgWeapons";
|
||||
};
|
||||
};
|
||||
// Display Name of sell item
|
||||
//_textCurrencySell = getText(configFile >> _stype >> _sname >> "displayName");
|
||||
|
||||
// Menu sort order
|
||||
_order = _x select 5;
|
||||
|
||||
// Trader Menu ID
|
||||
_tid = _x select 6;
|
||||
|
||||
// Action file to use for trade
|
||||
_afile = _x select 7;
|
||||
_File = "\z\addons\dayz_code\actions\" + _afile + ".sqf";
|
||||
|
||||
// Allways 1 for now
|
||||
_out = 1;
|
||||
|
||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
||||
|
||||
if (_qty > 0) then {
|
||||
_Display = format["Buy %1 (%2) for %3 %4", _textPart, _name, _bqty, _textCurrency];
|
||||
} else {
|
||||
_Display = format["<t color='#ffff00'>Buy %1 (%2) for %3 %4</t>", _textPart, _name, _bqty, _textCurrency];
|
||||
};
|
||||
|
||||
_part = player addAction [_Display, _File,[_name,_bname,_out,_bqty,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
|
||||
|
||||
//diag_log format["DEBUG TRADER: %1", _part];
|
||||
s_player_parts set [count s_player_parts,_part];
|
||||
|
||||
} forEach PVDZE_plr_TradeMenuResult;
|
||||
|
||||
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 0, true, false, "",""];
|
||||
s_player_parts set [count s_player_parts,_cancel];
|
||||
|
||||
// Cache data in client side global variable
|
||||
call compile format["tcacheBuy_%1 = %2;",_tid,PVDZE_plr_TradeMenuResult];
|
||||
|
||||
// Clear Data
|
||||
PVDZE_plr_TradeMenuResult = nil;
|
||||
s_player_parts_crtl = 1;
|
||||
@@ -1,19 +0,0 @@
|
||||
private["_trader_id","_category","_buy","_sell","_cancel"];
|
||||
|
||||
if (TradeInprogress) exitWith {}; // Do not allow if any script is running.
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
|
||||
_trader_id = (_this select 3) select 0;
|
||||
_category = (_this select 3) select 1;
|
||||
|
||||
_buy = player addAction ["Buy "+_category, "\z\addons\dayz_code\actions\buy_db.sqf",[_trader_id], 99, true, false, "",""];
|
||||
s_player_parts set [count s_player_parts,_buy];
|
||||
|
||||
_sell = player addAction ["Sell "+_category, "\z\addons\dayz_code\actions\sell_db.sqf",[_trader_id], 98, true, false, "",""];
|
||||
s_player_parts set [count s_player_parts,_sell];
|
||||
|
||||
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 0, true, false, "",""];
|
||||
s_player_parts set [count s_player_parts,_cancel];
|
||||
|
||||
s_player_parts_crtl = 1;
|
||||
@@ -1,10 +0,0 @@
|
||||
private ["_array","_object","_inventory"];
|
||||
_array = _this select 3;
|
||||
_object = _array select 0;
|
||||
_inventory = _array select 1;
|
||||
player playActionNow "Medic";
|
||||
sleep 8;
|
||||
{player addMagazine _x} forEach _inventory;
|
||||
deleteVehicle _object;
|
||||
r_action = false;
|
||||
call fnc_usec_medic_removeActions;
|
||||
@@ -1,15 +0,0 @@
|
||||
private ["_array","_location","_dir","_classname","_magazine","_weapon"];
|
||||
_array = _this select 3;
|
||||
_location = player modeltoworld [0,0.5,0];
|
||||
_dir = (getDir player) + 180;
|
||||
_classname = _array select 0;
|
||||
_magazine = _array select 1;
|
||||
player removeMagazine _magazine;
|
||||
player playActionNow "Medic";
|
||||
call fnc_usec_engineer_removeActions;
|
||||
r_action_engineer = false;
|
||||
sleep 8;
|
||||
_weapon = _classname createVehicle _location;
|
||||
_weapon setDir _dir;
|
||||
_weapon setpos _location;
|
||||
player reveal _weapon;
|
||||
@@ -1,24 +0,0 @@
|
||||
private ["_array","_object","_magazine","_classname","_dir","_location","_weapon"];
|
||||
_array = _this select 3;
|
||||
_object = _array select 0;
|
||||
_magazine = _array select 1;
|
||||
_classname = _array select 2;
|
||||
|
||||
_dir = direction _object;
|
||||
_location = getPosATL _object;
|
||||
|
||||
player removeMagazine _magazine;
|
||||
player playActionNow "Medic";
|
||||
|
||||
r_action = false;
|
||||
call fnc_usec_medic_removeActions;
|
||||
|
||||
sleep 8;
|
||||
//Delete old Object
|
||||
deleteVehicle _object;
|
||||
|
||||
//New Object
|
||||
_weapon = _classname createVehicle _location;
|
||||
_weapon setDir _dir;
|
||||
_weapon setpos _location;
|
||||
player reveal _weapon;
|
||||
@@ -1,149 +0,0 @@
|
||||
private ["_activatingPlayer","_trader_id","_type","_name","_sell","_order","_tid","_in","_part","_cancel","_Display","_File","_textCurrency","_textPart","_count","_btype","_stype","_bag","_bagclass","_header","_item","_buy","_sqty","_sname","_afile"];
|
||||
|
||||
if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_96") , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
|
||||
|
||||
// [ _trader_id, _category, _action ];
|
||||
_activatingPlayer = player;
|
||||
|
||||
_trader_id = (_this select 3) select 0;
|
||||
//_category = (_this select 3) select 1;
|
||||
|
||||
PVDZE_plr_TradeMenuResult = call compile format["tcacheSell_%1;",_trader_id];
|
||||
|
||||
if(isNil "PVDZE_plr_TradeMenuResult") then {
|
||||
//diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
//["PVDZE_plr_TradeMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||
PVDZE_plr_TradeMenu = [_activatingPlayer,_trader_id];
|
||||
publicVariableServer "PVDZE_plr_TradeMenu";
|
||||
waitUntil {!isNil "PVDZE_plr_TradeMenuResult"};
|
||||
};
|
||||
|
||||
//diag_log format["DEBUG Buy: %1", PVDZE_plr_TradeMenuResult];
|
||||
{
|
||||
_header = _x select 0; // "TRD"
|
||||
|
||||
// Trader Item name|type
|
||||
_item = _x select 1;
|
||||
_name = _item select 0;
|
||||
_type = _item select 1;
|
||||
switch(true)do{
|
||||
case (_type == 1): {
|
||||
_type = "CfgMagazines";
|
||||
};
|
||||
case (_type == 2): {
|
||||
_type = "CfgVehicles";
|
||||
};
|
||||
case (_type == 3): {
|
||||
_type = "CfgWeapons";
|
||||
};
|
||||
};
|
||||
// Display Name of item
|
||||
_textPart = getText(configFile >> _type >> _name >> "displayName");
|
||||
|
||||
// Total in stock
|
||||
//_qty = _x select 2;
|
||||
|
||||
// Buy Data from array
|
||||
_buy = _x select 3;
|
||||
//_bqty = _buy select 0;
|
||||
//_bname = _buy select 1;
|
||||
_btype = _buy select 2;
|
||||
switch(true)do{
|
||||
case (_btype == 1): {
|
||||
_btype = "CfgMagazines";
|
||||
};
|
||||
case (_btype == 2): {
|
||||
_btype = "CfgVehicles";
|
||||
};
|
||||
case (_btype == 3): {
|
||||
_btype = "CfgWeapons";
|
||||
};
|
||||
};
|
||||
// Display Name of buy item
|
||||
//_textCurrencyBuy = getText(configFile >> _btype >> _bname >> "displayName");
|
||||
|
||||
// Sell data from array
|
||||
_sell = _x select 4;
|
||||
_sqty = _sell select 0;
|
||||
_sname = _sell select 1;
|
||||
_stype = _sell select 2;
|
||||
switch(true)do{
|
||||
case (_stype == 1): {
|
||||
_stype = "CfgMagazines";
|
||||
};
|
||||
case (_stype == 2): {
|
||||
_stype = "CfgVehicles";
|
||||
};
|
||||
case (_stype == 3): {
|
||||
_stype = "CfgWeapons";
|
||||
};
|
||||
};
|
||||
// Display Name of sell item
|
||||
_textCurrency = getText(configFile >> _stype >> _sname >> "displayName");
|
||||
|
||||
// Menu sort order
|
||||
_order = _x select 5;
|
||||
|
||||
// Trader Menu ID
|
||||
_tid = _x select 6;
|
||||
|
||||
// Action file to use for trade
|
||||
_afile = _x select 7;
|
||||
_File = "\z\addons\dayz_code\actions\" + _afile + ".sqf";
|
||||
|
||||
// Allways 1 for now
|
||||
//_out = _sqty;
|
||||
// qty consumed of bname
|
||||
_in = 1;
|
||||
|
||||
_count = 0;
|
||||
if(_type == "CfgVehicles") then {
|
||||
if (_afile == "trade_backpacks") then {
|
||||
_bag = unitBackpack player;
|
||||
_bagclass = typeOf _bag;
|
||||
if(_name == _bagclass) then {
|
||||
_count = 1;
|
||||
};
|
||||
} else {
|
||||
_count = {(typeOf _x) == _name} count (nearestObjects [player, [_name], 20]);
|
||||
}
|
||||
};
|
||||
if(_type == "CfgMagazines") then {
|
||||
_count = {_x == _name} count magazines player;
|
||||
};
|
||||
if(_type == "CfgWeapons") then {
|
||||
_count = {_x == _name} count weapons player;
|
||||
};
|
||||
|
||||
|
||||
if (_count > 0) then {
|
||||
_Display = format["Sell %1 for %2 %3 each", _textPart, _sqty, _textCurrency];
|
||||
} else {
|
||||
_Display = format["<t color='#ffff00'>Sell %1 for %2 %3 each</t>", _textPart, _sqty, _textCurrency];
|
||||
};
|
||||
|
||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
||||
_part = player addAction [_Display, _File,[_sname,_name,_sqty,_in,"sell",_textPart,_textCurrency,_header], _order, true, true, "",""];
|
||||
|
||||
|
||||
// diag_log format["DEBUG TRADER: %1", _part];
|
||||
s_player_parts set [count s_player_parts,_part];
|
||||
|
||||
} forEach PVDZE_plr_TradeMenuResult;
|
||||
|
||||
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 0, true, false, "",""];
|
||||
s_player_parts set [count s_player_parts,_cancel];
|
||||
|
||||
// Cache data in client side global variable
|
||||
call compile format["tcacheSell_%1 = %2;",_tid,PVDZE_plr_TradeMenuResult];
|
||||
|
||||
|
||||
// Clear Data
|
||||
PVDZE_plr_TradeMenuResult = nil;
|
||||
|
||||
|
||||
s_player_parts_crtl = 1;
|
||||
TradeInprogress = false;
|
||||
@@ -1,15 +0,0 @@
|
||||
private ["_buy","_number"];
|
||||
|
||||
// start combination string build
|
||||
dayz_combination = _this select 3;
|
||||
_number = 0;
|
||||
|
||||
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
|
||||
|
||||
for "_x" from 1 to 10 do {
|
||||
_buy = player addAction [str(_number), "\z\addons\dayz_code\actions\vault_combination_3.sqf",str(_number), 99, true, false, "",""];
|
||||
s_player_combi set [count s_player_combi,_buy];
|
||||
_number = _number + 1;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
private ["_buy","_number"];
|
||||
|
||||
// combine previous selections with next
|
||||
dayz_combination = format["%1%2",dayz_combination,(_this select 3)];
|
||||
_number = 0;
|
||||
|
||||
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
|
||||
|
||||
for "_x" from 1 to 10 do {
|
||||
_buy = player addAction [str(_number), "\z\addons\dayz_code\actions\vault_combination_4.sqf",str(_number), 99, true, false, "",""];
|
||||
s_player_combi set [count s_player_combi,_buy];
|
||||
_number = _number + 1;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
private ["_buy","_number"];
|
||||
|
||||
// combine previous selections with next
|
||||
dayz_combination = format["%1%2",dayz_combination,(_this select 3)];
|
||||
_number = 0;
|
||||
|
||||
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
|
||||
|
||||
for "_x" from 1 to 10 do {
|
||||
_buy = player addAction [str(_number), "\z\addons\dayz_code\actions\vault_combination_final.sqf",str(_number), 99, true, false, "",""];
|
||||
s_player_combi set [count s_player_combi,_buy];
|
||||
_number = _number + 1;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
private [];
|
||||
// set final combination to player
|
||||
dayz_combination = format["%1%2",dayz_combination,(_this select 3)];
|
||||
{player removeAction _x} forEach s_player_combi;s_player_combi = [];
|
||||
s_player_unlockvault = -1;
|
||||
// Run unlock on vault
|
||||
if(!isNull dayz_selectedVault and (typeOf dayz_selectedVault) == "VaultStorageLocked") then {
|
||||
dayz_selectedVault spawn player_unlockVault;
|
||||
dayz_selectedVault = objNull;
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
private ["_obj"];
|
||||
_obj = _this select 3;
|
||||
_obj spawn player_unlockVault;
|
||||
@@ -178,34 +178,6 @@ if (!isNull _menClose and _hasPatient and !r_drag_sqf and !r_action and !_inVehi
|
||||
};
|
||||
|
||||
};
|
||||
/*
|
||||
if ((_unit isKindOf "Building")) then {
|
||||
_type = TypeOf(_unit);
|
||||
_typeVeh = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
|
||||
_isEngineer = _hasToolbox;//(_classbag isKindOf "BAF_AssaultPack_Engineer");
|
||||
//CAN DISASSEMBLE
|
||||
if (_isEngineer and (_type in USEC_CanDisassemble)) then {
|
||||
r_action = true;
|
||||
_index = USEC_CanDisassemble find _type;
|
||||
_inventory = USEC_DisassembleKits select _index;
|
||||
_action = _unit addAction [format[localize "str_actions_medical_12",_typeVeh], "\z\addons\dayz_code\actions\disassemble.sqf",[_unit,_inventory], 0, true, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
//Upgrade Wire
|
||||
if (_isEngineer and (_type == "usec_wire_cat1") and _hasWire) then {
|
||||
r_action = true;
|
||||
_unitTo = "usec_wire_cat2";
|
||||
_action = _unit addAction [format[localize "str_actions_medical_13",_typeVeh], "\z\addons\dayz_code\actions\engineer_upgrade.sqf",[_unit,"ItemWire",_unitTo], 0, false, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
if (_isEngineer and (_type == "usec_wire_cat2") and _hasWire) then {
|
||||
r_action = true;
|
||||
_unitTo = "Fort_RazorWire";
|
||||
_action = _unit addAction [format[localize "str_actions_medical_13",_typeVeh], "\z\addons\dayz_code\actions\engineer_upgrade.sqf",[_unit,"ItemWire",_unitTo], 0, false, true];
|
||||
r_player_actions set [count r_player_actions,_action];
|
||||
};
|
||||
};
|
||||
*/
|
||||
if (r_action) then {
|
||||
r_action_targets = r_action_targets + [_unit];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user