Advertisement
Guest User

Untitled

a guest
May 12th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 4.49 KB | None | 0 0
  1. private _display=uiNamespace getVariable["Lega_ChopShop",displayNull];
  2. if(isNull _display) then {createDialog"Lega_ChopShop";
  3. _display=uiNamespace getVariable["Lega_ChopShop",displayNull];};
  4. private _near_vehicles=(nearestObjects[player,["AllVehicles"],1000]) select{(!(_x isKindOf"CAManBase"))&&((damage _x)!=1)&&(!(_x isKindOf"Animal")) };
  5. private _list_controls=[];
  6. private _list_group=_display displayCtrl 1003;(ctrlPosition _list_group) params["_list_x","_list_y","_list_w","_list_h"];
  7. private _spacer=((((getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"dialog_width"))/4.5)*(profileNamespace getVariable["Lega_Dialog_Multiplier",0.70])*(10/4.5/(400/4.5)))*(pixelW*pixelGrid*0.50));
  8. private _position=[_spacer,0,((((getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"dialog_width"))/4.5)*(profileNamespace getVariable["lega_Dialog_Multiplier",0.70])*(380/4.5/(400/4.5)))*(pixelW*pixelGrid*0.50)),_list_h/6];
  9. _near_vehicles apply {private _background=_display ctrlCreate["Lega_RscStructuredText",-1,_list_group];
  10. private _displayName=getText(configFile>>"CfgVehicles">>(typeOf _x)>>"displayName");
  11. private _vehicle_cost=getNumber(missionConfigFile>>"LifeCfgVehicles">>(typeOf _x)>>"price");
  12. if((getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"damage_muliplier")) isEqualTo 1) then {_price=round(_vehicle_cost*(1-(damage _x)));};
  13.     private _claiming_cost=_vehicle_cost*(getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"claim_multiplier"));
  14. private _selling_price=_vehicle_cost*(getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"sell_multiplier"));
  15. private _remove_ownershop_cost=_vehicle_cost*(getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"removeOwner_multiplier"));
  16. private _claim_text=["claimtext",[([_claiming_cost]call Life_fnc_numberText)]]call Lega_fnc_chopShop_getString;
  17. private _sell_text=["selltext",[([_selling_price]call Life_fnc_numberText)]]call Lega_fnc_chopShop_getString;
  18. private _removal_text=["removaltext",[([_remove_ownershop_cost]call Life_fnc_numberText)]]call Lega_fnc_chopShop_getString;
  19. _background ctrlSetBackgroundColor[0.4,0.4,0.4,1];
  20. _background ctrlSetStructuredText parseText format["<t size='2.5' align='left'>%1</t><br/><t size='1.5' align='right'>%2</t><br/><t size='1.5' align='right'>%3</t><br/><t size='1.5' align='right'>%4</t>",_displayName,_claim_text,_sell_text,_removal_text ];
  21. _background ctrlSetPosition _position;
  22. _background ctrlCommit 0;
  23. _background setVariable["OriginalPositions",(ctrlPosition _background)];
  24. _background setVariable["vehicle",_x];
  25. _background setVariable["HoverPositions",[(_position select 0)-(_spacer*0.5),(_position select 1),(_position select 2)+_spacer,(_position select 3) ]];
  26. _background ctrlAddEventHandler["mouseEnter",{params[["_control",controlNull,[controlNull]]];
  27. if!(_control isEqualTo((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull])) then {_control ctrlSetBackgroundColor[0.7,0.7,0.7,1];
  28. _control ctrlSetPosition(_control getVariable["HoverPositions",[]]);
  29. _control ctrlCommit 0.2;};}];
  30. _background ctrlAddEventHandler["mouseExit",{params[["_control",controlNull,[controlNull]]];
  31. if!(_control isEqualTo((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull])) then {_control ctrlSetBackgroundColor[0.4,0.4,0.4,1];
  32. _control ctrlSetPosition(_control getVariable["OriginalPositions",[]]);
  33. _control ctrlCommit 0.2;};}];
  34. _background ctrlAddEventHandler["MouseButtonDblClick",{params[["_control",controlNull,[controlNull]]];
  35. if!(isNull((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull])) then {private _old_control=((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull]);
  36.     if(_old_control isEqualTo _control) exitWith{};
  37. _old_control ctrlSetTextColor[1,1,1,1];
  38. _old_control ctrlSetBackgroundColor[0.4,0.4,0.4,1];
  39. _old_control ctrlSetPosition(_old_control getVariable["OriginalPositions",[]]);
  40. _old_control ctrlCommit 0.2;};(uiNamespace getVariable["Lega_ChopShop",displayNull]) setVariable["Selected_Control",_control];
  41. _control ctrlSetBackgroundColor[1,1,1,1];
  42. _control ctrlSetTextColor[0.4,0.4,0.4,1];[_control]call Lega_fnc_chopShop_SelectionChanged;[(_control getVariable["vehicle",objNull])]spawn lega_fnc_chopShop_startPreview;}];
  43. _position set[1,((_position select 1)+((_position select 3)+(_spacer/2)))];};
  44. _list_group setVariable["OriginalWidth",_list_w];
  45. _list_group ctrlSetPosition[_list_x,_list_y,_list_w*1.1,_list_h];
  46. _list_group ctrlCommit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement