more custom stuff

This commit is contained in:
Aaron Clark
2012-11-09 06:48:59 -06:00
parent f8681b1b5a
commit e9e55f912b
14 changed files with 450 additions and 11 deletions

View File

@@ -0,0 +1,21 @@
private["_buy_item1","_buy_item2","_buy_item3","_buy_item4","_buy_item5","_buy_item6","_buy_item7"];
{player removeAction _x} forEach s_player_bank;s_player_bank = [];
_activatingPlayer = _this select 1;
_uid = getPlayerUID player;
if(isNil "dayzBankBalance") then {
dayzPublishBank = [_uid,0,"deposit",_activatingPlayer];
publicVariable "dayzPublishBank";
if (isServer) then {
dayzPublishBank call server_publishBank;
};
};
waitUntil {!isNil "dayzBankBalance"};
cutText [format["You have %1 Gold Bars",dayzBankBalance], "PLAIN DOWN"];
s_player_bankvault_crtl = -1;

View File

@@ -0,0 +1,28 @@
private["_qty","_uid","_buy_item3","_buy_item4","_buy_item5","_buy_item6","_buy_item7"];
{player removeAction _x} forEach s_player_bank;s_player_bank = [];
_activatingPlayer = _this select 1;
_qty = {_x == "ItemGoldBar"} count magazines player;
if ("ItemGoldBar" in magazines player) then {
for "_x" from 1 to _qty do {
player removeMagazine "ItemGoldBar";
};
_uid = getPlayerUID player;
dayzPublishBank = [_uid,_qty,"deposit",_activatingPlayer];
publicVariable "dayzPublishBank";
if (isServer) then {
dayzPublishBank call server_publishBank;
};
[player,"refuel",0,false] call dayz_zombieSpeak;
cutText [format["Deposited %1 Gold Bars",_qty], "PLAIN DOWN"];
} else {
cutText ["Need Gold Bars" , "PLAIN DOWN"];
};
s_player_bankvault_crtl = -1;

View File

@@ -0,0 +1,18 @@
private["_buy_item1","_buy_item2","_buy_item3","_buy_item4","_buy_item5","_buy_item6","_buy_item7"];
{player removeAction _x} forEach s_player_bank;s_player_bank = [];
// [part_out, part_in, qty_out, qty_in,];
_buy_item1 = player addAction ["Withdraw 1 Gold Bar", "\z\addons\dayz_code\actions\bank_withdraw_gold.sqf",["ItemGoldBar",1], 99, true, false, "",""];
_buy_item2 = player addAction ["Withdraw 3 Gold Bars", "\z\addons\dayz_code\actions\bank_withdraw_gold.sqf",["ItemGoldBar",3], 98, true, false, "",""];
_buy_item3 = player addAction ["Withdraw 6 Gold Bars", "\z\addons\dayz_code\actions\bank_withdraw_gold.sqf",["ItemGoldBar",6], 97, true, false, "",""];
_buy_item4 = player addAction ["Withdraw 12 Gold Bars", "\z\addons\dayz_code\actions\bank_withdraw_gold.sqf",["ItemGoldBar",12], 96, true, false, "",""];
_buy_item8 = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["bank"], 92, true, false, "",""];
s_player_bank set [count s_player_bank,_buy_item1];
s_player_bank set [count s_player_bank,_buy_item2];
s_player_bank set [count s_player_bank,_buy_item3];
s_player_bank set [count s_player_bank,_buy_item4];
s_player_bank set [count s_player_bank,_buy_item8];
s_player_bank_crtl = 1;

View File

