Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private["_display","_spawnButton","_listBox","_listItemIndex","_numberOfSpawnPoints","_randNum","_randData","_randomSpawnIndex"];
- disableSerialization;
- diag_log "Selecting spawn location...";
- ExileClientSpawnLocationSelectionDone = false;
- ExileClientSelectedSpawnLocationMarkerName = "";
- createDialog "RscExileSelectSpawnLocationDialog";
- waitUntil
- {
- _display = findDisplay 24002;
- !isNull _display
- };
- _display displayAddEventHandler ["KeyDown", "_this call ExileClient_gui_loadingScreen_event_onKeyDown"];
- _listBox = _display displayCtrl 24002;
- lbClear _listBox;
- {
- if (getMarkerType _x == "ExileSpawnZone") then
- {
- _listItemIndex = _listBox lbAdd (markerText _x);
- _listBox lbSetData [_listItemIndex, _x];
- };
- } forEach allMapMarkers;
- _numberOfSpawnPoints = {getMarkerType _x == "ExileSpawnZone"} count allMapMarkers;
- if(_numberOfSpawnPoints > 0)then
- {
- _randNum = floor(random _numberOfSpawnPoints);
- _randData = lbData [24002,_randNum];
- _randomSpawnIndex = _listBox lbAdd "Random";
- _listBox lbSetData [_randomSpawnIndex, _randData];
- };
- if(isNil "XG_Fnc_TempFNC") then
- {
- defaultLBsize = lbSize _listBox;
- myUID = getPlayerUID player;
- myFlags = [];
- {
- _flag = _x;
- _buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
- if(myUID in _buildRights)then
- {
- _name = _flag getVariable ["ExileTerritoryName", ""];
- _lbid = _listBox lbAdd _name;
- _listBox lbSetColor [_lbid, [0,0.68,1,1]];
- _listBox lbSetData [_lbid,str(count myFlags)];
- myFlags pushBack _flag;
- };
- } forEach (allMissionObjects "Exile_Construction_Flag_Static");
- fnc_LBSelChanged_24002 =
- {
- disableSerialization;
- _ctrl = _this select 0;
- _curSel = lbCurSel _ctrl;
- if(_curSel < defaultLBsize)then
- {
- _this call ExileClient_gui_selectSpawnLocation_event_onListBoxSelectionChanged;
- }
- else
- {
- _data = _ctrl lbData _curSel;
- _num = parseNumber _data;
- _flag = myFlags select _num;
- markerName = format['FLAG_%1',myUID];
- deleteMarker markerName;
- createMarker [markerName,getPosATL _flag];
- markerName setMarkerAlpha 0;
- createMarkerLocal [markerName,getPosATL _flag];
- ExileClientSelectedSpawnLocationMarkerName = markerName;
- localmarkerName = format['LOCALFLAG_%1',myUID];
- deleteMarkerLocal localmarkerName;
- _marker = createMarkerLocal [localmarkerName,getPosATL _flag];
- _marker setMarkerShapeLocal "ICON";
- _marker setMarkerTypeLocal "loc_Bunker";
- _marker setMarkerColorLocal "ColorGreen";
- _marker setMarkerTextLocal (_flag getVariable ["ExileTerritoryName", ""]);
- _mapControl = (findDisplay 24002) displayCtrl 24001;
- _mapControl ctrlMapAnimAdd [1, 0.1, getMarkerPos ExileClientSelectedSpawnLocationMarkerName];
- ctrlMapAnimCommit _mapControl;
- };
- };
- _listBox ctrlRemoveAllEventHandlers "LBSelChanged";
- _listBox ctrlAddEventHandler ["LBSelChanged", "_this call fnc_LBSelChanged_24002;"];
- fnc_ButtonClick_24003 =
- {
- XG_Fnc_TempFNC =
- {
- [XG_Fnc_ThreadID] call ExileClient_system_thread_removeTask;
- XG_Fnc_TempFNC = nil;
- };
- XG_Fnc_ThreadID = [900, XG_Fnc_TempFNC, [], false] call ExileClient_system_thread_addTask;
- [] call ExileClient_gui_selectSpawnLocation_event_onSpawnButtonClick;
- if(!isNil 'markerName')then
- {
- [] spawn
- {
- waitUntil {!isNil 'ExileClientLoadedIn'};
- uiSleep 3;
- deleteMarker markerName;
- deleteMarkerLocal localmarkerName;
- ["SuccessTitleAndText", ["Anonymous - Base Spawn:", "You will be able to respawn at your base again in 15 minutes!"]] call
- ExileClient_gui_toaster_addTemplateToast;
- };
- };
- };
- _spawnButton = _display displayCtrl 24003;
- _spawnButton ctrlRemoveAllEventHandlers "ButtonClick";
- _spawnButton ctrlSetEventHandler["ButtonClick","call fnc_ButtonClick_24003"];
- _spawnButton ctrlSetText "Let's go!";
- _spawnButton ctrlEnable true;
- _spawnButton ctrlCommit 0;
- }
- else
- {
- ["ErrorTitleAndText", ["Anonymous - Base Spawn:", "There is a 15 minute cool down to base spawning!"]] call ExileClient_gui_toaster_addTemplateToast;
- };
- true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement