Merge pull request #621 from KillahPotatoes/v0.97S13-530

Side missions framework
This commit is contained in:
Dubjunk 2019-06-23 23:20:29 +02:00 committed by GitHub
commit 6049e1c8c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 1473 additions and 56 deletions

View File

@ -35,6 +35,7 @@
"KPLIB_param_fuelInfluence",
"KPLIB_param_limitedZeusCeiling",
"KPLIB_param_limitedZeusRadius",
"KPLIB_param_missionRefund",
"KPLIB_param_mobileRespawn",
"KPLIB_param_permission",
"KPLIB_param_permissionCommander",

View File

@ -4,7 +4,7 @@
File: KPLIB_functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-16
Last Update: 2019-04-22
Last Update: 2019-06-22
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
@ -29,4 +29,6 @@ class KPLIB {
#include "modules\23_logistic\functions.hpp"
#include "modules\24_enemy\functions.hpp"
#include "modules\26_cratefiller\functions.hpp"
#include "modules\27_mission\functions.hpp"
#include "modules\90_missions\functions.hpp"
};

View File

@ -4,7 +4,7 @@
File: KPLIB_ui.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-16
Last Update: 2019-04-22
Last Update: 2019-06-09
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
@ -25,3 +25,4 @@
#include "modules\16_garrison\ui.hpp"
#include "modules\23_logistic\ui.hpp"
#include "modules\26_cratefiller\ui.hpp"
#include "modules\27_mission\ui.hpp"

View File

@ -4,7 +4,7 @@
File: fn_cratefiller_postInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-04-05
Last Update: 2019-05-19
Last Update: 2019-06-21
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No

View File

@ -4,7 +4,7 @@
File: fn_cratefiller_preInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-02-02
Last Update: 2019-05-19
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
@ -21,10 +21,6 @@
if (isServer) then {
["Module initializing...", "PRE] [CRATEFILLER", true] call KPLIB_fnc_common_log;
/*
----- Module Initialization -----
*/
// Register arsenal filled event handler
["KPLIB_arsenal_newLists", {[] call KPLIB_fnc_cratefiller_presets;}] call CBA_fnc_addEventHandler;

View File

@ -4,7 +4,7 @@
File: KPLIB_cratefiller.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-04-05
Last Update: 2019-05-04
Last Update: 2019-06-19
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
@ -24,31 +24,6 @@ class KPLIB_cratefiller {
class KPLIB_DialogArea: KPGUI_PRE_DialogBackgroundS {};
// Crates
class KPLIB_TransportTitle: KPGUI_PRE_InlineTitle {
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLETRANSPORT";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,0,48);
w = KP_GETW(KP_WIDTH_VAL_S,2);
h = KP_GETH(KP_HEIGHT_VAL_S,16);
};
// Equipment
class KPLIB_EquipmentTitle: KPLIB_TransportTitle {
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLEEQUIPMENT";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,0,48);
};
// Inventory
class KPLIB_InventoryTitle: KPLIB_TransportTitle {
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLEINVENTORY";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,5,48);
};
// Tools controlsGroup
class KPLIB_GroupTools: KPGUI_PRE_ControlsGroupNoScrollbars {
@ -127,30 +102,16 @@ class KPLIB_cratefiller {
action = "[] call KPLIB_fnc_cratefiller_showOverview";
};
// Crates
class KPLIB_ComboCargo: KPGUI_PRE_Combo {
idc = KPLIB_IDC_CRATEFILLER_COMBOCARGO;
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
w = KP_GETW(KP_WIDTH_VAL_S,(24/11));
h = KP_GETH(KP_HEIGHT_VAL_S,24);
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_INVENTORY_TT";
onLBSelChanged = "[] call KPLIB_fnc_cratefiller_showInventory";
};
class KPLIB_RefreshCargo: KPGUI_PRE_CloseCross {
text = "KPGUI\res\icon_refresh.paa";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,23,24);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
w = KP_GETW(KP_WIDTH_VAL_S,24);
h = KP_GETH(KP_HEIGHT_VAL_S,24);
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_REFRESH_TT";
action = "[] call KPLIB_fnc_cratefiller_getNearStorages";
};
// Equipment
class KPLIB_EquipmentTitle: KPGUI_PRE_InlineTitle {
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLEEQUIPMENT";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,0,48);
w = KP_GETW(KP_WIDTH_VAL_S,2);
h = KP_GETH(KP_HEIGHT_VAL_S,16);
};
class KPLIB_ComboEquipment: KPGUI_PRE_Combo {
idc = KPLIB_IDC_CRATEFILLER_COMBOEQUIPMENT;
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,1);
@ -204,8 +165,41 @@ class KPLIB_cratefiller {
idcRight = KPLIB_IDC_CRATEFILLER_RIGHTEQUIPMENTBUTTON;
};
// Crates
class KPLIB_TransportTitle: KPLIB_EquipmentTitle {
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLETRANSPORT";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,0,48);
};
class KPLIB_ComboCargo: KPGUI_PRE_Combo {
idc = KPLIB_IDC_CRATEFILLER_COMBOCARGO;
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
w = KP_GETW(KP_WIDTH_VAL_S,(24/11));
h = KP_GETH(KP_HEIGHT_VAL_S,24);
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_INVENTORY_TT";
onLBSelChanged = "[] call KPLIB_fnc_cratefiller_showInventory";
};
class KPLIB_RefreshCargo: KPGUI_PRE_CloseCross {
text = "KPGUI\res\icon_refresh.paa";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,23,24);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
w = KP_GETW(KP_WIDTH_VAL_S,24);
h = KP_GETH(KP_HEIGHT_VAL_S,24);
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_REFRESH_TT";
action = "[] call KPLIB_fnc_cratefiller_getNearStorages";
};
// Inventory
class KPLIB_InventoryTitle: KPLIB_TransportTitle {
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLEINVENTORY";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,5,48);
};
class KPLIB_ExportName: KPLIB_SearchBar {
idc = KPLIB_IDC_CRATEFILLER_EXPORTNAME;
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,2,4);

View File

@ -0,0 +1,91 @@
# KP Liberation Module Description
## Misison Module
This module provides an mission framework to register created missions.
Also it provides a dialog which can start and abort sidemissions.
### Dependencies
* Init
* Common
* Permission
### Consumed events
**KPLIB_doLoad** (server side)
Calls KPLIB_fnc_mission_loadData to process saved module data
**KPLIB_doSave** (server side)
Calls KPLIB_fnc_mission_saveData to add the module data to the save array
**KPLIB_missionExec** (server side)
Processes a mission start or abort dependent on the passed arguments
**KPLIB_missionEnd** (server side)
Calls KPLIB_fnc_mission_endMission to delete the ended mission from the running missions
### Emitted events
**KPLIB_missionExec** (server side)
Processes a mission start or abort dependent on the passed arguments
### Functions
* KPLIB_fnc_mission_abortMission
*Aborts the given mission.*
* KPLIB_fnc_mission_buttonClick
*Selects which mission should be started/aborted and starts th next function.*
* KPLIB_fnc_mission_displayMission
*Displays the information for the given mission.*
* KPLIB_fnc_mission_endMission
*Deletes the mission from the running missions*
* KPLIB_fnc_mission_loadData
*Loads data which is bound to the this module from the given save data or initializes needed data for a new campaign.*
* KPLIB_fnc_mission_openDialog
*Opens the mission dialog.*
* KPLIB_fnc_mission_postInit
*Module post initialization.*
* KPLIB_fnc_mission_preCheck
*Checks the mission conditions on a changing selection and disables the button.*
* KPLIB_fnc_mission_preInit
*Module pre initialization*
* KPLIB_fnc_mission_readData
*Reads the data of the given listbox.*
* KPLIB_fnc_mission_registerMission
*Registers a mission for the usage as event or "buyable" sidemission.*
* KPLIB_fnc_mission_saveData
*Fetches data which is bound to this module and send it to the global save data array.*
* KPLIB_fnc_mission_settings
*CBA Settings initialization for this module.*
* KPLIB_fnc_mission_setupPlayerActions
*Initialization of actions available to players.*
* KPLIB_fnc_mission_startMission
*Starts the given mission or selects one from the given array.*
### Scripts
No scripts will be started by this module

View File

@ -0,0 +1,89 @@
#include "script_component.hpp"
/*
KPLIB_fnc_mission_abortMission
File: fn_mission_abortMission.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-13
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Aborts the given mission.
Parameter(s):
_mission - String of the mission [STRING, defaults to ""]
Returns:
Function reached the end [BOOL]
*/
params [
["_mission", "", [""]]
];
// Exit if one of the condition isn't true
if (_mission isEqualTo "") exitWith {
false
};
// Get data from namespace
private _missionData = MGVAR(_mission, []);
private _runningMissions = MGVAR("runningMissions", []);
private _cost = _missionData select 9;
_cost params [
"_costSupply",
"_costAmmo",
"_costFuel",
"_costIntel"
];
private _FOB = (_runningMissions select (_runningMissions findIf {(_x select 0) isEqualTo _mission})) select 1;
private _crateCapacity = 0;
private _crateCount = 0;
_costSupply = _costSupply * (KPLIB_param_missionRefund / 100);
_costAmmo = _costAmmo * (KPLIB_param_missionRefund / 100);
_costFuel = _costFuel * (KPLIB_param_missionRefund / 100);
_costIntel = _costIntel * (KPLIB_param_missionRefund / 100);
// Check if the mission is a buyable mission and if there's enough empty storage capacity
if !(_missionData select 0) then {
private _supplyCrates = ceil (_costSupply / KPLIB_param_crateVolume);
private _ammoCrates = ceil (_costAmmo / KPLIB_param_crateVolume);
private _fuelCrates = ceil (_costFuel / KPLIB_param_crateVolume);
private _crateCount = _supplyCrates + _ammoCrates + _fuelCrates;
private _storages = [getMarkerPos _FOB, KPLIB_param_fobRange] call KPLIB_fnc_resources_getStorages;
{
_crateCapacity = _crateCapacity + ([_x] call KPLIB_fnc_resources_getStorageSpace);
} forEach _storages;
};
// Exit if there's not enough storage
if (_crateCapacity < _crateCount) exitWith {
[
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
[localize "STR_KPLIB_HINT_MISSIONSTORAGE"]
] call CBA_fnc_notify;
false
};
// Delete the mission from the running mission data
_runningMissions deleteAt (_runningMissions findIf {(_x select 0) isEqualTo _mission});
// Refund the costs
if !(_cost isEqualTo [0, 0, 0, 0]) then {
[_FOB, _costSupply, _costAmmo, _costFuel] call KPLIB_fnc_resources_refund;
[_costIntel] call KPLIB_fnc_resources_addIntel;
};
// Set data in namespace
MSVAR("runningMissions", _runningMissions);
// Execute the abort function via server event
["KPLIB_missionExec", [_missionData select 2]] call CBA_fnc_serverEvent;
closeDialog 0;
[{!dialog}, {[] call KPLIB_fnc_mission_openDialog;}] call CBA_fnc_waitUntilAndExecute;
true

View File

@ -0,0 +1,46 @@
#include "..\ui\defines.hpp"
/*
KPLIB_fnc_mission_buttonClick
File: fn_mission_buttonClick.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-22
Last Update: 2019-06-22
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Selects which mission should be started/aborted and starts th next function.
Parameter(s):
_ctrl - The given which contains the data [CONTROL, defaults to controlNull]
Returns:
Function reached the end [BOOL]
*/
params [
["_ctrl", controlNull, [controlNull]]
];
// Dialog controls
private _dialog = findDisplay KPLIB_IDC_MISSION_DIALOG;
private _ctrlMission = _dialog displayCtrl KPLIB_IDC_MISSION_MISSIONLIST;
private _ctrlButtonMission = _dialog displayCtrl KPLIB_IDC_MISSION_MISSIONBUTTON;
private _ctrlRunning = _dialog displayCtrl KPLIB_IDC_MISSION_RUNNINGLIST;
private _ctrlButtonRunning = _dialog displayCtrl KPLIB_IDC_MISSION_RUNNINGBUTTON;
// select the right control dependant on the passed control
if (_ctrl isEqualTo _ctrlButtonMission) then {
private _index = lnbCurSelRow _ctrlMission;
private _mission = [_ctrlMission, _index] call KPLIB_fnc_mission_readData;
[_mission] call KPLIB_fnc_mission_startMission;
};
if (_ctrl isEqualTo _ctrlButtonRunning) then {
private _index = lnbCurSelRow _ctrlRunning;
private _mission = [_ctrlRunning, _index] call KPLIB_fnc_mission_readData;
[_mission] call KPLIB_fnc_mission_abortMission;
};
true

View File

@ -0,0 +1,45 @@
#include "..\ui\defines.hpp"
#include "script_component.hpp"
/*
KPLIB_fnc_mission_displayMission
File: fn_mission_displayMission.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-21
Last Update: 2019-06-22
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Displays the information for the given mission.
Parameter(s):
_mission - Mission which should be displayed [STRING, defaults to ""]
Returns:
Function reached the end [BOOL]
*/
params [
["_mission", "", [""]]
];
// Dialog controls
private _dialog = findDisplay KPLIB_IDC_MISSION_DIALOG;
private _ctrlTitle = _dialog displayCtrl KPLIB_IDC_MISSION_TITLE;
private _ctrlDescription = _dialog displayCtrl KPLIB_IDC_MISSION_DESCRIPTION;
private _ctrlReward = _dialog displayCtrl KPLIB_IDC_MISSION_REWARD;
private _ctrlPenalty = _dialog displayCtrl KPLIB_IDC_MISSION_PENALTY;
private _ctrlPicture = _dialog displayCtrl KPLIB_IDC_MISSION_PICTURE;
// Get data from namespace
private _missionData = MGVAR(_mission, []);
// Fill the controls
_ctrlTitle ctrlSetText (_missionData select 3);
_ctrlDescription ctrlSetText (_missionData select 4);
_ctrlReward ctrlSetText (_missionData select 5);
_ctrlPenalty ctrlSetText (_missionData select 6);
_ctrlPicture ctrlSetText (_missionData select 7);
true

View File

@ -0,0 +1,35 @@
#include "script_component.hpp"
/*
KPLIB_fnc_mission_endMission
File: fn_mission_endMission.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-23
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Deletes the mission from the running missions.
Parameter(s):
_mission - String of the mission [STRING, defaults to ""]
Returns:
Function reached the end [BOOL]
*/
params [
["_mission", "", [""]]
];
// Get data from namespace
private _runningMissions = MGVAR("runningMissions", []);
// Delete the mission from the running mission data
_runningMissions deleteAt (_runningMissions findIf {(_x select 0) isEqualTo _mission});
// Set data in namespace
MSVAR("runningMissions", _runningMissions);
true

View File

@ -0,0 +1,37 @@
#include "script_component.hpp"
/*
KPLIB_fnc_mission_loadData
File: fn_mission_loadData.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-21
Last Update: 2019-06-21
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Loads data which is bound to the this module from the given save data or initializes needed data for a new campaign.
Parameter(s):
NONE
Returns:
Function reached the end [BOOL]
*/
if (KPLIB_param_debug) then {["Mission module loading...", "SAVE"] call KPLIB_fnc_common_log;};
private _moduleData = ["mission"] call KPLIB_fnc_init_getSaveData;
// Check if there is a new campaign
if (_moduleData isEqualTo []) then {
if (KPLIB_param_debug) then {["Mission module data empty, creating new data...", "SAVE"] call KPLIB_fnc_common_log;};
} else {
// Otherwise start applying the saved data
if (KPLIB_param_debug) then {["Mission module data found, applying data...", "SAVE"] call KPLIB_fnc_common_log;};
MSVAR("timeCheck", _moduleData select 0);
};
true

View File

@ -0,0 +1,83 @@
#include "..\ui\defines.hpp"
#include "script_component.hpp"
/*
KPLIB_fnc_mission_openDialog
File: fn_mission_openDialog.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-19
Last Update: 2019-06-22
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Opens the mission dialog.
Parameter(s):
NONE
Returns:
Function reached the end [BOOL]
*/
// Create dialog
createDialog "KPLIB_mission";
disableSerialization;
// Dialog controls
private _dialog = findDisplay KPLIB_IDC_MISSION_DIALOG;
private _ctrlHeaderMission = _dialog displayCtrl KPLIB_IDC_MISSION_HEADERMISSIONLIST;
private _ctrlMission = _dialog displayCtrl KPLIB_IDC_MISSION_MISSIONLIST;
private _ctrlHeaderRunning = _dialog displayCtrl KPLIB_IDC_MISSION_HEADERRUNNINGLIST;
private _ctrlRunning = _dialog displayCtrl KPLIB_IDC_MISSION_RUNNINGLIST;
// Fill the header
_ctrlHeaderMission lnbAddRow ["Missionname", "", "", "", ""];
_ctrlHeaderMission lnbSetPicture [[0, 1], "res\ui_supplies.paa"];
_ctrlHeaderMission lnbSetPicture [[0, 2], "res\ui_ammo.paa"];
_ctrlHeaderMission lnbSetPicture [[0, 3], "res\ui_fuel.paa"];
_ctrlHeaderMission lnbSetPicture [[0, 4], "\A3\Ui_f\data\GUI\Cfg\Ranks\general_gs.paa"];
_ctrlHeaderRunning lnbAddRow ["Missionname", "", "", "", ""];
_ctrlHeaderRunning lnbSetPicture [[0, 1], "res\ui_supplies.paa"];
_ctrlHeaderRunning lnbSetPicture [[0, 2], "res\ui_ammo.paa"];
_ctrlHeaderRunning lnbSetPicture [[0, 3], "res\ui_fuel.paa"];
_ctrlHeaderRunning lnbSetPicture [[0, 4], "\A3\Ui_f\data\GUI\Cfg\Ranks\general_gs.paa"];
// Variables
private _data = [];
// Get data from namespace
private _missions = MGVAR("registeredMissions", []);
private _running = MGVAR("runningMissions", []);
// Fill the dialog controls
{
_data = MGVAR(_x, []);
(_data select 9) params [
"_costSupply",
"_costAmmo",
"_costFuel",
"_costIntel"
];
_ctrlMission lnbAddRow [_data select 3, str _costSupply, str _costAmmo, str _costFuel, str _costIntel];
_ctrlMission lnbSetData [[_forEachIndex, 0], _x];
} forEach _missions;
{
_data = MGVAR(_x select 0, []);
(_data select 9) params [
"_costSupply",
"_costAmmo",
"_costFuel",
"_costIntel"
];
_costSupply = _costSupply * (KPLIB_param_missionRefund / 100);
_costAmmo = _costAmmo * (KPLIB_param_missionRefund / 100);
_costFuel = _costFuel * (KPLIB_param_missionRefund / 100);
_costIntel = _costIntel * (KPLIB_param_missionRefund / 100);
_ctrlRunning lnbAddRow [_data select 3, str _costSupply, str _costAmmo, str _costFuel, str _costIntel];
_ctrlRunning lnbSetData [[_forEachIndex, 0], (_x select 0)];
} forEach _running;
true

View File

@ -0,0 +1,43 @@
/*
KPLIB_fnc_mission_postInit
File: fn_mission_postInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-09
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
The postInit function of a module takes care of starting/executing the modules functions or scripts.
Basically it starts/initializes the module functionality to make all provided features usable.
Parameter(s):
NONE
Returns:
Module postInit finished [BOOL]
*/
if (isServer) then {
["Module initializing...", "POST] [MISSION", true] call KPLIB_fnc_common_log;
// Mission permission
[
"Mission",
{},
false
] call KPLIB_fnc_permission_addPermissionHandler;
};
if (hasInterface) then {
// Setup of actions available to players
[] call KPLIB_fnc_mission_setupPlayerActions;
};
if (isServer) then {["Module initialized", "POST] [MISSION", true] call KPLIB_fnc_common_log;};
true

View File

@ -0,0 +1,108 @@
#include "..\ui\defines.hpp"
#include "script_component.hpp"
/*
KPLIB_fnc_mission_preCheck
File: fn_mission_preCheck.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-21
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Checks the mission conditions on a changing selection and disables the button.
Parameter(s):
NONE
Returns:
Function reached the end [BOOL]
*/
// Dialog controls
private _dialog = findDisplay KPLIB_IDC_MISSION_DIALOG;
private _ctrlMission = _dialog displayCtrl KPLIB_IDC_MISSION_MISSIONLIST;
private _ctrlMissionButton = _dialog displayCtrl KPLIB_IDC_MISSION_MISSIONBUTTON;
// Disable the button
_ctrlMissionButton ctrlEnable false;
// Read the dialog controls
private _index = lnbCurSelRow _ctrlMission;
private _mission = [_ctrlMission, _index] call KPLIB_fnc_mission_readData;
// Get data from namespace
private _missionData = MGVAR(_mission, []);
// Variables
private _cost = _missionData select 9;
_cost params [
"_costSupply",
"_costAmmo",
"_costFuel",
"_costIntel"
];
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
private _resourceCheck = true;
private _timeCheck = true;
// Check the mission condition
private _conditionCheck = [] call (_missionData select 8);
// Check the timestamp of the mission
private _timeData = MGVAR("timeCheck", []);
private _index = _timeData findIf {(_x select 0) isEqualTo _mission};
if (_index != -1) then {
private _missionTimeData = _timeData select _index;
if (((_missionTimeData select 1) - diag_tickTime) <= 0) then {
_timeData deleteAt _index;
} else {
_timeCheck = false;
};
};
// Check if the mission is a buyable mission and check if there are enough resources available
if !(_missionData select 0) then {
([_nearFOB] call KPLIB_fnc_resources_getResTotal) params [
"_resSupply",
"_resAmmo",
"_resFuel"
];
if (
(_resSupply < _costSupply) ||
(_resAmmo < _costAmmo) ||
(_resFuel < _costFuel) ||
(KPLIB_resources_intel < _costIntel)
) then {
_resourceCheck = false;
};
};
// Disable the button if one of the condition isn't true
if !(_conditionCheck && _resourceCheck && _timeCheck) then {
if !(_conditionCheck) then {
[
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
[localize "STR_KPLIB_HINT_MISSIONCONDITION"]
] call CBA_fnc_notify;
};
if !(_resourceCheck) then {
[
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
[localize "STR_KPLIB_HINT_MISSIONRESOURCES"]
] call CBA_fnc_notify;
};
if !(_timeCheck) then {
[
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
[localize "STR_KPLIB_HINT_MISSIONTIME"]
] call CBA_fnc_notify;
};
} else {
_ctrlMissionButton ctrlEnable true;
[_mission] call KPLIB_fnc_mission_displayMission;
};
true

View File

@ -0,0 +1,47 @@
/*
KPLIB_fnc_mission_preInit
File: fn_mission_preInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-09
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
The preInit function defines global variables, adds event handlers and set some vital settings which are used in this module.
Parameter(s):
NONE
Returns:
Module preInit finished [BOOL]
*/
if (isServer) then {
["Module initializing...", "PRE] [Mission", true] call KPLIB_fnc_common_log;
// Register load event handler
["KPLIB_doLoad", {[] call KPLIB_fnc_mission_loadData;}] call CBA_fnc_addEventHandler;
// Register save event handler
["KPLIB_doSave", {[] call KPLIB_fnc_mission_saveData;}] call CBA_fnc_addEventHandler;
// Register mission execution event handler
["KPLIB_missionExec", {call compile preprocessFileLineNumbers (_this select 0);}] call CBA_fnc_addEventHandler;
// Register mission end event handler
["KPLIB_missionEnd", {[_this select 0] call KPLIB_fnc_mission_endMission;}] call CBA_fnc_addEventHandler;
KPLIB_mission_data = true call CBA_fnc_createNamespace;
publicVariable "KPLIB_mission_data";
};
// Process CBA Settings
[] call KPLIB_fnc_mission_settings;
if (isServer) then {["Module initialized", "PRE] [MISSION", true] call KPLIB_fnc_common_log;};
true

View File

@ -0,0 +1,27 @@
/*
KPLIB_fnc_mission_readData
File: fn_mission_readData.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-21
Last Update: 2019-06-22
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Reads the data of the given listbox.
Parameter(s):
_ctrl - The given control which contains the data [CONTROL, defaults to controlNull]
_index - The row index of the control [NUMBER, defaults to 0]
Returns:
Control data [STRING]
*/
params [
["_ctrl", controlNull, [controlNull]],
["_index", 0, [0]]
];
_ctrl lnbData [_index, 0];

View File

@ -0,0 +1,73 @@
#include "script_component.hpp"
/*
KPLIB_fnc_mission_registerMission
File: fn_mission_registerMission.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-13
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: Yes
Description:
Registers a mission for the usage as event or "buyable" sidemission.
Parameter(s):
_missionName - Name of the mission [STRING, defaults to ""]
_condition - Condition which is needed to start the mission [CODE, defaults to {false}]
_eventMission - Defines if the mission is an event (true) or buyable (false) [BOOL, defaults to false]
_cost - Defines the costs of the mission [S, A, F, I] [ARRAY, defaults to [0,0,0,0]]
_minTime - The time which needs to pass before the mission can start again [NUMBER, defaults to 0]
_randomTime - The additional time which will randomly added to the minTime [NUMBER, defaults to 0]
_missionStart - Path of the mission start function [STRING, defaults to ""]
_missionAbort - Path of the mission abort function [STRING, defaults to ""]
_picture - Path to the mission picture [STRING, defaults to "KPGUI\res\kp512_CA.paa"]
Returns:
Function reached the end [BOOL]
*/
params [
["_missionName", "", [""]],
["_condition", {false}, [{}]],
["_eventMission", false, [false]],
["_cost", [0,0,0,0], [[]], 4],
["_minTime", 0, [0]],
["_randomTime", 0, [0]],
["_missionStart", "", [""]],
["_missionAbort", "", [""]],
["_picture", "KPGUI\res\kp512_CA.paa", [""]]
];
// Exit when no mission name is declared
if (_missionName isEqualTo "") exitWith {
false
};
private _string = localize (["STR_KPLIB_MISSION_", toUpper _missionName] joinString "");
if (_string isEqualTo "") then {
_string = _missionName;
};
private _descString = localize (["STR_KPLIB_MISSION_", toUpper _missionName, "_DESCR"] joinString "");
if (_descString isEqualTo "") then {
_descString = _missionName;
};
private _rewardString = localize (["STR_KPLIB_MISSION_", toUpper _missionName, "_REWARD"] joinString "");
if (_rewardString isEqualTo "") then {
_rewardString = _missionName;
};
private _penaltyString = localize (["STR_KPLIB_MISSION_", toUpper _missionName, "_PENALTY"] joinString "");
if (_penaltyString isEqualTo "") then {
_penaltyString = _missionName;
};
// Set data in namespace
private _data = [_eventMission, _missionStart, _missionAbort, _string, _descString, _rewardString, _penaltyString, _picture, _condition, _cost, _minTime, _randomTime];
MSVAR(_missionName, _data);
_data = MGVAR("registeredMissions", []);
_data pushBack _missionName;
MSVAR("registeredMissions", _data);
true

View File

@ -0,0 +1,34 @@
#include "script_component.hpp"
/*
KPLIB_fnc_mission_saveData
File: fn_mission_saveData.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-21
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Fetches data which is bound to this module and send it to the global save data array.
Parameter(s):
NONE
Returns:
Function reached the end [BOOL]
*/
if (KPLIB_param_savedebug) then {["Mission module saving...", "SAVE"] call KPLIB_fnc_common_log;};
// Modify the data which will be saved
private _timeData = (MGVAR("timeCheck", [])) apply {[_x select 0, (_x select 1) - diag_tickTime]};
// Set module data to save and send it to the global save data array
["mission",
[
_timeData
]
] call KPLIB_fnc_init_setSaveData;
true

View File

@ -0,0 +1,34 @@
/*
KPLIB_fnc_mission_settings
File: fn_mission_settings.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-14
Last Update: 2019-06-14
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
CBA Settings initialization for this module.
Parameter(s):
NONE
Returns:
Function reached the end [BOOL]
*/
// KPLIB_param_missionRefund
// Defines the resource refund from mission abortions.
// Default: 50
[
"KPLIB_param_missionRefund",
"SLIDER",
[localize "STR_KPLIB_SETTINGS_MISSION_REFUND", localize "STR_KPLIB_SETTINGS_MISSION_REFUND_TT"],
localize "STR_KPLIB_SETTINGS_MISSION",
[0, 100, 50, 0],
1,
{}
] call CBA_Settings_fnc_init;
true

View File

@ -0,0 +1,33 @@
/*
KPLIB_fnc_mission_setupPlayerActions
File: fn_mission_setupPlayerActions.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-23
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Initialization of actions available to players.
Parameter(s):
NONE
Returns:
Function reached the end [BOOL]
*/
// Actions avalible LOCALLY to player
// Permission action
private _missionCondition = '
_target isEqualTo _originalTarget &&
(
serverCommandAvailable "#kick" ||
{["Mission"] call KPLIB_fnc_permission_checkPermission}
)
';
private _actionArray = [localize "STR_KPLIB_ACTION_MISSION", {[] call KPLIB_fnc_mission_openDialog}, nil, -801, false, true, "", _missionCondition, 10];
[_actionArray] call CBA_fnc_addPlayerAction;
true

View File

@ -0,0 +1,105 @@
#include "script_component.hpp"
/*
KPLIB_fnc_mission_startMission
File: fn_mission_startMission.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-13
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
Starts the given mission or selects one from the given array.
Parameter(s):
_mission - Array or string with the missions [STRING/ARRAY, defaults to ""]
Returns:
Mission started [BOOL]
*/
params [
["_mission", "", ["", []]]
];
// Check for array and select random mission from it
if (_mission isEqualType []) then {
_mission = selectRandom _mission;
};
// Get data from namespace
private _missionData = MGVAR(_mission, []);
private _runningMissions = MGVAR("runningMissions", []);
// Variables
private _cost = _missionData select 9;
_cost params [
"_costSupply",
"_costAmmo",
"_costFuel",
"_costIntel"
];
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
private _resourceCheck = true;
private _timeCheck = true;
// Check the mission condition
private _conditionCheckFnc = _missionData select 8;
// Check the timestamp of the mission
private _timeData = MGVAR("timeCheck", []);
private _index = _timeData findIf {(_x select 0) isEqualTo _mission};
if (_index != -1) then {
private _missionTimeData = _timeData select _index;
if (((_missionTimeData select 1) - diag_tickTime) <= 0) then {
_timeData deleteAt _index;
} else {
_timeCheck = false;
};
};
// Check if the mission is a buyable mission and check if there are enough resources available
if !(_missionData select 0) then {
([_nearFOB] call KPLIB_fnc_resources_getResTotal) params [
"_resSupply",
"_resAmmo",
"_resFuel"
];
if (
(_resSupply < _costSupply) ||
(_resAmmo < _costAmmo) ||
(_resFuel < _costFuel) ||
(KPLIB_resources_intel < _costIntel)
) then {
_resourceCheck = false;
};
};
// Exit if one of the condition isn't true
if !(_resourceCheck && {_timeCheck && {[] call _conditionCheckFnc}}) exitWith {
false
};
// Pay the resources if the mission costs anything
if !(_cost isEqualTo [0, 0, 0, 0]) then {
[_nearFOB, _costSupply, _costAmmo, _costFuel] call KPLIB_fnc_resources_pay;
[-_costIntel] call KPLIB_fnc_resources_addIntel;
};
// Execute the startup function via server event
["KPLIB_missionExec", [_missionData select 1]] call CBA_fnc_serverEvent;
// Prepare the namespace data
_runningMissions pushback [_mission, _nearFOB];
private _startTime = diag_tickTime + (_missionData select 10) + (round (random (_missionData select 11)));
_timeData pushBack [_mission, _startTime];
// Set data in namespace
MSVAR("runningMissions", _runningMissions);
MSVAR("timeCheck", _timeData);
closeDialog 0;
[{!dialog}, {[] call KPLIB_fnc_mission_openDialog;}] call CBA_fnc_waitUntilAndExecute;
true

View File

@ -0,0 +1,16 @@
/*
File: script_component.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-13
Last Update: 2019-06-13
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Defines for mission module scripts
*/
// Mission get var
#define MGVAR(var, defVal) (KPLIB_mission_data getVariable [var, defVal])
// Mission set var
#define MSVAR(var, val) (KPLIB_mission_data setVariable [var, val, true])

View File

@ -0,0 +1,66 @@
/*
KP LIBERATION MODULE FUNCTIONS
File: functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-09
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Defines for all functions, which are brought by this module.
*/
class mission {
file = "modules\27_mission\fnc";
// Aborts the given mission
class mission_abortMission {};
// Selects which mission should be started/aborted and starts th next function
class mission_buttonClick {};
// Displays the information for the given mission
class mission_displayMission {};
// Deletes the mission from the running missions
class mission_endMission {};
// Loads module specific data from the save
class mission_loadData {};
// Opens the mission dialog
class mission_openDialog {};
// Module post initialization
class mission_postInit {
postInit = 1;
};
// Checks the mission conditions on a changing selection and disables the button
class mission_preCheck {};
// Module pre initialization
class mission_preInit {
preInit = 1;
};
// Reads the data of the given listbox
class mission_readData {};
// Registers a mission for the usage as event or "buyable" sidemission
class mission_registerMission {};
// Saves module specific data for the save
class mission_saveData {};
// CBA Settings initialization for this module
class mission_settings {};
// Initialization of actions available to players
class mission_setupPlayerActions {};
// Starts the given mission or selects one from the given array
class mission_startMission {};
};

View File

@ -0,0 +1,15 @@
/*
KP LIBERATION MODULE UI FILE
File: ui.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-09
Last Update: 2019-06-15
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Initializes the ui defines, dialogs and elements which are brought by this module.
*/
#include "ui\defines.hpp"
#include "ui\KPLIB_mission.hpp"

View File

@ -0,0 +1,151 @@
/*
KP Liberation mission dialog
File: KPLIB_mission.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-15
Last Update: 2019-06-23
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
A lightweight mission dialog to buy and start sidemissions.
*/
class KPLIB_mission {
idd = KPLIB_IDC_MISSION_DIALOG;
movingEnable = 0;
class controlsBackground {
class KPLIB_DialogTitle: KPGUI_PRE_DialogTitleS {
text = "$STR_KPLIB_DIALOG_MISSION_TITLE";
};
class KPLIB_DialogArea: KPGUI_PRE_DialogBackgroundS {};
};
class controls {
// Left side of the dialog
class KPLIB_LabelStart: KPGUI_PRE_InlineTitle {
text = "$STR_KPLIB_DIALOG_MISSION_TITLESTART";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,0,48);
w = KP_GETW(KP_WIDTH_VAL_S,2);
h = KP_GETH(KP_HEIGHT_VAL_S,16);
};
class KPLIB_HeaderMissionList: KPGUI_PRE_ListNBox {
idc = KPLIB_IDC_MISSION_HEADERMISSIONLIST;
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
w = KP_GETW(KP_WIDTH_VAL_S,2);
h = KP_GETH(KP_HEIGHT_VAL_S,(24));
columns[] = {0, 0.4, 0.55, 0.70, 0.85};
};
class KPLIB_MissionList: KPGUI_PRE_ListNBox {
idc = KPLIB_IDC_MISSION_MISSIONLIST;
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,5,48);
w = KP_GETW(KP_WIDTH_VAL_S,2);
h = KP_GETH(KP_HEIGHT_VAL_S,(48/25));
columns[] = {0, 0.4, 0.55, 0.70, 0.85};
onLBSelChanged = "[] call KPLIB_fnc_mission_preCheck";
};
class KPLIB_ButtonStart: KPGUI_PRE_InlineButton {
idc = KPLIB_IDC_MISSION_MISSIONBUTTON;
text = "$STR_KPLIB_DIALOG_MISSION_BUTTONSTART";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,30,48);
w = KP_GETW(KP_WIDTH_VAL_S,2);
h = KP_GETH(KP_HEIGHT_VAL_S,24);
onButtonClick = "[_this select 0] call KPLIB_fnc_mission_buttonClick";
};
class KPLIB_LabelAbort: KPLIB_LabelStart {
text = "$STR_KPLIB_DIALOG_MISSION_TITLEABORT";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,32,48);
};
class KPLIB_HeaderRunningList: KPLIB_HeaderMissionList {
idc = KPLIB_IDC_MISSION_HEADERRUNNINGLIST;
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,35,48);
};
class KPLIB_RunningList: KPLIB_MissionList {
idc = KPLIB_IDC_MISSION_RUNNINGLIST;
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,37,48);
h = KP_GETH(KP_HEIGHT_VAL_S,(48/9));
onLBSelChanged = "[[_this select 0, _this select 1] call KPLIB_fnc_mission_readData] call KPLIB_fnc_mission_displayMission";
};
class KPLIB_ButtonAbort: KPLIB_ButtonStart {
idc = KPLIB_IDC_MISSION_RUNNINGBUTTON;
text = "$STR_KPLIB_DIALOG_MISSION_BUTTONABORT";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,46,48);
onButtonClick = "[_this select 0] call KPLIB_fnc_mission_buttonClick";
};
// Right side of the dialog
class KPLIB_LabelDescription: KPLIB_LabelStart {
idc = KPLIB_IDC_MISSION_TITLE;
text = "";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
};
class KPLIB_MissionDescription: KPGUI_PRE_Text {
idc = KPLIB_IDC_MISSION_DESCRIPTION;
text = "";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
w = KP_GETW(KP_WIDTH_VAL_S,2);
h = KP_GETH(KP_HEIGHT_VAL_S,4);
style = 16;
};
class KPLIB_LabelVictory: KPLIB_LabelDescription {
text = "$STR_KPLIB_DIALOG_MISSION_TITLEREWARD";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,15,48);
};
class KPLIB_VictoryReward: KPLIB_MissionDescription {
idc = KPLIB_IDC_MISSION_REWARD;
text = "";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,18,48);
h = KP_GETH(KP_HEIGHT_VAL_S,(48/4));
};
class KPLIB_LabelDefeat: KPLIB_LabelVictory {
text = "$STR_KPLIB_DIALOG_MISSION_TITLEPENALTY";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,23,48);
};
class KPLIB_DefeatPenalty: KPLIB_VictoryReward {
idc = KPLIB_IDC_MISSION_PENALTY;
text = "";
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,26,48);
};
class KPLIB_MissionLogo: KPGUI_PRE_PictureRatio {
idc = KPLIB_IDC_MISSION_PICTURE;
text = "KPGUI\res\kp512_CA.paa";
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,31,48);
h = KP_GETH(KP_HEIGHT_VAL_S,3);
};
class KPLIB_DialogCross: KPGUI_PRE_DialogCrossS {};
};
};