@@ -0,0 +1,41 @@
private["_buy_item1","_buy_item2","_buy_item3","_buy_item4","_buy_item5","_buy_item6","_buy_item7"];
_activatingPlayer = _this select 1;
_iarray = _this select 3;
// "ItemGoldBar",1
_part_out = (_iarray) select 0;
_qty_out = (_iarray) select 1;
_uid = getPlayerUID player;
if(isNil "dayzBankBalance") then {
dayzPublishBank = [_uid,0,"deposit",_activatingPlayer];
publicVariable "dayzPublishBank";
if (isServer) then {
dayzPublishBank call server_publishBank;
};
};
waitUntil {!isNil "dayzBankBalance"};
_currentBalance = parseNumber (dayzBankBalance);
if(_currentBalance >= _qty_out) then {
for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
};
dayzPublishBank = [_uid,_qty_out,"withdraw",_activatingPlayer];
publicVariable "dayzPublishBank";
if (isServer) then {
dayzPublishBank call server_publishBank;
};
[player,"refuel",0,false] call dayz_zombieSpeak;
cutText [format["Withdrawn %1 Gold Bars",_qty_out], "PLAIN DOWN"];
} else {
cutText [format["Insufficient funds you have %1 Gold Bars",dayzBankBalance], "PLAIN DOWN"];
};

View File

@@ -0,0 +1,60 @@
private["_activatingPlayer","_trader_id","_category","_action","_id","_type","_loc","_name","_qty","_cost","_qty","_sell","_cur","_order","_tid","_currency","_actionFile","_in","_out","_part","_cat","_cancel","_Display","_File","_textCurrency","_textPart"];
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
// [ _trader_id, _category, _action ];
_activatingPlayer = _this select 1;
_trader_id = (_this select 3) select 0;
_category = (_this select 3) select 1;
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
publicVariable "dayzTraderMenu";
if (isServer) then {
dayzTraderMenu call server_traders;
};
waitUntil {!isNil "dayzTraderMenuResult"};
//diag_log format["DEBUG Buy: %1", dayzTraderMenuResult];
{
_id = parseNumber (_x select 0);
_type = _x select 1;
_loc = _x select 2;
_name = _x select 3;
_qty = parseNumber (_x select 4);
_cost = parseNumber (_x select 5);
_sell = parseNumber (_x select 6);
_cur = _x select 7;
_cat = _x select 8;
_order = parseNumber (_x select 9);
_tid = parseNumber (_x select 10);
_currency = _x select 11;
_actionFile = _x select 12;
_textPart = getText(configFile >> _type >> _name >> "displayName");
_File = "\z\addons\dayz_code\actions\" + _actionFile + ".sqf";
_part_out = _name;
_part_in = _currency;
_out = 1;
_in = _cost;
_textCurrency = getText(configFile >> "CfgMagazines" >> _part_in >> "displayName");
_Display = "Buy " + _textPart + " for " + str(_cost) + " " + _textCurrency;
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,];
_part = player addAction [_Display, _File,[_part_out,_part_in,_out,_in], _order, true, true, "",""];
//diag_log format["DEBUG TRADER: %1", _part];
s_player_metals set [count s_player_metals,_part];
} forEach dayzTraderMenuResult;
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 92, true, false, "",""];
s_player_metals set [count s_player_metals,_cancel];
// Clear Data maybe consider cacheing results
dayzTraderMenuResult = nil;
s_player_parts_crtl = 1;

View File

@@ -0,0 +1,40 @@
private["_hasKnife","_qty","_item","_text","_string","_type","_loop","_meat","_timer"];
_item = _this select 3;
_hasKnife = "ItemKnife" in items player;
_type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];
_config = configFile >> "CfgSurvival" >> "Meat" >> _type;
player removeAction s_player_butcher;
s_player_butcher = -1;
if (_hasKnife and !_hasHarvested) then {
//Get Animal Type
_loop = true;
_isListed = isClass (_config);
_text = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
player playActionNow "Medic";
[player,"gut",0,false] call dayz_zombieSpeak;
_item setVariable["meatHarvested",true,true];
_qty = 1;
if (_isListed) then {
_qty = getNumber (_config >> "yield");
};
_id = [player,100,true,(getPosATL player)] spawn player_alertZombies;
_array = [_item,_qty];
if (local _item) then {
_array spawn local_gutObjectZ;
} else {
dayzGutBodyZ = _array;
publicVariable "dayzGutBodyZ";
};
sleep 6;
_string = format["Successfully Gutted Zombie",_text,_qty];
cutText [_string, "PLAIN DOWN"];
};

