Compare commits

...

21 Commits

Author SHA1 Message Date
Jacob Schmidt
6282080cb4 Add store mod source contains matching 2026-06-03 23:23:03 -05:00
Jacob Schmidt
69acbaef4c Add store DLC source filtering diagnostics 2026-06-03 23:06:03 -05:00
Jacob Schmidt
510c1a77b6 Improve store equipment category scanning 2026-06-03 22:57:55 -05:00
Jacob Schmidt
4f54edf467 Backport framework docs and store filter updates 2026-06-03 22:48:59 -05:00
Jacob Schmidt
d61cb86d3a Move service pricing into economy config 2026-06-03 17:47:02 -05:00
Jacob Schmidt
bfb317eb5c Clarify store and starting equipment guides 2026-06-03 17:42:02 -05:00
Jacob Schmidt
623f718caf Update framework mission configuration systems 2026-06-03 17:36:13 -05:00
Jacob Schmidt
6229f56ba4 Backport framework updates without mission files 2026-06-03 05:59:56 -05:00
Jacob Schmidt
d4d1f251c4 Integrate framework mission setup and generators 2026-05-31 17:14:47 -05:00
Jacob Schmidt
623f690a82 Add shared Forge mod dependency 2026-05-28 18:53:40 -05:00
Jacob Schmidt
1e2402c332 Fix framework generator CAD hydration 2026-05-26 22:22:13 -05:00
Jacob Schmidt
9c2a09eed9 Integrate mission generators into framework 2026-05-26 21:12:04 -05:00
Jacob Schmidt
1454a29de9 Refine transport service documentation for clarity and conciseness 2026-05-25 15:31:43 -05:00
Jacob Schmidt
bda6359e7c Update transport guide terminology for clarity 2026-05-25 14:57:39 -05:00
Jacob Schmidt
582dd39640 Replace transport docs placeholders with screenshots 2026-05-25 14:33:39 -05:00
Jacob Schmidt
89e3f794dc Fix transport personal payment fallback 2026-05-25 13:59:12 -05:00
Jacob Schmidt
c0dd782103 Add framework transport service 2026-05-25 13:27:34 -05:00
Jacob Schmidt
f2ac9fcbe7 Fix framework hashmap object initialization 2026-05-24 23:13:39 -05:00
Jacob Schmidt
5a48cbfa4a Fix SurrealDB reconnect on mission restart 2026-05-23 18:33:59 -05:00
Jacob Schmidt
2cdf4db591 Add git workflow helper 2026-05-23 09:57:54 -05:00
Jacob Schmidt
a6dbf9623a Document development branch workflow 2026-05-23 09:48:43 -05:00
324 changed files with 11429 additions and 874 deletions

1
.gitignore vendored
View File

@ -34,5 +34,6 @@ Thumbs.db
# Arma # Arma
arma/ui/map-viewer/ arma/ui/map-viewer/
arma/mod/.hemttout/
arma/server/surrealdb/forge.db/ arma/server/surrealdb/forge.db/
promo/ promo/

View File

@ -24,6 +24,7 @@ connect_timeout_ms = 5000
```text ```text
arma/ arma/
mod/ Shared client/server config addon built as @forge_mod
client/ Client-side addons and browser UIs client/ Client-side addons and browser UIs
server/ Server-side addons and extension crate server/ Server-side addons and extension crate
bin/ bin/
@ -44,13 +45,16 @@ npm run build:webui
.\build-arma.ps1 .\build-arma.ps1
``` ```
`.\build-arma.ps1` builds `arma/mod`, `arma/client`, and `arma/server`. Load
the resulting `@forge_mod` on both clients and servers, `@forge_client` on
clients, and `@forge_server` on the server only.
## Documentation ## Documentation
- [Framework Documentation](./docs/README.md) - [Framework Documentation](./docs/README.md)
- [Framework Architecture](./docs/FRAMEWORK_ARCHITECTURE.md) - [Framework Architecture](./docs/FRAMEWORK_ARCHITECTURE.md)
- [Module Reference](./docs/MODULE_REFERENCE.md) - [Module Reference](./docs/MODULE_REFERENCE.md)
- [Development Guide](./docs/DEVELOPMENT_GUIDE.md) - [Development Guide](./docs/DEVELOPMENT_GUIDE.md)
- [Git Workflow](./docs/GIT_WORKFLOW.md)
## Extension Status ## Extension Status

View File