View File

@ -0,0 +1,28 @@
/*
KP LIBERATION MISSION UI DEFINES
File: defines.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-15
Last Update: 2019-06-21
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Common defines for mission module UI elements
*/
#define KPLIB_IDC_MISSION_DIALOG 758027
#define KPLIB_IDC_MISSION_HEADERMISSIONLIST 687400
#define KPLIB_IDC_MISSION_MISSIONLIST 687401
#define KPLIB_IDC_MISSION_MISSIONBUTTON 687402
#define KPLIB_IDC_MISSION_HEADERRUNNINGLIST 687403
#define KPLIB_IDC_MISSION_RUNNINGLIST 687404
#define KPLIB_IDC_MISSION_RUNNINGBUTTON 687405
#define KPLIB_IDC_MISSION_TITLE 687406
#define KPLIB_IDC_MISSION_DESCRIPTION 687407
#define KPLIB_IDC_MISSION_REWARD 687408
#define KPLIB_IDC_MISSION_PENALTY 687409
#define KPLIB_IDC_MISSION_PICTURE 687410

View File

@ -0,0 +1,21 @@
# KP Liberation Module Description
## Missions Module
This module holds the user or dev team provided missions.
It also holds a postInit function which can be used to register the missions.
### Dependencies
* Common
* Mission
### Emitted events
**KPLIB_missionEnd** (server side)
Emitted when a mission is finished or failed
### Functions
* KPLIB_fnc_missions_postInit
*Module post initialization.*
### Scripts
No scripts will be started by this module