View File

@@ -0,0 +1,61 @@
private["_activatingPlayer","_trader_id","_category","_action","_id","_type","_loc","_name","_qty","_cost","_qty","_sell","_cur","_order","_tid","_currency","_actionFile","_in","_out","_part","_cat","_cancel","_Display","_File","_textCurrency","_textPart"];
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
// [ _trader_id, _category, _action ];
_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];
dayzTraderMenu = [_activatingPlayer,_trader_id,_category,_action];
publicVariable "dayzTraderMenu";
if (isServer) then {
dayzTraderMenu call server_traders;
};
waitUntil {!isNil "dayzTraderMenuResult"};
//diag_log format["DEBUG Sell: %1", dayzTraderMenuResult];
{
_id = parseNumber (_x select 0);
_type = _x select 1;
_loc = _x select 2;
_name = _x select 3;
_qty = parseNumber (_x select 4);
_cost = parseNumber (_x select 5);
_sell = parseNumber (_x select 6);
_cur = _x select 7;
_cat = _x select 8;
_order = parseNumber (_x select 9);
_tid = parseNumber (_x select 10);
_currency = _x select 11;
_actionFile = _x select 12;
_textPart = getText(configFile >> _type >> _name >> "displayName");
_File = "\z\addons\dayz_code\actions\" + _actionFile + ".sqf";
_part_out = _cur;
_part_in = _name;
_out = _sell;
_in = 1;
_textCurrency = getText(configFile >> "CfgMagazines" >> _part_out >> "displayName");
_Display = "Sell " + _textPart + " for " + str(_sell) + " " + _textCurrency;
// trade_items.sqf | [part_out, part_in, qty_out, qty_in,];
_part = player addAction [_Display, _File,[_part_out,_part_in,_out,_in], _order, true, true, "",""];
//diag_log format["DEBUG TRADER: %1", _part];
s_player_parts set [count s_player_parts,_part];
} forEach dayzTraderMenuResult;
_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["medical"], 99, true, false, "",""];
s_player_parts set [count s_player_parts,_cancel];
dayzTraderMenuResult = nil;
s_player_parts_crtl = 1;

View File

@@ -0,0 +1,9 @@
private["_sellgeneric1"];
{player removeAction _x} forEach s_player_tradecans;s_player_tradecans = [];
{player removeAction _x} forEach s_player_metals;s_player_metals = [];
{player removeAction _x} forEach s_player_bank;s_player_bank = [];
s_player_tradecans_crtl = -1;
s_player_metal_crtl = -1;
s_player_bank_crtl = -1;

View File

@@ -0,0 +1,36 @@
private["_iarray","_part_out","_part_in","_qty_out","_qty_in","_qty"];
// [part_out,part_in, qty_out, qty_in,];
_part_out = (_this select 3) select 0;
_part_in = (_this select 3) select 1;
_qty_out = (_this select 3) select 2;
_qty_in = (_this select 3) select 3;
_textPartIn = getText(configFile >> "CfgMagazines" >> _part_in >> "displayName");
_textPartOut = getText(configFile >> "CfgMagazines" >> _part_out >> "displayName");
// not portable yet
//{player removeAction _x} forEach s_player_metals;s_player_metals = [];
//s_player_metal_crtl = -1;
_qty = {_x == _part_in} count magazines player;
if (_qty >= _qty_in) then {
for "_x" from 1 to _qty_in do {
player removeMagazine _part_in;
};
for "_x" from 1 to _qty_out do {
player addMagazine _part_out;
};
[player,"repair",0,false] call dayz_zombieSpeak;
cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
} else {
_needed = _qty_in - _qty;
cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];
};

View File

@@ -69,6 +69,47 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
s_player_deleteBuild = -1;
};
// Bank Vault Code Misc_cargo_cont_tiny
if (!_isMan and _type == "Misc_cargo_cont_tiny") then {
if (s_player_bankvault_crtl < 0) then {
_Deposit = player addAction ["Make Deposit", "\z\addons\dayz_code\actions\bank_deposit.sqf",cursorTarget, 99, true, false, "",""];
_Withdraw = player addAction ["Make Withdraw", "\z\addons\dayz_code\actions\bank_withdraw.sqf",cursorTarget, 98, true, false, "",""];
_Balance = player addAction ["Check Balance", "\z\addons\dayz_code\actions\bank_checkbalance.sqf",cursorTarget, 97, true, false, "",""];
s_player_bank set [count s_player_bank,_Deposit];
s_player_bank set [count s_player_bank,_Withdraw];
s_player_bank set [count s_player_bank,_Balance];
s_player_bankvault_crtl = 1;
};
} else {
{player removeAction _x} forEach s_player_bank;s_player_bank = [];
s_player_bankvault_crtl = -1;
};
// Allow Owner to lock and unlock vehicle
if(_isVehicle and !_isMan and _canDo and _ownerID == dayz_characterID) then {
if (s_player_lockUnlock_crtl < 0) then {
_Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",cursorTarget, 2, true, true, "", "(locked cursorTarget)"];
_lock = player addAction [format["Lock %1",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",cursorTarget, 1, true, true, "", "(!locked cursorTarget)"];
s_player_lockunlock set [count s_player_lockunlock,_Unlock];
s_player_lockunlock set [count s_player_lockunlock,_lock];
s_player_lockUnlock_crtl = 1;
};
} else {
{player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
s_player_lockUnlock_crtl = -1;
};
/*
//Allow player to force save
if((_isVehicle or _isTent) and _canDo and !_isMan) then {
@@ -91,15 +132,21 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
s_player_fillfuel = -1;
};
if (!alive cursorTarget and _isAnimal and _hasKnife and !_isHarvested and _canDo) then {
// Gut animal or zombie
if (!alive cursorTarget and (_isAnimal or _isZombie) and _hasKnife and !_isHarvested and _canDo) then {
if (s_player_butcher < 0) then {
s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",cursorTarget, 3, true, true, "", ""];
if(_isZombie) then {
s_player_butcher = player addAction ["Gut Zombie", "\z\addons\dayz_code\actions\gather_zparts.sqf",cursorTarget, 3, true, true, "", ""];
} else {
s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",cursorTarget, 3, true, true, "", ""];
};
};
} else {
player removeAction s_player_butcher;
s_player_butcher = -1;
};
//Fireplace Actions check
if(inflamed cursorTarget and _hasRawMeat and _canDo) then {
if (s_player_cook < 0) then {
@@ -118,14 +165,6 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
s_player_fireout = -1;
};
//place tent
//if(_hasTent and _canDo) then {
// s_player_placetent = player addAction [localize "Place Tent", "\z\addons\dayz_code\actions\tent_pitch.sqf",cursorTarget, 0, false, true, "", ""];
//} else {
// player removeAction s_player_placetent;
// s_player_placetent = -1;
//};
//Packing my tent
if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
if ((s_player_packtent < 0) and (player distance cursorTarget < 3)) then {
@@ -187,6 +226,11 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
_string = format["<t %2>Repair%1</t>",_cmpt,_color]; //Repair - Part
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_repairActions set [count s_player_repairActions,_handle];
} else {
_color = "color='#70bf44'"; //green
_string = format["<t %2>Remove%1</t>",_cmpt,_color]; //Remove - Part
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_repairActions set [count s_player_repairActions,_handle];
};
} forEach _hitpoints;
@@ -195,6 +239,36 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
};
};
// Parts Trader Worker3
if (_isMan and cursorTarget == parts_trader_1) then {
if (s_player_parts_crtl < 0) then {
// [_trader_id, _category, ];
_buy = player addAction ["Buy Parts", "\z\addons\dayz_code\actions\buy_db.sqf",[1,"Parts"], 99, true, false, "",""];
_sell = player addAction ["Sell Parts", "\z\addons\dayz_code\actions\sell_db.sqf",[1,"Parts"], 98, true, false, "",""];
s_player_parts set [count s_player_parts,_buy];
s_player_parts set [count s_player_parts,_sell];
s_player_parts_crtl = 1;
};
};
// Dr_Hladik_EP1
if (_isMan and cursorTarget == mad_sci) then {
if (s_player_madsci_crtl < 0) then {
// [part_out, part_in, qty_out, qty_in,];
_zparts1 = player addAction ["Trade Zombie Parts for Bio Meat", "\z\addons\dayz_code\actions\trade_items.sqf",["FoodBioMeat","ItemZombieParts",2,1], 99, true, true, "",""];
s_player_madsci set [count s_player_madsci,_zparts1];
s_player_madsci_crtl = 1;
};
};
if (_isMan and !_isAlive and !_isZombie) then {
if (s_player_studybody < 0) then {
s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",cursorTarget, 0, false, true, "",""];
@@ -202,11 +276,28 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
} else {
player removeAction s_player_studybody;
s_player_studybody = -1;
};
};
} else {
//Engineering
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
dayz_myCursorTarget = objNull;
{player removeAction _x} forEach s_player_madsci;s_player_madsci = [];
{player removeAction _x} forEach s_player_parts;s_player_parts = [];
{player removeAction _x} forEach s_player_bank;s_player_bank = [];
{player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
s_player_madsci_crtl = -1;
s_player_parts_crtl = -1;
// lock unlock vehicles
s_player_lockUnlock_crtl = -1;
// Bank Vault
s_player_bankvault_crtl = -1;
//Others
player removeAction s_player_forceSave;
s_player_forceSave = -1;

View File

@@ -0,0 +1,23 @@
private["_qty","_item","_meat"];
_item = _this select 0;
_qty = _this select 1;
_meat = 0;
_loop = true;
if (local _item) then {
for "_x" from 1 to _qty do {
_item addMagazine "ItemZombieParts";
};
sleep 2;
_timer = time;
while {_loop} do {
_meat = count magazines _item;
if (_meat == 0) then {_loop = false};
if ((time - _timer) > 300) then {_loop = false};
sleep 1;
};
dayzHideBody = _item;
publicVariable "dayzHideBody";
hideBody _item;
sleep 10;
deleteVehicle _item;
};

View File

@@ -150,6 +150,7 @@ class CfgBuildingLoot {
lootPos[] = {};
itemType[] = {
{ "ItemSodaMdew","magazine" },
{ "ItemSodaRbull","magazine" },
{ "ItemWatch","generic" },
{ "ItemCompass","generic" },
{ "ItemMap","weapon" },
@@ -178,6 +179,7 @@ class CfgBuildingLoot {
};
itemChance[] = {
0.01,
0.005,
0.15,
0.05,
0.03,
@@ -227,6 +229,7 @@ class CfgBuildingLoot {
{ "WeaponHolder_PartVRotor","object" },
{ "WeaponHolder_ItemJerrycan","object" },
{ "WeaponHolder_ItemHatchet","object" },
{ "WeaponHolder_ItemOilBarrel","object" },
{ "ItemKnife","military" },
{ "ItemToolbox","weapon" },
{ "ItemWire","magazine" },
@@ -244,6 +247,7 @@ class CfgBuildingLoot {
0.01,
0.04,
0.11,
0.02,
0.07,
0.06,
0.01,

View File

@@ -384,6 +384,7 @@ if (isServer) then {
dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (or local to unit) when gutting an object
local_gutObjectZ = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObjectZ.sqf"; //Generated on the server (or local to unit) when gutting an object
local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
local_sefFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed

View File

@@ -61,6 +61,8 @@ dayz_resetSelfActions = {
s_player_removeflare = -1;
s_player_painkiller = -1;
s_player_studybody = -1;
s_player_madsci_crtl = -1;
s_player_parts_crtl = -1;
s_build_Sandbag1_DZ = -1;
s_build_Hedgehog_DZ = -1;
s_build_Wire_cat1 = -1;
@@ -73,6 +75,10 @@ call dayz_resetSelfActions;
s_player_lastTarget = objNull;
s_player_repairActions = [];
// Custom
s_player_madsci = [];
s_player_parts = [];
//Initialize Medical Variables
r_interrupt = false;
r_doLoop = false;