|
| 1 | + |
| 2 | +closeDialog 0; |
| 3 | +private _gotjob = false; |
| 4 | +private _jobdef = []; |
| 5 | +private _activeJobs = spawner getVariable ["OT_activeJobIds",[]]; |
| 6 | +private _completed = server getVariable ["OT_completedJobIds",[]]; |
| 7 | +private _params = []; |
| 8 | +private _id = ""; |
| 9 | +private _jobcode = {}; |
| 10 | +private _faction = OT_interactingWith getvariable ["faction",""]; |
| 11 | +private _expiry = 0; |
| 12 | +private _pos = getpos player; |
| 13 | +private _standing = server getVariable [format["standing%1",_cls],0]; |
| 14 | +private _inSpawnDistance = true; |
| 15 | +private _town = _pos call OT_fnc_nearestTown; |
| 16 | +private _stability = server getVariable [format["stability%1",_town],100]; |
| 17 | +private _population = server getVariable [format["population%1",_town],50]; |
| 18 | + |
| 19 | +{ |
| 20 | + _x params ["_name",["_target",""],"_condition","_code","_repeat","_chance","_expires"]; |
| 21 | + _jobdef = _x; |
| 22 | + _jobcode = _code; |
| 23 | + _expiry = _expires; |
| 24 | + call { |
| 25 | + if((toLower _target) isEqualTo "faction") exitWith { |
| 26 | + _id = format["%1-%2",_name,_gangid]; |
| 27 | + if(([_inSpawnDistance, _standing, _town, _stability, _population] call _condition) && !(_id in _completed) && !(_id in _activeJobs) && !(_id in OT_jobsOffered)) then { |
| 28 | + _gotjob = true; |
| 29 | + _params = [_faction]; |
| 30 | + } |
| 31 | + }; |
| 32 | + }; |
| 33 | + if(_gotjob) exitWith {}; |
| 34 | +}foreach([OT_allJobs,[],{random 100},"ASCEND",{_x select 7}] call BIS_fnc_SortBy); |
| 35 | + |
| 36 | +if !(_gotjob) exitWith { |
| 37 | + [OT_interactingWith,player,["We don't have any more jobs at the moment."]] spawn OT_fnc_doConversation; |
| 38 | +}; |
| 39 | + |
| 40 | +private _job = [_id,_params] call _jobcode; |
| 41 | +OT_jobShowing = _job; |
| 42 | +OT_jobShowingID = _id; |
| 43 | +OT_jobShowingExpiry = _expiry; |
| 44 | +OT_jobsOffered pushback _id; |
| 45 | +if(count _job isEqualTo 0) exitWith {call OT_fnc_requestJobGang}; |
| 46 | +_job params ["_info","_markerPos","_setup","_fail","_success","_end","_jobparams"]; |
| 47 | + |
| 48 | +OT_jobShowingType = "faction"; |
| 49 | + |
| 50 | +createDialog "OT_dialog_joboffer"; |
| 51 | +disableSerialization; |
| 52 | + |
| 53 | +_job params ["_info","_markerPos"]; |
| 54 | +_info params ["_title","_desc"]; |
| 55 | + |
| 56 | +_textctrl = (findDisplay 8000) displayCtrl 1199; |
| 57 | + |
| 58 | +_textctrl ctrlSetStructuredText parseText format[" |
| 59 | + <t align='center' size='1.1'>%1</t><br/><br/> |
| 60 | + <t align='center' size='0.8'>%2</t><br/> |
| 61 | +",_title,_desc]; |
| 62 | + |
| 63 | +_job |
0 commit comments