mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 09:10:27 +03:00
0.994
+ added client side caching of trader menus = faster less server load. + removed stock count on buy menus and replaced with yellow color coding if out of stock. + reworked purchased vehicle spawning and added parachute drop.
This commit is contained in:
@@ -8,24 +8,15 @@ _activatingPlayer = _this select 1;
|
||||
_trader_id = (_this select 3) select 0;
|
||||
_category = (_this select 3) select 1;
|
||||
|
||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
dayzTraderMenuResult = call compile format["tcacheBuy_%1;",_trader_id];
|
||||
|
||||
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||
publicVariableServer "dayzTraderMenu";
|
||||
|
||||
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||
|
||||
/*
|
||||
`id`,
|
||||
`item` varchar(255) NOT NULL COMMENT '[Class Name,1 = CfgMagazines | 2 = Vehicle | 3 = Weapon]',
|
||||
`qty` int(8) NOT NULL COMMENT 'amount in stock available to buy',
|
||||
`buy` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
||||
`sell` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
||||
`order` int(2) NOT NULL DEFAULT '0' COMMENT '# sort order for addAction menu',
|
||||
`tid` int(8) NOT NULL COMMENT 'Trader Menu ID',
|
||||
`afile` varchar(64) NOT NULL DEFAULT 'trade_items',
|
||||
*/
|
||||
if(isNil "dayzTraderMenuResult") then {
|
||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||
publicVariableServer "dayzTraderMenu";
|
||||
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||
};
|
||||
|
||||
diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
{
|
||||
@@ -103,24 +94,16 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
// 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 (Out of Stock: %2)", _textPart, _qty];
|
||||
_part = player addAction [_Display, "\z\addons\dayz_code\actions\trade_cancel.sqf",[], 0, true, false, "",""];
|
||||
|
||||
if (_qty > 0) then {
|
||||
_Display = format["Buy %1 (%2) for %3 %4", _textPart, _name, _bqty, _textCurrency];
|
||||
} else {
|
||||
// if over 50 in stock lower price to that of sell price
|
||||
if(_qty >= 50) then {
|
||||
_Display = format["Buy %1 (%2) for %3 %4 (Available: %5)", _textPart, _name, _sqty, _textCurrencySell, _qty];
|
||||
_part = player addAction [_Display, _File,[_name,_sname,_out,_sqty,"buy",_textCurrencySell,_textPart,_header], _order, true, true, "",""];
|
||||
} else {
|
||||
_Display = format["Buy %1 (%2) for %3 %4 (Available: %5)", _textPart, _name, _bqty, _textCurrency, _qty];
|
||||
_part = player addAction [_Display, _File,[_name,_bname,_out,_bqty,"buy",_textCurrency,_textPart,_header], _order, true, true, "",""];
|
||||
};
|
||||
|
||||
|
||||
_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];
|
||||
|
||||
@@ -129,6 +112,9 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
_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,dayzTraderMenuResult];
|
||||
|
||||
// Clear Data maybe consider cacheing results
|
||||
dayzTraderMenuResult = nil;
|
||||
s_player_parts_crtl = 1;
|
||||
@@ -8,23 +8,15 @@ _activatingPlayer = _this select 1;
|
||||
_trader_id = (_this select 3) select 0;
|
||||
_category = (_this select 3) select 1;
|
||||
|
||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
dayzTraderMenuResult = call compile format["tcacheSell_%1;",_trader_id];
|
||||
|
||||
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||
publicVariableServer "dayzTraderMenu";
|
||||
|
||||
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||
|
||||
/*
|
||||
`item` varchar(255) NOT NULL COMMENT '[Class Name,1 = CfgMagazines | 2 = Vehicle | 3 = Weapon]',
|
||||
`qty` int(8) NOT NULL COMMENT 'amount in stock available to buy',
|
||||
`buy` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
||||
`sell` varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
|
||||
`order` int(2) NOT NULL DEFAULT '0' COMMENT '# sort order for addAction menu',
|
||||
`tid` int(8) NOT NULL COMMENT 'Trader Menu ID',
|
||||
`afile` varchar(64) NOT NULL DEFAULT 'trade_items',
|
||||
*/
|
||||
if(isNil "dayzTraderMenuResult") then {
|
||||
diag_log format["DEBUG TRADER OBJ: %1", _trader_id];
|
||||
//["dayzTraderMenu",[_activatingPlayer,_trader_id,_category,_action]] call callRpcProcedure;
|
||||
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
|
||||
publicVariableServer "dayzTraderMenu";
|
||||
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||
};
|
||||
|
||||
diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
{
|
||||
@@ -124,37 +116,17 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
};
|
||||
|
||||
|
||||
// if under 5 in stock raise price to that of buy price
|
||||
if(_qty <= 5) then {
|
||||
|
||||
if (_count > 0) then {
|
||||
_Display = format["Sell %1 for %2 %3 each", _textPart, _bqty, _textCurrencyBuy];
|
||||
} else {
|
||||
_Display = format["<t color='#ffff00'>Sell %1 for %2 %3 each</t>", _textPart, _bqty, _textCurrencyBuy];
|
||||
};
|
||||
|
||||
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,_textPart,_textCurrency];
|
||||
|
||||
_part = player addAction [_Display, _File,[_sname,_name,_bqty,_in,"sell",_textPart,_textCurrencyBuy,_header], _order, true, true, "",""];
|
||||
|
||||
} else {
|
||||
|
||||
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, "",""];
|
||||
|
||||
};
|
||||
|
||||
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];
|
||||
// diag_log format["DEBUG TRADER: %1", _part];
|
||||
s_player_parts set [count s_player_parts,_part];
|
||||
|
||||
} forEach dayzTraderMenuResult;
|
||||
@@ -162,6 +134,12 @@ diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
|
||||
_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];
|
||||
|
||||
// Clear Data maybe consider cacheing results
|
||||
// Cache data in client side global variable
|
||||
call compile format["tcacheSell_%1 = %2;",_tid,dayzTraderMenuResult];
|
||||
|
||||
|
||||
// Clear Data
|
||||
dayzTraderMenuResult = nil;
|
||||
|
||||
|
||||
s_player_parts_crtl = 1;
|
||||
|
||||
@@ -53,28 +53,13 @@ if (_qty >= _qty_in) then {
|
||||
|
||||
_location = [(position player),0,20,1,2,2000,0] call BIS_fnc_findSafePos;
|
||||
|
||||
//place tent (local)
|
||||
_veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
_veh setVariable ["JustSpawned",true,true];
|
||||
|
||||
_veh setdir _dir;
|
||||
_veh setpos _location;
|
||||
|
||||
//_veh setPosATL _position;
|
||||
|
||||
_location = getPosATL _veh;
|
||||
|
||||
_veh setVariable ["characterID",dayz_playerUID,true];
|
||||
|
||||
clearWeaponCargoGlobal _veh;
|
||||
clearMagazineCargoGlobal _veh;
|
||||
//place vehicle spawn marker (local)
|
||||
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
//["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
|
||||
dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||
publicVariableServer "dayzPublishVeh";
|
||||
dayzPublishVeh2 = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||
publicVariableServer "dayzPublishVeh2";
|
||||
|
||||
|
||||
_veh call fnc_vehicleEventHandler;
|
||||
|
||||
player reveal _veh;
|
||||
@@ -99,7 +84,6 @@ if (_qty >= _qty_in) then {
|
||||
dayzDeleteObj = [_objectID,_objectUID];
|
||||
publicVariableServer "dayzDeleteObj";
|
||||
|
||||
|
||||
deleteVehicle _obj;
|
||||
|
||||
cutText [format[("Sold %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
|
||||
@@ -118,7 +102,7 @@ if (_qty >= _qty_in) then {
|
||||
if(_buy_o_sell == "buy") then {
|
||||
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText [format[("No %1 found within 20 meters."),_textPartOut] , "PLAIN DOWN"];
|
||||
cutText [format[("No %1 found within 20 meters."),_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -59,25 +59,12 @@ if (_qty >= _qty_in) then {
|
||||
_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
|
||||
};
|
||||
|
||||
//place tent (local)
|
||||
_veh = createVehicle [_part_out, _location, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
_veh setVariable ["JustSpawned",true,true];
|
||||
|
||||
_veh setdir _dir;
|
||||
_veh setpos _location;
|
||||
|
||||
_location = getPosATL _veh;
|
||||
|
||||
//_veh setVariable ["ObjectUID",dayz_playerUID,true];
|
||||
|
||||
|
||||
clearWeaponCargoGlobal _veh;
|
||||
clearMagazineCargoGlobal _veh;
|
||||
//place vehicle spawn marker (local)
|
||||
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
//["dayzPublishVeh",[_veh,[_dir,_location],_part_out,false,dayz_playerUID]] call callRpcProcedure;
|
||||
dayzPublishVeh = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||
publicVariableServer "dayzPublishVeh";
|
||||
dayzPublishVeh2 = [_veh,[_dir,_location],_part_out,false,dayz_playerUID];
|
||||
publicVariableServer "dayzPublishVeh2";
|
||||
|
||||
// event handlers to correctly track damage client side
|
||||
_veh call fnc_vehicleEventHandler;
|
||||
@@ -123,7 +110,7 @@ if (_qty >= _qty_in) then {
|
||||
if(_buy_o_sell == "buy") then {
|
||||
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
|
||||
} else {
|
||||
cutText [format[("No %1 found within 20 meters."),_textPartOut] , "PLAIN DOWN"];
|
||||
cutText [format[("No %1 found within 20 meters."),_textPartIn] , "PLAIN DOWN"];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ class CfgMods
|
||||
hidePicture = 0;
|
||||
hideName = 0;
|
||||
action = "http://www.dayzepoch.com";
|
||||
version = "0.993";
|
||||
version = "0.994";
|
||||
hiveVersion = 0.96; //0.93
|
||||
};
|
||||
};
|
||||
|
||||
@@ -45,6 +45,7 @@ if (isServer) then {
|
||||
|
||||
// Dayz epoch custom
|
||||
"dayzPublishVeh" addPublicVariableEventHandler {(_this select 1) spawn server_publishVeh};
|
||||
"dayzPublishVeh2" addPublicVariableEventHandler {(_this select 1) spawn server_publishVeh2};
|
||||
"dayzTradeObject" addPublicVariableEventHandler {(_this select 1) spawn server_tradeObj};
|
||||
"dayzTraderMenu" addPublicVariableEventHandler {(_this select 1) spawn server_traders};
|
||||
"dayzPlayerDeaths" addPublicVariableEventHandler {(_this select 1) spawn server_deaths};
|
||||
|
||||
@@ -137,7 +137,7 @@ class RscDisplayMain : RscStandardDisplay
|
||||
class DAYZ_Version : CA_Version
|
||||
{
|
||||
idc = -1;
|
||||
text = "DayZ Epoch 0.993 (1.7.6.1)";
|
||||
text = "DayZ Epoch 0.994 (1.7.6.1)";
|
||||
y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)";
|
||||
};
|
||||
delete CA_TitleMainMenu;
|
||||
|
||||
Reference in New Issue
Block a user