Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_houseMenu.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Building interaction menu
  8. */
  9. #define Btn1 37450
  10. #define Btn2 37451
  11. #define Btn3 37452
  12. #define Btn4 37453
  13. #define Btn5 37454
  14. #define Btn6 37455
  15. #define Btn7 37456
  16. #define Btn8 37457
  17. #define Title 37401
  18.  
  19. private ["_display","_curTarget","_Btn1","_Btn2","_Btn3","_Btn4","_Btn5","_Btn6","_Btn7","_Btn8"];
  20. disableSerialization;
  21. _curTarget = param [0,objNull,[objNull]];
  22. if (isNull _curTarget) exitWith {}; //Bad target
  23. _houseCfg = [(typeOf _curTarget)] call life_fnc_houseConfig;
  24. if (count _houseCfg isEqualTo 0 && playerSide isEqualTo civilian) exitWith {};
  25.  
  26. if (!dialog) then {
  27. createDialog "pInteraction_Menu";
  28. };
  29.  
  30. _Btn1 = CONTROL(37400,Btn1);
  31. _Btn2 = CONTROL(37400,Btn2);
  32. _Btn3 = CONTROL(37400,Btn3);
  33. _Btn4 = CONTROL(37400,Btn4);
  34. _Btn5 = CONTROL(37400,Btn5);
  35. _Btn6 = CONTROL(37400,Btn6);
  36. _Btn7 = CONTROL(37400,Btn7);
  37. _Btn8 = CONTROL(37400,Btn8);
  38. {_x ctrlShow false;} forEach [_Btn1,_Btn2,_Btn3,_Btn4,_Btn5,_Btn6,_Btn7,_Btn8];
  39.  
  40. life_pInact_curTarget = _curTarget;
  41.  
  42. if (_curTarget isKindOf "House_F" && playerSide isEqualTo west) exitWith {
  43.  
  44. private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Malden", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call TON_fnc_terrainSort;
  45. private _altisArray = [16019.5,16952.9,0];
  46. private _tanoaArray = [11074.2,11501.5,0.00137329];
  47. private _maldenArray = [133.785,2546.375,2.627];
  48. private _pos = [[["Altis", _altisArray],["Malden", _maldenArray], ["Tanoa", _tanoaArray]]] call TON_fnc_terrainSort;
  49.  
  50. if ((nearestObject [_pos,"Land_Dome_Big_F"]) isEqualTo _curTarget || (nearestObject [_pos,_vaultHouse]) isEqualTo _curTarget) then {
  51.  
  52. _Btn1 ctrlSetText localize "STR_pInAct_Repair";
  53. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_repairDoor; closeDialog 0;";
  54. _Btn1 ctrlShow true;
  55.  
  56. _Btn2 ctrlSetText localize "STR_pInAct_CloseOpen";
  57. _Btn2 buttonSetAction "[life_pInact_curTarget] call life_fnc_doorAnimate; closeDialog 0;";
  58. _Btn2 ctrlShow true;
  59.  
  60. } else {
  61. if (!isNil {_curTarget getVariable "house_owner"}) then {
  62. _Btn1 ctrlSetText localize "STR_House_Raid_Owner";
  63. _Btn1 buttonSetAction "[life_pInact_curTarget] call life_fnc_copHouseOwner;";
  64. _Btn1 ctrlShow true;
  65.  
  66. _Btn2 ctrlSetText localize "STR_pInAct_BreakDown";
  67. _Btn2 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_copBreakDoor; closeDialog 0;";
  68. _Btn2 ctrlShow true;
  69.  
  70. _Btn3 ctrlSetText localize "STR_pInAct_SearchHouse";
  71. _Btn3 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_raidHouse; closeDialog 0;";
  72. _Btn3 ctrlShow true;
  73.  
  74. if (player distance _curTarget > 3.6) then {
  75. _Btn3 ctrlEnable false;
  76. };
  77.  
  78. _Btn4 ctrlSetText localize "STR_pInAct_LockHouse";
  79. _Btn4 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_lockupHouse; closeDialog 0;";
  80. _Btn4 ctrlShow true;
  81. } else {
  82. closeDialog 0;
  83. };
  84. };
  85. };
  86.  
  87. if (!(_curTarget in life_vehicles) || isNil {_curTarget getVariable "house_owner"}) then {
  88.  
  89. private _isHouse = false;
  90.  
  91. if (isClass (missionConfigFile >> "Housing" >> worldName >> (typeOf _curTarget))) then {
  92. _Btn1 ctrlSetText localize "STR_pInAct_BuyHouse";
  93. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_buyHouse;";
  94. _isHouse = true;
  95. } else {
  96. _Btn1 ctrlSetText localize "STR_pInAct_BuyGarage";
  97. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_buyHouse;";
  98. };
  99. _Btn1 ctrlShow true;
  100.  
  101. if (!isNil {_curTarget getVariable "house_owner"}) then {
  102. _Btn1 ctrlEnable false;
  103. } else {
  104. _Btn8 ctrlSetText localize "STR_trade_sell_object";
  105. _Btn8 buttonSetAction "[life_pInact_curTarget] call life_fnc_initSellObject";
  106. _Btn8 ctrlShow true;
  107. };
  108.  
  109. if (_isHouse) then {
  110. if (getNumber (missionConfigFile >> "Housing" >> worldName >> (typeOf _curTarget) >> "canGarage") isEqualTo 1) then {
  111. _Btn2 ctrlSetText localize "STR_pInAct_GarageExt";
  112. _Btn2 buttonSetAction 'hint format [localize "STR_pInAct_GarageExtNOTF",[LIFE_SETTINGS(getNumber,"houseGarage_buyPrice")] call life_fnc_numberText];';
  113. _Btn2 ctrlShow true;
  114. };
  115. };
  116.  
  117. } else {
  118. if (isClass (missionConfigFile >> "Garages" >> worldName >> (typeOf _curTarget))) then {
  119. _Btn1 ctrlSetText localize "STR_pInAct_SellGarage";
  120. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_sellHouse; closeDialog 0;";
  121. _Btn1 ctrlShow true;
  122.  
  123. if (((_curTarget getVariable "house_owner") select 0) != getPlayerUID player) then {
  124. _Btn1 ctrlEnable false;
  125. } else {
  126. _Btn8 ctrlSetText localize "STR_trade_sell_object";
  127. _Btn8 buttonSetAction "[life_pInact_curTarget] call life_fnc_initSellObject";
  128. _Btn8 ctrlShow true;
  129. };
  130.  
  131. _Btn2 ctrlSetText localize "STR_pInAct_AccessGarage";
  132. _Btn2 buttonSetAction "[life_pInact_curTarget,""Car""] spawn life_fnc_vehicleGarage; closeDialog 0;";
  133. _Btn2 ctrlShow true;
  134.  
  135. _Btn3 ctrlSetText localize "STR_pInAct_StoreVeh";
  136. _Btn3 buttonSetAction "[life_pInact_curTarget,player] spawn life_fnc_storeVehicle; closeDialog 0;";
  137. _Btn3 ctrlShow true;
  138. } else {
  139. _Btn1 ctrlSetText localize "STR_pInAct_SellHouse";
  140. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_sellHouse; closeDialog 0;";
  141. _Btn1 ctrlShow true;
  142. if (((_curTarget getVariable "house_owner") select 0) != getPlayerUID player) then {
  143. _Btn1 ctrlEnable false;
  144. } else {
  145. _Btn8 ctrlSetText localize "STR_trade_sell_object";
  146. _Btn8 buttonSetAction "[life_pInact_curTarget] call life_fnc_initSellObject";
  147. _Btn8 ctrlShow true;
  148. };
  149. if (_curTarget getVariable ["locked",false]) then {
  150. _Btn2 ctrlSetText localize "STR_pInAct_UnlockStorage";
  151. } else {
  152. _Btn2 ctrlSetText localize "STR_pInAct_LockStorage";
  153. };
  154. _Btn2 buttonSetAction "[life_pInact_curTarget] call life_fnc_lockHouse; closeDialog 0;";
  155. _Btn2 ctrlShow true;
  156. if (isNull (_curTarget getVariable ["lightSource",objNull])) then {
  157. _Btn3 ctrlSetText localize "STR_pInAct_LightsOn";
  158. } else {
  159. _Btn3 ctrlSetText localize "STR_pInAct_LightsOff";
  160. };
  161. _Btn3 buttonSetAction "[life_pInact_curTarget] call life_fnc_lightHouseAction; closeDialog 0;";
  162. _Btn3 ctrlShow true;
  163. if (_curTarget getVariable ["alarme",true] || license_civ_AssuranceMaison) then { // Código adicionado
  164. _Btn4 ctrlSetText "Éteindre l'alarme";
  165. _Btn4 buttonSetAction "life_pInact_curTarget setVariable ['alarme',false,true]; closeDialog 0;";
  166. _Btn4 ctrlshow true;
  167. } else {
  168. _Btn4 ctrlSetText "Activer l'alarme";
  169. _Btn4 buttonSetAction "life_pInact_curTarget setVariable ['alarme',true,true]; closeDialog 0;";
  170. _Btn4 ctrlshow true;
  171. };
  172.  
  173. if (getNumber (missionConfigFile >> "Housing" >> worldName >> (typeOf _curTarget) >> "canGarage") isEqualTo 1 && {!(_curTarget getVariable ["blacklistedGarage",false])}) then {
  174. if (_curTarget getVariable ["garageBought",false]) then {
  175. _Btn4 ctrlSetText localize "STR_pInAct_SellGarage";
  176. _Btn4 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_sellHouseGarage; closeDialog 0;";
  177. _Btn4 ctrlShow true;
  178.  
  179. if (((_curTarget getVariable "house_owner") select 0) != (getPlayerUID player)) then {
  180. _Btn4 ctrlEnable false;
  181. };
  182.  
  183. _Btn5 ctrlSetText localize "STR_pInAct_AccessGarage";
  184. _Btn5 buttonSetAction "[life_pInact_curTarget,""Car""] spawn life_fnc_vehicleGarage; closeDialog 0;";
  185. _Btn5 ctrlShow true;
  186.  
  187. _Btn6 ctrlSetText localize "STR_pInAct_StoreVeh";
  188. _Btn6 buttonSetAction "[life_pInact_curTarget,player] spawn life_fnc_storeVehicle; closeDialog 0;";
  189. _Btn6 ctrlShow true;
  190. } else {
  191. _Btn5 ctrlSetText localize "STR_pInAct_BuyGarage";
  192. _Btn5 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_buyHouseGarage; closeDialog 0;";
  193. };
  194.  
  195. _Btn5 ctrlShow true;
  196.  
  197. };
  198.  
  199. };
  200. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement