Compare commits
2 Commits
58902f0c29
...
abde6649ac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abde6649ac | ||
|
|
096418cc78 |
@ -20,7 +20,7 @@ graph TD
|
||||
end
|
||||
|
||||
subgraph Server [ArmA 3 SERVER #40;Hot Cache#41;]
|
||||
ActorRegistry["GVAR(ActorRegistry)<br/>In-Memory HashMap<br/>UID -> {loadout, position, stats...}"]
|
||||
Registry["GVAR(Registry)<br/>In-Memory HashMap<br/>UID -> {loadout, position, stats...}"]
|
||||
SessionMgmt[Session Management<br/>- Token Generation<br/>- UID Resolution<br/>- Player State]
|
||||
end
|
||||
|
||||
@ -125,7 +125,7 @@ flowchart TD
|
||||
subgraph SessionMgmt [SERVER-SIDE #40;Session MGT#41;]
|
||||
Conn[Player Connection] --> Token[Session Token Generation<br/>#40;Generated on server#41;]
|
||||
Token --> UID[UID Resolution<br/>#40;Steam UID mapping#41;]
|
||||
UID --> State[Player State Tracking<br/>#40;Tracked in ActorRegistry#41;]
|
||||
UID --> State[Player State Tracking<br/>#40;Tracked in Registry#41;]
|
||||
State --> Access[Data Access Authorized<br/>#40;Authorized via session#41;]
|
||||
end
|
||||
```
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initActorClass.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2026-01-28
|
||||
* Last Update: 2026-01-31
|
||||
* Last Update: 2026-02-13
|
||||
* Public: Yes
|
||||
*
|
||||
* Description:
|
||||
@ -22,22 +22,22 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(ActorClass) = createHashMapObject [[
|
||||
["#type", "IActorClass"],
|
||||
["#create", {
|
||||
GVAR(ActorBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "ActorBaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["uid", getPlayerUID player];
|
||||
_self set ["actor", createHashMap];
|
||||
_self set ["isLoaded", false];
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["init", {
|
||||
["init", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
[SRPC(actor,requestInitActor), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
systemChat format ["Actor loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:Actor] Actor Class Initialized!";
|
||||
}],
|
||||
["save", {
|
||||
["save", compileFinal {
|
||||
params [["_sync", false, [false]]];
|
||||
|
||||
private _uid = _self get "uid";
|
||||
@ -45,7 +45,7 @@ GVAR(ActorClass) = createHashMapObject [[
|
||||
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["sync", {
|
||||
["sync", compileFinal {
|
||||
params [["_data", createHashMap, [createHashMap]], ["_jip", false, [false]]];
|
||||
|
||||
private _actor = _self get "actor";
|
||||
@ -72,13 +72,13 @@ GVAR(ActorClass) = createHashMapObject [[
|
||||
if !(_isLoaded) then { _self set ["isLoaded", true]; };
|
||||
diag_log "[FORGE:Client:Actor] Sync completed";
|
||||
}],
|
||||
["get", {
|
||||
["get", compileFinal {
|
||||
params [["_key", "", [""]], ["_default", nil, [[], "", 0, false, createHashMap]]];
|
||||
|
||||
private _actor = _self get "actor";
|
||||
_actor getOrDefault [_key, _default];
|
||||
}],
|
||||
["applyPosition", {
|
||||
["applyPosition", compileFinal {
|
||||
private _position = _self call ["get", ["position", [0, 0, 0]]];
|
||||
|
||||
if (GVAR(enableLoc)) then {
|
||||
@ -95,23 +95,23 @@ GVAR(ActorClass) = createHashMapObject [[
|
||||
};
|
||||
};
|
||||
}],
|
||||
["applyDirection", {
|
||||
["applyDirection", compileFinal {
|
||||
private _direction = _self call ["get", ["direction", 0]];
|
||||
if (GVAR(enableLoc)) then { player setDir _direction; };
|
||||
}],
|
||||
["applyStance", {
|
||||
["applyStance", compileFinal {
|
||||
private _stance = _self call ["get", ["stance", "STAND"]];
|
||||
if (GVAR(enableLoc)) then { player playAction _stance; };
|
||||
}],
|
||||
["applyRank", {
|
||||
["applyRank", compileFinal {
|
||||
private _rank = _self call ["get", ["rank", "PRIVATE"]];
|
||||
player setUnitRank _rank;
|
||||
}],
|
||||
["applyLoadout", {
|
||||
["applyLoadout", compileFinal {
|
||||
private _loadout = _self call ["get", ["loadout", []]];
|
||||
if (GVAR(enableGear) && count _loadout > 0) then { player setUnitLoadout _loadout; };
|
||||
}],
|
||||
["getNearbyActions", {
|
||||
["getNearbyActions", compileFinal {
|
||||
params [["_control", controlNull, [controlNull]]];
|
||||
|
||||
private _nearbyActions = [];
|
||||
@ -136,6 +136,7 @@ GVAR(ActorClass) = createHashMapObject [[
|
||||
|
||||
_control ctrlWebBrowserAction ["ExecJS", format ["updateAvailableActions(%1)", (toJSON _nearbyActions)]];
|
||||
}]
|
||||
]];
|
||||
];
|
||||
|
||||
GVAR(ActorClass) = createHashMapObject [GVAR(ActorBaseClass)];
|
||||
GVAR(ActorClass)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_handleUIEvents.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-16
|
||||
* Last Update: 2026-01-30
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -27,13 +27,13 @@ params ["_control", "_isConfirmDialog", "_message"];
|
||||
private _alert = fromJSON _message;
|
||||
private _event = _alert get "event";
|
||||
private _data = _alert get "data";
|
||||
// private _display = displayChild findDisplay 46;
|
||||
|
||||
private _uid = GVAR(BankClass) get "uid";
|
||||
private _account = GVAR(BankClass) get "account";
|
||||
private _cash = _account get "cash";
|
||||
private _bank = _account get "bank";
|
||||
private _cash = _account get "cash";
|
||||
private _pin = _account get "pin";
|
||||
private _funds = EGVAR(org,OrgClass) get "funds";
|
||||
|
||||
diag_log format ["[FORGE:Client:Bank] Handling UI event: %1 with data: %2", _event, _data];
|
||||
|
||||
@ -42,13 +42,12 @@ switch (_event) do {
|
||||
// DATA REQUESTS
|
||||
// ========================================================================
|
||||
case "bank::sync": {
|
||||
private _org = 0; // TODO: Get org balance
|
||||
private _players = SREG(bank,IndexRegistry);
|
||||
private _accountData = createHashMapFromArray [
|
||||
["uid", _uid],
|
||||
["cash", _cash],
|
||||
["bank", _bank],
|
||||
["org", _org],
|
||||
["org", _funds],
|
||||
["pin", _pin],
|
||||
["players", _players]
|
||||
];
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initBankClass.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-16
|
||||
* Last Update: 2026-01-31
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -21,15 +21,15 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(BankClass) = createHashMapObject [[
|
||||
["#type", "IBankClass"],
|
||||
["#create", {
|
||||
GVAR(BankBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "BankBaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["uid", getPlayerUID player];
|
||||
_self set ["account", createHashMap];
|
||||
_self set ["isLoaded", false];
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["init", {
|
||||
["init", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
|
||||
[SRPC(bank,requestInitBank), [_uid]] call CFUNC(serverEvent);
|
||||
@ -37,7 +37,7 @@ GVAR(BankClass) = createHashMapObject [[
|
||||
systemChat format ["Bank loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:Bank] Bank Class Initialized!";
|
||||
}],
|
||||
["save", {
|
||||
["save", compileFinal {
|
||||
params [["_sync", false, [false]]];
|
||||
|
||||
private _uid = _self get "uid";
|
||||
@ -45,27 +45,25 @@ GVAR(BankClass) = createHashMapObject [[
|
||||
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["sync", {
|
||||
["sync", compileFinal {
|
||||
params [["_data", createHashMap, [createHashMap]], ["_jip", false, [false]]];
|
||||
|
||||
private _account = _self get "account";
|
||||
private _isLoaded = _self get "isLoaded";
|
||||
|
||||
{
|
||||
_account set [_x, _y];
|
||||
} forEach _data;
|
||||
|
||||
{ _account set [_x, _y]; } forEach _data;
|
||||
_self set ["account", _account];
|
||||
|
||||
if !(_isLoaded) then { _self set ["isLoaded", true]; };
|
||||
diag_log "[FORGE:Client:Bank] Sync completed";
|
||||
}],
|
||||
["get", {
|
||||
["get", compileFinal {
|
||||
params [["_key", "", [""]], ["_default", nil, [[], "", 0, false, createHashMap]]];
|
||||
|
||||
private _account = _self get "account";
|
||||
_account getOrDefault [_key, _default];
|
||||
}]
|
||||
]];
|
||||
];
|
||||
|
||||
GVAR(BankClass) = createHashMapObject [GVAR(BankBaseClass)];
|
||||
GVAR(BankClass)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(GarageClass)) then { call FUNC(initGarageClass); };
|
||||
if (isNil QGVAR(VGarageClass)) then { call FUNC(initVGClass); };
|
||||
if (isNil QGVAR(VGClass)) then { call FUNC(initVGClass); };
|
||||
|
||||
[QGVAR(initGarage), {
|
||||
GVAR(GarageClass) call ["init", []];
|
||||
@ -20,19 +20,19 @@ if (isNil QGVAR(VGarageClass)) then { call FUNC(initVGClass); };
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(initVG), {
|
||||
GVAR(VGarageClass) call ["init", []];
|
||||
GVAR(VGClass) call ["init", []];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(responseInitVG), {
|
||||
params [["_data", createHashMap, [createHashMap]]];
|
||||
|
||||
GVAR(VGarageClass) call ["sync", [_data, true]];
|
||||
GVAR(VGClass) call ["sync", [_data, true]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(responseSyncVG), {
|
||||
params [["_data", createHashMap, [createHashMap, []]], ["_jip", false, [false]]];
|
||||
|
||||
GVAR(VGarageClass) call ["sync", [_data, _jip]];
|
||||
GVAR(VGClass) call ["sync", [_data, _jip]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[{
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initGarageClass.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-01-31
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -22,15 +22,15 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(GarageClass) = createHashMapObject [[
|
||||
["#type", "IGarageClass"],
|
||||
["#create", {
|
||||
GVAR(GarageBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "GarageBaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["uid", (getPlayerUID player)];
|
||||
_self set ["garage", createHashMap];
|
||||
_self set ["isLoaded", false];
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["init", {
|
||||
["init", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
private _garage = _self get "garage";
|
||||
|
||||
@ -39,13 +39,13 @@ GVAR(GarageClass) = createHashMapObject [[
|
||||
systemChat format ["Garage loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:Garage] Garage Class Initialized!";
|
||||
}],
|
||||
["save", {
|
||||
["save", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
[SRPC(garage,requestSaveGarage), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["sync", {
|
||||
["sync", compileFinal {
|
||||
params [["_data", createHashMap, [createHashMap]]];
|
||||
|
||||
private _garage = _self get "garage";
|
||||
@ -57,12 +57,13 @@ GVAR(GarageClass) = createHashMapObject [[
|
||||
if !(_isLoaded) then { _self set ["isLoaded", true]; };
|
||||
diag_log "[FORGE:Client:Garage] Sync completed";
|
||||
}],
|
||||
["get", {
|
||||
["get", compileFinal {
|
||||
params [["_key", "", [""]], ["_default", nil, [[], "", 0, false, createHashMap]]];
|
||||
|
||||
private _garage = _self get "garage";
|
||||
_garage getOrDefault [_key, _default];
|
||||
}]
|
||||
]];
|
||||
];
|
||||
|
||||
GVAR(GarageClass) = createHashMapObject [GVAR(GarageBaseClass)];
|
||||
GVAR(GarageClass)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initVGClass.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-16
|
||||
* Last Update: 2026-01-31
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(VGarageClass) = createHashMapObject [[
|
||||
["#type", "IVGarageClass"],
|
||||
["#create", {
|
||||
GVAR(VGBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "VGBaseClass"],
|
||||
["#create", compileFinal {
|
||||
GVAR(isPreLoaded) = false;
|
||||
|
||||
_self set ["uid", (getPlayerUID player)];
|
||||
@ -32,7 +32,7 @@ GVAR(VGarageClass) = createHashMapObject [[
|
||||
_self set ["isLoaded", false];
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["init", {
|
||||
["init", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
private _vGarage = _self get "vGarage";
|
||||
|
||||
@ -41,13 +41,13 @@ GVAR(VGarageClass) = createHashMapObject [[
|
||||
systemChat format ["VGarage loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:VGarage] VGarage Class Initialized!";
|
||||
}],
|
||||
["save", {
|
||||
["save", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
[SRPC(garage,requestSaveVG), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["sync", {
|
||||
["sync", compileFinal {
|
||||
params [["_data", createHashMap, [createHashMap]], ["_jip", false, [false]]];
|
||||
|
||||
private _vGarage = _self get "vGarage";
|
||||
@ -74,13 +74,13 @@ GVAR(VGarageClass) = createHashMapObject [[
|
||||
if !(_isLoaded) then { _self set ["isLoaded", true]; };
|
||||
diag_log "[FORGE:Client:VGarage] Sync completed";
|
||||
}],
|
||||
["get", {
|
||||
["get", compileFinal {
|
||||
params [["_key", "", [""]], ["_default", nil, [[], "", 0, false, createHashMap]]];
|
||||
|
||||
private _vGarage = _self get "vGarage";
|
||||
_vGarage getOrDefault [_key, _default];
|
||||
}],
|
||||
["apply", {
|
||||
["apply", compileFinal {
|
||||
params [["_key", "", [""]]];
|
||||
|
||||
private _vehicles = _self call ["get", [_key, []]];
|
||||
@ -98,6 +98,7 @@ GVAR(VGarageClass) = createHashMapObject [[
|
||||
_array append [getText (configFile >> "CfgVehicles" >> _x >> "model"), [configFile >> "CfgVehicles" >> _x]];
|
||||
} forEach _vehicles;
|
||||
}]
|
||||
]];
|
||||
];
|
||||
|
||||
GVAR(VGarageClass)
|
||||
GVAR(VGClass) = createHashMapObject [GVAR(VGBaseClass)];
|
||||
GVAR(VGClass)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(LockerClass)) then { call FUNC(initLockerClass); };
|
||||
if (isNil QGVAR(VArsenalClass)) then { call FUNC(initVAClass); };
|
||||
if (isNil QGVAR(VAClass)) then { call FUNC(initVAClass); };
|
||||
|
||||
[QGVAR(initLocker), {
|
||||
GVAR(LockerClass) call ["init", []];
|
||||
@ -20,19 +20,19 @@ if (isNil QGVAR(VArsenalClass)) then { call FUNC(initVAClass); };
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(initVA), {
|
||||
GVAR(VArsenalClass) call ["init", []];
|
||||
GVAR(VAClass) call ["init", []];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(responseInitVA), {
|
||||
params [["_data", createHashMap, [createHashMap]]];
|
||||
|
||||
GVAR(VArsenalClass) call ["sync", [_data, true]];
|
||||
GVAR(VAClass) call ["sync", [_data, true]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(responseSyncVA), {
|
||||
params [["_data", createHashMap, [createHashMap, []]], ["_jip", false, [false]]];
|
||||
|
||||
GVAR(VArsenalClass) call ["sync", [_data, _jip]];
|
||||
GVAR(VAClass) call ["sync", [_data, _jip]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[{
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initLockerClass.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-02-05
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -22,15 +22,29 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
["#type", "LockerRepository"],
|
||||
["get", {
|
||||
GVAR(LockerBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "LockerBaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["uid", (getPlayerUID player)];
|
||||
_self set ["isLoaded", false];
|
||||
_self set ["lastSave", time];
|
||||
_self set ["locker", createHashMap];
|
||||
}],
|
||||
["init", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
|
||||
[SRPC(locker,requestInitLocker), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
systemChat format ["Locker loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:Locker] Locker Class Initialized!";
|
||||
}],
|
||||
["get", compileFinal {
|
||||
params [["_key", "", [""]], ["_default", nil, [[], "", 0, false, createHashMap]]];
|
||||
|
||||
private _locker = _self get "locker";
|
||||
_locker getOrDefault [_key, _default];
|
||||
}],
|
||||
["getCargo", {
|
||||
["getCargo", compileFinal {
|
||||
params [["_container", objNull, [objNull]], ["_locker", createHashMap, [createHashMap]]];
|
||||
|
||||
private _cargoData = [
|
||||
@ -58,7 +72,7 @@ GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
|
||||
_locker
|
||||
}],
|
||||
["getContainerItems", {
|
||||
["getContainerItems", compileFinal {
|
||||
params [["_container", objNull, [objNull]], ["_locker", createHashMap, [createHashMap]]];
|
||||
|
||||
private _allContainers = everyContainer _container;
|
||||
@ -122,7 +136,7 @@ GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
|
||||
_locker
|
||||
}],
|
||||
["getAttachments", {
|
||||
["getAttachments", compileFinal {
|
||||
params [["_container", objNull, [objNull]], ["_locker", createHashMap, [createHashMap]]];
|
||||
|
||||
private _weaponItems = weaponsItemsCargo _container;
|
||||
@ -178,13 +192,13 @@ GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
|
||||
_locker
|
||||
}],
|
||||
["save", {
|
||||
["save", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
[SRPC(locker,requestSaveLocker), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["setEventHandlers", {
|
||||
["setEventHandlers", compileFinal {
|
||||
params [["_locker", objNull, [objNull]]];
|
||||
|
||||
_locker addEventHandler ["ContainerOpened", {
|
||||
@ -235,7 +249,7 @@ GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
};
|
||||
}];
|
||||
}],
|
||||
["setup", {
|
||||
["setup", compileFinal {
|
||||
private _lockers = (allVariables missionNamespace) select {
|
||||
private _var = missionNamespace getVariable _x;
|
||||
("locker" in _x) && { _var isEqualType objNull } && { !isNull _var } && { _x isNotEqualTo "forge_locker_box" }
|
||||
@ -267,7 +281,7 @@ GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
_self call ["setEventHandlers", [_localLocker]];
|
||||
} forEach _lockers;
|
||||
}],
|
||||
["sync", {
|
||||
["sync", compileFinal {
|
||||
params [["_data", createHashMap, [createHashMap]]];
|
||||
|
||||
private _isLoaded = _self get "isLoaded";
|
||||
@ -281,23 +295,5 @@ GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(LockerClass) = createHashMapObject [[
|
||||
["#base", GVAR(LockerRepository)],
|
||||
["#type", "ILockerClass"],
|
||||
["#create", {
|
||||
_self set ["uid", (getPlayerUID player)];
|
||||
_self set ["isLoaded", false];
|
||||
_self set ["lastSave", time];
|
||||
_self set ["locker", createHashMap];
|
||||
}],
|
||||
["init", {
|
||||
private _uid = _self get "uid";
|
||||
|
||||
[SRPC(locker,requestInitLocker), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
systemChat format ["Locker loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:Locker] Locker Class Initialized!";
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(LockerClass) = createHashMapObject [GVAR(LockerBaseClass)];
|
||||
GVAR(LockerClass)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* File: fnc_initVAClass.sqf
|
||||
* File: fnc_init.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-16
|
||||
* Last Update: 2026-02-05
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -18,34 +18,33 @@
|
||||
* vArsenal class object [HASHMAP OBJECT]
|
||||
*
|
||||
* Example:
|
||||
* call forge_client_locker_fnc_initVAClass;
|
||||
* call forge_client_locker_fnc_init;
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(VArsenalClass) = createHashMapObject [[
|
||||
["#type", "IVArsenalClass"],
|
||||
["#create", {
|
||||
GVAR(VABaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "VABaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["uid", (getPlayerUID player)];
|
||||
_self set ["vArsenal", createHashMap];
|
||||
_self set ["isLoaded", false];
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["init", {
|
||||
["init", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
|
||||
FORGE_Locker_Box = "ReammoBox_F" createVehicleLocal [0, 0, -999];
|
||||
[SRPC(locker,requestInitVA), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
systemChat format ["VArsenal loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:VArsenal] VArsenal Class Initialized!";
|
||||
}],
|
||||
["save", {
|
||||
["save", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
[SRPC(locker,requestSaveVA), [_uid]] call CFUNC(serverEvent);
|
||||
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["sync", {
|
||||
["sync", compileFinal {
|
||||
params [["_data", createHashMap, [createHashMap]], ["_jip", false, [false]]];
|
||||
|
||||
private _vArsenal = _self get "vArsenal";
|
||||
@ -70,28 +69,29 @@ GVAR(VArsenalClass) = createHashMapObject [[
|
||||
if !(_isLoaded) then { _self set ["isLoaded", true]; };
|
||||
diag_log "[FORGE:Client:VArsenal] Sync completed";
|
||||
}],
|
||||
["get", {
|
||||
["get", compileFinal {
|
||||
params [["_key", "", [""]], ["_default", nil, [[], "", 0, false, createHashMap]]];
|
||||
|
||||
private _vArsenal = _self get "vArsenal";
|
||||
_vArsenal getOrDefault [_key, _default];
|
||||
}],
|
||||
["applyItems", {
|
||||
["applyItems", compileFinal {
|
||||
private _items = _self call ["get", ["items", []]];
|
||||
[FORGE_Locker_Box, _items] call AFUNC(arsenal,addVirtualItems);
|
||||
}],
|
||||
["applyWeapons", {
|
||||
["applyWeapons", compileFinal {
|
||||
private _weapons = _self call ["get", ["weapons", []]];
|
||||
[FORGE_Locker_Box, _weapons] call AFUNC(arsenal,addVirtualItems);
|
||||
}],
|
||||
["applyMagazines", {
|
||||
["applyMagazines", compileFinal {
|
||||
private _magazines = _self call ["get", ["magazines", []]];
|
||||
[FORGE_Locker_Box, _magazines] call AFUNC(arsenal,addVirtualItems);
|
||||
}],
|
||||
["applyBackpacks", {
|
||||
["applyBackpacks", compileFinal {
|
||||
private _backpacks = _self call ["get", ["backpacks", []]];
|
||||
[FORGE_Locker_Box, _backpacks] call AFUNC(arsenal,addVirtualItems);
|
||||
}]
|
||||
]];
|
||||
];
|
||||
|
||||
GVAR(VArsenalClass)
|
||||
GVAR(VAClass) = createHashMapObject [GVAR(VABaseClass)];
|
||||
GVAR(VAClass)
|
||||
|
||||
@ -1,25 +1,29 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* File: fnc_initOrgClass.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2026-02-13
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
* Initializes the org class.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
* Org class object [HASHMAP OBJECT]
|
||||
*
|
||||
* Examples:
|
||||
* call forge_client_org_fnc_initOrgClass
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(OrgClass) = createHashMapObject [[
|
||||
["#type", "IOrgClass"],
|
||||
["#create", {
|
||||
GVAR(OrgBaseClass) = compileFinal createHashMapFromArray [
|
||||
["#type", "OrgBaseClass"],
|
||||
["#create", compileFinal {
|
||||
_self set ["uid", getPlayerUID player];
|
||||
_self set ["org", createHashMap];
|
||||
_self set ["isLoaded", false];
|
||||
@ -36,7 +40,7 @@ GVAR(OrgClass) = createHashMapObject [[
|
||||
|
||||
_self set ["org", _org];
|
||||
}],
|
||||
["init", {
|
||||
["init", compileFinal {
|
||||
private _uid = _self get "uid";
|
||||
private _org = _self get "org";
|
||||
|
||||
@ -45,7 +49,7 @@ GVAR(OrgClass) = createHashMapObject [[
|
||||
systemChat format ["Org loaded for %1", (name player)];
|
||||
diag_log "[FORGE:Client:Org] Org Class Initialized!";
|
||||
}],
|
||||
["save", {
|
||||
["save", compileFinal {
|
||||
params [["_sync", false, [false]]];
|
||||
|
||||
private _uid = _self get "uid";
|
||||
@ -53,7 +57,7 @@ GVAR(OrgClass) = createHashMapObject [[
|
||||
|
||||
_self set ["lastSave", time];
|
||||
}],
|
||||
["sync", {
|
||||
["sync", compileFinal {
|
||||
params [["_data", createHashMap, [createHashMap]], ["_jip", false, [false]]];
|
||||
|
||||
private _isLoaded = _self get "isLoaded";
|
||||
@ -65,12 +69,13 @@ GVAR(OrgClass) = createHashMapObject [[
|
||||
if !(_isLoaded) then { _self set ["isLoaded", true]; };
|
||||
diag_log "[FORGE:Client:Org] Sync completed";
|
||||
}],
|
||||
["get", {
|
||||
["get", compileFinal {
|
||||
params [["_key", "", [""]], ["_default", nil, [[], "", 0, false, createHashMap]]];
|
||||
|
||||
private _org = _self get "org";
|
||||
_org getOrDefault [_key, _default];
|
||||
}]
|
||||
]];
|
||||
];
|
||||
|
||||
GVAR(OrgClass) = createHashMapObject [GVAR(OrgBaseClass)];
|
||||
GVAR(OrgClass)
|
||||
|
||||
@ -14,22 +14,22 @@ PREP_RECOMPILE_END;
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestGetActor), {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Actor] Empty/Invalid UID!" };
|
||||
|
||||
private _finalData = GVAR(ActorStore) call ["get", [GVAR(ActorRegistry), "actor:get", _uid, _sync]];
|
||||
private _finalData = GVAR(ActorStore) call ["get", [GVAR(Registry), _uid, _field]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(actor,responseSyncActor), [_finalData], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSetActor), {
|
||||
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
|
||||
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Actor] Empty/Invalid UID or Key!" };
|
||||
if (_uid isEqualTo "" || _field isEqualTo "") exitWith { diag_log "[FORGE:Server:Actor] Empty/Invalid UID or Key!" };
|
||||
|
||||
private _hashMap = GVAR(ActorStore) call ["set", [GVAR(ActorRegistry), "actor:update", _uid, _key, _value, _sync]];
|
||||
private _hashMap = GVAR(ActorStore) call ["set", [GVAR(Registry), "actor:update", _uid, _field, _value, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(actor,responseSyncActor), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -41,18 +41,18 @@ PREP_RECOMPILE_END;
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Actor] Empty/Invalid UID!" };
|
||||
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Actor] Empty/Invalid field pairs!" };
|
||||
|
||||
private _hashMap = GVAR(ActorStore) call ["mset", [GVAR(ActorRegistry), "actor:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _hashMap = GVAR(ActorStore) call ["mset", [GVAR(Registry), "actor:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(actor,responseSyncActor), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSaveActor), {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Actor] Empty/Invalid UID!" };
|
||||
|
||||
private _finalData = GVAR(ActorStore) call ["save", [GVAR(ActorRegistry), "actor:update", _uid, _sync]];
|
||||
private _finalData = GVAR(ActorStore) call ["save", [GVAR(Registry), "actor:update", _uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(actor,responseSyncActor), [_finalData], _player] call CFUNC(targetEvent);
|
||||
@ -62,5 +62,5 @@ PREP_RECOMPILE_END;
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Actor] Empty/Invalid UID!" };
|
||||
GVAR(ActorStore) call ["remove", [GVAR(ActorRegistry), _uid]];
|
||||
GVAR(ActorStore) call ["remove", [GVAR(Registry), _uid]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initActorStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-01-30
|
||||
* Last Update: 2026-02-13
|
||||
* Public: Yes
|
||||
*
|
||||
* Description:
|
||||
@ -24,7 +24,7 @@
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(ActorModel) = compileFinal createHashMapObject [[
|
||||
["#type", "ActorModel"],
|
||||
["defaults", {
|
||||
["defaults", compileFinal {
|
||||
private _actor = createHashMap;
|
||||
|
||||
_actor set ["uid", ""];
|
||||
@ -42,7 +42,7 @@ GVAR(ActorModel) = compileFinal createHashMapObject [[
|
||||
|
||||
_actor
|
||||
}],
|
||||
["fromPlayer", {
|
||||
["fromPlayer", compileFinal {
|
||||
params [["_player", objNull, [objNull]]];
|
||||
|
||||
if (_player isEqualTo objNull) exitWith { _self call ["defaults", []] };
|
||||
@ -59,7 +59,7 @@ GVAR(ActorModel) = compileFinal createHashMapObject [[
|
||||
|
||||
_actor
|
||||
}],
|
||||
["migrate", {
|
||||
["migrate", compileFinal {
|
||||
params [["_actor", createHashMap, [createHashMap]]];
|
||||
|
||||
private _defaults = _self call ["defaults", []];
|
||||
@ -70,7 +70,7 @@ GVAR(ActorModel) = compileFinal createHashMapObject [[
|
||||
|
||||
_actor
|
||||
}],
|
||||
["validate", {
|
||||
["validate", compileFinal {
|
||||
params [["_actor", createHashMap, [createHashMap]]];
|
||||
|
||||
private _uid = _actor getOrDefault ["uid", ""];
|
||||
@ -104,17 +104,17 @@ GVAR(ActorModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(ActorRepository) = compileFinal createHashMapFromArray [
|
||||
GVAR(ActorBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
["#type", "ActorRepository"],
|
||||
["#create", {
|
||||
GVAR(ActorRegistry) = createHashMap;
|
||||
["INFO", "Actor Repository Initialized!"] call EFUNC(common,log);
|
||||
["#type", "ActorBaseStore"],
|
||||
["#create", compileFinal {
|
||||
GVAR(Registry) = createHashMap;
|
||||
["INFO", "Actor Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["get", {
|
||||
["init", compileFinal {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _cached = GVAR(ActorRegistry) getOrDefault [_uid, nil];
|
||||
private _cached = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if !(isNil { _cached }) exitWith { _cached };
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
@ -145,27 +145,12 @@ GVAR(ActorRepository) = compileFinal createHashMapFromArray [
|
||||
};
|
||||
|
||||
_finalActor = GVAR(ActorModel) call ["migrate", [_finalActor]];
|
||||
GVAR(ActorRegistry) set [_uid, _finalActor];
|
||||
_finalActor
|
||||
GVAR(Registry) set [_uid, _finalActor];
|
||||
|
||||
[CRPC(actor,responseInitActor), [_finalActor], _player] call CFUNC(targetEvent);
|
||||
_finalActor
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(ActorStore) = createHashMapObject [[
|
||||
["#base", GVAR(ActorRepository)],
|
||||
["#type", "IActorStore"],
|
||||
["#create", {
|
||||
["INFO", "Actor Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["init", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _actor = _self call ["get", [_uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(actor,responseInitActor), [_actor], _player] call CFUNC(targetEvent);
|
||||
_actor
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(ActorStore) = createHashMapObject [GVAR(ActorBaseStore)];
|
||||
GVAR(ActorStore)
|
||||
|
||||
@ -14,18 +14,22 @@ PREP_RECOMPILE_END;
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestGetBank), {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Bank] Empty/Invalid UID!" };
|
||||
GVAR(BankStore) call ["get", [GVAR(BankRegistry), "bank:get", _uid, _sync]];
|
||||
|
||||
private _finalData = GVAR(BankStore) call ["get", [GVAR(Registry), _uid, _field]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseSyncBank), [_finalData], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSetBank), {
|
||||
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
|
||||
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Bank] Empty/Invalid UID or Key!" };
|
||||
if (_uid isEqualTo "" || _field isEqualTo "") exitWith { diag_log "[FORGE:Server:Bank] Empty/Invalid UID or Key!" };
|
||||
|
||||
private _hashMap = GVAR(BankStore) call ["set", [GVAR(BankRegistry), "bank:update", _uid, _key, _value, _sync]];
|
||||
private _hashMap = GVAR(BankStore) call ["set", [GVAR(Registry), "bank:update", _uid, _field, _value, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseSyncBank), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -37,18 +41,18 @@ PREP_RECOMPILE_END;
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Bank] Empty/Invalid UID!" };
|
||||
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Bank] Empty/Invalid field pairs!" };
|
||||
|
||||
private _hashMap = GVAR(BankStore) call ["mset", [GVAR(BankRegistry), "bank:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _hashMap = GVAR(BankStore) call ["mset", [GVAR(Registry), "bank:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseSyncBank), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSaveBank), {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Bank] Empty/Invalid UID!" };
|
||||
|
||||
private _finalData = GVAR(BankStore) call ["save", [GVAR(BankRegistry), "bank:update", _uid, _sync]];
|
||||
private _finalData = GVAR(BankStore) call ["save", [GVAR(Registry), "bank:update", _uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseSyncBank), [_finalData], _player] call CFUNC(targetEvent);
|
||||
@ -58,7 +62,7 @@ PREP_RECOMPILE_END;
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Bank] Empty/Invalid UID!" };
|
||||
GVAR(BankStore) call ["remove", [GVAR(BankRegistry), _uid]];
|
||||
GVAR(BankStore) call ["remove", [GVAR(Registry), _uid]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestDeposit), {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initBankStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-01-30
|
||||
* Last Update: 2026-02-13
|
||||
* Public: Yes
|
||||
*
|
||||
* Description:
|
||||
@ -24,7 +24,7 @@
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(BankModel) = compileFinal createHashMapObject [[
|
||||
["#type", "BankModel"],
|
||||
["defaults", {
|
||||
["defaults", compileFinal {
|
||||
private _account = createHashMap;
|
||||
|
||||
_account set ["uid", ""];
|
||||
@ -37,7 +37,7 @@ GVAR(BankModel) = compileFinal createHashMapObject [[
|
||||
|
||||
_account
|
||||
}],
|
||||
["fromPlayer", {
|
||||
["fromPlayer", compileFinal {
|
||||
params [["_player", objNull, [objNull]]];
|
||||
|
||||
if (_player isEqualTo objNull) exitWith { _self call ["defaults", []] };
|
||||
@ -54,7 +54,7 @@ GVAR(BankModel) = compileFinal createHashMapObject [[
|
||||
|
||||
_account
|
||||
}],
|
||||
["migrate", {
|
||||
["migrate", compileFinal {
|
||||
params [["_account", createHashMap, [createHashMap]]];
|
||||
|
||||
private _defaults = _self call ["defaults", []];
|
||||
@ -65,7 +65,7 @@ GVAR(BankModel) = compileFinal createHashMapObject [[
|
||||
|
||||
_account
|
||||
}],
|
||||
["validate", {
|
||||
["validate", compileFinal {
|
||||
params [["_account", createHashMap, [createHashMap]]];
|
||||
|
||||
private _uid = _account getOrDefault ["uid", ""];
|
||||
@ -91,18 +91,18 @@ GVAR(BankModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(BankRepository) = compileFinal createHashMapFromArray [
|
||||
GVAR(BankBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
["#type", "BankRepository"],
|
||||
["#create", {
|
||||
GVAR(BankRegistry) = createHashMap;
|
||||
["#type", "BankBaseStore"],
|
||||
["#create", compileFinal {
|
||||
GVAR(IndexRegistry) = createHashMap;
|
||||
["INFO", "Bank Repository Initialized!"] call EFUNC(common,log);
|
||||
GVAR(Registry) = createHashMap;
|
||||
["INFO", "Bank Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["get", {
|
||||
["init", compileFinal {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _cached = GVAR(BankRegistry) getOrDefault [_uid, nil];
|
||||
private _cached = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if !(isNil { _cached }) exitWith { _cached };
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
@ -137,15 +137,17 @@ GVAR(BankRepository) = compileFinal createHashMapFromArray [
|
||||
GVAR(IndexRegistry) set [_uid, _regEntry];
|
||||
|
||||
// _finalAccount = GVAR(BankModel) call ["migrate", [_finalAccount]];
|
||||
GVAR(BankRegistry) set [_uid, _finalAccount];
|
||||
GVAR(Registry) set [_uid, _finalAccount];
|
||||
[CRPC(bank,responseInitBank), [_finalAccount], _player] call CFUNC(targetEvent);
|
||||
|
||||
_finalAccount
|
||||
}],
|
||||
["deposit", {
|
||||
["deposit", compileFinal {
|
||||
params [["_uid", "", [""]], ["_amount", 0, [0]]];
|
||||
|
||||
["INFO", format ["Deposit %1, for %2", _amount, _uid]] call EFUNC(common,log);
|
||||
|
||||
private _account = GVAR(BankRegistry) getOrDefault [_uid, nil];
|
||||
private _account = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if (isNil "_account") exitWith { ["ERROR", "Empty/Invalid Account!"] call EFUNC(common,log); };
|
||||
|
||||
private _bank = _account getOrDefault ["bank", 0];
|
||||
@ -153,42 +155,37 @@ GVAR(BankRepository) = compileFinal createHashMapFromArray [
|
||||
if (_cash < _amount) exitWith { ["WARNING", "Insufficient Funds!"] call EFUNC(common,log); };
|
||||
|
||||
private _finalAccount = createHashMapFromArray [["bank", (_bank + _amount)], ["cash", (_cash - _amount)]];
|
||||
_self call ["mset", [_uid, _finalAccount]];
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseSyncBank), [_finalAccount], _player] call CFUNC(targetEvent);
|
||||
[CRPC(notifications,recieveNotification), ["info", "Bank", format ["Deposited $%1", _amount]], _player] call CFUNC(targetEvent);
|
||||
}],
|
||||
["payment", {
|
||||
["payment", compileFinal {
|
||||
params [["_uid", "", [""]], ["_amount", 0, [0]]];
|
||||
|
||||
["INFO", format ["Payment %1, for %2", _amount, _uid]] call EFUNC(common,log);
|
||||
|
||||
private _account = GVAR(BankRegistry) getOrDefault [_uid, nil];
|
||||
private _account = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if (isNil "_account") exitWith { ["ERROR", "Empty/Invalid Account!"] call EFUNC(common,log); };
|
||||
|
||||
private _bank = _account getOrDefault ["bank", 0];
|
||||
private _finalAccount = createHashMapFromArray [["bank", (_bank + _amount)]];
|
||||
|
||||
_self call ["mset", [_uid, _finalAccount]];
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseSyncBank), [_finalAccount], _player] call CFUNC(targetEvent);
|
||||
[CRPC(notifications,recieveNotification), ["info", "Bank", format ["Paid $%1", _amount]], _player] call CFUNC(targetEvent);
|
||||
}],
|
||||
["transfer", {
|
||||
["transfer", compileFinal {
|
||||
params [["_uid", "", [""]], ["_target", "", [""]], ["_from", "", [""]], ["_amount", 0, [0]]];
|
||||
|
||||
if (_uid isEqualTo _target) exitWith {
|
||||
["WARNING", format ["Self-transfer attempt blocked for %1", _uid]] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
private _account = GVAR(BankRegistry) getOrDefault [_uid, nil];
|
||||
private _account = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if (isNil "_account") exitWith { ["ERROR", "Empty/Invalid Account!"] call EFUNC(common,log); };
|
||||
|
||||
private _targetAccount = GVAR(BankRegistry) getOrDefault [_target, nil];
|
||||
private _targetAccount = GVAR(Registry) getOrDefault [_target, nil];
|
||||
if (isNil "_targetAccount") exitWith { ["ERROR", "Empty/Invalid Target Account!"] call EFUNC(common,log); };
|
||||
|
||||
private _bank = _account getOrDefault [_from, 0];
|
||||
@ -198,9 +195,6 @@ GVAR(BankRepository) = compileFinal createHashMapFromArray [
|
||||
private _finalAccount = createHashMapFromArray [[_from, (_bank - _amount)]];
|
||||
private _finalTargetBank = createHashMapFromArray [["bank", (_targetBank + _amount)]];
|
||||
|
||||
_self call ["mset", [_uid, _finalAccount]];
|
||||
_self call ["mset", [_target, _finalTargetBank]];
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
private _targetPlayer = [_target] call EFUNC(common,getPlayer);
|
||||
|
||||
@ -209,12 +203,12 @@ GVAR(BankRepository) = compileFinal createHashMapFromArray [
|
||||
[CRPC(notifications,recieveNotification), ["info", "Bank", format ["Transferred $%1 to %2", _amount, (name _targetPlayer)]], _player] call CFUNC(targetEvent);
|
||||
[CRPC(notifications,recieveNotification), ["info", "Bank", format ["Received $%1 from %2", _amount, (name _player)]], _targetPlayer] call CFUNC(targetEvent);
|
||||
}],
|
||||
["withdraw", {
|
||||
["withdraw", compileFinal {
|
||||
params [["_uid", "", [""]], ["_amount", 0, [0]]];
|
||||
|
||||
["INFO", format ["Withdraw %1, for %2", _amount, _uid]] call EFUNC(common,log);
|
||||
|
||||
private _account = GVAR(BankRegistry) getOrDefault [_uid, nil];
|
||||
private _account = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if (isNil "_account") exitWith { ["ERROR", "Empty/Invalid Account!"] call EFUNC(common,log); };
|
||||
|
||||
private _bank = _account getOrDefault ["bank", 0];
|
||||
@ -222,8 +216,6 @@ GVAR(BankRepository) = compileFinal createHashMapFromArray [
|
||||
if (_bank < _amount) exitWith { ["WARNING", "Insufficient Funds!"] call EFUNC(common,log); };
|
||||
|
||||
private _finalAccount = createHashMapFromArray [["bank", (_bank - _amount)], ["cash", (_cash + _amount)]];
|
||||
_self call ["mset", [_uid, _finalAccount]];
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseSyncBank), [_finalAccount], _player] call CFUNC(targetEvent);
|
||||
@ -231,20 +223,5 @@ GVAR(BankRepository) = compileFinal createHashMapFromArray [
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(BankStore) = createHashMapObject [[
|
||||
["#base", GVAR(BankRepository)],
|
||||
["#type", "IBankStore"],
|
||||
["#create", {
|
||||
["INFO", "Bank Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["init", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _account = _self call ["get", [_uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(bank,responseInitBank), [_account], _player] call CFUNC(targetEvent);
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(BankStore) = createHashMapObject [GVAR(BankBaseStore)];
|
||||
GVAR(BankStore)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_baseStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2026-01-08
|
||||
* Last Update: 2026-01-30
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -24,69 +24,83 @@
|
||||
GVAR(BaseStore) = compileFinal createHashMapFromArray [
|
||||
["#type", "IBaseStore"],
|
||||
["fetch", {
|
||||
params [["_function", "", [""]], ["_uid", "", [""]]];
|
||||
params [["_function", "", [""]], ["_key", "", [""]]];
|
||||
|
||||
private _data = createHashMap;
|
||||
|
||||
[_function, [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
[_function, [_key]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
["INFO", format ["Data: %1", _result]] call EFUNC(common,log);
|
||||
|
||||
if (count _result > 0) then { _data = _self call ["toHashMap", [_result]] };
|
||||
if (_result isNotEqualTo []) then { _data = _self call ["toHashMap", [_result]] };
|
||||
|
||||
_data
|
||||
}],
|
||||
["set", {
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [0, "", [], false, createHashMap, objNull, grpNull]], ["_sync", false, [false]]];
|
||||
["get", {
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_key", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
private _existingData = _registry get _uid;
|
||||
private _existingData = _registry get _key;
|
||||
private _finalData = createHashMap;
|
||||
|
||||
if (_field isNotEqualTo "") then {
|
||||
_finalData = _existingData get _field
|
||||
} else {
|
||||
_finalData = _existingData
|
||||
};
|
||||
|
||||
_finalData
|
||||
}],
|
||||
["set", {
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_key", "", [""]], ["_field", "", [""]], ["_value", nil, [0, "", [], false, createHashMap, objNull, grpNull]], ["_sync", false, [false]]];
|
||||
|
||||
private _existingData = _registry get _key;
|
||||
private _finalData = +_existingData;
|
||||
private _hashMap = createHashMap;
|
||||
|
||||
_finalData set [_field, _value];
|
||||
_hashMap set [_field, _value];
|
||||
_registry set [_uid, _finalData];
|
||||
_registry set [_key, _finalData];
|
||||
|
||||
if (_sync) then {
|
||||
private _json = _self call ["toJSON", [_hashMap]];
|
||||
[_function, [_uid, _json]] call EFUNC(extension,extCall);
|
||||
[_function, [_key, _json]] call EFUNC(extension,extCall);
|
||||
};
|
||||
|
||||
_hashMap
|
||||
}],
|
||||
["mset", {
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_key", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
||||
|
||||
private _existingData = _registry get _uid;
|
||||
private _existingData = _registry get _key;
|
||||
private _finalData = +_existingData;
|
||||
private _hashMap = createHashMap;
|
||||
|
||||
{ _finalData set [_x, _y]; } forEach _fieldValuePairs;
|
||||
{ _hashMap set [_x, _y]; } forEach _fieldValuePairs;
|
||||
|
||||
_registry set [_uid, _finalData];
|
||||
_registry set [_key, _finalData];
|
||||
|
||||
if (_sync) then {
|
||||
private _json = _self call ["toJSON", [_hashMap]];
|
||||
[_function, [_uid, _json]] call EFUNC(extension,extCall);
|
||||
[_function, [_key, _json]] call EFUNC(extension,extCall);
|
||||
};
|
||||
|
||||
_hashMap
|
||||
}],
|
||||
["save", {
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_uid", "", [""]]];
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_function", "", [""]], ["_key", "", [""]]];
|
||||
|
||||
private _existingData = _registry get _uid;
|
||||
private _existingData = _registry get _key;
|
||||
private _finalData = +_existingData;
|
||||
private _json = _self call ["toJSON", [_finalData]];
|
||||
|
||||
[_function, [_uid, _json]] call EFUNC(extension,extCall);
|
||||
[_function, [_key, _json]] call EFUNC(extension,extCall);
|
||||
|
||||
_finalData
|
||||
}],
|
||||
["remove", {
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_uid", "", [""]]];
|
||||
params [["_registry", createHashMap, [createHashMap]], ["_key", "", [""]]];
|
||||
|
||||
_registry deleteAt _uid;
|
||||
_registry deleteAt _key;
|
||||
}],
|
||||
["toHashMap", {
|
||||
params [["_data", "", [""]]];
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initMEconomyStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-20
|
||||
* Last Update: 2026-01-03
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -69,7 +69,7 @@ GVAR(MEconomyStore) = createHashMapObject [[
|
||||
if (isNull _unit) exitWith { ["WARNING", format ["Invalid unit provided: %1", (name _unit)], nil, nil] call EFUNC(common,log); };
|
||||
|
||||
private _uid = getPlayerUID _unit;
|
||||
private _account = EGVAR(bank,BankRegistry) get _uid;
|
||||
private _account = EGVAR(bank,Registry) get _uid;
|
||||
|
||||
if (isNil "_account") exitWith { ["ERROR", format ["No account found for %1. UID: %2", (name _unit), _uid], nil, nil] call EFUNC(common,log); };
|
||||
|
||||
|
||||
@ -14,10 +14,14 @@ PREP_RECOMPILE_END;
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestGetGarage), {
|
||||
params [["_uid", "", [""]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
||||
GVAR(GarageStore) call ["get", [GVAR(GarageRegistry), "garage:get", _uid]];
|
||||
|
||||
private _finalData = GVAR(GarageStore) call ["get", [GVAR(Registry), "garage:get", _uid, _field]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncGarage), [_finalData], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSetGarage), {
|
||||
@ -25,7 +29,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID or Key!" };
|
||||
|
||||
private _hashMap = GVAR(GarageStore) call ["set", [GVAR(GarageRegistry), "garage:update", _uid, _key, _value, _sync]];
|
||||
private _hashMap = GVAR(GarageStore) call ["set", [GVAR(Registry), "garage:update", _uid, _key, _value, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncGarage), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -37,7 +41,7 @@ PREP_RECOMPILE_END;
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
||||
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid field pairs!" };
|
||||
|
||||
private _hashMap = GVAR(GarageStore) call ["mset", [GVAR(GarageRegistry), "garage:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _hashMap = GVAR(GarageStore) call ["mset", [GVAR(Registry), "garage:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncGarage), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -48,7 +52,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
||||
|
||||
private _finalData = GVAR(GarageStore) call ["save", [GVAR(GarageRegistry), "garage:update", _uid]];
|
||||
private _finalData = GVAR(GarageStore) call ["save", [GVAR(Registry), "garage:update", _uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncGarage), [_finalData], _player] call CFUNC(targetEvent);
|
||||
@ -58,7 +62,7 @@ PREP_RECOMPILE_END;
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Garage] Empty/Invalid UID!" };
|
||||
GVAR(GarageStore) call ["remove", [GVAR(GarageRegistry), _uid]];
|
||||
GVAR(GarageStore) call ["remove", [GVAR(Registry), _uid]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestInitVG), {
|
||||
@ -69,14 +73,14 @@ PREP_RECOMPILE_END;
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestGetVG), {
|
||||
params [["_uid", "", [""]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
||||
|
||||
private _hashMap = GVAR(VGarageStore) call ["get", [GVAR(VGarageRegistry), "owned:garage:fetch", _uid]];
|
||||
private _finalData = GVAR(VGarageStore) call ["get", [GVAR(VGRegistry), "owned:garage:fetch", _uid, _field]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncVG), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
[CRPC(garage,responseSyncVG), [_finalData], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSetVG), {
|
||||
@ -84,7 +88,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID or Key!" };
|
||||
|
||||
private _hashMap = GVAR(VGarageStore) call ["set", [GVAR(VGarageRegistry), "", _uid, _key, _value, _sync]];
|
||||
private _hashMap = GVAR(VGarageStore) call ["set", [GVAR(VGRegistry), "", _uid, _key, _value, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncVG), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -96,7 +100,7 @@ PREP_RECOMPILE_END;
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
||||
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid field pairs!" };
|
||||
|
||||
private _hashMap = GVAR(VGarageStore) call ["mset", [GVAR(VGarageRegistry), "", _uid, _fieldValuePairs, _sync]];
|
||||
private _hashMap = GVAR(VGarageStore) call ["mset", [GVAR(VGRegistry), "", _uid, _fieldValuePairs, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncVG), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -107,7 +111,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
||||
|
||||
private _finalData = GVAR(VGarageStore) call ["save", [GVAR(VGarageRegistry), "", _uid]];
|
||||
private _finalData = GVAR(VGarageStore) call ["save", [GVAR(VGRegistry), "", _uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseSyncVG), [_finalData], _player] call CFUNC(targetEvent);
|
||||
@ -117,5 +121,5 @@ PREP_RECOMPILE_END;
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VGarage] Empty/Invalid UID!" };
|
||||
GVAR(VGarageStore) call ["remove", [GVAR(VGarageRegistry), _uid]];
|
||||
GVAR(VGarageStore) call ["remove", [GVAR(VGRegistry), _uid]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initGarageStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-01-30
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -22,17 +22,17 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(GarageRepository) = compileFinal createHashMapFromArray [
|
||||
GVAR(GarageBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
["#type", "GarageRepository"],
|
||||
["#create", {
|
||||
GVAR(GarageRegistry) = createHashMap;
|
||||
["INFO", "Garage Repository Initialized!"] call EFUNC(common,log);
|
||||
["#type", "GarageBaseStore"],
|
||||
["#create", compileFinal {
|
||||
GVAR(Registry) = createHashMap;
|
||||
["INFO", "Garage Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["get", {
|
||||
["init", compileFinal {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _cached = GVAR(GarageRegistry) getOrDefault [_uid, nil];
|
||||
private _cached = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if !(isNil { _cached }) exitWith { _cached };
|
||||
|
||||
["garage:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
@ -56,25 +56,14 @@ GVAR(GarageRepository) = compileFinal createHashMapFromArray [
|
||||
["INFO", format ["Created new garage for %1", _uid]] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
GVAR(GarageRegistry) set [_uid, _finalGarage];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
GVAR(Registry) set [_uid, _finalGarage];
|
||||
[CRPC(garage,responseInitGarage), [_finalGarage], _player] call CFUNC(targetEvent);
|
||||
|
||||
_finalGarage
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(GarageStore) = createHashMapObject [[
|
||||
["#base", GVAR(GarageRepository)],
|
||||
["#type", "IGarageStore"],
|
||||
["#create", {
|
||||
["INFO", "Garage Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["init", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _garage = _self call ["get", [_uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseInitGarage), [_garage], _player] call CFUNC(targetEvent);
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(GarageStore) = createHashMapObject [GVAR(GarageBaseStore)];
|
||||
GVAR(GarageStore)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initVGStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-01-31
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -24,7 +24,7 @@
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(VGarageModel) = compileFinal createHashMapObject [[
|
||||
["#type", "VGarageModel"],
|
||||
["defaults", {
|
||||
["defaults", compileFinal {
|
||||
private _vGarage = createHashMap;
|
||||
|
||||
_vGarage set ["armor", []];
|
||||
@ -38,17 +38,17 @@ GVAR(VGarageModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(VGarageRepository) = compileFinal createHashMapFromArray [
|
||||
GVAR(VGBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
["#type", "VGarageRepository"],
|
||||
["#create", {
|
||||
GVAR(VGarageRegistry) = createHashMap;
|
||||
["INFO", "VGarage Repository Initialized!"] call EFUNC(common,log);
|
||||
["#type", "VGBaseStore"],
|
||||
["#create", compileFinal {
|
||||
GVAR(VGRegistry) = createHashMap;
|
||||
["INFO", "VGarage Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["get", {
|
||||
["init", compileFinal {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _cached = GVAR(VGarageRegistry) getOrDefault [_uid, nil];
|
||||
private _cached = GVAR(VGRegistry) getOrDefault [_uid, nil];
|
||||
if !(isNil { _cached }) exitWith { _cached };
|
||||
|
||||
["owned:garage:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
@ -74,25 +74,14 @@ GVAR(VGarageRepository) = compileFinal createHashMapFromArray [
|
||||
["INFO", format ["Created new virtual garage for %1", _uid]] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
GVAR(VGarageRegistry) set [_uid, _finalVGarage];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
GVAR(VGRegistry) set [_uid, _finalVGarage];
|
||||
[CRPC(garage,responseInitVG), [_finalVGarage], _player] call CFUNC(targetEvent);
|
||||
|
||||
_finalVGarage
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(VGarageStore) = createHashMapObject [[
|
||||
["#base", GVAR(VGarageRepository)],
|
||||
["#type", "VGarageStore"],
|
||||
["#create", {
|
||||
["INFO", "VGarage Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["init", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _vGarage = _self call ["get", [_uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(garage,responseInitVG), [_vGarage], _player] call CFUNC(targetEvent);
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(VGarageStore) = createHashMapObject [GVAR(VGBaseStore)];
|
||||
GVAR(VGarageStore)
|
||||
|
||||
@ -14,18 +14,22 @@ PREP_RECOMPILE_END;
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestGetLocker), {
|
||||
params [["_uid", "", [""]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
|
||||
GVAR(LockerStore) call ["get", [GVAR(LockerRegistry), "locker:get", _uid]];
|
||||
|
||||
private _finalData = GVAR(LockerStore) call ["get", [GVAR(Registry), "locker:get", _uid, _field]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncLocker), [_finalData], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSetLocker), {
|
||||
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
|
||||
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID or Key!" };
|
||||
if (_uid isEqualTo "" || _field isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID or Field!" };
|
||||
|
||||
private _hashMap = GVAR(LockerStore) call ["set", [GVAR(LockerRegistry), "locker:update", _uid, _key, _value, _sync]];
|
||||
private _hashMap = GVAR(LockerStore) call ["set", [GVAR(Registry), "locker:update", _uid, _field, _value, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncLocker), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -37,7 +41,7 @@ PREP_RECOMPILE_END;
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
|
||||
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid field pairs!" };
|
||||
|
||||
private _hashMap = GVAR(LockerStore) call ["mset", [GVAR(LockerRegistry), "locker:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _hashMap = GVAR(LockerStore) call ["mset", [GVAR(Registry), "locker:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncLocker), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -48,7 +52,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
|
||||
|
||||
private _finalData = GVAR(LockerStore) call ["save", [GVAR(LockerRegistry), "locker:update", _uid]];
|
||||
private _finalData = GVAR(LockerStore) call ["save", [GVAR(Registry), "locker:update", _uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncLocker), [_finalData], _player] call CFUNC(targetEvent);
|
||||
@ -58,7 +62,7 @@ PREP_RECOMPILE_END;
|
||||
params [["_uid", "", [""]], ["_data", createHashMap, [createHashMap]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Locker] Empty/Invalid UID!" };
|
||||
GVAR(LockerRegistry) set [_uid, _data];
|
||||
GVAR(Registry) set [_uid, _data];
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
[CRPC(locker,responseSyncLocker), [_data], _player] call CFUNC(targetEvent);
|
||||
@ -75,22 +79,26 @@ PREP_RECOMPILE_END;
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
|
||||
GVAR(VArsenalStore) call ["init", [_uid]];
|
||||
GVAR(VAStore) call ["init", [_uid]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestGetVA), {
|
||||
params [["_uid", "", [""]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
|
||||
GVAR(VArsenalStore) call ["get", [GVAR(VArsenalRegistry), "owned:locker:fetch", _uid]];
|
||||
|
||||
private _finalData = GVAR(VAStore) call ["get", [GVAR(VARegistry), "owned:locker:fetch", _uid, _field]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncVArsenal), [_finalData], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSetVA), {
|
||||
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
|
||||
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID or Key!" };
|
||||
if (_uid isEqualTo "" || _field isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID or Field!" };
|
||||
|
||||
private _hashMap = GVAR(VArsenalStore) call ["set", [GVAR(VArsenalRegistry), "owned:locker:update", _uid, _key, _value, _sync]];
|
||||
private _hashMap = GVAR(VAStore) call ["set", [GVAR(VARegistry), "owned:locker:update", _uid, _field, _value, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncVArsenal), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -102,7 +110,7 @@ PREP_RECOMPILE_END;
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
|
||||
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid field pairs!" };
|
||||
|
||||
private _hashMap = GVAR(VArsenalStore) call ["mset", [GVAR(VArsenalRegistry), "owned:locker:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _hashMap = GVAR(VAStore) call ["mset", [GVAR(VARegistry), "owned:locker:update", _uid, _fieldValuePairs, _sync]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncVArsenal), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
@ -113,7 +121,7 @@ PREP_RECOMPILE_END;
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
|
||||
|
||||
private _finalData = GVAR(VArsenalStore) call ["save", [GVAR(VArsenalRegistry), "owned:locker:update", _uid]];
|
||||
private _finalData = GVAR(VAStore) call ["save", [GVAR(VARegistry), "owned:locker:update", _uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseSyncVArsenal), [_finalData], _player] call CFUNC(targetEvent);
|
||||
@ -123,5 +131,5 @@ PREP_RECOMPILE_END;
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:VArsenal] Empty/Invalid UID!" };
|
||||
GVAR(VArsenalStore) call ["remove", [GVAR(VArsenalRegistry), _uid]];
|
||||
GVAR(VAStore) call ["remove", [GVAR(VARegistry), _uid]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initLockerStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-01-30
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -22,17 +22,17 @@
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
GVAR(LockerBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
["#type", "LockerRepository"],
|
||||
["#create", {
|
||||
GVAR(LockerRegistry) = createHashMap;
|
||||
["INFO", "Locker Repository Initialized!"] call EFUNC(common,log);
|
||||
["#type", "LockerBaseStore"],
|
||||
["#create", compileFinal {
|
||||
GVAR(Registry) = createHashMap;
|
||||
["INFO", "Locker Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["get", {
|
||||
["init", compileFinal {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _cached = GVAR(LockerRegistry) getOrDefault [_uid, nil];
|
||||
private _cached = GVAR(Registry) getOrDefault [_uid, nil];
|
||||
if !(isNil { _cached }) exitWith { _cached };
|
||||
|
||||
["locker:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
@ -56,25 +56,14 @@ GVAR(LockerRepository) = compileFinal createHashMapFromArray [
|
||||
["INFO", format ["Created new locker for %1", _uid]] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
GVAR(LockerRegistry) set [_uid, _finalLocker];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
GVAR(Registry) set [_uid, _finalLocker];
|
||||
[CRPC(locker,responseInitLocker), [_finalLocker], _player] call CFUNC(targetEvent);
|
||||
|
||||
_finalLocker
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(LockerStore) = createHashMapObject [[
|
||||
["#base", GVAR(LockerRepository)],
|
||||
["#type", "LockerStore"],
|
||||
["#create", {
|
||||
["INFO", "Locker Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["init", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _locker = _self call ["get", [_uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseInitLocker), [_locker], _player] call CFUNC(targetEvent);
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(LockerStore) = createHashMapObject [GVAR(LockerBaseStore)];
|
||||
GVAR(LockerStore)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* File: fnc_initVAStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Date: 2025-12-17
|
||||
* Last Update: 2026-02-05
|
||||
* Last Update: 2026-02-13
|
||||
* Public: No
|
||||
*
|
||||
* Description:
|
||||
@ -24,7 +24,7 @@
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(VArsenalModel) = compileFinal createHashMapObject [[
|
||||
["#type", "VArsenalModel"],
|
||||
["defaults", {
|
||||
["defaults", compileFinal {
|
||||
private _vArsenal = createHashMap;
|
||||
|
||||
_vArsenal set ["backpacks", ["B_AssaultPack_rgr"]];
|
||||
@ -36,17 +36,17 @@ GVAR(VArsenalModel) = compileFinal createHashMapObject [[
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(VArsenalRepository) = compileFinal createHashMapFromArray [
|
||||
GVAR(VABaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
["#type", "VArsenalRepository"],
|
||||
["#create", {
|
||||
GVAR(VArsenalRegistry) = createHashMap;
|
||||
["INFO", "VArsenal Repository Initialized!"] call EFUNC(common,log);
|
||||
["#type", "VABaseStore"],
|
||||
["#create", compileFinal {
|
||||
GVAR(VARegistry) = createHashMap;
|
||||
["INFO", "VArsenal Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["get", {
|
||||
["init", compileFinal {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _cached = GVAR(VArsenalRegistry) getOrDefault [_uid, nil];
|
||||
private _cached = GVAR(VARegistry) getOrDefault [_uid, nil];
|
||||
if !(isNil { _cached }) exitWith { _cached };
|
||||
|
||||
["owned:locker:exists", [_uid]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
@ -72,25 +72,14 @@ GVAR(VArsenalRepository) = compileFinal createHashMapFromArray [
|
||||
["INFO", format ["Created new virtual arsenal for %1", _uid]] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
GVAR(VArsenalRegistry) set [_uid, _finalVArsenal];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
GVAR(VARegistry) set [_uid, _finalVArsenal];
|
||||
[CRPC(locker,responseInitVA), [_finalVArsenal], _player] call CFUNC(targetEvent);
|
||||
|
||||
_finalVArsenal
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(VArsenalStore) = createHashMapObject [[
|
||||
["#base", GVAR(VArsenalRepository)],
|
||||
["#type", "VArsenalStore"],
|
||||
["#create", {
|
||||
["INFO", "VArsenal Store Initialized!"] call EFUNC(common,log);
|
||||
}],
|
||||
["init", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _vArsenal = _self call ["get", [_uid]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(locker,responseInitVA), [_vArsenal], _player] call CFUNC(targetEvent);
|
||||
}]
|
||||
]];
|
||||
|
||||
GVAR(VArsenalStore)
|
||||
GVAR(VAStore) = createHashMapObject [GVAR(VABaseStore)];
|
||||
GVAR(VAStore)
|
||||
|
||||
@ -35,7 +35,7 @@ if (isNil QEGVAR(garage,VGarageStore)) then { call EFUNC(garage,initVGStore); };
|
||||
if (isNil QEGVAR(locker,LockerStore)) then { call EFUNC(locker,initLockerStore); };
|
||||
|
||||
// VArsenal
|
||||
if (isNil QEGVAR(locker,VArsenalStore)) then { call EFUNC(locker,initVAStore); };
|
||||
if (isNil QEGVAR(locker,VAStore)) then { call EFUNC(locker,initVAStore); };
|
||||
|
||||
// Org
|
||||
if (isNil QEGVAR(org,OrgStore)) then { call EFUNC(org,initOrgStore); };
|
||||
|
||||
@ -16,17 +16,26 @@ PREP_RECOMPILE_END;
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestGetOrg), {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
||||
GVAR(OrgStore) call ["get", [_uid, _sync]];
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _key = _index get "orgID";
|
||||
private _finalData = GVAR(OrgStore) call ["get", [GVAR(Registry), _key, _field]];
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
[CRPC(org,responseSyncOrg), [_finalData], _player] call CFUNC(targetEvent);
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSetOrg), {
|
||||
params [["_uid", "", [""]], ["_key", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil, [[], "", 0, false, createHashMap]], ["_sync", false, [false]]];
|
||||
|
||||
if (_uid isEqualTo "" || _key isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID or Key!" };
|
||||
GVAR(OrgStore) call ["set", [_uid, _key, _value, _sync]];
|
||||
if (_uid isEqualTo "" || _field isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID or Field!" };
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _key = _index get "orgID";
|
||||
GVAR(OrgStore) call ["set", [GVAR(Registry), "org:update", _key, _field, _value, _sync]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestMSetOrg), {
|
||||
@ -35,19 +44,28 @@ PREP_RECOMPILE_END;
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
||||
if ((_fieldValuePairs isEqualTo createHashMap) || !(_fieldValuePairs isEqualType createHashMap)) exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid field pairs!" };
|
||||
|
||||
GVAR(OrgStore) call ["mset", [_uid, _fieldValuePairs, _sync]];
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _key = _index get "orgID";
|
||||
|
||||
GVAR(OrgStore) call ["mset", [GVAR(Registry), "org:update", _key, _fieldValuePairs, _sync]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestSaveOrg), {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
||||
GVAR(OrgStore) call ["save", [_uid, _sync]];
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _key = _index get "orgID";
|
||||
GVAR(OrgStore) call ["save", [GVAR(Registry), "org:update", _key]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
[QGVAR(requestRemoveOrg), {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
if (_uid isEqualTo "") exitWith { diag_log "[FORGE:Server:Org] Empty/Invalid UID!" };
|
||||
GVAR(OrgStore) call ["remove", [_uid]];
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _key = _index get "orgID";
|
||||
GVAR(OrgStore) call ["remove", [GVAR(Registry), "org:update", _key]];
|
||||
}] call CFUNC(addEventHandler);
|
||||
|
||||
@ -1,251 +1,161 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
/*
|
||||
* File: fnc_initOrgStore.sqf
|
||||
* Author: IDSolutions
|
||||
* Initializes the org store.
|
||||
* Date: 2026-02-13
|
||||
* Last Update: 2026-02-13
|
||||
* Public: Yes
|
||||
*
|
||||
* Description:
|
||||
* Initializes the org store for managing player organizations.
|
||||
* Provides methods for creating, fetching, and updating organizations.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
* Org store object [HASHMAP OBJECT]
|
||||
*
|
||||
* Examples:
|
||||
* call forge_server_org_fnc_initOrgStore
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#pragma hemtt ignore_variables ["_self"]
|
||||
GVAR(OrgStore) = createHashMapObject [[
|
||||
["#type", "IOrgStore"],
|
||||
["#create", {
|
||||
GVAR(IndexRegistry) = createHashMap;
|
||||
GVAR(OrgRegistry) = createHashMap;
|
||||
GVAR(OrgModel) = compileFinal createHashMapObject [[
|
||||
["#type", "OrgModel"],
|
||||
["defaults", compileFinal {
|
||||
private _org = createHashMap;
|
||||
|
||||
private _hashMap = createHashMap;
|
||||
_hashMap set ["id", "default"];
|
||||
_hashMap set ["owner", "server"];
|
||||
_hashMap set ["name", "Forge Dynamics"];
|
||||
_hashMap set ["funds", 200000];
|
||||
_hashMap set ["reputation", 0];
|
||||
_org set ["id", ""];
|
||||
_org set ["owner", ""];
|
||||
_org set ["name", ""];
|
||||
_org set ["funds", 0];
|
||||
_org set ["reputation", 0];
|
||||
|
||||
private _json = _self call ["toJSON", [_hashMap]];
|
||||
["org:create", ["default", _json]] call EFUNC(extension,extCall);
|
||||
|
||||
["INFO", "Org Store Initialized!", nil, nil] call EFUNC(common,log);
|
||||
_org
|
||||
}],
|
||||
["init", {
|
||||
params [["_uid", "", [""]], ["_defaultOrg", createHashMap, [createHashMap]]];
|
||||
["migrate", compileFinal {
|
||||
params [["_org", createHashMap, [createHashMap]]];
|
||||
|
||||
private _actor = EGVAR(actor,ActorRegistry) get _uid;
|
||||
private _orgID = _actor get "organization";
|
||||
|
||||
["org:exists", [_orgID]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
|
||||
private _exists = _result == "true";
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
if !(_exists) exitWith {
|
||||
_self call ["default", [_uid, (name _player)]];
|
||||
["WARNING", format ["No existing org found for %1, using default org.", _uid], nil, nil] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
private _regEntry = createHashMapFromArray [["orgID", _orgID]];
|
||||
GVAR(IndexRegistry) set [_uid, _regEntry];
|
||||
|
||||
private _organization = _self call ["fetch", [_uid]];
|
||||
private _members = _self call ["fetchMembers", [_uid]];
|
||||
// private _assets = _self call ["fetchAssets", [_uid]];
|
||||
|
||||
private _finalOrg = GVAR(OrgRegistry) getOrDefault [_orgID, _organization];
|
||||
_finalOrg set ["members", _members];
|
||||
// _finalOrg set ["assets", _assets];
|
||||
|
||||
GVAR(OrgRegistry) set [_orgID, _finalOrg, true];
|
||||
[CRPC(org,responseInitOrg), [_finalOrg], _player] call CFUNC(targetEvent);
|
||||
|
||||
["INFO", format ["Found org for %1", _uid], nil, nil] call EFUNC(common,log);
|
||||
_finalOrg
|
||||
}],
|
||||
["default", {
|
||||
params [["_uid", "", [""]], ["_name", "", [""]]];
|
||||
|
||||
private _assets = createHashMap;
|
||||
private _members = createHashMap;
|
||||
private _member = createHashMapFromArray [["uid", _uid], ["name", _name]];
|
||||
|
||||
private _regEntry = createHashMapFromArray [["orgID", "default"]];
|
||||
GVAR(IndexRegistry) set [_uid, _regEntry];
|
||||
|
||||
private _organization = _self call ["fetch", ["default"]];
|
||||
_members set [_uid, _member];
|
||||
|
||||
private _finalOrg = GVAR(OrgRegistry) getOrDefault ["default", _organization];
|
||||
_finalOrg set ["members", _members];
|
||||
_finalOrg set ["assets", _assets];
|
||||
|
||||
GVAR(OrgRegistry) set ["default", _finalOrg];
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
[CRPC(org,responseInitOrg), [_finalOrg], _player] call CFUNC(targetEvent);
|
||||
|
||||
_finalOrg
|
||||
}],
|
||||
["fetch", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _index = "";
|
||||
private _organization = createHashMap;
|
||||
private _orgID = "default";
|
||||
|
||||
if (_uid isNotEqualTo "default") then {
|
||||
_index = GVAR(IndexRegistry) get _uid;
|
||||
_orgID = _index get "orgID";
|
||||
};
|
||||
|
||||
["org:get", [_orgID]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
["INFO", format ["Data: %1", _result], nil, nil] call EFUNC(common,log);
|
||||
|
||||
if (count _result > 0) then { _organization = _self call ["toHashMap", [_result]]; };
|
||||
|
||||
_organization
|
||||
}],
|
||||
["fetchAssets", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _assets = createHashMap;
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _orgID = _index get "orgID";
|
||||
|
||||
["org:assets:get", [_orgID]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
["INFO", format ["Assets: %1", _result], nil, nil] call EFUNC(common,log);
|
||||
|
||||
if (count _result > 0) then { _assets = _self call ["toHashMap", [_result]]; };
|
||||
|
||||
_assets
|
||||
}],
|
||||
["fetchMembers", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _members = createHashMap;
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _orgID = _index get "orgID";
|
||||
|
||||
["org:members:get", [_orgID]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
["INFO", format ["Members: %1", _result], nil, nil] call EFUNC(common,log);
|
||||
|
||||
private _raw_members = _self call ["toHashMap", [_result]];
|
||||
private _defaults = _self call ["defaults", []];
|
||||
|
||||
{
|
||||
private _uid = _x get "uid";
|
||||
_members set [_uid, _x];
|
||||
} forEach _raw_members;
|
||||
if !(_x in _org) then { _org set [_x, _y]; };
|
||||
} forEach _defaults;
|
||||
|
||||
_members
|
||||
_org
|
||||
}],
|
||||
["get", {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
["validate", compileFinal {
|
||||
params [["_org", createHashMap, [createHashMap]]];
|
||||
|
||||
private _finalOrg = createHashMap;
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _orgID = _index get "orgID";
|
||||
private _id = _org get "id";
|
||||
private _owner = _org get "owner";
|
||||
private _name = _org get "name";
|
||||
private _funds = _org get "funds";
|
||||
private _reputation = _org get "reputation";
|
||||
|
||||
if (_sync) then {
|
||||
_finalOrg = _self call ["fetch", [_uid]];
|
||||
GVAR(OrgRegistry) set [_orgID, _finalOrg];
|
||||
} else {
|
||||
_finalOrg = GVAR(OrgRegistry) getOrDefault [_orgID, createHashMap];
|
||||
[_id, _owner, _name, _funds, _reputation] try {
|
||||
if (_id isEqualTo "" || !(_id isEqualType "")) then { throw "Invalid ID!"; };
|
||||
if (_owner isEqualTo "" || !(_owner isEqualType "")) then { throw "Invalid Owner!"; };
|
||||
if (_name isEqualTo "" || !(_name isEqualType "")) then { throw "Invalid Name!"; };
|
||||
if (_funds isEqualTo 0 || !(_funds isEqualType 0)) then { throw "Invalid Funds!"; };
|
||||
if (_reputation isEqualTo 0 || !(_reputation isEqualType 0)) then { throw "Invalid Reputation!"; };
|
||||
} catch {
|
||||
["ERROR", format ["Failed to validate org %1!", _exception]] call EFUNC(common,log);
|
||||
false
|
||||
};
|
||||
|
||||
_finalOrg
|
||||
}],
|
||||
["set", {
|
||||
params [["_uid", "", [""]], ["_field", "", [""]], ["_value", nil], ["_sync", false, [false]]];
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _orgID = _index get "orgID";
|
||||
private _organization = GVAR(OrgRegistry) get _orgID;
|
||||
private _finalOrg = +_organization;
|
||||
private _hashMap = createHashMap;
|
||||
|
||||
_finalOrg set [_field, _value];
|
||||
_hashMap set [_field, _value];
|
||||
|
||||
GVAR(OrgRegistry) set [_orgID, _finalOrg];
|
||||
|
||||
if (_sync) then {
|
||||
private _json = _self call ["toJSON", [_hashMap]];
|
||||
["org:update", [_orgID, _json]] call EFUNC(extension,extCall);
|
||||
};
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
[CRPC(org,responseSyncOrg), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
|
||||
_hashMap
|
||||
}],
|
||||
["mset", {
|
||||
params [["_uid", "", [""]], ["_fieldValuePairs", createHashMap, [createHashMap]], ["_sync", false, [false]]];
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _orgID = _index get "orgID";
|
||||
private _organization = GVAR(OrgRegistry) get _orgID;
|
||||
private _finalOrg = +_organization;
|
||||
private _hashMap = createHashMap;
|
||||
|
||||
{ _finalOrg set [_x, _y]; } forEach _fieldValuePairs;
|
||||
{ _hashMap set [_x, _y]; } forEach _fieldValuePairs;
|
||||
|
||||
GVAR(OrgRegistry) set [_orgID, _finalOrg];
|
||||
|
||||
if (_sync) then {
|
||||
private _json = _self call ["toJSON", [_hashMap]];
|
||||
["org:update", [_orgID, _json]] call EFUNC(extension,extCall);
|
||||
};
|
||||
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
[CRPC(org,responseSyncOrg), [_hashMap], _player] call CFUNC(targetEvent);
|
||||
|
||||
_hashMap
|
||||
}],
|
||||
["save", {
|
||||
params [["_uid", "", [""]], ["_sync", false, [false]]];
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _orgID = _index get "orgID";
|
||||
private _organization = GVAR(OrgRegistry) get _orgID;
|
||||
private _finalOrg = +_organization;
|
||||
private _json = _self call ["toJSON", [_finalOrg]];
|
||||
|
||||
["org:update", [_orgID, _json]] call EFUNC(extension,extCall);
|
||||
|
||||
if (_sync) then {
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
[CRPC(org,responseSyncOrg), [_finalOrg], _player] call CFUNC(targetEvent);
|
||||
};
|
||||
|
||||
_finalOrg
|
||||
}],
|
||||
["remove", {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _index = GVAR(IndexRegistry) get _uid;
|
||||
private _orgID = _index get "orgID";
|
||||
GVAR(OrgRegistry) deleteAt _orgID;
|
||||
}],
|
||||
["toHashMap", {
|
||||
params [["_data", "", [""]]];
|
||||
|
||||
private _hashMap = fromJSON _data;
|
||||
_hashMap
|
||||
}],
|
||||
["toJSON", {
|
||||
params [["_data", createHashMap, [createHashMap]]];
|
||||
|
||||
private _json = toJSON _data;
|
||||
_json
|
||||
true
|
||||
}]
|
||||
]];
|
||||
|
||||
SETMVAR(FORGE_OrgStore,GVAR(OrgStore));
|
||||
GVAR(OrgBaseStore) = compileFinal createHashMapFromArray [
|
||||
["#base", EGVAR(common,BaseStore)],
|
||||
["#type", "OrgBaseStore"],
|
||||
["#create", compileFinal {
|
||||
GVAR(IndexRegistry) = createHashMap;
|
||||
GVAR(Registry) = createHashMap;
|
||||
["INFO", "Org Store Initialized!"] call EFUNC(common,log);
|
||||
|
||||
["org:exists", ["default"]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
if !(_isSuccess) exitWith {
|
||||
["ERROR", "Failed to check for default org!"] call EFUNC(common,log);
|
||||
createHashMap;
|
||||
};
|
||||
|
||||
private _finalOrg = createHashMap;
|
||||
|
||||
if (_result == "true") then {
|
||||
_finalOrg = _self call ["fetch", ["org:get", "default"]];
|
||||
} else {
|
||||
_finalOrg set ["id", "default"];
|
||||
_finalOrg set ["owner", "server"];
|
||||
_finalOrg set ["name", "Forge Dynamics"];
|
||||
_finalOrg set ["funds", 200000];
|
||||
_finalOrg set ["reputation", 0];
|
||||
|
||||
private _json = _self call ["toJSON", [_finalOrg]];
|
||||
["org:create", ["default", _json]] call EFUNC(extension,extCall);
|
||||
};
|
||||
|
||||
GVAR(Registry) set ["default", _finalOrg];
|
||||
}],
|
||||
["init", compileFinal {
|
||||
params [["_uid", "", [""]]];
|
||||
|
||||
private _actor = EGVAR(actor,Registry) get _uid;
|
||||
private _orgID = _actor get "organization";
|
||||
if (_orgID isEqualTo "") then { _orgID = "default" };
|
||||
|
||||
private _cached = GVAR(Registry) getOrDefault [_orgID, nil];
|
||||
if !(isNil { _cached }) exitWith { _cached };
|
||||
|
||||
["org:exists", [_orgID]] call EFUNC(extension,extCall) params ["_result", "_isSuccess"];
|
||||
if !(_isSuccess) exitWith {
|
||||
["ERROR", format ["Failed to check for org %1!", _orgID]] call EFUNC(common,log);
|
||||
createHashMap;
|
||||
};
|
||||
|
||||
private _finalOrg = createHashMap;
|
||||
private _finalMembers = createHashMap;
|
||||
// private _finalAssets = createHashMap;
|
||||
private _player = [_uid] call EFUNC(common,getPlayer);
|
||||
|
||||
if (_result == "true") then {
|
||||
_finalOrg = _self call ["fetch", ["org:get", _orgID]];
|
||||
["INFO", format ["Found org for %1", _orgID]] call EFUNC(common,log);
|
||||
} else {
|
||||
["WARNING", format ["No existing org found for %1, using default org.", _uid]] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
private _entry = createHashMapFromArray [["orgID", _orgID]];
|
||||
GVAR(IndexRegistry) set [_uid, _entry];
|
||||
|
||||
private _members = _self call ["fetch", ["org:members:get", _orgID]];
|
||||
// private _assets = _self call ["fetch", ["org:assets:get", _orgID]];
|
||||
|
||||
{
|
||||
private _key = _x get "uid";
|
||||
private _value = _x;
|
||||
_finalMembers set [_key, _value];
|
||||
} forEach _members;
|
||||
|
||||
// {
|
||||
// private _key = _x get "classname";
|
||||
// private _value = _x;
|
||||
// _finalAssets set [_key, _value];
|
||||
// } forEach _assets;
|
||||
|
||||
_finalOrg set ["members", _finalMembers];
|
||||
// _finalOrg set ["assets", _finalAssets];
|
||||
|
||||
GVAR(Registry) set [_orgID, _finalOrg, true];
|
||||
[CRPC(org,responseInitOrg), [_finalOrg], _player] call CFUNC(targetEvent);
|
||||
|
||||
_finalOrg
|
||||
}]
|
||||
];
|
||||
|
||||
GVAR(OrgStore) = createHashMapObject [GVAR(OrgBaseStore)];
|
||||
GVAR(OrgStore)
|
||||
|
||||
235
arma/ui/app.js
Normal file
235
arma/ui/app.js
Normal file
@ -0,0 +1,235 @@
|
||||
/**
|
||||
* Simple React-like Vanilla JS Implementation
|
||||
*/
|
||||
|
||||
// --- 1. The "Library" Logic ---
|
||||
|
||||
// Helper to create DOM elements (like React.createElement)
|
||||
function h(tag, props = {}, ...children) {
|
||||
const el = document.createElement(tag);
|
||||
|
||||
// Handle props
|
||||
if (props) {
|
||||
Object.entries(props).forEach(([key, value]) => {
|
||||
if (key.startsWith('on') && typeof value === 'function') {
|
||||
el.addEventListener(key.substring(2).toLowerCase(), value);
|
||||
} else if (key === 'className') {
|
||||
el.className = value;
|
||||
} else if (key === 'style' && typeof value === 'object') {
|
||||
Object.assign(el.style, value);
|
||||
} else {
|
||||
el.setAttribute(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Handle children
|
||||
children.forEach(child => {
|
||||
if (typeof child === 'string' || typeof child === 'number') {
|
||||
el.appendChild(document.createTextNode(child));
|
||||
} else if (child instanceof Node) {
|
||||
el.appendChild(child);
|
||||
} else if (Array.isArray(child)) {
|
||||
child.forEach(c => el.appendChild(c));
|
||||
}
|
||||
});
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
// Simple Rendering Logic
|
||||
let _rootContainer = null;
|
||||
let _rootComponent = null;
|
||||
|
||||
function render(component, container) {
|
||||
_rootContainer = container;
|
||||
_rootComponent = component;
|
||||
_render();
|
||||
}
|
||||
|
||||
function _render() {
|
||||
_rootContainer.innerHTML = ''; // Clear previous tree (simple re-render)
|
||||
_rootContainer.appendChild(_rootComponent());
|
||||
}
|
||||
|
||||
// Simple State Hook (Global for simplicity, or localized using closures)
|
||||
// Note: In a real app this would be more complex to handle multiple components.
|
||||
// For this demo, we'll re-render the whole app on state change.
|
||||
const createSignal = (initialValue) => {
|
||||
let _val = initialValue;
|
||||
const getValue = () => _val;
|
||||
const setValue = (newValue) => {
|
||||
_val = typeof newValue === 'function' ? newValue(_val) : newValue;
|
||||
_render(); // Trigger re-render
|
||||
};
|
||||
return [getValue, setValue];
|
||||
};
|
||||
|
||||
// --- 2. The Application Components ---
|
||||
|
||||
// Global View State: 'home', 'login', 'create'
|
||||
const [getView, setView] = createSignal('home');
|
||||
|
||||
// Header Component
|
||||
function Header({ title }) {
|
||||
return h('div', { className: 'header' },
|
||||
h('h1', {
|
||||
style: { cursor: 'pointer' },
|
||||
onClick: () => setView('home')
|
||||
}, title),
|
||||
h('p', null, 'Organization Registration & Management Portal')
|
||||
);
|
||||
}
|
||||
|
||||
// Login Form Component
|
||||
function LoginForm() {
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault(); // Critical for strict sandbox
|
||||
const formData = new FormData(e.target);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
console.log('Login Attempt:', data);
|
||||
// TODO: Handle authentication logic here
|
||||
};
|
||||
|
||||
return h('div', { className: 'card', style: { maxWidth: '400px', margin: '0 auto' } },
|
||||
h('h2', null, 'Organization Login'),
|
||||
h('form', { onSubmit: handleSubmit },
|
||||
h('div', null,
|
||||
h('label', null, 'Email'),
|
||||
h('input', { name: 'email', type: 'text', placeholder: 'admin@spearnet.mil' })
|
||||
),
|
||||
h('div', null,
|
||||
h('label', null, 'Password'),
|
||||
h('input', { name: 'password', type: 'password', placeholder: '••••••••' })
|
||||
),
|
||||
h('div', { className: 'form-actions' },
|
||||
h('button', { type: 'submit', style: { width: '100%' } }, 'Access Authenticator'),
|
||||
h('span', {
|
||||
className: 'cancel-link',
|
||||
onClick: () => setView('home')
|
||||
}, 'Cancel / Return to Main')
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Create Org Form Component
|
||||
function CreateOrgForm() {
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault(); // Critical for strict sandbox
|
||||
const formData = new FormData(e.target);
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
console.log('Org Registration:', data);
|
||||
// TODO: Handle registration logic here
|
||||
};
|
||||
|
||||
return h('div', { className: 'split-container' },
|
||||
h('div', { className: 'info-panel' },
|
||||
h('h2', null, 'Registration Details'),
|
||||
h('p', null, 'Complete the form to add your organization to the Global Organization Registry.'),
|
||||
h('ul', { style: { textAlign: 'left', marginTop: '1.5rem', listStyleType: 'none', padding: 0 } },
|
||||
h('li', { style: { marginBottom: '0.5rem' } }, '✅ Official Organization Designator'),
|
||||
h('li', { style: { marginBottom: '0.5rem' } }, '✅ Secure Comms Channel'),
|
||||
h('li', { style: { marginBottom: '0.5rem' } }, '✅ Deployment Roster Access'),
|
||||
h('li', { style: { marginBottom: '0.5rem' } }, '✅ After-Action Report Tools')
|
||||
),
|
||||
h('div', { className: 'price-tag', style: { marginTop: '2rem', padding: '1rem', background: 'var(--bg-app)', borderRadius: 'var(--radius)', border: '1px solid var(--border)' } },
|
||||
h('span', { style: { display: 'block', fontSize: '0.9rem', color: 'var(--text-muted)' } }, 'Registration Fee'),
|
||||
h('span', { style: { display: 'block', fontSize: '2rem', fontWeight: '700', color: 'var(--primary)' } }, '$50,000')
|
||||
)
|
||||
),
|
||||
h('div', { className: 'form-panel card', style: { margin: 0 } },
|
||||
h('h2', null, 'Organization Registration'),
|
||||
h('form', { onSubmit: handleSubmit },
|
||||
h('div', null,
|
||||
h('label', null, 'Organization Name'),
|
||||
h('input', { name: 'orgName', type: 'text', placeholder: 'e.g. Task Force 141' })
|
||||
),
|
||||
h('div', null,
|
||||
h('label', null, 'Organization Type'),
|
||||
h('select', { name: 'type' },
|
||||
h('option', { value: 'infantry' }, 'Infantry / Milsim'),
|
||||
h('option', { value: 'aviation' }, 'Aviation Wing'),
|
||||
h('option', { value: 'pmc' }, 'Private Military Company'),
|
||||
h('option', { value: 'support' }, 'Logistics & Support')
|
||||
)
|
||||
),
|
||||
h('div', { className: 'form-actions' },
|
||||
h('button', { type: 'submit', style: { width: '100%' } }, 'Submit Registration'),
|
||||
h('span', {
|
||||
className: 'cancel-link',
|
||||
onClick: () => setView('home')
|
||||
}, 'Cancel / Return to Main')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Home View Component
|
||||
function HomeView() {
|
||||
return h('div', { className: 'content' },
|
||||
h('div', { className: 'card' },
|
||||
h('h2', null, 'Create Organization'),
|
||||
h('p', null, 'Establish your Task Force, PMC, or Milsim unit with the Global Organization Network. Receive your official unit designator and TO&E authorization instantly.'),
|
||||
h('button', { onClick: () => setView('create') }, 'Register')
|
||||
),
|
||||
h('div', { className: 'card' },
|
||||
h('h2', null, 'Organization Dashboard'),
|
||||
h('p', null, 'Access your unit dashboard to modify rosters, adjust active deployments, and submit after-action reports through the secure field uplink.'),
|
||||
h('button', { onClick: () => setView('login') }, 'Login')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Footer Component (unchanged)
|
||||
function Footer() {
|
||||
return h('div', { className: 'footer' },
|
||||
h('div', { className: 'wrapper' },
|
||||
h('div', null,
|
||||
h('h3', null, 'Registry Resources'),
|
||||
h('ul', { style: { listStyleType: 'none', padding: 0 } },
|
||||
h('li', null, 'Registration Guidelines'),
|
||||
h('li', null, 'Tax & Fee Schedule'),
|
||||
h('li', null, 'Legal Compliance'),
|
||||
h('li', null, 'Trademark Database')
|
||||
)
|
||||
),
|
||||
h('div', null,
|
||||
h('h3', null, 'Bureau Support'),
|
||||
h('ul', { style: { listStyleType: 'none', padding: 0 } },
|
||||
h('li', null, 'Office: Sector 7 Admin Block'),
|
||||
h('li', null, 'Hours: 0800 - 1600 (GST)'),
|
||||
h('li', null, 'Helpdesk: 555-01-REGISTRY'),
|
||||
h('li', null, 'support@org-bureau.gov')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Main App Component
|
||||
function App() {
|
||||
const view = getView();
|
||||
|
||||
let mainContent;
|
||||
if (view === 'home') {
|
||||
mainContent = HomeView();
|
||||
} else if (view === 'login') {
|
||||
mainContent = LoginForm();
|
||||
} else if (view === 'create') {
|
||||
mainContent = CreateOrgForm();
|
||||
}
|
||||
|
||||
return h('main', null,
|
||||
h('div', { className: 'container' },
|
||||
Header({ title: 'Global Organization Network' }),
|
||||
mainContent
|
||||
),
|
||||
Footer()
|
||||
);
|
||||
}
|
||||
|
||||
// --- 3. Mount Application ---
|
||||
const root = document.getElementById('app');
|
||||
render(App, root);
|
||||
26
arma/ui/atm.html
Normal file
26
arma/ui/atm.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ATM - Global Financial Network</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style>
|
||||
body {
|
||||
background: #f1f5f9;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="atm.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
272
arma/ui/atm.js
Normal file
272
arma/ui/atm.js
Normal file
@ -0,0 +1,272 @@
|
||||
/**
|
||||
* ATM App - Vanilla JS Kiosk Implementation
|
||||
*/
|
||||
|
||||
// --- 1. The "Library" Logic (Reused) ---
|
||||
|
||||
function h(tag, props = {}, ...children) {
|
||||
const el = document.createElement(tag);
|
||||
if (props) {
|
||||
Object.entries(props).forEach(([key, value]) => {
|
||||
if (key.startsWith('on') && typeof value === 'function') {
|
||||
el.addEventListener(key.substring(2).toLowerCase(), value);
|
||||
} else if (key === 'className') {
|
||||
el.className = value;
|
||||
} else if (key === 'style' && typeof value === 'object') {
|
||||
Object.assign(el.style, value);
|
||||
} else {
|
||||
el.setAttribute(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
children.forEach(child => {
|
||||
if (typeof child === 'string' || typeof child === 'number') {
|
||||
el.appendChild(document.createTextNode(child));
|
||||
} else if (child instanceof Node) {
|
||||
el.appendChild(child);
|
||||
} else if (Array.isArray(child)) {
|
||||
child.forEach(c => el.appendChild(c));
|
||||
}
|
||||
});
|
||||
return el;
|
||||
}
|
||||
|
||||
let _rootContainer = null;
|
||||
let _rootComponent = null;
|
||||
|
||||
function render(component, container) {
|
||||
_rootContainer = container;
|
||||
_rootComponent = component;
|
||||
_render();
|
||||
}
|
||||
|
||||
function _render() {
|
||||
_rootContainer.innerHTML = '';
|
||||
_rootContainer.appendChild(_rootComponent());
|
||||
}
|
||||
|
||||
const createSignal = (initialValue) => {
|
||||
let _val = initialValue;
|
||||
const getValue = () => _val;
|
||||
const setValue = (newValue) => {
|
||||
_val = typeof newValue === 'function' ? newValue(_val) : newValue;
|
||||
_render();
|
||||
};
|
||||
return [getValue, setValue];
|
||||
};
|
||||
|
||||
// --- 2. ATM Application Components ---
|
||||
|
||||
// Global State
|
||||
const [getView, setView] = createSignal('pin'); // 'pin', 'menu', 'withdraw', 'custom_withdraw', 'balance'
|
||||
const [getPin, setPin] = createSignal('');
|
||||
const [getCustomAmount, setCustomAmount] = createSignal(''); // For custom withdrawal
|
||||
const [getBalance, setBalance] = createSignal(1250000); // Shared mockup balance
|
||||
const [getMessage, setMessage] = createSignal(''); // For feedback
|
||||
|
||||
// Header
|
||||
function Header() {
|
||||
return h('div', { className: 'header', style: { marginBottom: '2rem' } },
|
||||
h('h1', null, 'ATM TERMINAL'),
|
||||
h('p', null, 'Global Financial Network')
|
||||
);
|
||||
}
|
||||
|
||||
// PIN Entry View
|
||||
function PinView() {
|
||||
const currentPin = getPin();
|
||||
|
||||
const handleNumClick = (num) => {
|
||||
if (currentPin.length < 4) {
|
||||
setPin(prev => prev + num);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClear = () => setPin('');
|
||||
const handleEnter = () => {
|
||||
if (currentPin.length === 4) {
|
||||
// Mock auth success
|
||||
setView('menu');
|
||||
} else {
|
||||
setMessage('Invalid PIN Length');
|
||||
setTimeout(() => setMessage(''), 2000);
|
||||
}
|
||||
};
|
||||
|
||||
return h('div', { className: 'card', style: { padding: '3rem 2rem' } },
|
||||
h('h2', null, 'Enter Security PIN'),
|
||||
h('div', { className: 'pin-display' },
|
||||
currentPin.replace(/./g, '•') || '----'
|
||||
),
|
||||
h('p', { style: { color: 'red', height: '1.5rem' } }, getMessage()),
|
||||
h('div', { className: 'numpad' },
|
||||
['1', '2', '3', '4', '5', '6', '7', '8', '9'].map(num =>
|
||||
h('button', { onClick: () => handleNumClick(num) }, num)
|
||||
),
|
||||
h('button', { style: { background: '#ef4444', color: 'white' }, onClick: handleClear }, 'C'),
|
||||
h('button', { onClick: () => handleNumClick('0') }, '0'),
|
||||
h('button', { style: { background: '#10b981', color: 'white' }, onClick: handleEnter }, '↵')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Main Menu View
|
||||
function MenuView() {
|
||||
return h('div', { className: 'kiosk-content' },
|
||||
h('h2', { style: { textAlign: 'center', marginBottom: '1rem' } }, 'Select Transaction'),
|
||||
h('div', { className: 'kiosk-menu-stack' },
|
||||
h('button', { className: 'kiosk-btn', onClick: () => setView('withdraw') },
|
||||
'Withdraw Cash'
|
||||
),
|
||||
h('button', { className: 'kiosk-btn', onClick: () => setView('balance') },
|
||||
'Check Balance'
|
||||
),
|
||||
h('button', {
|
||||
className: 'kiosk-btn',
|
||||
style: { background: 'var(--bg-surface)', color: 'var(--text-main)', border: '1px solid var(--border)' },
|
||||
onClick: () => {
|
||||
setPin('');
|
||||
setView('pin');
|
||||
}
|
||||
}, 'Cancel Transaction')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Withdraw View
|
||||
function WithdrawView() {
|
||||
const handleWithdraw = (amount) => {
|
||||
if (getBalance() >= amount) {
|
||||
setBalance(prev => prev - amount);
|
||||
setMessage(`Please take your cash: $${amount}`);
|
||||
setTimeout(() => {
|
||||
setMessage('');
|
||||
setView('menu');
|
||||
}, 3000);
|
||||
} else {
|
||||
setMessage('Insufficient Funds');
|
||||
setTimeout(() => setMessage(''), 2000);
|
||||
}
|
||||
};
|
||||
|
||||
if (getMessage()) {
|
||||
return h('div', { className: 'card', style: { padding: '4rem', textAlign: 'center' } },
|
||||
h('h2', { style: { color: 'var(--primary)' } }, getMessage())
|
||||
);
|
||||
}
|
||||
|
||||
return h('div', { className: 'kiosk-content' },
|
||||
h('h2', { style: { textAlign: 'center', marginBottom: '1rem' } }, 'Select Amount'),
|
||||
h('div', { className: 'kiosk-grid' },
|
||||
h('button', { className: 'kiosk-btn', onClick: () => handleWithdraw(20) }, '$20'),
|
||||
h('button', { className: 'kiosk-btn', onClick: () => handleWithdraw(50) }, '$50'),
|
||||
h('button', { className: 'kiosk-btn', onClick: () => handleWithdraw(100) }, '$100'),
|
||||
h('button', {
|
||||
className: 'kiosk-btn',
|
||||
onClick: () => {
|
||||
setCustomAmount('');
|
||||
setView('custom_withdraw');
|
||||
}
|
||||
}, 'Other Amount'),
|
||||
h('button', { className: 'kiosk-btn', style: { gridColumn: 'span 2', background: 'var(--text-muted)' }, onClick: () => setView('menu') }, 'Cancel')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Custom Withdraw View
|
||||
function CustomWithdrawView() {
|
||||
const currentAmount = getCustomAmount();
|
||||
|
||||
const handleNumClick = (num) => {
|
||||
if (currentAmount.length < 5) { // Limit to 5 digits for safety
|
||||
setCustomAmount(prev => prev + num);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClear = () => setCustomAmount('');
|
||||
|
||||
const handleEnter = () => {
|
||||
const amount = parseInt(currentAmount, 10);
|
||||
if (amount > 0) {
|
||||
if (getBalance() >= amount) {
|
||||
setBalance(prev => prev - amount);
|
||||
setMessage(`Please take your cash: $${amount}`);
|
||||
setTimeout(() => {
|
||||
setMessage('');
|
||||
setView('menu');
|
||||
}, 3000);
|
||||
} else {
|
||||
setMessage('Insufficient Funds');
|
||||
setTimeout(() => setMessage(''), 2000);
|
||||
}
|
||||
} else {
|
||||
setMessage('Invalid Amount');
|
||||
setTimeout(() => setMessage(''), 2000);
|
||||
}
|
||||
};
|
||||
|
||||
if (getMessage()) {
|
||||
return h('div', { className: 'card', style: { padding: '4rem', textAlign: 'center' } },
|
||||
h('h2', { style: { color: 'var(--primary)' } }, getMessage())
|
||||
);
|
||||
}
|
||||
|
||||
return h('div', { className: 'card', style: { padding: '3rem 2rem' } },
|
||||
h('h2', null, 'Enter Amount'),
|
||||
h('div', { className: 'pin-display' },
|
||||
currentAmount ? `$${currentAmount}` : '$0'
|
||||
),
|
||||
h('div', { className: 'numpad' },
|
||||
['1', '2', '3', '4', '5', '6', '7', '8', '9'].map(num =>
|
||||
h('button', { onClick: () => handleNumClick(num) }, num)
|
||||
),
|
||||
h('button', { style: { background: '#ef4444', color: 'white' }, onClick: handleClear }, 'C'),
|
||||
h('button', { onClick: () => handleNumClick('0') }, '0'),
|
||||
h('button', { style: { background: '#10b981', color: 'white' }, onClick: handleEnter }, '↵')
|
||||
),
|
||||
h('button', {
|
||||
style: { width: '100%', marginTop: '2rem', padding: '1rem', background: 'var(--text-muted)' },
|
||||
onClick: () => setView('withdraw')
|
||||
}, 'Cancel')
|
||||
);
|
||||
}
|
||||
|
||||
// Balance View
|
||||
function BalanceView() {
|
||||
return h('div', { className: 'card', style: { textAlign: 'center', padding: '3rem' } },
|
||||
h('h2', { style: { color: 'var(--text-muted)' } }, 'Available Balance'),
|
||||
h('div', { style: { fontSize: '4rem', fontWeight: '800', margin: '2rem 0', color: 'var(--primary-hover)' } },
|
||||
'$' + getBalance().toLocaleString()
|
||||
),
|
||||
h('button', { className: 'kiosk-btn', style: { width: '100%', maxWidth: '300px', margin: '0 auto' }, onClick: () => setView('menu') }, 'Return to Menu')
|
||||
);
|
||||
}
|
||||
|
||||
// Main App
|
||||
function App() {
|
||||
const view = getView();
|
||||
|
||||
let mainContent;
|
||||
if (view === 'pin') {
|
||||
mainContent = PinView();
|
||||
} else if (view === 'menu') {
|
||||
mainContent = MenuView();
|
||||
} else if (view === 'withdraw') {
|
||||
mainContent = WithdrawView();
|
||||
} else if (view === 'custom_withdraw') {
|
||||
mainContent = CustomWithdrawView();
|
||||
} else if (view === 'balance') {
|
||||
mainContent = BalanceView();
|
||||
}
|
||||
|
||||
return h('main', null,
|
||||
h('div', { className: 'container' },
|
||||
Header(),
|
||||
mainContent
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Mount
|
||||
const root = document.getElementById('app');
|
||||
render(App, root);
|
||||
16
arma/ui/bank.html
Normal file
16
arma/ui/bank.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>FDIC - Global Financial Network</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="bank.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
265
arma/ui/bank.js
Normal file
265
arma/ui/bank.js
Normal file
@ -0,0 +1,265 @@
|
||||
/**
|
||||
* Player Bank App - Vanilla JS "React-like" Implementation
|
||||
*/
|
||||
|
||||
// --- 1. The "Library" Logic (Reused) ---
|
||||
|
||||
function h(tag, props = {}, ...children) {
|
||||
const el = document.createElement(tag);
|
||||
if (props) {
|
||||
Object.entries(props).forEach(([key, value]) => {
|
||||
if (key.startsWith('on') && typeof value === 'function') {
|
||||
el.addEventListener(key.substring(2).toLowerCase(), value);
|
||||
} else if (key === 'className') {
|
||||
el.className = value;
|
||||
} else if (key === 'style' && typeof value === 'object') {
|
||||
Object.assign(el.style, value);
|
||||
} else {
|
||||
el.setAttribute(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
children.forEach(child => {
|
||||
if (typeof child === 'string' || typeof child === 'number') {
|
||||
el.appendChild(document.createTextNode(child));
|
||||
} else if (child instanceof Node) {
|
||||
el.appendChild(child);
|
||||
} else if (Array.isArray(child)) {
|
||||
child.forEach(c => el.appendChild(c));
|
||||
}
|
||||
});
|
||||
return el;
|
||||
}
|
||||
|
||||
let _rootContainer = null;
|
||||
let _rootComponent = null;
|
||||
|
||||
function render(component, container) {
|
||||
_rootContainer = container;
|
||||
_rootComponent = component;
|
||||
_render();
|
||||
}
|
||||
|
||||
function _render() {
|
||||
_rootContainer.innerHTML = '';
|
||||
_rootContainer.appendChild(_rootComponent());
|
||||
}
|
||||
|
||||
const createSignal = (initialValue) => {
|
||||
let _val = initialValue;
|
||||
const getValue = () => _val;
|
||||
const setValue = (newValue) => {
|
||||
_val = typeof newValue === 'function' ? newValue(_val) : newValue;
|
||||
_render();
|
||||
};
|
||||
return [getValue, setValue];
|
||||
};
|
||||
|
||||
// --- 2. Bank Application Components ---
|
||||
|
||||
// Global State
|
||||
const [getView, setView] = createSignal('login'); // 'login', 'dashboard'
|
||||
const [getBalance, setBalance] = createSignal(1250000);
|
||||
const [getPending, setPending] = createSignal(45250); // Mock pending earnings
|
||||
const [getTransactions, setTransactions] = createSignal([
|
||||
{ id: 1, type: 'credit', desc: 'Contract Payment: OP-442', amount: 150000, date: '2026-02-05' },
|
||||
{ id: 2, type: 'debit', desc: 'Equipment Purchase: Ammunition', amount: -4500, date: '2026-02-04' },
|
||||
{ id: 3, type: 'debit', desc: 'Vehicle Maintenance', amount: -1200, date: '2026-02-03' },
|
||||
]);
|
||||
|
||||
// Header
|
||||
function Header() {
|
||||
return h('div', { className: 'header' },
|
||||
h('h1', {
|
||||
style: { cursor: 'pointer' },
|
||||
onClick: () => setView('login')
|
||||
}, 'Global Financial Network'),
|
||||
h('p', null, 'Secure Banking')
|
||||
);
|
||||
}
|
||||
|
||||
// Login View
|
||||
function BankLogin() {
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
setView('dashboard');
|
||||
};
|
||||
|
||||
return h('div', { className: 'card', style: { maxWidth: '400px', margin: '0 auto' } },
|
||||
h('h2', null, 'Secure Access'),
|
||||
h('form', { onSubmit: handleSubmit },
|
||||
h('div', null,
|
||||
h('label', null, 'Account ID'),
|
||||
h('input', { type: 'text', placeholder: 'xxxx-xxxx-xxxx' })
|
||||
),
|
||||
h('div', null,
|
||||
h('label', null, 'Security PIN'),
|
||||
h('input', { type: 'password', placeholder: '••••' })
|
||||
),
|
||||
h('div', { className: 'form-actions' },
|
||||
h('button', { type: 'submit', style: { width: '100%' } }, 'Authenticate'),
|
||||
h('p', { style: { fontSize: '0.8rem', color: 'var(--text-muted)', marginTop: '1rem' } }, 'Authorized Personnel Only')
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Transaction History Helper
|
||||
function TransactionHistory() {
|
||||
const transactions = getTransactions();
|
||||
|
||||
return h('div', { className: 'card' },
|
||||
h('h3', { style: { textAlign: 'left', borderBottom: '1px solid var(--border)', paddingBottom: '1rem', marginBottom: '1rem' } }, 'Recent Transactions'),
|
||||
h('ul', { style: { listStyle: 'none', padding: 0 } },
|
||||
...transactions.map(tx => h('li', {
|
||||
style: {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
padding: '0.75rem 0',
|
||||
borderBottom: '1px solid var(--bg-surface-hover)'
|
||||
}
|
||||
},
|
||||
h('div', { style: { textAlign: 'left' } },
|
||||
h('div', { style: { fontWeight: '500' } }, tx.desc),
|
||||
h('div', { style: { fontSize: '0.85rem', color: 'var(--text-muted)' } }, tx.date)
|
||||
),
|
||||
h('div', {
|
||||
style: {
|
||||
fontWeight: '700',
|
||||
color: tx.type === 'credit' ? '#10b981' : '#ef4444'
|
||||
}
|
||||
},
|
||||
(tx.type === 'credit' ? '+' : '') + '$' + Math.abs(tx.amount).toLocaleString()
|
||||
)
|
||||
))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Transfer Form
|
||||
function TransferForm() {
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(e.target);
|
||||
const amount = parseFloat(formData.get('amount'));
|
||||
|
||||
if (amount > 0 && amount <= getBalance()) {
|
||||
setBalance(prev => prev - amount);
|
||||
const newTx = {
|
||||
id: Date.now(),
|
||||
type: 'debit',
|
||||
desc: 'Transfer to ' + formData.get('recipient'),
|
||||
amount: -amount,
|
||||
date: new Date().toISOString().split('T')[0]
|
||||
};
|
||||
setTransactions(prev => [newTx, ...prev]);
|
||||
}
|
||||
};
|
||||
|
||||
return h('div', { className: 'card' },
|
||||
h('h2', null, 'Wire Transfer'),
|
||||
h('form', { onSubmit: handleSubmit },
|
||||
h('div', null,
|
||||
h('label', null, 'Recipient Name / GUID'),
|
||||
h('input', { name: 'recipient', type: 'text', placeholder: 'Enter Name or GUID' })
|
||||
),
|
||||
h('div', null,
|
||||
h('label', null, 'Amount'),
|
||||
h('input', { name: 'amount', type: 'number', placeholder: '0.00' })
|
||||
),
|
||||
h('button', { type: 'submit' }, 'Send Funds')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Dashboard View
|
||||
function BankDashboard() {
|
||||
return h('div', { className: 'content' },
|
||||
// Top Row: Balance
|
||||
h('div', { className: 'card', style: { gridColumn: 'span 2' } },
|
||||
h('h2', { style: { fontSize: '1.2rem', color: 'var(--text-muted)', textTransform: 'uppercase', letterSpacing: '0.05em' } }, 'Total Balance'),
|
||||
h('div', { style: { fontSize: '2.8rem', fontWeight: '800', color: 'var(--primary-hover)', margin: '1rem 0' } },
|
||||
'$' + getBalance().toLocaleString()
|
||||
),
|
||||
h('div', { style: { textAlign: 'center', marginBottom: '1.5rem', color: 'var(--text-muted)', fontSize: '1.2rem' } },
|
||||
'Pending: ',
|
||||
h('span', { style: { color: '#fbbf24', fontWeight: 'bold' } }, '$' + getPending().toLocaleString())
|
||||
),
|
||||
h('div', { style: { display: 'flex', gap: '1rem', justifyContent: 'center' } },
|
||||
h('button', {
|
||||
onClick: () => {
|
||||
const pending = getPending();
|
||||
if (pending > 0) {
|
||||
setBalance(prev => prev + pending);
|
||||
setPending(0);
|
||||
const newTx = {
|
||||
id: Date.now(),
|
||||
type: 'credit',
|
||||
desc: 'Field Deposit',
|
||||
amount: pending,
|
||||
date: new Date().toISOString().split('T')[0]
|
||||
};
|
||||
setTransactions(prev => [newTx, ...prev]);
|
||||
}
|
||||
},
|
||||
style: { opacity: getPending() > 0 ? '1' : '0.5', cursor: getPending() > 0 ? 'pointer' : 'default' }
|
||||
}, 'Deposit Pending'),
|
||||
h('button', { style: { background: 'var(--bg-surface-hover)', color: 'var(--text-main)', border: '1px solid var(--border)' } }, 'Statement')
|
||||
)
|
||||
),
|
||||
// Middle Row: Transfer Form
|
||||
TransferForm(),
|
||||
// Bottom Row: History (Full Width in simplified grid, or separate)
|
||||
TransactionHistory()
|
||||
);
|
||||
}
|
||||
|
||||
// Footer
|
||||
function Footer() {
|
||||
return h('div', { className: 'footer' },
|
||||
h('div', { className: 'wrapper' },
|
||||
h('div', null,
|
||||
h('h3', null, 'Secure Banking'),
|
||||
h('ul', { style: { listStyleType: 'none', padding: 0 } },
|
||||
h('li', null, 'FDIC Insured'),
|
||||
h('li', null, 'Fraud Protection'),
|
||||
h('li', null, '24/7 Support'),
|
||||
h('li', null, 'API Access')
|
||||
)
|
||||
),
|
||||
h('div', null,
|
||||
h('h3', null, 'Notices'),
|
||||
h('ul', { style: { listStyleType: 'none', padding: 0 } },
|
||||
h('li', null, 'Terms of Service'),
|
||||
h('li', null, 'Privacy Policy'),
|
||||
h('li', null, 'Interest Rates'),
|
||||
h('li', null, 'Report Fraud')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Main App
|
||||
function App() {
|
||||
const view = getView();
|
||||
|
||||
let mainContent;
|
||||
if (view === 'login') {
|
||||
mainContent = BankLogin();
|
||||
} else if (view === 'dashboard') {
|
||||
mainContent = BankDashboard();
|
||||
}
|
||||
|
||||
return h('main', null,
|
||||
h('div', { className: 'container' },
|
||||
Header(),
|
||||
mainContent
|
||||
),
|
||||
Footer()
|
||||
);
|
||||
}
|
||||
|
||||
// Mount
|
||||
const root = document.getElementById('app');
|
||||
render(App, root);
|
||||
16
arma/ui/index.html
Normal file
16
arma/ui/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ORBIS - Global Organization Network</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
303
arma/ui/style.css
Normal file
303
arma/ui/style.css
Normal file
@ -0,0 +1,303 @@
|
||||
:root {
|
||||
--bg-app: #fdfcf8;
|
||||
/* Warm white */
|
||||
--bg-surface: #ffffff;
|
||||
--bg-surface-hover: #f1f5f9;
|
||||
--primary: #475569;
|
||||
/* Slate gray */
|
||||
--primary-hover: #1e293b;
|
||||
--text-main: #1f2937;
|
||||
--text-muted: #64748b;
|
||||
--text-inverse: #f8fafc;
|
||||
--border: #e2e8f0;
|
||||
--radius: 8px;
|
||||
--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
||||
--footer-bg: #1e293b;
|
||||
/* Dark slate for footer */
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: var(--bg-app);
|
||||
color: var(--text-main);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
#app {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 3rem;
|
||||
padding-bottom: 2rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 0.5rem;
|
||||
letter-spacing: -0.025em;
|
||||
color: var(--primary-hover);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-muted);
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
/* Cards */
|
||||
.card {
|
||||
background: var(--bg-surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
box-shadow: var(--shadow);
|
||||
text-align: center;
|
||||
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
font-size: 1.8rem;
|
||||
color: var(--primary-hover);
|
||||
}
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
button {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--primary-hover);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
|
||||
}
|
||||
|
||||
&+& {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Split Layout */
|
||||
.split-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 2rem;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.info-panel {
|
||||
text-align: left;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
/* Forms */
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
text-align: left;
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--text-muted);
|
||||
font-weight: 500;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--border);
|
||||
background: var(--bg-app);
|
||||
color: var(--text-main);
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.2s;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
margin-top: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cancel-link {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
|
||||
&:hover {
|
||||
color: var(--primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.footer {
|
||||
margin-top: auto;
|
||||
background: var(--footer-bg);
|
||||
color: var(--text-inverse);
|
||||
display: block;
|
||||
|
||||
.wrapper {
|
||||
max-width: 1200px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 3rem 2rem;
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 4rem;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: var(--text-inverse);
|
||||
font-size: 0.85rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
font-weight: 700;
|
||||
margin-bottom: 1.5rem;
|
||||
border-bottom: 1px solid #475569 !important;
|
||||
padding-bottom: 0.5rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
ul {
|
||||
li {
|
||||
color: #cbd5e1;
|
||||
font-size: 0.95rem;
|
||||
margin-bottom: 0.75rem !important;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s;
|
||||
|
||||
&:hover {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ATM Kiosk Styles */
|
||||
.kiosk-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.kiosk-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
/* Constrain width for better look */
|
||||
}
|
||||
|
||||
.kiosk-menu-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
/* Narrower for vertical stack */
|
||||
}
|
||||
|
||||
.kiosk-btn {
|
||||
padding: 2rem;
|
||||
font-size: 1.25rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
height: 100%;
|
||||
min-height: 120px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.numpad {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 1rem;
|
||||
max-width: 300px;
|
||||
margin: 0 auto;
|
||||
|
||||
button {
|
||||
padding: 1.5rem;
|
||||
font-size: 1.5rem;
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-main);
|
||||
border: 1px solid var(--border);
|
||||
box-shadow: var(--shadow);
|
||||
margin: 0;
|
||||
|
||||
&:hover {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
border-color: var(--primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pin-display {
|
||||
font-size: 2.5rem;
|
||||
letter-spacing: 0.5rem;
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
font-family: monospace;
|
||||
color: var(--primary);
|
||||
}
|
||||
@ -20,7 +20,7 @@
|
||||
[["_SP_PLAYER_",[["30Rnd_65x39_caseless_mag",[["amount",4],["classname","30Rnd_65x39_caseless_mag"],["category","magazine"]]],["arifle_MX_F",[["amount",1],["classname","arifle_MX_F"],["category","weapon"]]],["NVGoggles",[["amount",1],["classname","NVGoggles"],["category","hmd"]]]]]];
|
||||
|
||||
// Org Registry
|
||||
[["0160566824",[["assets",[]],["name","Black Rifle Company"],["id","0160566824"],["funds",0],["reputation",0],["owner","_SP_PLAYER_"],["members",[["_SP_PLAYER_",[["name","Jacob Schmidt"],["uid","_SP_PLAYER_"]]]]]]]];
|
||||
[["default",[["name","Forge Dynamics"],["id","default"],["funds",200000],["reputation",0],["owner","server"]]],["0160566824",[["name","Black Rifle Company"],["id","0160566824"],["funds",0],["reputation",0],["owner","_SP_PLAYER_"],["members",[["_SP_PLAYER_",[["name","Jacob Schmidt"],["uid","_SP_PLAYER_"]]]]]]]];
|
||||
// Org Index Registry
|
||||
[["_SP_PLAYER_",[["orgID","0160566824"]]]];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user