View File

@ -0,0 +1,11 @@
/*
This file handles the mission abortion.
It contains the basic data or calls the needed functions to abort the mission
Example content:
- Unit deletion
- Marker deletion
- Task deletion
*/
["Example mission aborted!"] call CBA_fnc_notify;

View File

@ -0,0 +1,14 @@
/*
This file handles the mission end.
It contains everything which is needed the clearly end the mission, reward pay or penaltys etc.
Example content:
- Check the mission state (finished or failed)
- Unit deletion
- Marker deletion
- Task deletion
*/
// Execute the end function via server event
// Replace "Your mission name" with the registered name of your mission to ensure that the mission will be deleted from the running misisons clearly
["KPLIB_missionEnd", ["Your mission name"]] call CBA_fnc_serverEvent;

View File

@ -0,0 +1,11 @@
/*
This file handles the mission start.
It contains the basic data or calls the needed functions to start the mission.
Example content:
- Unit spawns
- Marker creation
- Task creation
*/
["Example mission started!"] call CBA_fnc_notify;

View File

@ -0,0 +1,43 @@
/*
KPLIB_fnc_missions_postInit
File: fn_missions_postInit.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-22
Last Update: 2019-06-22
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Description:
The postInit function of a module takes care of starting/executing the modules functions or scripts.
Basically it starts/initializes the module functionality to make all provided features usable.
Parameter(s):
NONE
Returns:
Module postInit finished [BOOL]
*/
if (isServer) then {
["Module initializing...", "POST] [MISSIONS", true] call KPLIB_fnc_common_log;
[
"Example",
{true},
false,
[10, 0, 0, 0],
10,
10,
"modules\90_missions\example\start.sqf",
"modules\90_missions\example\abort.sqf"
] call KPLIB_fnc_mission_registerMission;
};
if (isServer) then {["Module initialized", "POST] [MISSIONS", true] call KPLIB_fnc_common_log;};
true

View File

@ -0,0 +1,22 @@
/*
KP LIBERATION MODULE FUNCTIONS
File: functions.hpp
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-06-22
Last Update: 2019-06-22
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
Defines for all functions, which are brought by this module.
*/
class missions {
file = "modules\90_missions\fnc";
// Module post initialization
class missions_postInit {
postInit = 1;
};
};

View File

@ -44,6 +44,7 @@ With these additions the intended complexity comes into the mission. It is highl
24 Enemy Commander
25 Friendly Commander Managing Dialog
26 Cratefiller
27 Mission handling
```
### TBA
Mod specific compatibility modules

View File

@ -270,6 +270,10 @@
<English>-- LOGISTIC --</English>
<German>-- LOGISTIK --</German>
</Key>
<Key ID="STR_KPLIB_ACTION_MISSION">
<English>-- MISSIONS --</English>
<German>-- MISSIONEN --</German>
</Key>
<Key ID="STR_KPLIB_ACTION_PERMISSION">
<English>-- PERMISSIONS --</English>
<German>-- RECHTE --</German>
@ -1123,6 +1127,38 @@
<German>Wähle eine Waffe um die passenden Magazine oder Zubehör zu finden.</German>
<Polish>Wybierz broń do której mają być wyszukane magazynki oraz dodatki.</Polish>
</Key>
<!-- MISSION DIALOG -->
<Key ID="STR_KPLIB_DIALOG_MISSION_TITLE">
<English>KP Liberation Missions</English>
<German>KP Liberation Missionen</German>
</Key>
<Key ID="STR_KPLIB_DIALOG_MISSION_BUTTONABORT">
<English>Abort mission</English>
<German>Mission abbrechen</German>
</Key>
<Key ID="STR_KPLIB_DIALOG_MISSION_BUTTONSTART">
<English>Start mission</English>
<German>Mission starten</German>
</Key>
<Key ID="STR_KPLIB_DIALOG_MISSION_TITLEABORT">
<English>Running missions</English>
<German>Laufende Missionen</German>
</Key>
<Key ID="STR_KPLIB_DIALOG_MISSION_TITLEPENALTY">
<English>Penalty on mission failure</English>
<German>Strafe bei nicht erfoglreicher Mission</German>
</Key>
<Key ID="STR_KPLIB_DIALOG_MISSION_TITLEREWARD">
<English>Reward on mission success</English>
<German>Belohnung bei erfoglreicher Mission</German>
</Key>
<Key ID="STR_KPLIB_DIALOG_MISSION_TITLESTART">
<English>Available missions</English>
<German>Verfügbare Missionen</German>
</Key>
</Package>
@ -1162,6 +1198,22 @@
<English>Clear the aft deck and the helicopter first.</English>
<German>Räume zuerst das Achterdeck und den Helikopter.</German>
</Key>
<Key ID="STR_KPLIB_HINT_MISSIONCONDITION">
<English>The conditions for the mission start aren't met.</English>
<German>Die Bedingungen für den Missionsstart sind nicht erfüllt.</German>
</Key>
<Key ID="STR_KPLIB_HINT_MISSIONRESOURCES">
<English>There aren't enough resources to start the mission.</English>
<German>Es sind nicht genügend Ressourcen vorhanden, um die Mission zu starten.</German>
</Key>
<Key ID="STR_KPLIB_HINT_MISSIONSTORAGE">
<English>There isn't enough storage capacity to abort the mission.</English>
<German>Es ist nicht genügend Lagerkapazität vorhanden, um die Mission abzubrechen.</German>
</Key>
<Key ID="STR_KPLIB_HINT_MISSIONTIME">
<English>The mission can't be started yet, you'll need to wait some more time.</English>
<German>Die Mission kann noch nicht gestartet werden, du musst noch etwas warten.</German>
</Key>
<Key ID="STR_KPLIB_HINT_NAME">
<English>Invalid name.</English>
<German>Ungültiger Name.</German>
@ -1835,6 +1887,19 @@
<English>Enables/Disables the Liberation cratefiller equipment overview.</English>
<German>Aktiviert/Deaktiviert die Liberation Kistenfüller Ausrüstungsübersicht.</German>
</Key>
<!-- MISSION CATEGORY -->
<Key ID="STR_KPLIB_SETTINGS_MISSION">
<English>KPLIB - Missions</English>
<German>KPLIB - Missionen</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_MISSION_REFUND">
<English>Mission abortion refund factor</English>
<German>Rückerstattungsfaktor bei Missionsabbruch</German>
</Key>
<Key ID="STR_KPLIB_SETTINGS_MISSION_REFUND_TT">
<English>Defines the mission abortion refund in percentage.</English>
<German>Definiert die Rückerstattung in Prozent.</German>
</Package>
@ -2052,6 +2117,10 @@
<English>Logistic Vehicle</English>
<German>Logistik Fahrzeuge</German>
</Key>
<Key ID="STR_KPLIB_PERMISSION_MISSION">
<English>Missions</English>
<German>Missionen</German>
</Key>
<Key ID="STR_KPLIB_PERMISSION_RECYCLE">
<English>Recycle</English>
<German>Recyceln</German>
@ -2077,4 +2146,29 @@
<German>Transportfahrzeug</German>
</Key>
</Package>
<!-- USER MISSIONS -->
<Package name="Missions">
<!-- EXAMPLE MISSION -->
<Key ID="STR_KPLIB_MISSION_EXAMPLE">
<English>Example Mission</English>
<German>Beispiel Mission</German>
</Key>
<Key ID="STR_KPLIB_MISSION_EXAMPLE_DESCR">
<English>This mission serves as a test mission and template.\n\nThis box shows the mission description.</English>
<German>Diese Mission dient als Test Mission und Vorlage.\n\nDiese Box zeigt die Missionsbeschreibung.</German>
</Key>
<Key ID="STR_KPLIB_MISSION_EXAMPLE_REWARD">
<English>This box describes the reward of the completed mission.</English>
<German>Diese Box beschreibt die Belohnung bei erfolgreichem Missionsabschluss.</German>
</Key>
<Key ID="STR_KPLIB_MISSION_EXAMPLE_PENALTY">
<English>This box describes the penalty of the failed mission.</English>
<German>Diese Box beschreibt die Strafe bei nicht erfolgreichem Missionsabschluss.</German>
</Key>
</Package>
</Project>