@ -23,7 +23,7 @@ player addEventHandler ["Respawn", {
[SRPC(economy,onRespawn), [_unit, _corpse, _uid]] call CFUNC(serverEvent); [SRPC(economy,onRespawn), [_unit, _corpse, _uid]] call CFUNC(serverEvent);
}]; }];
if (isNil QGVAR(ActorRepository)) then { call FUNC(initRepository); }; if (isNil QGVAR(ActorRepository)) then { call FUNC(initRepository); true };
GVAR(resetMedicalSpectator) = { GVAR(resetMedicalSpectator) = {
player switchMove ""; player switchMove "";

View File

@ -37,6 +37,10 @@ switch (_event) do {
case "actor::open::bank": { [] spawn EFUNC(bank,openUI); }; case "actor::open::bank": { [] spawn EFUNC(bank,openUI); };
case "actor::open::cad": { [] spawn EFUNC(cad,openUI); }; case "actor::open::cad": { [] spawn EFUNC(cad,openUI); };
case "actor::open::device": { hint "Device interaction is not yet implemented."; }; case "actor::open::device": { hint "Device interaction is not yet implemented."; };
case "actor::open::missionSetup": {
diag_log "[FORGE:Client:Actor] Requesting framework mission setup UI.";
[SRPC(task,requestOpenMissionSetup), [player]] call CFUNC(serverEvent);
};
case "actor::open::garage": { case "actor::open::garage": {
private _garageObject = objNull; private _garageObject = objNull;
if (_data isEqualType createHashMap) then { if (_data isEqualType createHashMap) then {
@ -58,6 +62,54 @@ switch (_event) do {
case "actor::open::phone": { [] spawn EFUNC(phone,openUI); }; case "actor::open::phone": { [] spawn EFUNC(phone,openUI); };
case "actor::open::iplayer": { hint "Player interaction is not yet implemented." }; case "actor::open::iplayer": { hint "Player interaction is not yet implemented." };
case "actor::open::store": { [] spawn EFUNC(store,openUI); }; case "actor::open::store": { [] spawn EFUNC(store,openUI); };
case "actor::request::transport": {
if !(_data isEqualType createHashMap) exitWith {
hint "Invalid transport request.";
};
private _destination = _data getOrDefault ["destination", createHashMap];
if !(_destination isEqualType createHashMap) exitWith {
hint "Invalid transport destination.";
};
private _fromNode = objectFromNetId (_data getOrDefault ["netId", ""]);
private _toNode = objectFromNetId (_destination getOrDefault ["netId", ""]);
if (isNull _fromNode || { isNull _toNode }) exitWith {
hint "Transport destination is no longer available.";
};
private _transportSetting = {
params [["_name", "", [""]], ["_default", 0, [0]]];
private _configDefault = _default;
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
if (isNumber (_serviceConfig >> _name)) then {
_configDefault = getNumber (_serviceConfig >> _name);
};
private _paramValue = [_name, _configDefault] call BIS_fnc_getParamValue;
private _value = missionNamespace getVariable [_name, _paramValue];
if (_value isEqualType "") exitWith { (parseNumber _value) max 0 };
if (_value isEqualType 0) exitWith { _value max 0 };
_configDefault
};
private _options = createHashMapFromArray [
["label", _data getOrDefault ["label", "Transport"]],
["nodePrefix", _data getOrDefault ["nodePrefix", "transport"]],
["vehiclePrefix", _data getOrDefault ["vehiclePrefix", "transport_vehicle"]],
["arrivalPrefix", _data getOrDefault ["arrivalPrefix", "transport_arrival"]],
["maxIndexedNodes", _data getOrDefault ["maxIndexedNodes", 10]],
["baseFare", _data getOrDefault ["baseFare", ["transportBaseFare", 100] call _transportSetting]],
["pricePerKm", _data getOrDefault ["pricePerKm", ["transportPricePerKm", 50] call _transportSetting]],
["cargoRadius", _data getOrDefault ["cargoRadius", 25]],
["includeCargo", _data getOrDefault ["includeCargo", true]]
];
[SRPC(transport,requestTransport), [player, _fromNode, _toNode, _options]] call CFUNC(serverEvent);
};
default { hint format ["Unhandled UI event: %1", _event]; }; default { hint format ["Unhandled UI event: %1", _event]; };
}; };

View File

@ -107,6 +107,10 @@ GVAR(ActorRepositoryBaseClass) = compileFinal createHashMapFromArray [
["getNearbyActions", compileFinal { ["getNearbyActions", compileFinal {
params [["_control", controlNull, [controlNull]]]; params [["_control", controlNull, [controlNull]]];
private _nearbyActions = []; private _nearbyActions = [];
if !(GETMVAR(forge_server_task_missionSetup_settingsApplied,false)) then {
_nearbyActions pushBack ["missionSetup", true];
};
{ {
private _isAtm = _x getVariable ["isAtm", false]; private _isAtm = _x getVariable ["isAtm", false];
private _isBank = _x getVariable ["isBank", false]; private _isBank = _x getVariable ["isBank", false];
@ -121,6 +125,12 @@ GVAR(ActorRepositoryBaseClass) = compileFinal createHashMapFromArray [
]; ];
private _deviceType = _x getVariable ["deviceType", ""]; private _deviceType = _x getVariable ["deviceType", ""];
private _isPlayer = _x isKindOf "Man" && isPlayer _x; private _isPlayer = _x isKindOf "Man" && isPlayer _x;
private _objectName = vehicleVarName _x;
private _transportPrefix = _x getVariable ["transportNodePrefix", "transport"];
private _isTransport = _x getVariable ["isTransport", false];
if (!_isTransport && { _objectName isNotEqualTo "" }) then {
_isTransport = _objectName isEqualTo _transportPrefix || { (_objectName find format ["%1_", _transportPrefix]) == 0 };
};
if (_isStore) then { _nearbyActions pushBack ["store", true]; }; if (_isStore) then { _nearbyActions pushBack ["store", true]; };
if (_isAtm) then { _nearbyActions pushBack ["atm", true]; }; if (_isAtm) then { _nearbyActions pushBack ["atm", true]; };
@ -129,6 +139,71 @@ GVAR(ActorRepositoryBaseClass) = compileFinal createHashMapFromArray [
if (_isGarage) then { _nearbyActions pushBack ["garage", _garageContext]; }; if (_isGarage) then { _nearbyActions pushBack ["garage", _garageContext]; };
if (_isGarage && GVAR(enableVG)) then { _nearbyActions pushBack ["vg", _garageContext]; }; if (_isGarage && GVAR(enableVG)) then { _nearbyActions pushBack ["vg", _garageContext]; };
if (_deviceType isNotEqualTo "") then { _nearbyActions pushBack ["device", _deviceType]; }; if (_deviceType isNotEqualTo "") then { _nearbyActions pushBack ["device", _deviceType]; };
if (_isTransport) then {
private _fromTransportNode = _x;
private _maxIndexedNodes = _x getVariable ["transportMaxIndexedNodes", 10];
private _transportSetting = {
params [["_name", "", [""]], ["_default", 0, [0]]];
private _configDefault = _default;
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
if (isNumber (_serviceConfig >> _name)) then {
_configDefault = getNumber (_serviceConfig >> _name);
};
private _paramValue = [_name, _configDefault] call BIS_fnc_getParamValue;
private _value = missionNamespace getVariable [_name, _paramValue];
if (_value isEqualType "") exitWith { (parseNumber _value) max 0 };
if (_value isEqualType 0) exitWith { _value max 0 };
_configDefault
};
private _baseFare = _x getVariable ["transportBaseFare", ["transportBaseFare", 100] call _transportSetting];
private _pricePerKm = _x getVariable ["transportPricePerKm", ["transportPricePerKm", 50] call _transportSetting];
private _vehiclePrefix = _x getVariable ["transportVehiclePrefix", format ["%1_vehicle", _transportPrefix]];
private _arrivalPrefix = _x getVariable ["transportArrivalPrefix", format ["%1_arrival", _transportPrefix]];
private _nodeNames = [_transportPrefix];
for "_i" from 1 to _maxIndexedNodes do {
_nodeNames pushBack format ["%1_%2", _transportPrefix, _i];
};
private _destinations = [];
{
private _node = missionNamespace getVariable [_x, objNull];
if (!isNull _node && { _node isNotEqualTo _fromTransportNode }) then {
private _nodeLabel = _node getVariable ["transportLabel", vehicleVarName _node];
if (_nodeLabel isEqualTo "") then { _nodeLabel = "Transport Point"; };
private _distanceMeters = _fromTransportNode distance2D _node;
private _cost = round (_baseFare + ((_distanceMeters / 1000) * _pricePerKm));
_destinations pushBack createHashMapFromArray [
["netId", netId _node],
["name", vehicleVarName _node],
["label", _nodeLabel],
["cost", _cost]
];
};
} forEach _nodeNames;
if (_destinations isNotEqualTo []) then {
private _transportContext = createHashMapFromArray [
["netId", netId _x],
["name", _objectName],
["label", _x getVariable ["transportLabel", "Transport"]],
["nodePrefix", _transportPrefix],
["vehiclePrefix", _vehiclePrefix],
["arrivalPrefix", _arrivalPrefix],
["maxIndexedNodes", _maxIndexedNodes],
["baseFare", _baseFare],
["pricePerKm", _pricePerKm],
["cargoRadius", _x getVariable ["transportCargoRadius", 25]],
["includeCargo", _x getVariable ["transportIncludeCargo", true]],
["destinations", _destinations]
];
_nearbyActions pushBack ["transport", _transportContext];
};
};
if (_isPlayer && { _x isNotEqualTo player }) then { _nearbyActions pushBack ["player", name _x]; }; if (_isPlayer && { _x isNotEqualTo player }) then { _nearbyActions pushBack ["player", name _x]; };
} forEach (player nearObjects 5); } forEach (player nearObjects 5);

View File

@ -151,6 +151,12 @@ const actionDefinitions = {
description: "View and manage your organization data", description: "View and manage your organization data",
action: "actor::open::org", action: "actor::open::org",
}, },
missionSetup: {
id: "missionSetup",
title: "Mission Setup",
description: "Open framework mission setup",
action: "actor::open::missionSetup",
},
store: { store: {
id: "store", id: "store",
title: "Store", title: "Store",
@ -193,12 +199,19 @@ const actionDefinitions = {
description: "Access your virtual garage", description: "Access your virtual garage",
action: "actor::open::vgarage", action: "actor::open::vgarage",
}, },
transport: {
id: "transport",
title: "Transport",
description: "Show available travel destinations",
action: "actor::show::transport",
},
}; };
const initialState = { const initialState = {
availableActions: [], availableActions: [],
menuItems: [...baseMenuItems], menuItems: [...baseMenuItems],
baseMenuItems: [...baseMenuItems], baseMenuItems: [...baseMenuItems],
defaultMenuItems: [...baseMenuItems],
actionDefinitions: { ...actionDefinitions }, actionDefinitions: { ...actionDefinitions },
}; };
@ -244,6 +257,7 @@ function actorReducer(state = initialState, action) {
...state, ...state,
availableActions: action.payload, availableActions: action.payload,
menuItems: newMenuItems, menuItems: newMenuItems,
defaultMenuItems: newMenuItems,
}; };
case ActionTypes.SET_MENU_ITEMS: case ActionTypes.SET_MENU_ITEMS:
@ -426,6 +440,43 @@ function RadialMenu() {
const handleItemClick = (item) => { const handleItemClick = (item) => {
console.log("Menu item clicked:", item); console.log("Menu item clicked:", item);
if (item.action === "actor::show::default") {
store.dispatch(
actions.setMenuItems(state.defaultMenuItems || state.baseMenuItems),
);
return;
}
if (item.action === "actor::show::transport") {
const context = item.context || {};
const destinations = Array.isArray(context.destinations)
? context.destinations
: [];
const transportItems = [
{
id: "transport-back",
title: "Back",
description: "Return to the default interaction menu",
action: "actor::show::default",
},
...destinations.map((destination, index) => ({
id: `transport-destination-${index}`,
title: destination.cost
? `${destination.label || destination.name || "Destination"} - $${destination.cost}`
: destination.label || destination.name || "Destination",
description: "Request transport to this destination",
action: "actor::request::transport",
context: {
...context,
destination,
},
})),
];
store.dispatch(actions.setMenuItems(transportItems));
return;
}
const alert = { const alert = {
event: item.action, event: item.action,
data: item.context || {}, data: item.context || {},

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isNil QGVAR(BankRepository)) then { call FUNC(initRepository); }; if (isNil QGVAR(BankRepository)) then { call FUNC(initRepository); true };
if (isNil QGVAR(BankUIBridge)) then { call FUNC(initUIBridge); }; if (isNil QGVAR(BankUIBridge)) then { call FUNC(initUIBridge); true };
GVAR(sendPhoneBankEvent) = { GVAR(sendPhoneBankEvent) = {
params [["_functionName", "", [""]], ["_arguments", [], [[]]]]; params [["_functionName", "", [""]], ["_arguments", [], [[]]]];

View File

@ -23,11 +23,14 @@
private _webUIDeclarations = call EFUNC(common,initWebUIBridge); private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration"; private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
GVAR(BankUIBridgeBaseClass) = compileFinal createHashMapFromArray [ GVAR(BankUIBridgeBaseClass) = compileFinal ([
["#base", _webUIBridgeDeclaration], _webUIBridgeDeclaration,
createHashMapFromArray [
["#type", "BankUIBridgeBaseClass"], ["#type", "BankUIBridgeBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
_self set ["screen", createHashMapObject [EGVAR(common,WebUIScreenDeclaration), []]];
_self set ["mode", "bank"]; _self set ["mode", "bank"];
true
}], }],
["getActiveBrowserControl", compileFinal { ["getActiveBrowserControl", compileFinal {
private _display = uiNamespace getVariable ["RscBank", displayNull]; private _display = uiNamespace getVariable ["RscBank", displayNull];
@ -166,7 +169,13 @@ GVAR(BankUIBridgeBaseClass) = compileFinal createHashMapFromArray [
_self set ["mode", _finalMode]; _self set ["mode", _finalMode];
_finalMode _finalMode
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(BankUIBridge) = createHashMapObject [GVAR(BankUIBridgeBaseClass)]; private _merged = +_base;
GVAR(BankUIBridge) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(BankUIBridge) = createHashMapObject [GVAR(BankUIBridgeBaseClass), []];
true

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isNil QGVAR(CADRepository)) then { call FUNC(initRepository); }; if (isNil QGVAR(CADRepository)) then { call FUNC(initRepository); true };
if (isNil QGVAR(CADUIBridge)) then { call FUNC(initUIBridge); }; if (isNil QGVAR(CADUIBridge)) then { call FUNC(initUIBridge); true };
[QGVAR(openCAD), { [QGVAR(openCAD), {
call FUNC(openUI); call FUNC(openUI);

View File

@ -30,6 +30,7 @@ GVAR(CADRepository) = createHashMapObject [[
_self set ["requests", []]; _self set ["requests", []];
_self set ["assignments", []]; _self set ["assignments", []];
_self set ["activity", []]; _self set ["activity", []];
_self set ["generatedTaskTypes", []];
_self set ["session", createHashMap]; _self set ["session", createHashMap];
_self set ["mode", "operations"]; _self set ["mode", "operations"];
_self set ["dispatchView", "board"]; _self set ["dispatchView", "board"];
@ -41,6 +42,7 @@ GVAR(CADRepository) = createHashMapObject [[
["requests", +(_self getOrDefault ["requests", []])], ["requests", +(_self getOrDefault ["requests", []])],
["assignments", +(_self getOrDefault ["assignments", []])], ["assignments", +(_self getOrDefault ["assignments", []])],
["activity", +(_self getOrDefault ["activity", []])], ["activity", +(_self getOrDefault ["activity", []])],
["generatedTaskTypes", +(_self getOrDefault ["generatedTaskTypes", []])],
["session", +(_self getOrDefault ["session", createHashMap])], ["session", +(_self getOrDefault ["session", createHashMap])],
["mode", _self getOrDefault ["mode", "operations"]], ["mode", _self getOrDefault ["mode", "operations"]],
["dispatchView", _self getOrDefault ["dispatchView", "board"]] ["dispatchView", _self getOrDefault ["dispatchView", "board"]]
@ -72,6 +74,7 @@ GVAR(CADRepository) = createHashMapObject [[
_self set ["requests", +(_payload getOrDefault ["requests", []])]; _self set ["requests", +(_payload getOrDefault ["requests", []])];
_self set ["assignments", +(_payload getOrDefault ["assignments", []])]; _self set ["assignments", +(_payload getOrDefault ["assignments", []])];
_self set ["activity", +(_payload getOrDefault ["activity", []])]; _self set ["activity", +(_payload getOrDefault ["activity", []])];
_self set ["generatedTaskTypes", +(_payload getOrDefault ["generatedTaskTypes", []])];
_self set ["session", +(_payload getOrDefault ["session", createHashMap])]; _self set ["session", +(_payload getOrDefault ["session", createHashMap])];
true true
}], }],

View File

@ -23,12 +23,15 @@
private _webUIDeclarations = call EFUNC(common,initWebUIBridge); private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration"; private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
GVAR(CADUIBridgeBaseClass) = compileFinal createHashMapFromArray [ GVAR(CADUIBridgeBaseClass) = compileFinal ([
["#base", _webUIBridgeDeclaration], _webUIBridgeDeclaration,
createHashMapFromArray [
["#type", "CADUIBridgeBaseClass"], ["#type", "CADUIBridgeBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
_self set ["screen", createHashMapObject [EGVAR(common,WebUIScreenDeclaration), []]];
_self set ["dispatcherReady", false]; _self set ["dispatcherReady", false];
_self set ["topBarReady", false]; _self set ["topBarReady", false];
true
}], }],
["getActiveBrowserControl", compileFinal { ["getActiveBrowserControl", compileFinal {
private _display = uiNamespace getVariable [QGVAR(Display), displayNull]; private _display = uiNamespace getVariable [QGVAR(Display), displayNull];
@ -482,7 +485,13 @@ GVAR(CADUIBridgeBaseClass) = compileFinal createHashMapFromArray [
["success", _result getOrDefault ["success", false]] ["success", _result getOrDefault ["success", false]]
]]] ]]]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(CADUIBridge) = createHashMapObject [GVAR(CADUIBridgeBaseClass)]; private _merged = +_base;
GVAR(CADUIBridge) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(CADUIBridge) = createHashMapObject [GVAR(CADUIBridgeBaseClass), []];
true

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,16 @@
const dispatcherFormatters = window.cadDispatcherFormatters || {}; const dispatcherFormatters = window.cadDispatcherFormatters || {};
const dispatcherModals = window.cadDispatcherModals || {}; const dispatcherModals = window.cadDispatcherModals || {};
const dispatcherRender = window.cadDispatcherRender || {}; const dispatcherRender = window.cadDispatcherRender || {};
const defaultTaskTypes = [
{ value: "attack", label: "Attack" },
{ value: "defend", label: "Defend" },
{ value: "delivery", label: "Delivery" },
{ value: "destroy", label: "Destroy" },
{ value: "defuse", label: "Defuse" },
{ value: "hostage", label: "Hostage" },
{ value: "hvtkill", label: "Kill HVT" },
{ value: "hvtcapture", label: "Capture HVT" },
];
window.cadDispatcher = { window.cadDispatcher = {
contracts: [], contracts: [],
@ -11,16 +21,7 @@ window.cadDispatcher = {
editingGroupId: "", editingGroupId: "",
viewingRequestId: "", viewingRequestId: "",
convertingRequestId: "", convertingRequestId: "",
taskTypes: [ taskTypes: defaultTaskTypes.slice(),
{ value: "attack", label: "Attack" },
{ value: "defend", label: "Defend" },
{ value: "delivery", label: "Delivery" },
{ value: "destroy", label: "Destroy" },
{ value: "defuse", label: "Defuse" },
{ value: "hostage", label: "Hostage" },
{ value: "hvtkill", label: "Kill HVT" },
{ value: "hvtcapture", label: "Capture HVT" },
],
statuses: [ statuses: [
"available", "available",
"en_route", "en_route",
@ -133,6 +134,14 @@ window.cadDispatcher = {
this.requests = Array.isArray(payload.requests) ? payload.requests : []; this.requests = Array.isArray(payload.requests) ? payload.requests : [];
this.groups = Array.isArray(payload.groups) ? payload.groups : []; this.groups = Array.isArray(payload.groups) ? payload.groups : [];
this.activity = Array.isArray(payload.activity) ? payload.activity : []; this.activity = Array.isArray(payload.activity) ? payload.activity : [];
if (Array.isArray(payload.generatedTaskTypes)) {
this.taskTypes = payload.generatedTaskTypes
.map((entry) => ({
value: String(entry?.value || "").trim(),
label: String(entry?.label || entry?.value || "").trim(),
}))
.filter((entry) => entry.value);
}
this.session = this.session =
payload.session && typeof payload.session === "object" payload.session && typeof payload.session === "object"
? payload.session ? payload.session
@ -223,6 +232,14 @@ window.cadDispatcher = {
this.closeOrderModal(); this.closeOrderModal();
}, },
requestGeneratedTask() { requestGeneratedTask() {
if (!this.taskTypes.length) {
this.setStatus(
"Generated task requests are disabled by server settings.",
"error",
);
return;
}
const taskType = document.getElementById( const taskType = document.getElementById(
"dispatcherTaskTypeSelect", "dispatcherTaskTypeSelect",
).value; ).value;

View File

@ -18,6 +18,21 @@ window.cadDispatcherModals = {
return; return;
} }
const saveButton = document.getElementById(
"dispatcherTaskModalSaveBtn",
);
const hasTaskTypes = this.taskTypes.length > 0;
taskTypeSelect.disabled = !hasTaskTypes;
if (saveButton) {
saveButton.disabled = !hasTaskTypes;
}
if (!hasTaskTypes) {
taskTypeSelect.innerHTML =
'<option value="">No generated tasks available</option>';
return;
}
taskTypeSelect.innerHTML = this.buildTaskTypeOptions( taskTypeSelect.innerHTML = this.buildTaskTypeOptions(
taskTypeSelect.value || this.taskTypes[0]?.value || "", taskTypeSelect.value || this.taskTypes[0]?.value || "",
); );

View File

@ -8,7 +8,8 @@ class CfgPatches {
name = COMPONENT_NAME; name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { requiredAddons[] = {
"forge_client_main" "forge_client_main",
"forge_mod_common"
}; };
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {};
@ -18,4 +19,3 @@ class CfgPatches {
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp" #include "CfgSounds.hpp"
#include "CfgVehicles.hpp"

View File

@ -37,6 +37,7 @@ GVAR(WebUIScreenDeclaration) = compileFinal createHashMapFromArray [
_self set ["control", _control]; _self set ["control", _control];
_self set ["readyState", false]; _self set ["readyState", false];
_self set ["pendingEvents", []]; _self set ["pendingEvents", []];
true
}], }],
["dispose", compileFinal { ["dispose", compileFinal {
_self set ["control", controlNull]; _self set ["control", controlNull];
@ -86,7 +87,8 @@ GVAR(WebUIScreenDeclaration) = compileFinal createHashMapFromArray [
GVAR(WebUIBridgeDeclaration) = compileFinal createHashMapFromArray [ GVAR(WebUIBridgeDeclaration) = compileFinal createHashMapFromArray [
["#type", "IWebUIBridge"], ["#type", "IWebUIBridge"],
["#create", compileFinal { ["#create", compileFinal {
_self set ["screen", createHashMapObject [GVAR(WebUIScreenDeclaration)]]; _self set ["screen", createHashMapObject [GVAR(WebUIScreenDeclaration), []]];
true
}], }],
["deliverPayload", compileFinal { ["deliverPayload", compileFinal {
params [["_control", controlNull, [controlNull]], ["_payload", createHashMap, [createHashMap]]]; params [["_control", controlNull, [controlNull]], ["_payload", createHashMap, [createHashMap]]];
@ -132,7 +134,7 @@ GVAR(WebUIBridgeDeclaration) = compileFinal createHashMapFromArray [
}; };
if (!_hasScreen) then { if (!_hasScreen) then {
_screen = createHashMapObject [GVAR(WebUIScreenDeclaration)]; _screen = createHashMapObject [GVAR(WebUIScreenDeclaration), []];
_self set ["screen", _screen]; _self set ["screen", _screen];
}; };

View File

@ -1,12 +1,12 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isNil QGVAR(GarageHelperService)) then { call FUNC(initHelperService); }; if (isNil QGVAR(GarageHelperService)) then { call FUNC(initHelperService); true };
if (isNil QGVAR(GarageRepository)) then { call FUNC(initRepository); }; if (isNil QGVAR(GarageRepository)) then { call FUNC(initRepository); true };
if (isNil QGVAR(GarageContextService)) then { call FUNC(initContextService); }; if (isNil QGVAR(GarageContextService)) then { call FUNC(initContextService); true };
if (isNil QGVAR(GaragePayloadService)) then { call FUNC(initPayloadService); }; if (isNil QGVAR(GaragePayloadService)) then { call FUNC(initPayloadService); true };
if (isNil QGVAR(GarageActionService)) then { call FUNC(initActionService); }; if (isNil QGVAR(GarageActionService)) then { call FUNC(initActionService); true };
if (isNil QGVAR(GarageUIBridge)) then { call FUNC(initUIBridge); }; if (isNil QGVAR(GarageUIBridge)) then { call FUNC(initUIBridge); true };
if (isNil QGVAR(VGRepository)) then { call FUNC(initVGRepository); }; if (isNil QGVAR(VGRepository)) then { call FUNC(initVGRepository); true };
[QGVAR(initGarage), { [QGVAR(initGarage), {
GVAR(GarageRepository) call ["init", []]; GVAR(GarageRepository) call ["init", []];

View File

@ -23,8 +23,9 @@
private _webUIDeclarations = call EFUNC(common,initWebUIBridge); private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration"; private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
GVAR(GarageUIBridgeBaseClass) = compileFinal createHashMapFromArray [ GVAR(GarageUIBridgeBaseClass) = compileFinal ([
["#base", _webUIBridgeDeclaration], _webUIBridgeDeclaration,
createHashMapFromArray [
["#type", "GarageUIBridgeBaseClass"], ["#type", "GarageUIBridgeBaseClass"],
["getActiveBrowserControl", compileFinal { ["getActiveBrowserControl", compileFinal {
private _display = uiNamespace getVariable ["RscGarage", displayNull]; private _display = uiNamespace getVariable ["RscGarage", displayNull];
@ -53,7 +54,13 @@ GVAR(GarageUIBridgeBaseClass) = compileFinal createHashMapFromArray [
_self call ["sendEvent", ["garage::sync", GVAR(GaragePayloadService) call ["buildPayload", []], _control]] _self call ["sendEvent", ["garage::sync", GVAR(GaragePayloadService) call ["buildPayload", []], _control]]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(GarageUIBridge) = createHashMapObject [GVAR(GarageUIBridgeBaseClass)]; private _merged = +_base;
GVAR(GarageUIBridge) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(GarageUIBridge) = createHashMapObject [GVAR(GarageUIBridgeBaseClass), []];
true

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isNil QGVAR(LockerRepository)) then { call FUNC(initRepository); }; if (isNil QGVAR(LockerRepository)) then { call FUNC(initRepository); true };
if (isNil QGVAR(VARepository)) then { call FUNC(initVARepository); }; if (isNil QGVAR(VARepository)) then { call FUNC(initVARepository); true };
[QGVAR(initLocker), { [QGVAR(initLocker), {
GVAR(LockerRepository) call ["init", []]; GVAR(LockerRepository) call ["init", []];

View File

@ -67,6 +67,7 @@
#define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3) #define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3)
#define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3) #define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3)
#define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2) #define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2)
#define SETMPVAR(var1,var2) missionNamespace SETPVAR_SYS(var1,var2)
#define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2) #define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2)
#define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2) #define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2)
#define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2) #define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2)

View File

@ -0,0 +1 @@
forge\forge_client\addons\mission_setup

View File

@ -0,0 +1,11 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_SCRIPT(XEH_postInitClient));
};
};

View File

@ -0,0 +1,3 @@
PREP(handleUIEvents);
PREP(initRepository);
PREP(openUI);

View File

@ -0,0 +1,19 @@
#include "script_component.hpp"
if (isNil QGVAR(MissionSetupRepository)) then { call FUNC(initRepository); };
[CRPC(mission_setup,openMissionSetup), {
diag_log "[FORGE:Client:MissionSetup] Received server open request.";
[] call FUNC(openUI);
}] call CFUNC(addEventHandler);
[{
GETVAR(player,FORGE_isLoaded,false)
}, {
diag_log format [
"[FORGE:Client:MissionSetup] Requesting mission setup open. Player=%1 VarName=%2",
player,
vehicleVarName player
];
[SRPC(task,requestOpenMissionSetup), [player]] call CFUNC(serverEvent);
}] call CFUNC(waitUntilAndExecute);

View File

@ -0,0 +1,5 @@
#include "script_component.hpp"
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

View File

@ -0,0 +1,21 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
author = AUTHOR;
authors[] = {"IDSolutions"};
url = ECSTRING(main,url);
name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
"forge_client_main",
"forge_client_common"
};
units[] = {};
weapons[] = {};
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "ui\RscMissionSetup.hpp"

View File

@ -0,0 +1,76 @@
#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Handles JSON events from the framework mission setup browser UI.
*
* Arguments:
* 0: Browser control <CONTROL>
* 1: Whether the event came from a confirm dialog <BOOL>
* 2: JSON event payload <STRING>
*
* Return Value:
* Event handled <BOOL>
*
* Public: No
*/
params [
["_control", controlNull, [controlNull]],
["_isConfirmDialog", false, [false]],
["_message", "", [""]]
];
if (_message isEqualTo "") exitWith { false };
private _alert = fromJSON _message;
if !(_alert isEqualType createHashMap) exitWith { false };
private _event = _alert getOrDefault ["event", ""];
private _data = _alert getOrDefault ["data", createHashMap];
diag_log format ["[FORGE:Client:MissionSetup] Handling UI event: %1", _event];
private _send = {
params ["_eventName", "_payload"];
if (isNull _control) exitWith { false };
private _json = toJSON createHashMapFromArray [
["event", _eventName],
["data", _payload]
];
_control ctrlWebBrowserAction ["ExecJS", format ["MissionSetupBridge.receive(%1)", _json]];
true
};
switch (_event) do {
case "missionSetup::ready": {
if (isNil QGVAR(MissionSetupRepository)) then { call FUNC(initRepository); };
["missionSetup::hydrate", GVAR(MissionSetupRepository) call ["buildSetupPayload", []]] call _send;
};
case "missionSetup::apply": {
if !(_data isEqualType createHashMap) exitWith {
["missionSetup::error", createHashMapFromArray [["message", "Invalid mission setup payload."]]] call _send;
};
uiNamespace setVariable [QGVAR(MissionSetupHandled), true];
[SRPC(task,requestApplyMissionSetupSettings), [_data, player]] call CFUNC(serverEvent);
closeDialog 1;
};
case "missionSetup::cancel": {
uiNamespace setVariable [QGVAR(MissionSetupHandled), true];
[SRPC(task,requestApplyMissionSetupSettings), [createHashMap, player]] call CFUNC(serverEvent);
closeDialog 1;
};
case "missionSetup::close": {
uiNamespace setVariable [QGVAR(MissionSetupHandled), true];
[SRPC(task,requestApplyMissionSetupSettings), [createHashMap, player]] call CFUNC(serverEvent);
closeDialog 1;
};
default {
["missionSetup::error", createHashMapFromArray [["message", format ["Unhandled setup event: %1", _event]]]] call _send;
};
};
true

View File

@ -0,0 +1,226 @@
#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Initializes the client mission setup repository.
*
* Arguments:
* None
*
* Return Value:
* Mission setup repository object <HASHMAP OBJECT>
*
* Public: No
*/
#pragma hemtt ignore_variables ["_self"]
GVAR(MissionSetupRepositoryBaseClass) = compileFinal createHashMapFromArray [
["#type", "MissionSetupRepositoryBaseClass"],
["getEnemyFactionOptions", compileFinal {
private _config = missionConfigFile >> "CfgEnemyFactions";
if !(isClass _config) then { _config = configFile >> "CfgEnemyFactions"; };
private _allowedSides = getArray (_config >> "sides");
if (_allowedSides isEqualTo []) then { _allowedSides = [0, 2]; };
private _denylist = getArray (_config >> "denylist");
private _overridesConfig = _config >> "Overrides";
private _spawnableFactions = createHashMap;
{
if (getNumber (_x >> "scope") < 2) then { continue; };
if !(configName _x isKindOf "CAManBase") then { continue; };
private _faction = getText (_x >> "faction");
if (_faction isEqualTo "") then { continue; };
private _side = getNumber (_x >> "side");
if !(_side in _allowedSides) then { continue; };
_spawnableFactions set [_faction, true];
} forEach ("true" configClasses (configFile >> "CfgVehicles"));
private _mappedFactions = createHashMap;
private _factionMapRoot = missionConfigFile >> "CfgFactionUnitMap";
if !(isClass _factionMapRoot) then { _factionMapRoot = configFile >> "CfgFactionUnitMap"; };
{
private _unitsConfig = _x >> "Units";
if !(isClass _unitsConfig) then { continue; };
private _hasUnits = false;
{
private _vehicle = getText (_x >> "vehicle");
if (_vehicle isNotEqualTo "" && { isClass (configFile >> "CfgVehicles" >> _vehicle) }) exitWith { _hasUnits = true; };
} forEach ("true" configClasses _unitsConfig);
if (_hasUnits) then { _mappedFactions set [configName _x, true]; };
} forEach ("true" configClasses _factionMapRoot);
private _getFactionSideNumber = {
params ["_factionConfig"];
if (isNumber (_factionConfig >> "side")) exitWith { getNumber (_factionConfig >> "side") };
switch (toUpperANSI getText (_factionConfig >> "side")) do {
case "0";
case "EAST";
case "OPFOR": { 0 };
case "2";
case "GUER";
case "GUERRILA";
case "GUERRILLA";
case "INDEPENDENT";
case "RESISTANCE": { 2 };
default { -1 };
};
};
private _records = [];
private _dynamicIndex = 0;
{
private _faction = configName _x;
if (_faction isEqualTo "") then { continue; };
if (_faction in _denylist) then { continue; };
private _side = [_x] call _getFactionSideNumber;
if !(_side in _allowedSides) then { continue; };
if (!(_spawnableFactions getOrDefault [_faction, false]) && {
!(_mappedFactions getOrDefault [_faction, false])
}) then {
continue;
};
private _override = _overridesConfig >> _faction;
private _display = getText (_x >> "displayName");
private _order = 1000 + _dynamicIndex;
private _value = 1000 + _dynamicIndex;
if (isClass _override) then {
private _overrideDisplay = getText (_override >> "display");
if (_overrideDisplay isNotEqualTo "") then { _display = _overrideDisplay; };
if (isNumber (_override >> "order")) then { _order = getNumber (_override >> "order"); };
if (isNumber (_override >> "value")) then { _value = getNumber (_override >> "value"); };
};
if (_display isEqualTo "") then { _display = _faction; };
_records pushBack [_order, _display, _faction, _value];
_dynamicIndex = _dynamicIndex + 1;
} forEach ("true" configClasses (configFile >> "CfgFactionClasses"));
_records sort true;
private _options = [];
{
_x params ["_order", "_display", "_faction", "_value"];
_options pushBack [_faction, _display, _value];
} forEach _records;
if (_options isEqualTo []) then {
_options = [
["OPF_F", "CSAT", 0],
["IND_G_F", "FIA", 6]
];
};
_options
}],
["resolveEnemyFactionParam", compileFinal {
params [
["_value", 6, [0, ""]],
["_fallback", "IND_G_F", [""]]
];
if (_value isEqualType "") then {
if (_value isEqualTo "") exitWith { _fallback };
if (isClass (configFile >> "CfgFactionClasses" >> _value)) exitWith { _value };
_value = parseNumber _value;
};
private _faction = _fallback;
{
_x params ["_optionFaction", "_display", "_optionValue"];
if (_optionValue isEqualTo _value) exitWith { _faction = _optionFaction; };
} forEach (_self call ["getEnemyFactionOptions", []]);
_faction
}],
["buildSetupPayload", compileFinal {
private _missionConfig = missionConfigFile >> "CfgMissions";
if !(isClass _missionConfig) then { _missionConfig = configFile >> "CfgMissions"; };
private _paramOrDefault = {
params ["_varName", "_default"];
private _paramValue = [_varName, _default] call BIS_fnc_getParamValue;
private _value = missionNamespace getVariable [_varName, _paramValue];
if (_value isEqualType "") exitWith { parseNumber _value };
_value
};
private _serviceDefault = {
params ["_varName", "_default"];
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
if (isNumber (_serviceConfig >> _varName)) exitWith {
getNumber (_serviceConfig >> _varName)
};
_default
};
private _factions = [];
{
_x params ["_faction", "_display", "_value"];
_factions pushBack createHashMapFromArray [
["faction", _faction],
["display", _display],
["value", _value]
];
} forEach (_self call ["getEnemyFactionOptions", []]);
private _defaultFactionParam = GETMVAR(enemyFaction,6);
if (_defaultFactionParam isEqualTo 6) then {
private _paramValue = ["enemyFaction", -1] call BIS_fnc_getParamValue;
if (_paramValue isNotEqualTo -1) then { _defaultFactionParam = _paramValue; };
};
private _defaultFaction = _self call ["resolveEnemyFactionParam", [_defaultFactionParam, "IND_G_F"]];
private _hasDefaultFaction = false;
{
if ((_x getOrDefault ["faction", ""]) isEqualTo _defaultFaction) exitWith { _hasDefaultFaction = true; };
} forEach _factions;
if (!_hasDefaultFaction && { _factions isNotEqualTo [] }) then {
_defaultFaction = (_factions select 0) getOrDefault ["faction", _defaultFaction];
};
createHashMapFromArray [
["factions", _factions],
["settings", createHashMapFromArray [
["enemyFaction", _defaultFaction],
["maxConcurrentMissions", ["maxConcurrentMissions", getNumber (_missionConfig >> "maxConcurrentMissions")] call _paramOrDefault],
["missionInterval", ["missionInterval", getNumber (_missionConfig >> "missionInterval")] call _paramOrDefault],
["locationReuseCooldown", ["locationReuseCooldown", getNumber (_missionConfig >> "locationReuseCooldown")] call _paramOrDefault],
["moneyMin", ["moneyMin", 500] call _paramOrDefault],
["moneyMax", ["moneyMax", 1000] call _paramOrDefault],
["reputationMin", ["reputationMin", 25] call _paramOrDefault],
["reputationMax", ["reputationMax", 100] call _paramOrDefault],
["penaltyMin", ["penaltyMin", -5] call _paramOrDefault],
["penaltyMax", ["penaltyMax", -25] call _paramOrDefault],
["timeLimitMin", ["timeLimitMin", 600] call _paramOrDefault],
["timeLimitMax", ["timeLimitMax", 900] call _paramOrDefault],
["medicalSpawnCost", ["medicalSpawnCost", ["medicalSpawnCost", 100] call _serviceDefault] call _paramOrDefault],
["medicalHealCost", ["medicalHealCost", ["medicalHealCost", 100] call _serviceDefault] call _paramOrDefault],
["serviceRepairCost", ["serviceRepairCost", ["serviceRepairCost", 500] call _serviceDefault] call _paramOrDefault],
["serviceRearmCost", ["serviceRearmCost", ["serviceRearmCost", 500] call _serviceDefault] call _paramOrDefault],
["fuelCost", ["fuelCost", ["fuelCost", 5] call _serviceDefault] call _paramOrDefault],
["transportBaseFare", ["transportBaseFare", ["transportBaseFare", 100] call _serviceDefault] call _paramOrDefault],
["transportPricePerKm", ["transportPricePerKm", ["transportPricePerKm", 50] call _serviceDefault] call _paramOrDefault],
["generatorProvider", GETMVAR(forge_server_task_generatorProvider,"builtin")]
]]
]
}]
];
GVAR(MissionSetupRepository) = createHashMapObject [GVAR(MissionSetupRepositoryBaseClass)];
GVAR(MissionSetupRepository)

View File

@ -0,0 +1,58 @@
#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Opens the framework mission setup UI.
*
* Arguments:
* None
*
* Return Value:
* UI opened <BOOL>
*
* Public: Yes
*/
if !(hasInterface) exitWith {
diag_log "[FORGE:Client:MissionSetup] openUI skipped: no interface.";
false
};
if !(isNull (uiNamespace getVariable ["RscMissionSetup", displayNull])) exitWith {
diag_log "[FORGE:Client:MissionSetup] openUI skipped: dialog already open.";
true
};
diag_log "[FORGE:Client:MissionSetup] Creating mission setup dialog.";
private _display = createDialog ["RscMissionSetup", true];
if (isNull _display) exitWith {
diag_log "[FORGE:Client:MissionSetup] createDialog returned null display.";
false
};
uiNamespace setVariable [QGVAR(MissionSetupHandled), false];
_display displayAddEventHandler ["Unload", {
if !(uiNamespace getVariable [QGVAR(MissionSetupHandled), false]) then {
diag_log "[FORGE:Client:MissionSetup] Dialog unloaded before apply/cancel; applying default mission setup settings.";
[SRPC(task,requestApplyMissionSetupSettings), [createHashMap, player]] call CFUNC(serverEvent);
};
uiNamespace setVariable [QGVAR(MissionSetupHandled), nil];
}];
private _control = _display displayCtrl 94011;
if (isNull _control) exitWith {
diag_log "[FORGE:Client:MissionSetup] Browser control 94011 not found. Closing dialog.";
closeDialog 1;
false
};
_control ctrlAddEventHandler ["JSDialog", {
params ["_control", "_isConfirmDialog", "_message"];
[_control, _isConfirmDialog, _message] call FUNC(handleUIEvents);
}];
_control ctrlWebBrowserAction ["LoadFile", QPATHTOF2(ui\_site\index.html)];
diag_log "[FORGE:Client:MissionSetup] Mission setup UI load requested.";
true

View File

@ -0,0 +1,9 @@
#define COMPONENT mission_setup
#define COMPONENT_BEAUTIFIED Mission_Setup
#include "\forge\forge_client\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#include "\forge\forge_client\addons\main\script_macros.hpp"

View File

@ -0,0 +1,23 @@
class RscText;
class RscMissionSetup {
idd = 94010;
fadeIn = 0;
fadeOut = 0;
duration = 1e011;
onLoad = "uiNamespace setVariable ['RscMissionSetup', _this select 0]";
onUnLoad = "uiNamespace setVariable ['RscMissionSetup', nil]";
class controlsBackground {};
class controls {
class Browser: RscText {
type = 106;
idc = 94011;
x = "safeZoneXAbs + (safeZoneWAbs * 0.125)";
y = "safeZoneY + (safeZoneH * 0.125)";
w = "safeZoneWAbs * 0.75";
h = "safeZoneH * 0.75";
colorBackground[] = {0, 0, 0, 0};
};
};
};

View File

@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>FORGE Mission Setup</title><script>window.ForgeSiteConfig={addonName:"mission_setup",logLabel:"Mission Setup UI",styles:["mission-setup.css"],commonScripts:[],scripts:["mission-setup.js"]},function(){const e="../../../common/ui/_site/forge-site-loader.js";("undefined"!=typeof A3API&&A3API&&"function"==typeof A3API.RequestFile?A3API.RequestFile("forge\\forge_client\\addons\\common\\ui\\_site\\forge-site-loader.js"):fetch(e).then(o=>{if(!o.ok)throw new Error("Failed to load "+e);return o.text()})).then(function(e){const o=document.createElement("script");o.text=e,document.head.appendChild(o)}).catch(e=>{console.error("[Mission Setup UI] Failed to load Forge site loader.",e)})}()</script></head><body><div id="app"></div></body></html>

View File

@ -0,0 +1,349 @@
:root {
--bg-app: rgba(9, 12, 18, 0.88);
--surface: rgba(20, 24, 33, 0.9);
--border: rgba(255, 255, 255, 0.1);
--border-strong: rgba(255, 255, 255, 0.2);
--text-main: rgba(245, 248, 255, 0.92);
--text-muted: rgba(245, 248, 255, 0.62);
--text-subtle: rgba(245, 248, 255, 0.42);
--accent: rgba(104, 196, 255, 0.95);
--accent-soft: rgba(104, 196, 255, 0.13);
--accent-wash: rgba(41, 69, 93, 0.18);
--danger: rgba(255, 138, 128, 0.95);
--danger-bg: rgba(92, 18, 18, 0.78);
--shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
* {
box-sizing: border-box;
}
html,
body,
#app {
width: 100%;
height: 100%;
margin: 0;
}
body {
overflow: hidden;
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
color: var(--text-main);
background:
radial-gradient(circle at top left, var(--accent-wash), transparent 30%),
linear-gradient(180deg, rgba(9, 14, 20, 0.96), rgba(15, 22, 31, 0.98)),
var(--bg-app);
backdrop-filter: blur(16px);
}
button,
input,
select {
font: inherit;
}
button {
cursor: pointer;
}
.shell {
height: 100%;
display: grid;
grid-template-rows: auto 1fr auto;
}
.titlebar {
min-height: 2.5rem;
padding: 0 1.1rem;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid var(--border);
background: linear-gradient(90deg, rgba(16, 22, 31, 0.96), rgba(19, 26, 36, 0.94) 55%, rgba(15, 20, 28, 0.96));
}
.brand {
display: flex;
align-items: baseline;
gap: 0.8rem;
}
.kicker {
color: var(--accent);
font-size: 0.76rem;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.title {
font-size: 1rem;
font-weight: 700;
}
option {
background: rgb(20, 24, 33);
color: rgb(245, 248, 255);
}
.close {
width: 2rem;
height: 2rem;
border: 1px solid var(--border);
background: rgba(255, 96, 96, 0.1);
color: rgba(255, 220, 220, 0.95);
font-size: 1.15rem;
}
.content {
min-height: 0;
padding: 0.75rem 1rem;
overflow: hidden;
display: flex;
align-items: center;
}
.grid {
width: min(94rem, 100%);
max-width: 94rem;
margin: 0 auto;
display: grid;
grid-template-columns: minmax(28rem, 1.35fr) minmax(18rem, 0.8fr) minmax(20rem, 0.85fr);
gap: 0.75rem;
}
.panel {
min-width: 0;
border: 1px solid var(--border);
background: linear-gradient(180deg, rgba(23, 31, 40, 0.86), var(--surface) 9rem);
box-shadow: var(--shadow);
}
.panel-head {
padding: 0.65rem 0.85rem;
border-bottom: 1px solid var(--border);
}
.panel-head h1,
.panel-head h2 {
margin: 0.2rem 0 0;
font-size: 1.02rem;
letter-spacing: 0;
}
.form {
padding: 0.7rem 0.85rem 0.85rem;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.5rem;
}
.form.compact {
gap: 0.55rem;
}
.field {
display: grid;
gap: 0.28rem;
}
.wide {
grid-column: 1 / -1;
}
.timer-row {
display: grid;
grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr) minmax(0, 0.95fr);
gap: 0.5rem;
}
label {
color: var(--text-subtle);
font-size: 0.62rem;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.toggle {
min-height: 2.65rem;
padding: 0 0.85rem;
display: flex;
align-items: center;
gap: 0.65rem;
border: 1px solid var(--border);
background: rgba(24, 31, 40, 0.9);
color: var(--text-main);
}
.toggle input {
width: 1rem;
min-height: 1rem;
}
.provider-toggle {
min-height: 2rem;
padding: 0 0.65rem;
display: grid;
grid-template-columns: auto 1fr;
align-items: center;
gap: 0.75rem;
border: 1px solid var(--border);
background: rgba(24, 31, 40, 0.9);
color: var(--text-main);
}
.provider-toggle input {
position: absolute;
opacity: 0;
pointer-events: none;
}
.switch {
width: 2.6rem;
height: 1.35rem;
position: relative;
border: 1px solid var(--border-strong);
background: rgba(255, 255, 255, 0.07);
}
.switch::after {
content: "";
width: 0.9rem;
height: 0.9rem;
position: absolute;
top: 0.16rem;
left: 0.18rem;
background: rgba(245, 248, 255, 0.86);
transition: transform 120ms ease, background 120ms ease;
}
.provider-toggle input:checked + .switch {
background: rgba(24, 86, 126, 0.95);
border-color: rgba(104, 196, 255, 0.34);
}
.provider-toggle input:checked + .switch::after {
transform: translateX(1.2rem);
background: #ffffff;
}
.provider-toggle:focus-within {
outline: 2px solid rgba(104, 196, 255, 0.34);
outline-offset: 2px;
}
.provider-copy {
min-width: 0;
display: grid;
gap: 0.1rem;
}
.provider-copy strong,
.provider-copy small {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.provider-copy strong {
font-size: 0.86rem;
}
.provider-copy small {
color: var(--text-muted);
font-size: 0.72rem;
font-weight: 700;
}
input,
select {
width: 100%;
min-height: 2rem;
padding: 0 0.65rem;
border: 1px solid var(--border);
background: rgba(24, 31, 40, 0.9);
color: var(--text-main);
}
input:disabled {
opacity: 0.45;
}
input:focus,
select:focus,
button:focus-visible {
outline: 2px solid rgba(104, 196, 255, 0.34);
outline-offset: 2px;
}
.summary {
padding: 0.7rem 0.85rem 0.85rem;
display: grid;
gap: 0.42rem;
}
.summary-row {
display: flex;
justify-content: space-between;
gap: 1rem;
padding-bottom: 0.42rem;
border-bottom: 1px solid var(--border);
}
.summary-row span {
color: var(--text-muted);
}
.summary-row strong {
text-align: right;
}
.notice {
margin-top: 1rem;
padding: 0.85rem 1rem;
color: var(--danger);
background: var(--danger-bg);
border: 1px solid rgba(255, 107, 107, 0.38);
}
.actions {
padding: 0.6rem 1rem;
display: flex;
justify-content: flex-end;
gap: 0.75rem;
border-top: 1px solid var(--border);
background: linear-gradient(90deg, rgba(11, 17, 24, 0.82), rgba(23, 31, 40, 0.86));
}
.btn {
min-height: 2rem;
padding: 0.55rem 0.9rem;
border: 1px solid var(--border-strong);
background: rgba(24, 31, 40, 0.9);
color: var(--text-main);
font-size: 0.82rem;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.btn.primary {
background: rgba(24, 86, 126, 0.95);
color: #ffffff;
border-color: rgba(104, 196, 255, 0.34);
}
.btn.primary:hover {
background: rgba(32, 108, 156, 0.98);
}
.btn.secondary {
background: rgba(255, 255, 255, 0.03);
}
.btn.secondary:hover {
background: var(--accent-soft);
border-color: rgba(104, 196, 255, 0.28);
}

View File

@ -0,0 +1,379 @@
(function () {
const state = {
factions: [],
settings: {
enemyFaction: "IND_G_F",
maxConcurrentMissions: 3,
missionInterval: 300,
locationReuseCooldown: 900,
moneyMin: 500,
moneyMax: 1000,
reputationMin: 25,
reputationMax: 100,
penaltyMin: -5,
penaltyMax: -25,
timeLimitEnabled: true,
timeLimitMin: 600,
timeLimitMax: 900,
medicalSpawnCost: 100,
medicalHealCost: 100,
serviceRepairCost: 500,
serviceRearmCost: 500,
fuelCost: 5,
transportBaseFare: 100,
transportPricePerKm: 50,
generatorProvider: "builtin",
},
error: "",
};
function send(event, data = {}) {
if (!window.A3API || typeof window.A3API.SendAlert !== "function") {
return false;
}
window.A3API.SendAlert(JSON.stringify({ event, data }));
return true;
}
function fieldNumber(id) {
const value = Number(document.getElementById(id)?.value || 0);
return Number.isFinite(value) ? value : 0;
}
function readSettings() {
const timeLimitEnabled = document.getElementById("timeLimitEnabled")?.checked !== false;
return {
enemyFaction: String(document.getElementById("enemyFaction")?.value || "IND_G_F"),
maxConcurrentMissions: fieldNumber("maxConcurrentMissions"),
missionInterval: fieldNumber("missionInterval"),
locationReuseCooldown: fieldNumber("locationReuseCooldown"),
moneyMin: fieldNumber("moneyMin"),
moneyMax: fieldNumber("moneyMax"),
reputationMin: fieldNumber("reputationMin"),
reputationMax: fieldNumber("reputationMax"),
penaltyMin: fieldNumber("penaltyMin"),
penaltyMax: fieldNumber("penaltyMax"),
timeLimitEnabled,
timeLimitMin: timeLimitEnabled ? fieldNumber("timeLimitMin") : 0,
timeLimitMax: timeLimitEnabled ? fieldNumber("timeLimitMax") : 0,
medicalSpawnCost: fieldNumber("medicalSpawnCost"),
medicalHealCost: fieldNumber("medicalHealCost"),
serviceRepairCost: fieldNumber("serviceRepairCost"),
serviceRearmCost: fieldNumber("serviceRearmCost"),
fuelCost: fieldNumber("fuelCost"),
transportBaseFare: fieldNumber("transportBaseFare"),
transportPricePerKm: fieldNumber("transportPricePerKm"),
generatorProvider: document.getElementById("generatorProviderCustom")?.checked ? "custom" : "builtin",
};
}
function escapeHtml(value) {
return String(value ?? "")
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
function normalizeSettings(settings) {
const next = Object.assign({}, settings);
next.timeLimitMin = Number(next.timeLimitMin || 0);
next.timeLimitMax = Number(next.timeLimitMax || 0);
if (typeof next.timeLimitEnabled !== "boolean") {
next.timeLimitEnabled = next.timeLimitMax > 0;
}
return next;
}
function apply() {
const settings = readSettings();
if (settings.moneyMax < settings.moneyMin) {
state.error = "Money max must be greater than or equal to money min.";
render();
return;
}
if (settings.reputationMax < settings.reputationMin) {
state.error = "Reputation max must be greater than or equal to reputation min.";
render();
return;
}
if (settings.penaltyMin > 0 || settings.penaltyMax > 0) {
state.error = "Reputation hits must be zero or negative values.";
render();
return;
}
if (settings.timeLimitEnabled) {
if (settings.timeLimitMin < 1 || settings.timeLimitMax < 1) {
state.error = "Time limits must be positive seconds when task timers are enabled.";
render();
return;
}
if (settings.timeLimitMax < settings.timeLimitMin) {
state.error = "Time limit max must be greater than or equal to time limit min.";
render();
return;
}
}
const costFields = [
settings.medicalSpawnCost,
settings.medicalHealCost,
settings.serviceRepairCost,
settings.serviceRearmCost,
settings.fuelCost,
settings.transportBaseFare,
settings.transportPricePerKm,
];
if (costFields.some((value) => value < 0)) {
state.error = "Service pricing cannot use negative values.";
render();
return;
}
state.error = "";
send("missionSetup::apply", settings);
}
function close() {
send("missionSetup::cancel", {});
}
function option(faction) {
const selected = faction.faction === state.settings.enemyFaction ? " selected" : "";
return `<option value="${escapeHtml(faction.faction)}"${selected}>${escapeHtml(faction.display)}</option>`;
}
function render() {
const settings = state.settings;
const faction = state.factions.find((item) => item.faction === settings.enemyFaction);
const factionLabel = faction ? faction.display : settings.enemyFaction;
const generatorProviderLabel = settings.generatorProvider === "custom" ? "Custom" : "Built-in";
const generatorProviderChecked = settings.generatorProvider === "custom" ? " checked" : "";
const timeLimitEnabled = settings.timeLimitEnabled !== false;
const timeLimitChecked = timeLimitEnabled ? " checked" : "";
const timeLimitDisabled = timeLimitEnabled ? "" : " disabled";
const timeLimitLabel = timeLimitEnabled ? "Enabled" : "No Limit";
const timeLimitMinValue = timeLimitEnabled ? settings.timeLimitMin : 600;
const timeLimitMaxValue = timeLimitEnabled ? settings.timeLimitMax : 900;
const timeLimitSummary = timeLimitEnabled
? `${settings.timeLimitMin}s - ${settings.timeLimitMax}s`
: "No limit";
document.getElementById("app").innerHTML = `
<div class="shell">
<header class="titlebar">
<div class="brand">
<span class="kicker">FORGE</span>
<span class="title">Mission Setup</span>
</div>
<button class="close" type="button" aria-label="Close" data-action="close">x</button>
</header>
<main class="content">
<div class="grid">
<section class="panel">
<div class="panel-head">
<span class="kicker">Deployment Profile</span>
<h1>Operation Settings</h1>
</div>
<div class="form">
<div class="field wide">
<label for="enemyFaction">Opposing Faction</label>
<select id="enemyFaction">${state.factions.map(option).join("")}</select>
</div>
<div class="field">
<label for="locationReuseCooldown">Location Cooldown</label>
<input id="locationReuseCooldown" type="number" min="0" step="60" value="${settings.locationReuseCooldown}" />
</div>
<div class="field">
<label for="generatorProviderCustom">Mission Generator</label>
<label class="provider-toggle" for="generatorProviderCustom">
<input id="generatorProviderCustom" type="checkbox"${generatorProviderChecked} />
<span class="switch" aria-hidden="true"></span>
<span class="provider-copy">
<strong>${generatorProviderLabel}</strong>
<small>Mission Generators</small>
</span>
</label>
</div>
<div class="field">
<label for="maxConcurrentMissions">Concurrent Missions</label>
<input id="maxConcurrentMissions" type="number" min="1" max="50" value="${settings.maxConcurrentMissions}" />
</div>
<div class="field">
<label for="missionInterval">Mission Interval</label>
<input id="missionInterval" type="number" min="1" step="30" value="${settings.missionInterval}" />
</div>
<div class="field">
<label for="moneyMin">Min Funds</label>
<input id="moneyMin" type="number" min="0" step="100" value="${settings.moneyMin}" />
</div>
<div class="field">
<label for="moneyMax">Max Funds</label>
<input id="moneyMax" type="number" min="0" step="100" value="${settings.moneyMax}" />
</div>
<div class="field">
<label for="reputationMin">Min Rating</label>
<input id="reputationMin" type="number" step="1" value="${settings.reputationMin}" />
</div>
<div class="field">
<label for="reputationMax">Max Rating</label>
<input id="reputationMax" type="number" step="1" value="${settings.reputationMax}" />
</div>
<div class="field">
<label for="penaltyMin">Min Rep Hit</label>
<input id="penaltyMin" type="number" max="0" step="1" value="${settings.penaltyMin}" />
</div>
<div class="field">
<label for="penaltyMax">Max Rep Hit</label>
<input id="penaltyMax" type="number" max="0" step="1" value="${settings.penaltyMax}" />
</div>
<div class="timer-row wide">
<div class="field">
<label for="timeLimitEnabled">Task Timer</label>
<label class="provider-toggle" for="timeLimitEnabled">
<input id="timeLimitEnabled" type="checkbox"${timeLimitChecked} />
<span class="switch" aria-hidden="true"></span>
<span class="provider-copy">
<strong>${timeLimitLabel}</strong>
<small>Time Limits</small>
</span>
</label>
</div>
<div class="field">
<label for="timeLimitMin">Min Time</label>
<input id="timeLimitMin" type="number" min="1" step="60" value="${timeLimitMinValue}"${timeLimitDisabled} />
</div>
<div class="field">
<label for="timeLimitMax">Max Time</label>
<input id="timeLimitMax" type="number" min="1" step="60" value="${timeLimitMaxValue}"${timeLimitDisabled} />
</div>
</div>
</div>
</section>
<aside class="panel">
<div class="panel-head">
<span class="kicker">Service Pricing</span>
<h2>Economy Settings</h2>
</div>
<div class="form compact">
<div class="field">
<label for="medicalSpawnCost">Medical Respawn</label>
<input id="medicalSpawnCost" type="number" min="0" step="50" value="${settings.medicalSpawnCost}" />
</div>
<div class="field">
<label for="medicalHealCost">Medical Heal</label>
<input id="medicalHealCost" type="number" min="0" step="50" value="${settings.medicalHealCost}" />
</div>
<div class="field">
<label for="serviceRepairCost">Repair</label>
<input id="serviceRepairCost" type="number" min="0" step="50" value="${settings.serviceRepairCost}" />
</div>
<div class="field">
<label for="serviceRearmCost">Rearm</label>
<input id="serviceRearmCost" type="number" min="0" step="50" value="${settings.serviceRearmCost}" />
</div>
<div class="field">
<label for="fuelCost">Fuel / Liter</label>
<input id="fuelCost" type="number" min="0" step="1" value="${settings.fuelCost}" />
</div>
<div class="field">
<label for="transportBaseFare">Transport Base</label>
<input id="transportBaseFare" type="number" min="0" step="25" value="${settings.transportBaseFare}" />
</div>
<div class="field wide">
<label for="transportPricePerKm">Transport / KM</label>
<input id="transportPricePerKm" type="number" min="0" step="25" value="${settings.transportPricePerKm}" />
</div>
</div>
</aside>
<aside class="panel">
<div class="panel-head">
<span class="kicker">Current Selection</span>
<h2>Generator Runtime</h2>
</div>
<div class="summary">
<div class="summary-row"><span>Faction</span><strong>${escapeHtml(factionLabel)}</strong></div>
<div class="summary-row"><span>Generator</span><strong>${generatorProviderLabel}</strong></div>
<div class="summary-row"><span>Mission Cap</span><strong>${settings.maxConcurrentMissions}</strong></div>
<div class="summary-row"><span>Interval</span><strong>${settings.missionInterval}s</strong></div>
<div class="summary-row"><span>Location Cooldown</span><strong>${settings.locationReuseCooldown}s</strong></div>
<div class="summary-row"><span>Reward Range</span><strong>$${Number(settings.moneyMin).toLocaleString()} - $${Number(settings.moneyMax).toLocaleString()}</strong></div>
<div class="summary-row"><span>Reputation</span><strong>${settings.reputationMin} - ${settings.reputationMax}</strong></div>
<div class="summary-row"><span>Reputation Hit</span><strong>${settings.penaltyMin} to ${settings.penaltyMax}</strong></div>
<div class="summary-row"><span>Time Limit</span><strong>${timeLimitSummary}</strong></div>
<div class="summary-row"><span>Repair / Rearm</span><strong>$${Number(settings.serviceRepairCost).toLocaleString()} / $${Number(settings.serviceRearmCost).toLocaleString()}</strong></div>
<div class="summary-row"><span>Fuel</span><strong>$${Number(settings.fuelCost).toLocaleString()} / L</strong></div>
<div class="summary-row"><span>Medical Billing</span><strong>$${Number(settings.medicalSpawnCost).toLocaleString()} respawn / $${Number(settings.medicalHealCost).toLocaleString()} heal</strong></div>
${state.error ? `<div class="notice">${state.error}</div>` : ""}
</div>
</aside>
</div>
</main>
<footer class="actions">
<button class="btn secondary" type="button" data-action="close">Cancel</button>
<button class="btn primary" type="button" data-action="apply">Apply Settings</button>
</footer>
</div>
`;
document.querySelectorAll("input, select").forEach((input) => {
input.addEventListener("change", () => {
state.settings = readSettings();
render();
});
});
document.querySelectorAll("[data-action='close']").forEach((button) => {
button.addEventListener("click", close);
});
document.querySelector("[data-action='apply']").addEventListener("click", apply);
}
window.MissionSetupBridge = {
receive(payload) {
if (!payload || typeof payload !== "object") {
return false;
}
if (payload.event === "missionSetup::hydrate") {
let factions = Array.isArray(payload.data?.factions) ? payload.data.factions : [];
const seen = new Set();
factions = factions.filter((faction) => {
const key = ((faction.display || faction.faction) + "").toLowerCase().trim();
if (seen.has(key)) {
return false;
}
seen.add(key);
return true;
});
state.factions = factions;
state.settings = normalizeSettings(Object.assign({}, state.settings, payload.data?.settings || {}));
render();
return true;
}
if (payload.event === "missionSetup::error") {
state.error = String(payload.data?.message || "Mission setup failed.");
render();
return true;
}
return false;
},
};
render();
send("missionSetup::ready", { loaded: true });
})();

View File

@ -5,7 +5,7 @@
}, { }, {
("NotificationHudLayer" call BFUNC(rscLayer)) cutRsc ["RscNotifications", "PLAIN"]; ("NotificationHudLayer" call BFUNC(rscLayer)) cutRsc ["RscNotifications", "PLAIN"];
call FUNC(openUI); call FUNC(openUI);
if (isNil QGVAR(NotificationService)) then { call FUNC(initService); }; if (isNil QGVAR(NotificationService)) then { call FUNC(initService); true };
}] call CFUNC(waitUntilAndExecute); }] call CFUNC(waitUntilAndExecute);
[QGVAR(recieveNotification), { [QGVAR(recieveNotification), {

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isNil QGVAR(OrgRepository)) then { call FUNC(initRepository); }; if (isNil QGVAR(OrgRepository)) then { call FUNC(initRepository); true };
if (isNil QGVAR(OrgUIBridge)) then { call FUNC(initUIBridge); }; if (isNil QGVAR(OrgUIBridge)) then { call FUNC(initUIBridge); true };
[QGVAR(initOrg), { [QGVAR(initOrg), {
GVAR(OrgRepository) call ["init", []]; GVAR(OrgRepository) call ["init", []];

View File

@ -24,8 +24,9 @@
private _webUIDeclarations = call EFUNC(common,initWebUIBridge); private _webUIDeclarations = call EFUNC(common,initWebUIBridge);
private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration"; private _webUIBridgeDeclaration = _webUIDeclarations get "bridgeDeclaration";
GVAR(OrgUIBridgeBaseClass) = compileFinal createHashMapFromArray [ GVAR(OrgUIBridgeBaseClass) = compileFinal ([
["#base", _webUIBridgeDeclaration], _webUIBridgeDeclaration,
createHashMapFromArray [
["#type", "OrgUIBridgeBaseClass"], ["#type", "OrgUIBridgeBaseClass"],
["setPendingBrowserControl", compileFinal { ["setPendingBrowserControl", compileFinal {
params [["_control", controlNull, [controlNull]]]; params [["_control", controlNull, [controlNull]]];
@ -242,7 +243,13 @@ GVAR(OrgUIBridgeBaseClass) = compileFinal createHashMapFromArray [
["refreshPortal", compileFinal { ["refreshPortal", compileFinal {
_self call ["requestHydrate", ["org::sync"]] _self call ["requestHydrate", ["org::sync"]]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(OrgUIBridge) = createHashMapObject [GVAR(OrgUIBridgeBaseClass)]; private _merged = +_base;
GVAR(OrgUIBridge) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(OrgUIBridge) = createHashMapObject [GVAR(OrgUIBridgeBaseClass), []];
true

View File

@ -6,7 +6,7 @@
[QGVAR(initPhone), []] call CFUNC(localEvent); [QGVAR(initPhone), []] call CFUNC(localEvent);
}] call CFUNC(waitUntilAndExecute); }] call CFUNC(waitUntilAndExecute);
if (isNil QGVAR(PhoneRepository)) then { [] call FUNC(initRepository); }; if (isNil QGVAR(PhoneRepository)) then { [] call FUNC(initRepository); true };
[QGVAR(initPhone), { [QGVAR(initPhone), {
GVAR(PhoneRepository) call ["init", []]; GVAR(PhoneRepository) call ["init", []];

View File

@ -1,6 +1,6 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isNil QGVAR(StoreUIBridge)) then { call FUNC(initUIBridge); }; if (isNil QGVAR(StoreUIBridge)) then { call FUNC(initUIBridge); true };
[QGVAR(responseCategory), { [QGVAR(responseCategory), {
params [["_payload", createHashMap, [createHashMap]]]; params [["_payload", createHashMap, [createHashMap]]];

File diff suppressed because one or more lines are too long

View File

@ -571,7 +571,7 @@ ${scopeSelector} .store-toast.is-error {
{ className: "filter-placeholder" }, { className: "filter-placeholder" },
selectedPaymentSource selectedPaymentSource
? selectedPaymentSource.label ? selectedPaymentSource.label
: "Cash", : "Select Payment",
), ),
), ),
), ),
@ -645,7 +645,7 @@ ${scopeSelector} .store-toast.is-error {
h( h(
"span", "span",
{ className: "footer-copy" }, { className: "footer-copy" },
"Uniforms, protective gear, weapon slots, vehicles, ammunition groups, and general support inventory.", "Uniforms, protective gear, weapon slots, vehicles, units, ammunition groups, and general support inventory.",
), ),
), ),
h( h(

View File

@ -300,15 +300,13 @@ ${scopeSelector} .cart-empty {
getters.getPaymentSourceById( getters.getPaymentSourceById(
storeConfig, storeConfig,
state.selectedPaymentSource, state.selectedPaymentSource,
) || ) || null;
paymentSources[0] ||
null;
const availablePaymentSourceCount = paymentSources.filter( const availablePaymentSourceCount = paymentSources.filter(
(source) => source.enabled !== false, (source) => source.enabled !== false,
).length; ).length;
const selectedPaymentLabel = selectedPaymentSource const selectedPaymentLabel = selectedPaymentSource
? selectedPaymentSource.label ? selectedPaymentSource.label
: "Unavailable"; : "Select Payment";
const selectedPaymentBalance = selectedPaymentSource const selectedPaymentBalance = selectedPaymentSource
? Number(selectedPaymentSource.balance || 0) ? Number(selectedPaymentSource.balance || 0)
: 0; : 0;
@ -392,12 +390,20 @@ ${scopeSelector} .cart-empty {
"select", "select",
{ {
className: "payment-source-select", className: "payment-source-select",
value: state.selectedPaymentSource, value: state.selectedPaymentSource || "",
onChange: (event) => onChange: (event) =>
actions.selectPaymentSource( actions.selectPaymentSource(
event.target.value, event.target.value,
), ),
}, },
h(
"option",
{
value: "",
disabled: true,
},
"Select Payment",
),
paymentSources.map((source) => paymentSources.map((source) =>
h( h(
"option", "option",
@ -467,7 +473,28 @@ ${scopeSelector} .cart-empty {
: "Unavailable", : "Unavailable",
), ),
) )
: null, : h(
"div",
{
className: "payment-source-meta",
},
h(
"span",
{
className: "payment-source-label",
},
"Select Payment",
),
h(
"span",
{
className: "payment-source-state",
},
availablePaymentSourceCount > 0
? "Required"
: "Unavailable",
),
),
), ),
), ),
h( h(
@ -630,6 +657,7 @@ ${scopeSelector} .cart-empty {
className: "store-btn store-btn-primary", className: "store-btn store-btn-primary",
disabled: disabled:
summary.lineCount === 0 || summary.lineCount === 0 ||
!selectedPaymentSource ||
state.isCheckingOut, state.isCheckingOut,
onClick: () => actions.requestCheckout(), onClick: () => actions.requestCheckout(),
}, },

View File

@ -81,6 +81,7 @@
{ id: "ammo", label: "Ammo" }, { id: "ammo", label: "Ammo" },
{ id: "misc", label: "Misc" }, { id: "misc", label: "Misc" },
{ id: "vehicles", label: "Vehicles" }, { id: "vehicles", label: "Vehicles" },
{ id: "units", label: "Units" },
], ],
vehicleCards: [ vehicleCards: [
{ id: "cars", label: "Cars" }, { id: "cars", label: "Cars" },
@ -113,6 +114,7 @@
planes: [], planes: [],
naval: [], naval: [],
other: [], other: [],
units: [],
}, },
}; };

View File

@ -112,8 +112,8 @@
return { return {
eyebrow: "Supply Categories", eyebrow: "Supply Categories",
title: "Procurement Dashboard", title: "Procurement Dashboard",
copy: "Choose a category to enter the exchange. Weapons and vehicles open a second tier, while the other departments display placeholder product inventory inside the new runtime/store architecture.", copy: "Choose a category to enter the exchange. Weapons and vehicles open a second tier, while the other departments display live product inventory inside the runtime store architecture.",
badge: "8 Categories", badge: "11 Categories",
}; };
} }

View File

@ -36,6 +36,7 @@
const payload = { const payload = {
items: [], items: [],
vehicles: [], vehicles: [],
units: [],
totalPrice, totalPrice,
paymentMethod, paymentMethod,
}; };
@ -57,6 +58,20 @@
return; return;
} }
if (normalizedItem.entryKind === "unit") {
for (
let index = 0;
index < normalizedItem.quantity;
index += 1
) {
payload.units.push({
classname: normalizedItem.classname,
category: "units",
});
}
return;
}
payload.items.push({ payload.items.push({
classname: normalizedItem.classname, classname: normalizedItem.classname,
category: normalizedItem.category, category: normalizedItem.category,

View File

@ -58,7 +58,7 @@
[this.getIsCheckingOut, this.setIsCheckingOut] = [this.getIsCheckingOut, this.setIsCheckingOut] =
createSignal(false); createSignal(false);
[this.getSelectedPaymentSource, this.setSelectedPaymentSource] = [this.getSelectedPaymentSource, this.setSelectedPaymentSource] =
createSignal("cash"); createSignal("");
} }
resetToCategories() { resetToCategories() {
@ -191,23 +191,9 @@
const currentSource = String( const currentSource = String(
this.getSelectedPaymentSource() || "", this.getSelectedPaymentSource() || "",
).trim(); ).trim();
const defaultSource = String(
storeConfig?.defaultPaymentSource || "",
).trim();
const sourceIds = paymentSources.map((source) => const sourceIds = paymentSources.map((source) =>
String(source?.id || "").trim(), String(source?.id || "").trim(),
); );
const enabledSource = paymentSources.find(
(source) => source && source.enabled !== false,
);
const defaultAvailable =
defaultSource && sourceIds.includes(defaultSource)
? paymentSources.find(
(source) =>
String(source?.id || "").trim() ===
defaultSource,
)
: null;
if ( if (
currentSource && currentSource &&
@ -221,19 +207,7 @@
return; return;
} }
if (defaultAvailable && defaultAvailable.enabled !== false) { this.setSelectedPaymentSource("");
this.setSelectedPaymentSource(defaultSource);
return;
}
if (enabledSource) {
this.setSelectedPaymentSource(
String(enabledSource.id || "cash"),
);
return;
}
this.setSelectedPaymentSource(defaultSource || "cash");
} }
navigateToBreadcrumb(target) { navigateToBreadcrumb(target) {

View File

@ -1,4 +1,4 @@
protocol = 1; protocol = 1;
publishedid = MOD_ID; publishedid = 0;
name = "forge-client"; name = "forge-client";
timestamp = 5250140732737923549; timestamp = 5250140732737923549;

View File

@ -0,0 +1,2 @@
[config]
unknown_external = "allow"

View File

@ -0,0 +1,24 @@
name = "forge-mod"
author = "J.Schmidt"
prefix = "forge_mod"
mainprefix = "forge"
[version]
path = "addons/main/script_version.hpp"
git_hash = 0
[files]
include = [
"mod.cpp",
"meta.cpp",
"icon_64_ca.paa",
"icon_128_ca.paa",
"icon_128_highlight_ca.paa",
"title_ca.paa",
"LICENSE.md",
"README.md",
]
exclude = []
[properties]
author = "J.Schmidt"

119
arma/mod/LICENSE.md Normal file
View File

@ -0,0 +1,119 @@
![APL-SA](https://www.bohemia.net/assets/img/licenses/APL-SA.png)
## Brief summary of this Licence
PLEASE, NOTE THAT THIS SUMMARY HAS NO LEGAL EFFECT AND IS ONLY OF AN INFORMATORY NATURE DESIGNED FOR YOU TO GET THE BASIC INFORMATION ABOUT THE CONTENT OF THIS LICENCE. THE ONLY LEGALLY BINDING PROVISIONS ARE THOSE IN THE ORIGINAL AND FULL TEXT OF THIS LICENCE.
With this licence you are free to adapt (i.e. modify, rework or update) and share (i.e. copy, distribute or transmit) the material under the following conditions:
- **Attribution** - You must attribute the material in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the material).
- **Noncommercial** - You may not use this material for any commercial purposes.
- **Arma Only** - You may not convert or adapt this material to be used in other games than Arma.
- **Share Alike** - If you adapt, or build upon this material, you may distribute the resulting material only under the same license.
---
# Full version of licence
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Arma Public License - Share Alike ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
### Section 1 Definitions
1. **Adapted Material** means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
2. **Adapter's License** means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
3. **ArmaOnly** means primarily intended for or directed towards the use in any of existing and future Arma games, including but not limited to Arma: Cold War Assault, Arma, Arma 2 and Arma 3 and its official sequels and expansion packs.
4. **Arma Public Share Alike Compatible License** means a license listed at [https://www.bohemia.net/community/licenses](https://www.bohemia.net/community/licenses) as essentially the equivalent of this Public License.
5. **Copyright and Similar Rights** means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
6. **Effective Technological Measures** means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
7. **Exceptions and Limitations** means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
8. **Licensed Material** means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
9. **Licensed Rights** means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
10. **Licensor** means the individual(s) or entity(ies) granting rights under this Public License.
11. **NonCommercial** means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
12. **Share** means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
13. **Sui Generis Database Rights** means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
14. **You** means the individual or entity exercising the Licensed Rights under this Public License. **Your** has a corresponding meaning.
### Section 2 Scope
1. **License grant**
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
1. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial and ArmaOnly purposes only; and
2. produce, reproduce, and Share Adapted Material for NonCommercial and ArmaOnly purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. Downstream recipients.
1. Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
2. Additional offer from the Licensor Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
3. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(a)(i).
2. **Other rights**
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial and ArmaOnly purposes.
### Section 3 License Conditions
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
1. **Attribution**
1. If You Share the Licensed Material (including in modified form), You must:
1. retain the following if it is supplied by the Licensor with the Licensed Material:
1. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
2. a copyright notice;
3. a notice that refers to this Public License;
4. a notice that refers to the disclaimer of warranties;
5. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
2. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
3. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(a) to the extent reasonably practicable.
2. **ShareAlike**
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
1. The Adapters License You apply must be this Public License, or an Arma Public Share Alike Compatible License.
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
### Section 4 Sui Generis Database Rights
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
1. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial and ArmaOnly purposes only;
2. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
3. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
### Section 5 Disclaimer of Warranties and Limitation of Liability
1. **Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.**
2. **To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.**
3. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
### Section 6 Term and Termination
1. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
2. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
3. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
4. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
### Section 7 Other Terms and Conditions
1. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
2. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
### Section 8 Interpretation
1. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
2. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
3. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
4. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
### Bohemia Interactive Notices
1. Bohemia Interactive a.s. is not a party to this License, and makes no warranty whatsoever in connection with the Licensed Material. Bohemia Interactive a.s. will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, Bohemia Interactive a.s. may elect to apply the Public License to material it publishes and in those instances it becomes the "Licensor".
2. Except for the limited purpose of indicating to the public that the Licensed Material is shared under this Public License, Bohemia Interactive a.s. does not authorize the use by either party of the trademarks "Arma", "Bohemia Interactive" or any related trademark or logo of Arma or Bohemia Interactive without the prior written consent of Bohemia Interactive a.s.

19
arma/mod/README.md Normal file
View File

@ -0,0 +1,19 @@
# FORGE Shared Mod
Shared client/server config classes for FORGE missions. This HEMTT project
builds to `@forge_mod`.
Load `@forge_mod` on both clients and servers. Server runtime systems remain in
`@forge_server`, and player-facing UI remains in `@forge_client`.
## Addons
- `forge_mod_common`: shared vehicle/config definitions, including
`forge_bodyBag`.
- `forge_mod_task`: Forge Eden task module classes used by missions. The module
config points at server-side task functions, but those functions are still
provided by `@forge_server`.
Mission `requiredAddons` should reference `forge_mod_*` packages for shared
classes. Clients should never need `@forge_server` just to load or edit a Forge
mission.

View File

@ -0,0 +1 @@
forge\forge_mod\addons\common

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
author = AUTHOR;
authors[] = {"IDSolutions"};
url = "https://github.com/IDSolutions/MOD_REPO";
name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
"forge_mod_main",
"A3_Characters_F"
};
units[] = {"forge_bodyBag"};
weapons[] = {};
VERSION_CONFIG;
};
};
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,4 @@
#define COMPONENT common
#define COMPONENT_BEAUTIFIED Common
#include "\forge\forge_mod\addons\main\script_mod.hpp"
#include "\forge\forge_mod\addons\main\script_macros.hpp"

View File

@ -0,0 +1 @@
forge\forge_mod\addons\main

View File

@ -0,0 +1,15 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
author = AUTHOR;
authors[] = {"J.Schmidt"};
url = "https://github.com/IDSolutions/MOD_REPO";
name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"cba_main"};
units[] = {};
weapons[] = {};
VERSION_CONFIG;
};
};

View File

@ -0,0 +1,4 @@
#define COMPONENT main
#define COMPONENT_BEAUTIFIED Main
#include "script_mod.hpp"
#include "script_macros.hpp"

View File

@ -0,0 +1,8 @@
#define QUOTE(var1) #var1
#define DOUBLES(var1,var2) var1##_##var2
#define TRIPLES(var1,var2,var3) DOUBLES(DOUBLES(var1,var2),var3)
#define ADDON DOUBLES(PREFIX,COMPONENT)
#define VERSION_CONFIG version = VERSION; versionStr = QUOTE(VERSION_STR); versionAr[] = {VERSION_AR}
#define SERVER_TASK_FUNC(var1) QUOTE(TRIPLES(DOUBLES(forge_server,task),fnc,var1))

View File

@ -0,0 +1,18 @@
#define MAINPREFIX forge
#define PREFIX forge_mod
#define MOD_NAME forge-mod
#define AUTHOR "J.Schmidt"
#define REQUIRED_VERSION 2.20
#include "script_version.hpp"
#define VERSION MAJOR.MINOR
#define VERSION_STR MAJOR.MINOR.PATCH.BUILD
#define VERSION_AR MAJOR,MINOR,PATCH,BUILD
#ifndef COMPONENT_BEAUTIFIED
#define COMPONENT_BEAUTIFIED COMPONENT
#endif
#define COMPONENT_NAME QUOTE(MOD_NAME - COMPONENT_BEAUTIFIED)

View File

@ -0,0 +1,4 @@
#define MAJOR 1
#define MINOR 0
#define PATCH 0
#define BUILD 0

View File

@ -0,0 +1 @@
forge\forge_mod\addons\task

View File

@ -14,7 +14,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(attackModule); function = SERVER_TASK_FUNC(attackModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 1; isTriggerActivated = 1;
@ -127,7 +127,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(explosivesModule); function = SERVER_TASK_FUNC(explosivesModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 0; isTriggerActivated = 0;
@ -164,7 +164,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(hostagesModule); function = SERVER_TASK_FUNC(hostagesModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 0; isTriggerActivated = 0;
@ -201,7 +201,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(shootersModule); function = SERVER_TASK_FUNC(shootersModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 0; isTriggerActivated = 0;
@ -238,7 +238,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(protectedModule); function = SERVER_TASK_FUNC(protectedModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 0; isTriggerActivated = 0;
@ -274,7 +274,7 @@ class CfgVehicles {
displayName = "Defend Task"; displayName = "Defend Task";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(defendModule); function = SERVER_TASK_FUNC(defendModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 1; isTriggerActivated = 1;
@ -399,7 +399,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(defuseModule); function = SERVER_TASK_FUNC(defuseModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 1; isTriggerActivated = 1;
@ -512,7 +512,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(destroyModule); function = SERVER_TASK_FUNC(destroyModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 1; isTriggerActivated = 1;
@ -625,7 +625,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(hostageModule); function = SERVER_TASK_FUNC(hostageModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 1; isTriggerActivated = 1;
@ -775,7 +775,7 @@ class CfgVehicles {
displayName = "Delivery Task"; displayName = "Delivery Task";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(deliveryModule); function = SERVER_TASK_FUNC(deliveryModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 1; isTriggerActivated = 1;
@ -892,7 +892,7 @@ class CfgVehicles {
displayName = "Cargo Entities"; displayName = "Cargo Entities";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(cargoModule); function = SERVER_TASK_FUNC(cargoModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 0; isTriggerActivated = 0;
@ -928,7 +928,7 @@ class CfgVehicles {
// icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa"; // icon = "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\default_ca.paa";
category = "FORGE_Modules"; category = "FORGE_Modules";
function = QFUNC(hvtModule); function = SERVER_TASK_FUNC(hvtModule);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 1; isTriggerActivated = 1;

View File

@ -0,0 +1,34 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
author = AUTHOR;
authors[] = {"J.Schmidt"};
url = "https://github.com/IDSolutions/MOD_REPO";
name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
"forge_mod_main",
"A3_Modules_F"
};
units[] = {
"FORGE_Module_Attack",
"FORGE_Module_Explosives",
"FORGE_Module_Hostages",
"FORGE_Module_Shooters",
"FORGE_Module_Protected",
"FORGE_Module_Defend",
"FORGE_Module_Defuse",
"FORGE_Module_Destroy",
"FORGE_Module_Hostage",
"FORGE_Module_Delivery",
"FORGE_Module_Cargo",
"FORGE_Module_HVT"
};
weapons[] = {};
VERSION_CONFIG;
};
};
#include "CfgFactionClasses.hpp"
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,44 @@
#define COMPONENT task
#define COMPONENT_BEAUTIFIED Task
#include "\forge\forge_mod\addons\main\script_mod.hpp"
#include "\forge\forge_mod\addons\main\script_macros.hpp"
#define REWARD_ARRAY_ATTRIBUTES(PREFIX) \
class EquipmentRewards: Edit { \
property = QUOTE(DOUBLES(PREFIX,EquipmentRewards)); \
displayName = "Equipment Rewards"; \
tooltip = "Comma-separated equipment class names, e.g. ItemGPS, ItemCompass. Legacy SQF arrays still work."; \
typeName = "STRING"; \
}; \
class SupplyRewards: Edit { \
property = QUOTE(DOUBLES(PREFIX,SupplyRewards)); \
displayName = "Supply Rewards"; \
tooltip = "Comma-separated supply class names, e.g. FirstAidKit, Medikit. Legacy SQF arrays still work."; \
typeName = "STRING"; \
}; \
class WeaponRewards: Edit { \
property = QUOTE(DOUBLES(PREFIX,WeaponRewards)); \
displayName = "Weapon Rewards"; \
tooltip = "Comma-separated weapon class names, e.g. arifle_MX_F, arifle_Katiba_F. Legacy SQF arrays still work."; \
typeName = "STRING"; \
}; \
class VehicleRewards: Edit { \
property = QUOTE(DOUBLES(PREFIX,VehicleRewards)); \
displayName = "Vehicle Rewards"; \
tooltip = "Comma-separated vehicle class names, e.g. B_MRAP_01_F, B_Quadbike_01_F. Legacy SQF arrays still work."; \
typeName = "STRING"; \
}; \
class SpecialRewards: Edit { \
property = QUOTE(DOUBLES(PREFIX,SpecialRewards)); \
displayName = "Special Rewards"; \
tooltip = "Comma-separated special reward class names, e.g. B_UAV_01_F, B_Heli_Light_01_F. Legacy SQF arrays still work."; \
typeName = "STRING"; \
};
#define TASK_CHAIN_ATTRIBUTES(PREFIX) \
class PrerequisiteTaskIds: Edit { \
property = QUOTE(DOUBLES(PREFIX,PrerequisiteTaskIds)); \
displayName = "Prerequisite Task IDs"; \
tooltip = "Comma-separated task IDs that must succeed before this task appears in CAD or can be assigned"; \
typeName = "STRING"; \
};

BIN
arma/mod/icon_128_ca.paa Normal file

Binary file not shown.

Binary file not shown.

BIN
arma/mod/icon_64_ca.paa Normal file

Binary file not shown.

4
arma/mod/meta.cpp Normal file
View File

@ -0,0 +1,4 @@
protocol = 1;
publishedid = 0;
name = "forge-mod";
timestamp = 5250140732737923549;

15
arma/mod/mod.cpp Normal file
View File

@ -0,0 +1,15 @@
dir = "@forge_mod";
author = "J.Schmidt";
name = "Forge Mod";
description = "Forge Shared Mod - Version 1.0.0";
overview = "";
overviewPicture = "title_ca.paa";
picture = "title_ca.paa";
logoSmall = "icon_64_ca.paa";
logo = "icon_128_ca.paa";
logoOver = "icon_128_highlight_ca.paa";
tooltip = "Forge Mod";
tooltipOwned = "IDS Owned";
action = "https://innovativedevsolutions.org";
actionName = "Website";
dlcColor[] = {0.45, 0.47, 0.41, 1};

BIN
arma/mod/title_ca.paa Normal file

Binary file not shown.

View File

@ -25,13 +25,38 @@ life state, phone number, email, organization, and holster state.
## Runtime Behavior ## Runtime Behavior
- Missing persistent actors can be created from live player snapshots. - Missing persistent actors can be created from live player snapshots.
- Newly created actors receive a Field Commander job orientation email, two - Newly created actors receive their starting loadout from mission
`CfgStartingEquipment`, plus a Field Commander job orientation email, two
Field Commander text messages, and a `$2,000` starting credit in their bank Field Commander text messages, and a `$2,000` starting credit in their bank
account. account.
- Hot actor reads are migrated and hydrated before use. - Hot actor reads are migrated and hydrated before use.
- `saveHotState` in the main addon snapshots and saves actor state on player - `saveHotState` in the main addon snapshots and saves actor state on player
disconnect and mission end. disconnect and mission end.
## Starting Equipment
Missions can include `CfgStartingEquipment.hpp` from `description.ext` to
override starter actor gear without recompiling the addon or extension.
```cpp
class CfgStartingEquipment {
loadout[] = {
{},
{},
{},
{"U_BG_Guerrilla_6_1", {{"FirstAidKit", 2}}},
{},
{},
"H_Cap_blk_ION",
"",
{},
{"ItemMap", "ItemGPS", "ItemRadio", "ItemCompass", "ItemWatch", ""}
};
};
```
The Rust actor model no longer hardcodes a starter loadout. SQF supplies the
mission-configured loadout when it creates a missing actor record.
## Event Surface ## Event Surface
The addon handles server events for actor init, get, set, multi-set, save, and The addon handles server events for actor init, get, set, multi-set, save, and
remove requests, then replies to the requesting player through client actor RPCs. remove requests, then replies to the requesting player through client actor RPCs.

View File

@ -1,6 +1,6 @@
#include "script_component.hpp" #include "script_component.hpp"
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); }; if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
if (isNil QGVAR(BankAccountCreatedEventTokens)) then { if (isNil QGVAR(BankAccountCreatedEventTokens)) then {
private _welcomeNewActor = { private _welcomeNewActor = {
params ["_event"]; params ["_event"];

View File

@ -4,7 +4,7 @@
* File: fnc_initActorStore.sqf * File: fnc_initActorStore.sqf
* Author: IDSolutions * Author: IDSolutions
* Date: 2025-12-17 * Date: 2025-12-17
* Last Update: 2026-05-16 * Last Update: 2026-06-03
* Public: Yes * Public: Yes
* *
* Description: * Description:
@ -25,12 +25,23 @@
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(ActorModel) = compileFinal createHashMapObject [[ GVAR(ActorModel) = compileFinal createHashMapObject [[
["#type", "ActorModel"], ["#type", "ActorModel"],
["getStartingConfig", compileFinal {
missionConfigFile >> "CfgStartingEquipment"
}],
["getDefaultLoadout", compileFinal {
private _config = _self call ["getStartingConfig", []];
private _loadoutConfig = _config >> "loadout";
if (isArray _loadoutConfig) exitWith { getArray _loadoutConfig };
[[],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",4,17],[],""],["U_BG_Guerrilla_6_1",[["FirstAidKit", 2],["ACE_EarPlugs",1]]],["V_Rangemaster_belt",[["16Rnd_9x21_Mag",4]]],[],"H_Cap_blk_ION","",["Binocular","","","",[],[],""],["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch",""]]
}],
["defaults", compileFinal { ["defaults", compileFinal {
private _actor = createHashMap; private _actor = createHashMap;
_actor set ["uid", ""]; _actor set ["uid", ""];
_actor set ["name", ""]; _actor set ["name", ""];
_actor set ["loadout", [[],[],[],["U_BG_Guerrilla_6_1",[["FirstAidKit", 2]]],[],[],"H_Cap_blk_ION","",[],["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch",""]]]; _actor set ["loadout", _self call ["getDefaultLoadout", []]];
_actor set ["position", [0,0,0]]; _actor set ["position", [0,0,0]];
_actor set ["direction", 0]; _actor set ["direction", 0];
_actor set ["stance", "STAND"]; _actor set ["stance", "STAND"];

View File

@ -2,7 +2,7 @@
call FUNC(initBank); call FUNC(initBank);
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); }; if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
if (isNil QGVAR(AccountSyncEventTokens)) then { if (isNil QGVAR(AccountSyncEventTokens)) then {
private _sendAccountSync = { private _sendAccountSync = {
params ["_event"]; params ["_event"];

View File

@ -14,11 +14,13 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(BankBaseStore) = compileFinal createHashMapFromArray [ GVAR(BankBaseStore) = compileFinal ([
["#base", EGVAR(common,BaseStore)], EGVAR(common,BaseStore),
createHashMapFromArray [
["#type", "BankBaseStore"], ["#type", "BankBaseStore"],
["#create", compileFinal { ["#create", compileFinal {
["INFO", "Bank Store Initialized!"] call EFUNC(common,log); ["INFO", "Bank Store Initialized!"] call EFUNC(common,log);
true
}], }],
["normalizeAccount", compileFinal { ["normalizeAccount", compileFinal {
params [["_uid", "", [""]], ["_account", createHashMap, [createHashMap]], ["_playerName", "", [""]]]; params [["_uid", "", [""]], ["_account", createHashMap, [createHashMap]], ["_playerName", "", [""]]];
@ -571,7 +573,13 @@ GVAR(BankBaseStore) = compileFinal createHashMapFromArray [
] ]
] ]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(BankStore) = createHashMapObject [GVAR(BankBaseStore)]; private _merged = +_base;
GVAR(BankStore) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(BankStore) = createHashMapObject [GVAR(BankBaseStore), []];
true

View File

@ -91,20 +91,19 @@ call FUNC(registerEventListeners);
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent); [CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
}; };
if (isNil "forge_pmc_fnc_requestMissionTask") exitWith { if (isNil QEGVAR(task,MissionGeneratorProviderRegistry)) exitWith {
_result set ["message", "This mission does not expose dispatcher-generated tasks."]; _result set ["message", "Generated mission provider registry is unavailable."];
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent); [CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
}; };
// Temporary mission-owned integration point. This keeps simulator-specific _result = EGVAR(task,MissionGeneratorProviderRegistry) call ["requestMissionTask", [_taskType, _metadata, _uid]];
// generator logic in the mission until CAD/task grows a framework-level
// on-demand generation interface.
_result = [_taskType, _metadata, _uid] call forge_pmc_fnc_requestMissionTask;
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
if (_result getOrDefault ["success", false]) then { if !(_result getOrDefault ["success", false]) exitWith {
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
};
[CRPC(cad,responseCadRequest), [_result], _player] call CFUNC(targetEvent);
[CRPC(cad,invalidateCadState), []] call CFUNC(globalEvent); [CRPC(cad,invalidateCadState), []] call CFUNC(globalEvent);
};
}] call CFUNC(addEventHandler); }] call CFUNC(addEventHandler);
[QGVAR(requestSubmitCadSupportRequest), { [QGVAR(requestSubmitCadSupportRequest), {

View File

@ -299,6 +299,12 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
private _permissionService = _self get "PermissionService"; private _permissionService = _self get "PermissionService";
private _groupRepository = _self get "GroupRepository"; private _groupRepository = _self get "GroupRepository";
private _generatedTaskTypes = [];
if !(isNil QEGVAR(task,MissionGeneratorProviderRegistry)) then {
_generatedTaskTypes = EGVAR(task,MissionGeneratorProviderRegistry) call ["getGeneratedTaskTypes", []];
} else {
["INFO", "CAD hydrate generated task types unavailable because the task provider registry is not ready."] call EFUNC(common,log);
};
private _groupID = _groupRepository call ["getPlayerGroupId", [_uid]]; private _groupID = _groupRepository call ["getPlayerGroupId", [_uid]];
private _session = createHashMapFromArray [ private _session = createHashMapFromArray [
@ -311,6 +317,7 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
private _seed = createHashMapFromArray [ private _seed = createHashMapFromArray [
["groups", _groupRepository call ["buildGroups", []]], ["groups", _groupRepository call ["buildGroups", []]],
["activeTasks", EGVAR(task,TaskStore) call ["getActiveTaskCatalog", []]], ["activeTasks", EGVAR(task,TaskStore) call ["getActiveTaskCatalog", []]],
["generatedTaskTypes", _generatedTaskTypes],
["session", _session] ["session", _session]
]; ];
private _emptyPayload = createHashMapFromArray [ private _emptyPayload = createHashMapFromArray [
@ -319,6 +326,7 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
["requests", []], ["requests", []],
["assignments", []], ["assignments", []],
["activity", []], ["activity", []],
["generatedTaskTypes", _generatedTaskTypes],
["session", _session] ["session", _session]
]; ];
private _persistenceService = _self getOrDefault ["PersistenceService", createHashMap]; private _persistenceService = _self getOrDefault ["PersistenceService", createHashMap];
@ -330,7 +338,9 @@ GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
private _hydrateResult = _persistenceService call ["buildHydratePayload", [_seed]]; private _hydrateResult = _persistenceService call ["buildHydratePayload", [_seed]];
if (_hydrateResult getOrDefault ["success", false]) exitWith { if (_hydrateResult getOrDefault ["success", false]) exitWith {
_hydrateResult getOrDefault ["data", createHashMap] private _data = _hydrateResult getOrDefault ["data", createHashMap];
_data set ["generatedTaskTypes", _generatedTaskTypes];
_data
}; };
["WARNING", "CAD hydrate failed in the extension; returning seed-only payload."] call EFUNC(common,log); ["WARNING", "CAD hydrate failed in the extension; returning seed-only payload."] call EFUNC(common,log);

View File

@ -1,12 +0,0 @@
class CfgVehicles {
class Land_Bodybag_01_black_F;
class forge_bodyBag: Land_Bodybag_01_black_F {
maximumLoad = 2000;
transportMaxWeapons = 500;
transportMaxMagazines = 2000;
transportMaxItems = 1000;
ace_dragging_canCarry = 1;
ace_dragging_carryPosition[] = {0, 0.5, 1.2};
ace_dragging_carryDirection = 90;
};
};

View File

@ -6,7 +6,7 @@ PREP_RECOMPILE_END;
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)]; // private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
if (isNil QGVAR(EventBus)) then { call FUNC(eventBus); }; if (isNil QGVAR(EventBus)) then { call FUNC(eventBus); true };
if (isNil QGVAR(NotificationEventTokens)) then { if (isNil QGVAR(NotificationEventTokens)) then {
private _sendNotification = { private _sendNotification = {
params ["_event"]; params ["_event"];

View File

@ -8,7 +8,8 @@ class CfgPatches {
name = COMPONENT_NAME; name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { requiredAddons[] = {
"forge_server_main" "forge_server_main",
"forge_mod_common"
}; };
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {};
@ -18,4 +19,3 @@ class CfgPatches {
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp" #include "CfgSounds.hpp"
#include "CfgVehicles.hpp"

View File

@ -37,8 +37,14 @@ if (_stackTrace) then {
// private _timestamp = format (["%1-%2-%3 %4:%5:%6:%7"] + systemTimeUTC); // private _timestamp = format (["%1-%2-%3 %4:%5:%6:%7"] + systemTimeUTC);
if (isNil "_file") then { _file = ["", _fnc_scriptName] select (!isNil "_fnc_scriptName"); }; if (isNil "_file") then {
if (isNil "_callingFile" && !isNil "_fnc_scriptNameParent") then { _callingFile = _fnc_scriptNameParent; }; _file = "";
if (!isNil "_fnc_scriptName") then {
_file = _fnc_scriptName;
};
};
if (isNil "_callingFile" && {!isNil "_fnc_scriptNameParent"}) then { _callingFile = _fnc_scriptNameParent; };
// private _callingFileText = if !(isNil "_callingFile") then { format ["Called By: %1", _callingFile] } else { "" }; // private _callingFileText = if !(isNil "_callingFile") then { format ["Called By: %1", _callingFile] } else { "" };

View File

@ -0,0 +1,16 @@
/*
* Framework fallback prices for service/economy interactions.
*
* Mission-local CfgServicePricing overrides this config. Mission Params with
* matching names override config defaults before the setup UI opens, and
* submitted setup UI values override both.
*/
class CfgServicePricing {
medicalSpawnCost = 100;
medicalHealCost = 100;
serviceRepairCost = 500;
serviceRearmCost = 500;
fuelCost = 5;
transportBaseFare = 100;
transportPricePerKm = 50;
};

View File

@ -9,6 +9,21 @@ inventory handling.
Current stores cover fuel tracking, medical service behavior, and service Current stores cover fuel tracking, medical service behavior, and service
charges such as repairs and rearming. charges such as repairs and rearming.
## Configurable Prices
Service prices are read dynamically from mission namespace values so the
framework mission setup UI can override them at startup. If the UI is cancelled
or unavailable, mission `Params` with matching names are used as the backup;
if no param is defined, `CfgServicePricing` provides the fallback.
Supported setting names:
- `medicalSpawnCost` - best-effort medical respawn charge; default `100`
- `medicalHealCost` - heal charge; default `100`
- `serviceRepairCost` - default repair service charge; default `500`
- `serviceRearmCost` - default rearm service charge; default `500`
- `fuelCost` - refuel price per liter; default `5`
- `transportBaseFare` - transport fare base price; default `100`
- `transportPricePerKm` - transport distance price; default `50`
## Dependencies ## Dependencies
- `forge_server_main` - `forge_server_main`
- `forge_server_common` for logging, formatting, and player lookup - `forge_server_common` for logging, formatting, and player lookup
@ -23,7 +38,8 @@ Note: Bank and Org are runtime-only dependencies (not compile-time requiredAddon
totals, charges the player's organization through `OrgStore`, syncs the org totals, charges the player's organization through `OrgStore`, syncs the org
patch, and rolls fuel back to the starting level when organization funds patch, and rolls fuel back to the starting level when organization funds
cannot cover the refuel. cannot cover the refuel.
- `fnc_initMEconomyStore.sqf` manages medical spawn occupancy, healing charges, - `fnc_initMEconomyStore.sqf` manages medical spawn occupancy, medical spawn
billing, healing charges,
respawn placement, death inventory handling, and body-bag transfer. Medical respawn placement, death inventory handling, and body-bag transfer. Medical
charges use player bank/cash first, then organization funds with repayable charges use player bank/cash first, then organization funds with repayable
member debt only when the player cannot cover the service. member debt only when the player cannot cover the service.

View File

@ -6,9 +6,9 @@ PREP_RECOMPILE_END;
// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)]; // private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)];
if (isNil QGVAR(MEconomyStore)) then { call FUNC(initMEconomyStore); }; if (isNil QGVAR(MEconomyStore)) then { call FUNC(initMEconomyStore); true };
if (isNil QGVAR(FEconomyStore)) then { call FUNC(initFEconomyStore); }; if (isNil QGVAR(FEconomyStore)) then { call FUNC(initFEconomyStore); true };
if (isNil QGVAR(SEconomyStore)) then { call FUNC(initSEconomyStore); }; if (isNil QGVAR(SEconomyStore)) then { call FUNC(initSEconomyStore); true };
[QGVAR(FuelStart), { [QGVAR(FuelStart), {
params ["_source", "_target", "_unit"]; params ["_source", "_target", "_unit"];

View File

@ -18,3 +18,4 @@ class CfgPatches {
}; };
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgServicePricing.hpp"

View File

@ -32,6 +32,22 @@ GVAR(FEconomyStore) = createHashMapObject [[
["INFO", "Fuel Store Initialized!", nil, nil] call EFUNC(common,log); ["INFO", "Fuel Store Initialized!", nil, nil] call EFUNC(common,log);
}], }],
["numberSetting", {
params [["_name", "", [""]], ["_default", 0, [0]]];
private _configDefault = _default;
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
if (isNumber (_serviceConfig >> _name)) then {
_configDefault = getNumber (_serviceConfig >> _name);
};
private _paramValue = [_name, _configDefault] call BIS_fnc_getParamValue;
private _value = missionNamespace getVariable [_name, _paramValue];
if (_value isEqualType "") exitWith { (parseNumber _value) max 0 };
if (_value isEqualType 0) exitWith { _value max 0 };
_configDefault
}],
["start", { ["start", {
params ["_source", "_target", "_unit"]; params ["_source", "_target", "_unit"];
@ -100,7 +116,7 @@ GVAR(FEconomyStore) = createHashMapObject [[
if (_fuelCapacity <= 0) then { _fuelCapacity = 100; }; if (_fuelCapacity <= 0) then { _fuelCapacity = 100; };
private _totalLiters = _missingFuel * _fuelCapacity; private _totalLiters = _missingFuel * _fuelCapacity;
private _totalCost = _totalLiters * GVAR(FuelCost); private _totalCost = _totalLiters * (_self call ["numberSetting", ["fuelCost", GVAR(FuelCost)]]);
private _chargeResult = GVAR(SEconomyStore) call ["chargeOrg", [_unit, _totalCost, "Refueling"]]; private _chargeResult = GVAR(SEconomyStore) call ["chargeOrg", [_unit, _totalCost, "Refueling"]];
if !(_chargeResult getOrDefault ["success", false]) exitWith { if !(_chargeResult getOrDefault ["success", false]) exitWith {
_self call ["notify", [_unit, "danger", "Refueling", _chargeResult getOrDefault ["message", "Organization funds cannot cover this refuel. Refueling was not completed."]]]; _self call ["notify", [_unit, "danger", "Refueling", _chargeResult getOrDefault ["message", "Organization funds cannot cover this refuel. Refueling was not completed."]]];
@ -130,7 +146,7 @@ GVAR(FEconomyStore) = createHashMapObject [[
private _player = [_uid] call EFUNC(common,getPlayer); private _player = [_uid] call EFUNC(common,getPlayer);
private _totalLiters = GETVAR(_target,liters,0); private _totalLiters = GETVAR(_target,liters,0);
private _totalCost = _totalLiters * GVAR(FuelCost); private _totalCost = _totalLiters * (_self call ["numberSetting", ["fuelCost", GVAR(FuelCost)]]);
private _formattedTotalCost = [_totalCost] call EFUNC(common,formatNumber); private _formattedTotalCost = [_totalCost] call EFUNC(common,formatNumber);
private _formattedTotalLiters = _totalLiters toFixed 2; private _formattedTotalLiters = _totalLiters toFixed 2;

View File

@ -4,7 +4,7 @@
* File: fnc_initMEconomyStore.sqf * File: fnc_initMEconomyStore.sqf
* Author: IDSolutions * Author: IDSolutions
* Date: 2025-12-20 * Date: 2025-12-20
* Last Update: 2026-05-15 * Last Update: 2026-06-03
* Public: No * Public: No
* *
* Description: * Description:
@ -30,8 +30,25 @@ GVAR(MEconomyStore) = createHashMapObject [[
_self set ["mSpawns", createHashMap]; _self set ["mSpawns", createHashMap];
GVAR(occupancyTriggers) = []; GVAR(occupancyTriggers) = [];
GVAR(SpawnCost) = 100;
["INFO", "Medical Store Initialized!", nil, nil] call EFUNC(common,log); ["INFO", "Medical Store Initialized!", nil, nil] call EFUNC(common,log);
}], }],
["numberSetting", {
params [["_name", "", [""]], ["_default", 0, [0]]];
private _configDefault = _default;
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
if (isNumber (_serviceConfig >> _name)) then {
_configDefault = getNumber (_serviceConfig >> _name);
};
private _paramValue = [_name, _configDefault] call BIS_fnc_getParamValue;
private _value = missionNamespace getVariable [_name, _paramValue];
if (_value isEqualType "") exitWith { (parseNumber _value) max 0 };
if (_value isEqualType 0) exitWith { _value max 0 };
_configDefault
}],
["init", { ["init", {
private _mSpawns = (_self get "mSpawns"); private _mSpawns = (_self get "mSpawns");
private _prefix = "med_spawn"; private _prefix = "med_spawn";
@ -166,40 +183,61 @@ GVAR(MEconomyStore) = createHashMapObject [[
_result set ["message", ""]; _result set ["message", ""];
_result _result
}], }],
["onHealed", { ["chargeMedicalService", {
params [["_unit", objNull, [objNull]]]; params [
["_unit", objNull, [objNull]],
if (isNull _unit) exitWith { ["WARNING", format ["Invalid unit provided: %1", (name _unit)], nil, nil] call EFUNC(common,log); }; ["_amount", 0, [0]],
["_serviceLabel", "Medical service", [""]],
["_requirePayment", true, [true]]
];
if (isNull _unit) exitWith {
["WARNING", format ["Invalid unit provided: %1", (name _unit)], nil, nil] call EFUNC(common,log);
false
};
private _uid = getPlayerUID _unit; private _uid = getPlayerUID _unit;
if (_uid isEqualTo "") exitWith { ["WARNING", "Unable to charge medical service for unit without UID.", nil, nil] call EFUNC(common,log); }; if (_uid isEqualTo "") exitWith {
["WARNING", "Unable to charge medical service for unit without UID.", nil, nil] call EFUNC(common,log);
!_requirePayment
};
private _healCost = 100; if (_amount <= 0) exitWith { true };
private _personalCharge = _self call ["chargePlayer", [_uid, _healCost]]; private _personalCharge = _self call ["chargePlayer", [_uid, _amount]];
if (_personalCharge getOrDefault ["success", false]) exitWith { if (_personalCharge getOrDefault ["success", false]) exitWith {
private _sourceLabel = ["cash", "bank"] select ((_personalCharge getOrDefault ["source", "bank"]) isEqualTo "bank"); private _sourceLabel = ["cash", "bank"] select ((_personalCharge getOrDefault ["source", "bank"]) isEqualTo "bank");
_self call ["notify", [_unit, "info", "Medical Billing", format ["Medical service charged $%1 from your %2.", [_healCost] call EFUNC(common,formatNumber), _sourceLabel]]]; _self call ["notify", [_unit, "info", "Medical Billing", format ["%1 charged $%2 from your %3.", _serviceLabel, [_amount] call EFUNC(common,formatNumber), _sourceLabel]]];
[CRPC(actor,onActorHealed), [], _unit] call CFUNC(targetEvent); true
}; };
if !(_personalCharge getOrDefault ["fallbackEligible", false]) exitWith { if !(_personalCharge getOrDefault ["fallbackEligible", false]) exitWith {
private _message = _personalCharge getOrDefault ["message", "Personal funds could not be charged for medical service."]; private _message = _personalCharge getOrDefault ["message", "Personal funds could not be charged for medical service."];
_self call ["notify", [_unit, "danger", "Medical Billing", _message]]; _self call ["notify", [_unit, "danger", "Medical Billing", _message]];
!_requirePayment
}; };
if (isNil QGVAR(SEconomyStore)) exitWith { if (isNil QGVAR(SEconomyStore)) exitWith {
["ERROR", "Service economy store unavailable for medical organization fallback charge.", nil, nil] call EFUNC(common,log); ["ERROR", "Service economy store unavailable for medical organization fallback charge.", nil, nil] call EFUNC(common,log);
_self call ["notify", [_unit, "danger", "Medical Billing", "Organization billing is unavailable. Medical service cannot complete."]]; _self call ["notify", [_unit, "danger", "Medical Billing", "Organization billing is unavailable. Medical service cannot complete."]];
!_requirePayment
}; };
private _chargeResult = GVAR(SEconomyStore) call ["chargeOrg", [_unit, _healCost, "Medical", true]]; private _chargeResult = GVAR(SEconomyStore) call ["chargeOrg", [_unit, _amount, "Medical", true]];
if !(_chargeResult getOrDefault ["success", false]) exitWith { if !(_chargeResult getOrDefault ["success", false]) exitWith {
private _message = _chargeResult getOrDefault ["message", "Organization funds cannot cover this medical service."]; private _message = _chargeResult getOrDefault ["message", "Organization funds cannot cover this medical service."];
_self call ["notify", [_unit, "danger", "Medical Billing", _message]]; _self call ["notify", [_unit, "danger", "Medical Billing", _message]];
!_requirePayment
}; };
_self call ["notify", [_unit, "info", "Medical Billing", format ["Personal funds could not cover medical service. Organization charged $%1; repay it through your organization credit line.", [_healCost] call EFUNC(common,formatNumber)]]]; _self call ["notify", [_unit, "info", "Medical Billing", format ["Personal funds could not cover %1. Organization charged $%2; repay it through your organization credit line.", _serviceLabel, [_amount] call EFUNC(common,formatNumber)]]];
true
}],
["onHealed", {
params [["_unit", objNull, [objNull]]];
private _healCost = _self call ["numberSetting", ["medicalHealCost", 100]];
if !(_self call ["chargeMedicalService", [_unit, _healCost, "Medical service", true]]) exitWith {};
[CRPC(actor,onActorHealed), [], _unit] call CFUNC(targetEvent); [CRPC(actor,onActorHealed), [], _unit] call CFUNC(targetEvent);
}], }],
["onRespawn", { ["onRespawn", {
@ -214,6 +252,8 @@ GVAR(MEconomyStore) = createHashMapObject [[
deleteVehicle _corpse; deleteVehicle _corpse;
private _player = [_uid] call EFUNC(common,getPlayer); private _player = [_uid] call EFUNC(common,getPlayer);
private _spawnCost = _self call ["numberSetting", ["medicalSpawnCost", GVAR(SpawnCost)]];
_self call ["chargeMedicalService", [_player, _spawnCost, "Medical spawn", false]];
[CRPC(actor,onActorRespawn), [_loadout, _medSpawnPos, _medSpawnDir], _player] call CFUNC(targetEvent); [CRPC(actor,onActorRespawn), [_loadout, _medSpawnPos, _medSpawnDir], _player] call CFUNC(targetEvent);
}], }],
["onKilled", { ["onKilled", {

View File

@ -30,6 +30,22 @@ GVAR(SEconomyStore) = createHashMapObject [[
GVAR(ServiceRearmCost) = 500; GVAR(ServiceRearmCost) = 500;
["INFO", "Service Store Initialized!", nil, nil] call EFUNC(common,log); ["INFO", "Service Store Initialized!", nil, nil] call EFUNC(common,log);
}], }],
["numberSetting", {
params [["_name", "", [""]], ["_default", 0, [0]]];
private _configDefault = _default;
private _serviceConfig = missionConfigFile >> "CfgServicePricing";
if !(isClass _serviceConfig) then { _serviceConfig = configFile >> "CfgServicePricing"; };
if (isNumber (_serviceConfig >> _name)) then {
_configDefault = getNumber (_serviceConfig >> _name);
};
private _paramValue = [_name, _configDefault] call BIS_fnc_getParamValue;
private _value = missionNamespace getVariable [_name, _paramValue];
if (_value isEqualType "") exitWith { (parseNumber _value) max 0 };
if (_value isEqualType 0) exitWith { _value max 0 };
_configDefault
}],
["notify", { ["notify", {
params [["_unit", objNull, [objNull]], ["_type", "info", [""]], ["_title", "Service", [""]], ["_message", "", [""]]]; params [["_unit", objNull, [objNull]], ["_type", "info", [""]], ["_title", "Service", [""]], ["_message", "", [""]]];
@ -148,7 +164,7 @@ GVAR(SEconomyStore) = createHashMapObject [[
if (isNull _target || { isNull _unit }) exitWith { false }; if (isNull _target || { isNull _unit }) exitWith { false };
private _repairCost = [_cost, GVAR(ServiceRepairCost)] select (_cost < 0); private _repairCost = [_cost, _self call ["numberSetting", ["serviceRepairCost", GVAR(ServiceRepairCost)]]] select (_cost < 0);
private _charge = _self call ["chargeOrg", [_unit, _repairCost, "Repair"]]; private _charge = _self call ["chargeOrg", [_unit, _repairCost, "Repair"]];
if !(_charge getOrDefault ["success", false]) exitWith { if !(_charge getOrDefault ["success", false]) exitWith {
_self call ["notify", [_unit, "danger", "Repair", _charge getOrDefault ["message", "Organization funds cannot cover this repair."]]]; _self call ["notify", [_unit, "danger", "Repair", _charge getOrDefault ["message", "Organization funds cannot cover this repair."]]];
@ -164,7 +180,7 @@ GVAR(SEconomyStore) = createHashMapObject [[
if (isNull _target || { isNull _unit }) exitWith { false }; if (isNull _target || { isNull _unit }) exitWith { false };
private _rearmCost = [_cost, GVAR(ServiceRearmCost)] select (_cost < 0); private _rearmCost = [_cost, _self call ["numberSetting", ["serviceRearmCost", GVAR(ServiceRearmCost)]]] select (_cost < 0);
private _charge = _self call ["chargeOrg", [_unit, _rearmCost, "Rearm"]]; private _charge = _self call ["chargeOrg", [_unit, _rearmCost, "Rearm"]];
if !(_charge getOrDefault ["success", false]) exitWith { if !(_charge getOrDefault ["success", false]) exitWith {
_self call ["notify", [_unit, "danger", "Rearm", _charge getOrDefault ["message", "Organization funds cannot cover this rearm."]]]; _self call ["notify", [_unit, "danger", "Rearm", _charge getOrDefault ["message", "Organization funds cannot cover this rearm."]]];

View File

@ -34,3 +34,26 @@ Garage listens for sync events through the event bus:
- `notification.requested` - storage and vehicle modification alerts - `notification.requested` - storage and vehicle modification alerts
The store module emits these events when granting vehicles; garage applies the changes to player state. The store module emits these events when granting vehicles; garage applies the changes to player state.
## Starting Unlocks
Missions can include `CfgStartingEquipment.hpp` from `description.ext` to
configure initial virtual garage unlocks for new players.
```cpp
class CfgStartingEquipment {
class Unlocks {
class Garage {
cars[] = {"B_Quadbike_01_F"};
armor[] = {};
helis[] = {};
planes[] = {};
naval[] = {};
other[] = {};
};
};
};
```
The extension virtual garage default is intentionally empty. The server addon
seeds `CfgStartingEquipment` unlocks only when a player does not already have a
persistent owner-scoped garage record.

View File

@ -2,7 +2,7 @@
call FUNC(initGarage); call FUNC(initGarage);
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); }; if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
if (isNil QGVAR(SyncEventTokens)) then { if (isNil QGVAR(SyncEventTokens)) then {
private _sendVGarageSync = { private _sendVGarageSync = {
params ["_event"]; params ["_event"];

View File

@ -22,13 +22,15 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(GarageBaseStore) = compileFinal createHashMapFromArray [ GVAR(GarageBaseStore) = compileFinal ([
["#base", EGVAR(common,BaseStore)], EGVAR(common,BaseStore),
createHashMapFromArray [
["#type", "GarageBaseStore"], ["#type", "GarageBaseStore"],
["#create", compileFinal { ["#create", compileFinal {
["INFO", "Garage Store Initialized!"] call EFUNC(common,log); ["INFO", "Garage Store Initialized!"] call EFUNC(common,log);
_self set ["lastCallSucceeded", false]; _self set ["lastCallSucceeded", false];
_self set ["lastError", ""]; _self set ["lastError", ""];
true
}], }],
["callHotGarage", compileFinal { ["callHotGarage", compileFinal {
params [["_function", "", [""]], ["_arguments", [], [[]]]]; params [["_function", "", [""]], ["_arguments", [], [[]]]];
@ -114,7 +116,13 @@ GVAR(GarageBaseStore) = compileFinal createHashMapFromArray [
if (_uid isEqualTo "" || { _payloadJson isEqualTo "" }) exitWith { createHashMap }; if (_uid isEqualTo "" || { _payloadJson isEqualTo "" }) exitWith { createHashMap };
_self call ["callHotGarage", ["garage:hot:remove_vehicle", [_uid, _payloadJson]]] _self call ["callHotGarage", ["garage:hot:remove_vehicle", [_uid, _payloadJson]]]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(GarageStore) = createHashMapObject [GVAR(GarageBaseStore)]; private _merged = +_base;
GVAR(GarageStore) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(GarageStore) = createHashMapObject [GVAR(GarageBaseStore), []];
true

View File

@ -24,25 +24,40 @@
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(VGarageModel) = compileFinal createHashMapObject [[ GVAR(VGarageModel) = compileFinal createHashMapObject [[
["#type", "VGarageModel"], ["#type", "VGarageModel"],
["getStartingUnlocksConfig", compileFinal {
missionConfigFile >> "CfgStartingEquipment" >> "Unlocks" >> "Garage"
}],
["getStartingUnlocks", compileFinal {
params [["_category", "", [""]], ["_fallback", [], [[]]]];
private _config = _self call ["getStartingUnlocksConfig", []];
private _categoryConfig = _config >> _category;
if (isArray _categoryConfig) exitWith { getArray _categoryConfig };
+_fallback
}],
["defaults", compileFinal { ["defaults", compileFinal {
private _vGarage = createHashMap; private _vGarage = createHashMap;
_vGarage set ["armor", []]; _vGarage set ["armor", _self call ["getStartingUnlocks", ["armor", []]]];
_vGarage set ["cars", ["B_Quadbike_01_F"]]; _vGarage set ["cars", _self call ["getStartingUnlocks", ["cars", ["B_Quadbike_01_F"]]]];
_vGarage set ["helis", []]; _vGarage set ["helis", _self call ["getStartingUnlocks", ["helis", []]]];
_vGarage set ["naval", []]; _vGarage set ["naval", _self call ["getStartingUnlocks", ["naval", []]]];
_vGarage set ["other", []]; _vGarage set ["other", _self call ["getStartingUnlocks", ["other", []]]];
_vGarage set ["planes", []]; _vGarage set ["planes", _self call ["getStartingUnlocks", ["planes", []]]];
_vGarage _vGarage
}] }]
]]; ]];
GVAR(VGBaseStore) = compileFinal createHashMapFromArray [ GVAR(VGBaseStore) = compileFinal ([
["#base", EGVAR(common,BaseStore)], EGVAR(common,BaseStore),
createHashMapFromArray [
["#type", "VGBaseStore"], ["#type", "VGBaseStore"],
["#create", compileFinal { ["#create", compileFinal {
["INFO", "VGarage Store Initialized!"] call EFUNC(common,log); ["INFO", "VGarage Store Initialized!"] call EFUNC(common,log);
true
}], }],
["callHotVGarage", compileFinal { ["callHotVGarage", compileFinal {
params [["_function", "", [""]], ["_arguments", [], [[]]]]; params [["_function", "", [""]], ["_arguments", [], [[]]]];
@ -69,17 +84,46 @@ GVAR(VGBaseStore) = compileFinal createHashMapFromArray [
private _command = ["owned:garage:hot:fetch", "owned:garage:hot:init"] select _initialize; private _command = ["owned:garage:hot:fetch", "owned:garage:hot:init"] select _initialize;
_self call ["callHotVGarage", [_command, [_uid]]] _self call ["callHotVGarage", [_command, [_uid]]]
}], }],
["isPersistentVGarageInitialized", compileFinal {
params [["_uid", "", [""]]];
if (_uid isEqualTo "") exitWith { false };
["owned:garage:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
_isSuccess && { _result isEqualTo "true" }
}],
["seedStartingUnlocks", compileFinal {
params [["_uid", "", [""]], ["_garage", createHashMap, [createHashMap]]];
if (_uid isEqualTo "" || { _garage isEqualTo createHashMap }) exitWith { _garage };
private _defaults = GVAR(VGarageModel) call ["defaults", []];
private _seeded = +_garage;
{
_seeded set [_x, +_y];
} forEach _defaults;
private _updated = _self call ["callHotVGarage", ["owned:garage:hot:override", [_uid, toJSON _seeded]]];
if (_updated isEqualTo createHashMap) exitWith { _seeded };
_self call ["callHotVGarage", ["owned:garage:hot:save", [_uid]]];
_updated
}],
["init", compileFinal { ["init", compileFinal {
params [["_uid", "", [""]]]; params [["_uid", "", [""]]];
private _player = [_uid] call EFUNC(common,getPlayer); private _player = [_uid] call EFUNC(common,getPlayer);
if (isNull _player) exitWith { createHashMap }; if (isNull _player) exitWith { createHashMap };
private _hasPersistentGarage = _self call ["isPersistentVGarageInitialized", [_uid]];
private _garage = _self call ["loadHotVGarage", [_uid, true]]; private _garage = _self call ["loadHotVGarage", [_uid, true]];
if (_garage isEqualTo createHashMap) then { if (_garage isEqualTo createHashMap) then {
_garage = GVAR(VGarageModel) call ["defaults", []]; _garage = GVAR(VGarageModel) call ["defaults", []];
["ERROR", format ["Failed to initialize virtual garage for %1! Using fallback virtual garage.", _uid]] call EFUNC(common,log); ["ERROR", format ["Failed to initialize virtual garage for %1! Using fallback virtual garage.", _uid]] call EFUNC(common,log);
}; };
if !(_hasPersistentGarage) then {
_garage = _self call ["seedStartingUnlocks", [_uid, _garage]];
};
[CRPC(garage,responseInitVG), [_garage], _player] call CFUNC(targetEvent); [CRPC(garage,responseInitVG), [_garage], _player] call CFUNC(targetEvent);
_garage _garage
@ -90,7 +134,13 @@ GVAR(VGBaseStore) = compileFinal createHashMapFromArray [
if (_uid isEqualTo "") exitWith { createHashMap }; if (_uid isEqualTo "") exitWith { createHashMap };
_self call ["callHotVGarage", ["owned:garage:hot:save", [_uid]]] _self call ["callHotVGarage", ["owned:garage:hot:save", [_uid]]]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(VGarageStore) = createHashMapObject [GVAR(VGBaseStore)]; private _merged = +_base;
GVAR(VGarageStore) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(VGarageStore) = createHashMapObject [GVAR(VGBaseStore), []];
true

View File

@ -35,3 +35,24 @@ Locker listens for sync events through the event bus:
- `notification.requested` - storage and item modification alerts - `notification.requested` - storage and item modification alerts
The store module emits these events when granting items; locker applies the changes to player state. The store module emits these events when granting items; locker applies the changes to player state.
## Starting Unlocks
Missions can include `CfgStartingEquipment.hpp` from `description.ext` to
configure initial virtual arsenal unlocks for new players.
```cpp
class CfgStartingEquipment {
class Unlocks {
class Locker {
items[] = {"FirstAidKit", "ItemMap", "ItemCompass"};
weapons[] = {"hgun_P07_F"};
magazines[] = {"16Rnd_9x21_Mag"};
backpacks[] = {};
};
};
};
```
The extension virtual locker default is intentionally empty. The server addon
seeds `CfgStartingEquipment` unlocks only when a player does not already have a
persistent owner-scoped locker record.

View File

@ -2,7 +2,7 @@
call FUNC(initLocker); call FUNC(initLocker);
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); }; if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
if (isNil QGVAR(SyncEventTokens)) then { if (isNil QGVAR(SyncEventTokens)) then {
private _sendLockerSync = { private _sendLockerSync = {
params ["_event"]; params ["_event"];

View File

@ -22,11 +22,13 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(LockerBaseStore) = compileFinal createHashMapFromArray [ GVAR(LockerBaseStore) = compileFinal ([
["#base", EGVAR(common,BaseStore)], EGVAR(common,BaseStore),
createHashMapFromArray [
["#type", "LockerBaseStore"], ["#type", "LockerBaseStore"],
["#create", compileFinal { ["#create", compileFinal {
["INFO", "Locker Store Initialized!"] call EFUNC(common,log); ["INFO", "Locker Store Initialized!"] call EFUNC(common,log);
true
}], }],
["callHotLocker", compileFinal { ["callHotLocker", compileFinal {
params [["_function", "", [""]], ["_arguments", [], [[]]]]; params [["_function", "", [""]], ["_arguments", [], [[]]]];
@ -92,7 +94,13 @@ GVAR(LockerBaseStore) = compileFinal createHashMapFromArray [
if (_uid isEqualTo "") exitWith { createHashMap }; if (_uid isEqualTo "") exitWith { createHashMap };
_self call ["callHotLocker", ["locker:hot:save", [_uid]]] _self call ["callHotLocker", ["locker:hot:save", [_uid]]]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(LockerStore) = createHashMapObject [GVAR(LockerBaseStore)]; private _merged = +_base;
GVAR(LockerStore) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(LockerStore) = createHashMapObject [GVAR(LockerBaseStore), []];
true

View File

@ -24,23 +24,38 @@
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(VArsenalModel) = compileFinal createHashMapObject [[ GVAR(VArsenalModel) = compileFinal createHashMapObject [[
["#type", "VArsenalModel"], ["#type", "VArsenalModel"],
["getStartingUnlocksConfig", compileFinal {
missionConfigFile >> "CfgStartingEquipment" >> "Unlocks" >> "Locker"
}],
["getStartingUnlocks", compileFinal {
params [["_category", "", [""]], ["_fallback", [], [[]]]];
private _config = _self call ["getStartingUnlocksConfig", []];
private _categoryConfig = _config >> _category;
if (isArray _categoryConfig) exitWith { getArray _categoryConfig };
+_fallback
}],
["defaults", compileFinal { ["defaults", compileFinal {
private _vArsenal = createHashMap; private _vArsenal = createHashMap;
_vArsenal set ["backpacks", ["B_AssaultPack_rgr"]]; _vArsenal set ["backpacks", _self call ["getStartingUnlocks", ["backpacks", ["B_AssaultPack_rgr"]]]];
_vArsenal set ["items", ["FirstAidKit", "G_Combat", "H_Cap_blk_ION", "H_HelmetB", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch", "U_BG_Guerrilla_6_1", "V_TacVest_oli", "ACE_EarPlugs"]]; _vArsenal set ["items", _self call ["getStartingUnlocks", ["items", ["FirstAidKit", "G_Combat", "H_Cap_blk_ION", "H_HelmetB", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch", "U_BG_Guerrilla_6_1", "V_TacVest_oli", "ACE_EarPlugs"]]]];
_vArsenal set ["magazines", ["16Rnd_9x21_Mag", "30Rnd_65x39_caseless_black_mag", "Chemlight_blue", "Chemlight_green", "Chemlight_red", "Chemlight_yellow", "HandGrenade", "SmokeShell", "SmokeShellBlue", "SmokeShellGreen", "SmokeShellOrange", "SmokeShellPurple", "SmokeShellRed", "SmokeShellYellow"]]; _vArsenal set ["magazines", _self call ["getStartingUnlocks", ["magazines", ["16Rnd_9x21_Mag", "30Rnd_65x39_caseless_black_mag", "Chemlight_blue", "Chemlight_green", "Chemlight_red", "Chemlight_yellow", "HandGrenade", "SmokeShell", "SmokeShellBlue", "SmokeShellGreen", "SmokeShellOrange", "SmokeShellPurple", "SmokeShellRed", "SmokeShellYellow"]]]];
_vArsenal set ["weapons", ["arifle_MX_F", "hgun_P07_F"]]; _vArsenal set ["weapons", _self call ["getStartingUnlocks", ["weapons", ["arifle_MX_F", "hgun_P07_F"]]]];
_vArsenal _vArsenal
}] }]
]]; ]];
GVAR(VABaseStore) = compileFinal createHashMapFromArray [ GVAR(VABaseStore) = compileFinal ([
["#base", EGVAR(common,BaseStore)], EGVAR(common,BaseStore),
createHashMapFromArray [
["#type", "VABaseStore"], ["#type", "VABaseStore"],
["#create", compileFinal { ["#create", compileFinal {
["INFO", "VArsenal Store Initialized!"] call EFUNC(common,log); ["INFO", "VArsenal Store Initialized!"] call EFUNC(common,log);
true
}], }],
["callHotVArsenal", compileFinal { ["callHotVArsenal", compileFinal {
params [["_function", "", [""]], ["_arguments", [], [[]]]]; params [["_function", "", [""]], ["_arguments", [], [[]]]];
@ -67,17 +82,46 @@ GVAR(VABaseStore) = compileFinal createHashMapFromArray [
private _command = ["owned:locker:hot:fetch", "owned:locker:hot:init"] select _initialize; private _command = ["owned:locker:hot:fetch", "owned:locker:hot:init"] select _initialize;
_self call ["callHotVArsenal", [_command, [_uid]]] _self call ["callHotVArsenal", [_command, [_uid]]]
}], }],
["isPersistentVArsenalInitialized", compileFinal {
params [["_uid", "", [""]]];
if (_uid isEqualTo "") exitWith { false };
["owned:locker:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
_isSuccess && { _result isEqualTo "true" }
}],
["seedStartingUnlocks", compileFinal {
params [["_uid", "", [""]], ["_arsenal", createHashMap, [createHashMap]]];
if (_uid isEqualTo "" || { _arsenal isEqualTo createHashMap }) exitWith { _arsenal };
private _defaults = GVAR(VArsenalModel) call ["defaults", []];
private _seeded = +_arsenal;
{
_seeded set [_x, +_y];
} forEach _defaults;
private _updated = _self call ["callHotVArsenal", ["owned:locker:hot:override", [_uid, toJSON _seeded]]];
if (_updated isEqualTo createHashMap) exitWith { _seeded };
_self call ["callHotVArsenal", ["owned:locker:hot:save", [_uid]]];
_updated
}],
["init", compileFinal { ["init", compileFinal {
params [["_uid", "", [""]]]; params [["_uid", "", [""]]];
private _player = [_uid] call EFUNC(common,getPlayer); private _player = [_uid] call EFUNC(common,getPlayer);
if (isNull _player) exitWith { createHashMap }; if (isNull _player) exitWith { createHashMap };
private _hasPersistentArsenal = _self call ["isPersistentVArsenalInitialized", [_uid]];
private _arsenal = _self call ["loadHotVArsenal", [_uid, true]]; private _arsenal = _self call ["loadHotVArsenal", [_uid, true]];
if (_arsenal isEqualTo createHashMap) then { if (_arsenal isEqualTo createHashMap) then {
_arsenal = GVAR(VArsenalModel) call ["defaults", []]; _arsenal = GVAR(VArsenalModel) call ["defaults", []];
["ERROR", format ["Failed to initialize virtual arsenal for %1! Using fallback virtual arsenal.", _uid]] call EFUNC(common,log); ["ERROR", format ["Failed to initialize virtual arsenal for %1! Using fallback virtual arsenal.", _uid]] call EFUNC(common,log);
}; };
if !(_hasPersistentArsenal) then {
_arsenal = _self call ["seedStartingUnlocks", [_uid, _arsenal]];
};
[CRPC(locker,responseInitVA), [_arsenal], _player] call CFUNC(targetEvent); [CRPC(locker,responseInitVA), [_arsenal], _player] call CFUNC(targetEvent);
_arsenal _arsenal
@ -88,7 +132,13 @@ GVAR(VABaseStore) = compileFinal createHashMapFromArray [
if (_uid isEqualTo "") exitWith { createHashMap }; if (_uid isEqualTo "") exitWith { createHashMap };
_self call ["callHotVArsenal", ["owned:locker:hot:save", [_uid]]] _self call ["callHotVArsenal", ["owned:locker:hot:save", [_uid]]]
}] }]
]; ]] call {
params ["_base", "_child"];
GVAR(VAStore) = createHashMapObject [GVAR(VABaseStore)]; private _merged = +_base;
GVAR(VAStore) { _merged set [_x, _y]; } forEach _child;
_merged
});
GVAR(VAStore) = createHashMapObject [GVAR(VABaseStore), []];
true

View File

@ -4,6 +4,8 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
PREP_RECOMPILE_END; PREP_RECOMPILE_END;
if (isServer) then { "forge_server" callExtension ["surreal:reconnect", []]; };
GVAR(PlayerBootstrapRegistry) = createHashMap; GVAR(PlayerBootstrapRegistry) = createHashMap;
["forge_icom_event", { ["forge_icom_event", {

View File

@ -17,37 +17,37 @@
*/ */
// Base // Base
if (isNil QEGVAR(common,BaseStore)) then { call EFUNC(common,baseStore); }; if (isNil QEGVAR(common,BaseStore)) then { call EFUNC(common,baseStore); true };
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); }; if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); true };
// Actor // Actor
if (isNil QEGVAR(actor,ActorStore)) then { call EFUNC(actor,initActorStore); }; if (isNil QEGVAR(actor,ActorStore)) then { call EFUNC(actor,initActorStore); true };
// Bank // Bank
if (isNil QEGVAR(bank,BankSessionManager)) then { call EFUNC(bank,initSessionManager); }; if (isNil QEGVAR(bank,BankSessionManager)) then { call EFUNC(bank,initSessionManager); true };
if (isNil QEGVAR(bank,BankMessenger)) then { call EFUNC(bank,initMessenger); }; if (isNil QEGVAR(bank,BankMessenger)) then { call EFUNC(bank,initMessenger); true };
if (isNil QEGVAR(bank,BankModel)) then { call EFUNC(bank,initModel); }; if (isNil QEGVAR(bank,BankModel)) then { call EFUNC(bank,initModel); true };
if (isNil QEGVAR(bank,BankPayloadBuilder)) then { call EFUNC(bank,initPayloadBuilder); }; if (isNil QEGVAR(bank,BankPayloadBuilder)) then { call EFUNC(bank,initPayloadBuilder); true };
if (isNil QEGVAR(bank,BankStore)) then { call EFUNC(bank,initBankStore); }; if (isNil QEGVAR(bank,BankStore)) then { call EFUNC(bank,initBankStore); true };
// Garage // Garage
if (isNil QEGVAR(garage,GarageStore)) then { call EFUNC(garage,initGarageStore); }; if (isNil QEGVAR(garage,GarageStore)) then { call EFUNC(garage,initGarageStore); true };
// VGarage // VGarage
if (isNil QEGVAR(garage,VGarageStore)) then { call EFUNC(garage,initVGStore); }; if (isNil QEGVAR(garage,VGarageStore)) then { call EFUNC(garage,initVGStore); true };
// Locker // Locker
if (isNil QEGVAR(locker,LockerStore)) then { call EFUNC(locker,initLockerStore); }; if (isNil QEGVAR(locker,LockerStore)) then { call EFUNC(locker,initLockerStore); true };
// VArsenal // VArsenal
if (isNil QEGVAR(locker,VAStore)) then { call EFUNC(locker,initVAStore); }; if (isNil QEGVAR(locker,VAStore)) then { call EFUNC(locker,initVAStore); true };
// Org // Org
if (isNil QEGVAR(org,OrgPayloadBuilder)) then { call EFUNC(org,initPayloadBuilder); }; if (isNil QEGVAR(org,OrgPayloadBuilder)) then { call EFUNC(org,initPayloadBuilder); true };
if (isNil QEGVAR(org,OrgStore)) then { call EFUNC(org,initOrgStore); }; if (isNil QEGVAR(org,OrgStore)) then { call EFUNC(org,initOrgStore); true };
// Store // Store
if (isNil QEGVAR(store,StorefrontStore)) then { call EFUNC(store,initStorefrontStore); }; if (isNil QEGVAR(store,StorefrontStore)) then { call EFUNC(store,initStorefrontStore); true };
// Validation Harness // Validation Harness
if (isNil QGVAR(ValidationHarness)) then { call FUNC(initValidationHarness); }; if (isNil QGVAR(ValidationHarness)) then { call FUNC(initValidationHarness); true };

Some files were not shown because too many files have changed in this diff Show More