Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_newWealth","_missing","_missingQty","_proceed","_itemIn","_countIn","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_option"];
- disableSerialization;
- IF (DZE_ActionInProgress) exitWith { cutText [(localize "STR_EPOCH_ACTIONS_2") , "PLAIN DOWN"]; };
- DZE_ActionInProgress = TRUE;
- player removeAction s_player_maintain_area;
- s_player_maintain_area = 1;
- player removeAction s_player_maintain_area_preview;
- s_player_maintain_area_preview = 1;
- _target = cursorTarget;
- _objectClasses = DZE_maintainClasses;
- _range = DZE_PlotPole SELECT 0;
- _objects = nearestObjects [_target, _objectClasses, _range];
- _objects_filtered = [];
- {
- IF (damage _x >= DZE_DamageBeforeMaint) THEN {
- _objects_filtered SET [COUNT _objects_filtered, _x];
- };
- } COUNT _objects;
- _objects = _objects_filtered;
- _count = COUNT _objects;
- IF (_count == 0) exitWith {
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7012);
- _result = format["Objects to maintain: %1" , _count];
- _ctrl ctrlSetText _result;
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7013);
- _result = format["Price to maintain: %1 %2" , 0, CurrencyName];
- _ctrl ctrlSetText _result;
- DZE_ActionInProgress = FALSE;
- s_player_maintain_area = -1;
- s_player_maintain_area_preview = -1;
- };
- _theCost = _count * 200;
- _requirements = [[CurrencyName,_theCost]];
- _option = _this SELECT 0;
- switch _option do {
- CASE "maintain": {
- _wealth = player getVariable["cashMoney",0];
- _missing = "";
- _missingQty = 0;
- _proceed = TRUE;
- {
- _itemIn = _x SELECT 0;
- _countIn = _x SELECT 1;
- IF (_wealth < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _wealth); _proceed = FALSE; };
- } COUNT _requirements;
- IF (_proceed) THEN {
- _newWealth = (_wealth - _countIn);
- player playActionNow "Medic";
- [player,_range,TRUE,(getPosATL player)] spawn player_alertZombies;
- player setVariable["cashMoney",_newWealth,TRUE];
- PVDZE_plr_Save = [player,(magazines player),TRUE,TRUE];
- publicVariableServer "PVDZE_plr_Save";
- PVDZE_maintainArea = [player,1,_target];
- publicVariableServer "PVDZE_maintainArea";
- cutText [format[(localize "STR_EPOCH_ACTIONS_4"), _count], "PLAIN DOWN", 5];
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7012);
- _result = format["SUCCESS : Objects maintained: %1" , _count];
- _ctrl ctrlSetText _result;
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7013);
- _result = format["SUCCESS : Price maintained: %1 %2" , _theCost, CurrencyName];
- _ctrl ctrlSetText _result;
- } ELSE {
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7012);
- _result = format["FAILED: Objects to maintain: %1" , _count];
- _ctrl ctrlSetText _result;
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7013);
- _result = format["FAILED: Price to maintain: %1 %2" , _theCost, CurrencyName];
- _ctrl ctrlSetText _result;
- cutText [format[(localize "STR_EPOCH_ACTIONS_6"), _missingQty, CurrencyName], "PLAIN DOWN"];
- };
- };
- CASE "preview": {
- _cost = "";
- {
- _itemIn = _x SELECT 0;
- _countIn = _x SELECT 1;
- IF (_cost != "") THEN {
- _cost = _cost + " and ";
- };
- _cost = _cost + (str(_countIn) + " " + CurrencyName);
- } COUNT _requirements;
- cutText [format[(localize "STR_EPOCH_ACTIONS_7"), _count, _cost], "PLAIN DOWN"];
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7012);
- _result = format["Objects to maintain: %1" , _count];
- _ctrl ctrlSetText _result;
- _ctrl = ((uiNamespace getVariable "PlotManagement") displayCtrl 7013);
- _result = format["Price to maintain: %1 %2" , _theCost, CurrencyName];
- _ctrl ctrlSetText _result;
- };
- };
- DZE_ActionInProgress = FALSE;
- s_player_maintain_area = -1;
- s_player_maintain_area_preview = -1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement