- Split BankBaseStore into SessionManager, Messenger, Model, Store, Validator - Extract validation logic into BankValidator with try/catch and per-action methods - Remove duplicate notifications from transaction actions - Update event handlers to call validator first, forward context to store/session - Fix locker grantItems: add missing 'attachment' category mapping to 'item' - Fix locker grantItems: replace exitWith with if/else to prevent skipping remaining items Co-Authored-By: Oz <oz-agent@warp.dev>
52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
#include "script_component.hpp"
|
|
|
|
if (isNil QGVAR(BankClass)) then { call FUNC(initClass); };
|
|
if (isNil QGVAR(BankUIBridge)) then { call FUNC(initUIBridge); };
|
|
|
|
[QGVAR(initBank), {
|
|
GVAR(BankClass) call ["init", []];
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseInitBank), {
|
|
params [["_data", createHashMap, [createHashMap]]];
|
|
|
|
GVAR(BankClass) call ["sync", [_data, true]];
|
|
if !(isNil QGVAR(BankUIBridge)) then {
|
|
GVAR(BankUIBridge) call ["refreshSession", []];
|
|
};
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseSyncBank), {
|
|
params [["_data", createHashMap, [createHashMap]], ["_jip", false, [false]]];
|
|
|
|
GVAR(BankClass) call ["sync", [_data, _jip]];
|
|
if !(isNil QGVAR(BankUIBridge)) then {
|
|
GVAR(BankUIBridge) call ["refreshSession", []];
|
|
};
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseHydrateBank), {
|
|
params [["_data", createHashMap, [createHashMap]]];
|
|
|
|
if !(isNil QGVAR(BankUIBridge)) then {
|
|
GVAR(BankUIBridge) call ["handleHydrateResponse", [_data, "bank::hydrate"]];
|
|
};
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[QGVAR(responseBankNotice), {
|
|
params [
|
|
["_type", "error", [""]],
|
|
["_message", "", [""]]
|
|
];
|
|
|
|
if !(isNil QGVAR(BankUIBridge)) then {
|
|
GVAR(BankUIBridge) call ["handleNoticeResponse", [_type, _message]];
|
|
};
|
|
}] call CFUNC(addEventHandler);
|
|
|
|
[{
|
|
getPlayerUID player isNotEqualTo "";
|
|
}, {
|
|
[QGVAR(initBank), []] call CFUNC(localEvent);
|
|
}] call CFUNC(waitUntilAndExecute);
|