feat: implement new admin panel, in-game store, and arsenal management systems.

This commit is contained in:
Jacob Schmidt 2025-12-23 05:45:17 -06:00
parent 61abcf5200
commit 89d0b2d8bb
21 changed files with 322 additions and 368 deletions

View File

@ -1,7 +1,7 @@
PREP(adminMessage);
PREP(adminPromote);
PREP(adminRefresh);
PREP(adminTransfer);
PREP(handleEvents);
PREP(handleTransfer);
PREP(initAdmin);
PREP(openAdmin);
PREP(printAddonName);
PREP(sendMessage);
PREP(updatePaygrade);

View File

@ -1,49 +0,0 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_adminMessage
* Author: IDSolutions
*
* [Description]
* Admin Message Menu
*
* Arguments:
* None
*
* Return Value:
* None
*
* Examples:
* None
*
* Public: Yes
*/
private ["_data", "_dialog", "_list", "_target", "_targetValue", "_textBox", "_textMessage"];
_dialog = findDisplay 202303;
_list = _dialog displayCtrl 2023001;
_textBox = _dialog displayCtrl 2023006;
_targetValue = lbCurSel _list;
_data = _list lbData _targetValue;
if ((isNil {_data})) exitWith { hintSilent "You did not select a player!" };
{
if (str (name (_x)) == str _data) then {
_target = _x;
};
} forEach playableUnits;
hintSilent format ["Player Selected. You have selected %1", _target];
if (isNil "_target") then {
hintSilent "Please Select an Active Player First!"
} else {
_textMessage = ctrlText _textBox;
[_target, _textMessage] remoteExec ["forge_server_misc_fnc_textMessage", 2];
// [format ["Message sent to %1: <br/>%2", _target, _textMessage], "blue-grey", 3] call EFUNC(misc,notify);
};
["dummy"] call FUNC(adminRefresh);

View File

@ -1,51 +0,0 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_adminPromote
* Author: IDSolutions
*
* [Description]
* Admin Promote Menu
*
* Arguments:
* None
*
* Return Value:
* None
*
* Examples:
* None
*
* Public: Yes
*/
params [["_condition", "", [""]]];
private ["_data", "_data2", "_dialog", "_list", "_list2", "_paygrade", "_rankValue", "_target", "_targetValue"];
_dialog = findDisplay 202303;
_list = _dialog displayCtrl 2023001;
_list2 = _dialog displayCtrl 2023003;
_targetValue = lbCurSel _list;
_rankValue = lbCurSel _list2;
_data = _list lbData _targetValue;
_data2 = call compile format ["%1", (_list2 lbData _rankValue)];
_paygrade = _data2 select 0;
if ((isNil {_data})) exitWith { hintSilent "You did not select a player!" };
{
if (str (name (_x)) == str _data) then {
_target = _x;
};
} forEach playableUnits;
switch (_condition) do {
case ("promote"): {
SETPVAR(_target,FORGE_PayGrade,_paygrade)
};
case ("demote"): {
SETPVAR(_target,FORGE_PayGrade,_paygrade)
};
};
["dummy"] call FUNC(adminRefresh);

View File

@ -5,74 +5,39 @@
* Author: IDSolutions
*
* [Description]
* Admin Refresh Menu
* Refreshes the admin interface player list and resets input fields.
* This function populates the player list with names and paygrades,
* storing player UIDs as data for each entry. Only shows players
* on the same side as the admin.
*
* Arguments:
* None
* 0: Dummy <ANY> - Optional parameter, not used (for compatibility with event handlers)
*
* Return Value:
* None
*
* Examples:
* None
* [] call forge_client_admin_fnc_adminRefresh;
* ["dummy"] call forge_client_admin_fnc_adminRefresh;
*
* Public: Yes
* Public: No - Called from admin dialog controls
*/
params [["_condition", "", [""]], ["_amount", 0, [0]]];
private _store = missionNamespace getVariable ["FORGE_ORG_STORE_REG", createHashMap];
private _org = _store call ["getOrg", []];
if (isNil "_org") exitWith { ["You are not in an organization!", "warning", 3] call EFUNC(misc,notify) };
private _orgFunds = _org get "funds";
private _newFunds = 0;
private _dialog = findDisplay 202303;
private _list = _dialog displayCtrl 2023001;
switch (_condition) do {
case ("deduct"): {
_newFunds = _orgFunds - _amount;
ctrlSetText [2023002, format ["$%1", (_newFunds call EFUNC(misc,formatNumber))]];
};
case ("advance"): {
_newFunds = _orgFunds + _amount;
ctrlSetText [2023002, format ["$%1", (_newFunds call EFUNC(misc,formatNumber))]];
};
default {
lbClear _list;
{
if (str (side _x) == str (playerSide)) then {
private _name = name (_x);
private _defaultPaygrade = "E1";
private _paygrade = GETVAR(_x,FORGE_PayGrade,_defaultPaygrade);
private _index = _list lbAdd format["%1 - %2", _name, _paygrade];
_list lbSetData [_index, name (_x)];
};
} forEach playableUnits;
lbSetCurSel [2023001, 0];
ctrlSetText [2023005, ""];
ctrlSetText [2023006, ""];
};
};
lbClear _list;
{
if (str (side _x) == str (playerSide)) then {
private _name = name (_x);
private _defaultPaygrade = "E1";
private _paygrade = GETVAR(_x,FORGE_PayGrade,_defaultPaygrade);
private _paygrade = GETVAR(_x,FORGE_PayGrade,QUOTE(E1));
private _index = _list lbAdd format["%1 - %2", _name, _paygrade];
_list lbSetData [_index, name (_x)];
_list lbSetData [_index, getPlayerUID _x];
};
} forEach playableUnits;
} forEach allPlayers;
lbSetCurSel [2023001, 0];
ctrlSetText [2023005, ""];

View File

@ -1,118 +0,0 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_adminTransfer
* Author: IDSolutions
*
* [Description]
* Admin Transfer Menu
*
* Arguments:
* None
*
* Return Value:
* None
*
* Examples:
* None
*
* Public: Yes
*/
params [["_condition", "", [""]]];
private _store = missionNamespace getVariable ["FORGE_ORG_STORE_REG", createHashMap];
private _org = _store call ["getOrg", []];
if (isNil "_org") exitWith { ["You are not in an organization!", "warning", 3] call EFUNC(misc,notify) };
private _orgFunds = _org get "funds";
private _dialog = findDisplay 202303;
private _list = _dialog displayCtrl 2023001;
private _targetValue = lbCurSel _list;
private _data = _list lbData _targetValue;
private _amount = round (parseNumber (ctrlText 2023005));
if ((isNil {_data})) exitWith { hint "You did not select a player!" };
{
if (str (name (_x)) == str _data) then {
private _target = _x;
};
} count playableUnits;
switch (_condition) do {
case ("advance"): {
private _bank = GETVAR(_target,FORGE_Bank,0);
private _newBalance = _bank + _amount;
if (_amount > _orgFunds) exitWith { ["Not enough money in the organization's account!", "warning", 3] call EFUNC(misc,notify) };
SETPVAR(_target,FORGE_Bank,_newBalance);
["deduct", _amount] call FUNC(adminRefresh);
_store call ["updateFunds", -_amount];
};
case ("advanceAll"): {
private _count = count playableUnits;
if ((10000 * _count) > _orgFunds) exitWith { ["Not enough money in the organization's account!", "warning", 3] call EFUNC(misc,notify) };
{
private _bank = GETVAR(_x,FORGE_Bank,0);
private _newBalance = _bank + 10000;
SETPVAR(_x,FORGE_Bank,_newBalance);
} count playableUnits;
["deduct", (10000 * _count)] call FUNC(adminRefresh);
_store call ["updateFunds", -(10000 * _count)];
};
case ("deduct"): {
private _bank = GETVAR(_target,FORGE_Bank,0);
private _newBalance = _bank - _amount;
if (_amount > _bank) exitWith { ["Not enough money in the player's account!", "warning", 3] call EFUNC(misc,notify) };
SETPVAR(_target,FORGE_Bank,_newBalance);
["advance", _amount] call FUNC(adminRefresh);
_store call ["updateFunds", _amount];
};
case ("payday"): {
private _totalPayment = 0;
private _paymentToDo = [];
private _payGrades = (missionConfigFile >> "CfgPaygrades" >> "payGrades") call BIS_fnc_getCfgData;
{
private _player = _x;
private _payGrade = GETVAR(_player,FORGE_PayGrade,nil);
{
_x params ["_payGradeIndex", "_payGradeBonus"];
if ((_x select 0) == _payGrade) then {
_paymentToDo pushBack [_player, _payGradeBonus];
_totalPayment = _totalPayment + _payGradeBonus;
};
} forEach _payGrades;
} count playableUnits;
if (_totalPayment > _orgFunds) exitWith { ["Not enough money in the organization's account!", "warning", 3] call EFUNC(misc,notify) };
{
_x params ["_player", "_bonus"];
private _bank = GETVAR(_player,FORGE_Bank,0);
private _newBalance = _bank + _bonus;
SETPVAR(_player,FORGE_Bank,_newBalance);
} count _paymentToDo;
["deduct", _totalPayment] call FUNC(adminRefresh);
_store call ["updateFunds", -_totalPayment];
};
};
ctrlSetText [2023005, ""];

View File

@ -0,0 +1,62 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_handleEvents
* Author: IDSolutions
*
* [Description]
* Handles events from the admin interface.
* This function listens for events from the admin interface
* and processes them accordingly.
*
* Arguments:
* 0: Event <STRING> - The event to handle
* 1: Data <ANY> - The data associated with the event
*
* Return Value:
* None
*
* Examples:
* ["EVENT_NAME", "DATA"] call forge_client_admin_fnc_handleEvents;
*
* Public: No - Called from admin dialog controls
*/
params ["_control", "_isConfirmDialog", "_message"];
diag_log format ["[FORGE: Admin] Received event: %1", _message];
private _messageParts = _message splitString ":";
private _event = _messageParts select 0;
private _data = _messageParts select 1;
switch (_event) do {
case "REQUEST_PLAYER_DATA": {
private _playerData = createHashMap;
private _playerList = [];
{
private _player = _x;
private _uid = getPlayerUID _player;
private _name = name _player;
private _paygrade = GETVAR(_player,FORGE_PayGrade,QUOTE(E1));
private _funds = GETVAR(_player,FORGE_BankBalance,0);
private _playerInfo = createHashMapFromArray [
["uid", _uid],
["name", _name],
["paygrade", _paygrade],
["funds", _funds],
["side", str (side _player)]
];
_playerList pushBack _playerInfo;
} forEach allPlayers;
_playerData set ["players", _playerList];
_control ctrlWebBrowserAction ["ExecJS", format ["handlePlayerDataRequest(%1)", (toJSON _playerList)]];
};
default {
diag_log format ["[FORGE: Admin] Unknown event: %1", _event];
};
};

View File

@ -0,0 +1,40 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_handleTransfer
* Author: IDSolutions
*
* [Description]
* Handles fund transfers through the admin interface.
* This function retrieves the selected player's UID and amount
* from the admin dialog, then sends it to the server-side admin store.
* Supports multiple transfer types: advance (to single player),
* deduct (from single player), advanceAll (to all players),
* and payday (distribute based on paygrade).
*
* Arguments:
* 0: Condition <STRING> - The type of transfer to perform ("advance", "deduct", "advanceAll", "payday")
*
* Return Value:
* None
*
* Examples:
* ["advance"] call forge_client_admin_fnc_handleTransfer;
* ["payday"] call forge_client_admin_fnc_handleTransfer;
*
* Public: No - Called from admin dialog controls
*/
params [["_condition", "", [""]]];
private _dialog = findDisplay 202303;
private _list = _dialog displayCtrl 2023001;
private _index = lbCurSel _list;
private _uid = _list lbData _index;
private _amount = round (parseNumber (ctrlText 2023005));
if (_condition in ["advance", "deduct"] && ((isNil "_uid") || { _uid isEqualTo "" })) exitWith { hint "You did not select a player!"; };
[_condition, _amount, _uid] remoteExec ["forge_server_admin_fnc_handleTransfer", 2];
ctrlSetText [2023005, ""];

View File

@ -27,13 +27,13 @@ private _list = _dialog displayCtrl 2023001;
private _list2 = _dialog displayCtrl 2023003;
{
if (str (side _x) == str (playerSide)) then {
if (str (side _x) == str (playerSide) && isPlayer _x) then {
private _name = name (_x);
private _defaultPaygrade = "E1";
private _payGrade = GETVAR(_x,FORGE_PayGrade,_defaultPaygrade);
private _uid = getPlayerUID _x;
private _payGrade = GETVAR(_x,FORGE_PayGrade,QUOTE(E1));
private _index = _list lbAdd format["%1 - %2", _name, _payGrade];
_list lbSetData [_index, _name];
_list lbSetData [_index, _uid];
};
} count (allPlayers);

View File

@ -1,22 +0,0 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_printAddonName
* Author: IDSolutions
*
* [Description]
* Prints the name of the addon to the system chat.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Examples:
* None
*
* Public: No
*/
systemChat format ["Thank you for using the %1", 'ADDON'];

View File

@ -0,0 +1,37 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_sendMessage
* Author: IDSolutions
*
* [Description]
* Sends a message to a selected player through the admin interface.
* This function retrieves the selected player's UID and message content
* from the admin dialog, then sends it to the server-side admin store.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Examples:
* [] call forge_client_admin_fnc_sendMessage;
*
* Public: No - Called from admin dialog controls
*/
private _dialog = findDisplay 202303;
private _list = _dialog displayCtrl 2023001;
private _control = _dialog displayCtrl 2023006;
private _index = lbCurSel _list;
private _uid = _list lbData _index;
private _message = ctrlText _control;
if ((isNil "_uid") || {_uid isEqualTo ""}) exitWith { hintSilent "You did not select a player!"; };
[_uid, _message] remoteExec ["forge_server_admin_fnc_sendMessage", 2];
hintSilent format ["Message sent to UID %1: %2", _uid, _message];
["dummy"] call FUNC(adminRefresh);

View File

@ -0,0 +1,37 @@
#include "..\script_component.hpp"
/*
* Function: forge_client_admin_fnc_updatePaygrade
* Author: IDSolutions
*
* [Description]
* Updates a player's paygrade in the server's admin store.
* This function retrieves the selected player's UID and the target paygrade
* from the admin dialog, then sends it to the server-side admin store.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Examples:
* [] call forge_client_admin_fnc_updatePaygrade;
*
* Public: No - Called from admin dialog controls
*/
private _dialog = findDisplay 202303;
private _list = _dialog displayCtrl 2023001;
private _list2 = _dialog displayCtrl 2023003;
private _targetIndex = lbCurSel _list;
private _rankIndex = lbCurSel _list2;
private _targetUID = _list lbData _targetIndex;
private _rankData = call compile format ["%1", (_list2 lbData _rankIndex)];
private _paygrade = _rankData select 0;
if ((isNil "_targetUID") || {_targetUID isEqualTo ""}) exitWith { hintSilent "You did not select a player!" };
[_targetUID, _paygrade] remoteExec ["forge_server_admin_fnc_updatePaygrade", 2];
["dummy"] call FUNC(adminRefresh);

View File

@ -83,7 +83,7 @@ class RscAdmin {
class RscAdminPromote: RscButton {
idc = -1;
colorText[] = {1,1,1,1};
onButtonClick = "['promote'] call forge_client_admin_fnc_adminPromote;";
onButtonClick = "[] call forge_client_admin_fnc_updatePaygrade;";
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1};
text = "Promote";
x = "0.675 * safezoneW + safezoneX";
@ -163,7 +163,7 @@ class RscAdmin {
class RscAdminSend: RscButton {
idc = -1;
colorText[] = {1,1,1,1};
onButtonClick = "[] call forge_client_admin_fnc_adminMessage;";
onButtonClick = "[] call forge_client_admin_fnc_sendMessage;";
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1};
text = "Send Message";
x = "0.6125 * safezoneW + safezoneX";

View File

@ -26,15 +26,15 @@ private _default = [[],[],[],[]];
private _armory_unlocks = GETVAR(player,Armory_Unlocks,_default);
private _typeToNumber = switch (_type) do {
case "backpack": {3};
case "facewear": {0};
case "headgear": {0};
case "hmd": {0};
case "item": {0};
case "magazine": {2};
case "uniform": {0};
case "facewear";
case "headgear";
case "hmd";
case "item";
case "uniform";
case "vest": {0};
case "weapon": {1};
case "magazine": {2};
case "backpack": {3};
default {0};
};

View File

@ -5,25 +5,26 @@
* Author: IDSolutions
*
* [Description]
* Initializes the arsenal system
* Initializes the arsenal system with armory and garage data
*
* Arguments:
* 0: Armory data <ARRAY>
* 1: Garage data <ARRAY>
* 0: Armory data <ARRAY> - [items, weapons, magazines, backpacks]
* 1: Garage data <ARRAY> - [cars, armor, helicopters, planes, naval, static]
*
* Return Value:
* None
* BOOLEAN - true if initialization successful, false if invalid data
*
* Examples:
* None
*
* Public: Yes
* Example:
* [[_items, _weapons, _magazines, _backpacks], [_cars, _armor, _helis, _planes, _naval, _statics]] call forge_client_arsenal_fnc_initArsenal
*/
params [["_armory_data", [], [[]]], ["_garage_data", [], [[]]]];
if (count _armory_data isEqualTo [""]) then { _armory_data = [[],[],[],[]] };
if (count _garage_data isEqualTo [""]) then { _garage_data = [[],[],[],[],[],[]] };
private _defaultArmory = [[],[],[],[]];
private _defaultGarage = [[],[],[],[],[],[]];
if (!(_armory_data isEqualTypeArray _defaultArmory) || (count _armory_data != 4)) then { _armory_data = _defaultArmory; };
if (!(_garage_data isEqualTypeArray _defaultGarage) || (count _garage_data != 6)) then { _garage_data = _defaultGarage; };
if (GVAR(armory_type) == 0) then {
{
[GVAR(gear_box), _x, false, true, 1, _forEachIndex] call BFUNC(addVirtualItemCargo);
@ -34,23 +35,29 @@ if (GVAR(armory_type) == 0) then {
} forEach _armory_data;
};
_armory_data params [["_items", [], [[]]], ["_weapons", [], [[]]], ["_magazines", [], [[]]], ["_backpacks", [], [[]]]];
_garage_data params [["_cars", [], [[]]], ["_armor", [], [[]]], ["_helis", [], [[]]], ["_planes", [], [[]]], ["_naval", [], [[]]], ["_statics", [], [[]]]];
GVAR(armory_unlocks) = _armory_data;
GVAR(garage_unlocks) = _garage_data;
GVAR(item_unlocks) = _armory_data select 0;
GVAR(weapon_unlocks) = _armory_data select 1;
GVAR(magazine_unlocks) = _armory_data select 2;
GVAR(backpack_unlocks) = _armory_data select 3;
GVAR(item_unlocks) = _items;
GVAR(weapon_unlocks) = _weapons;
GVAR(magazine_unlocks) = _magazines;
GVAR(backpack_unlocks) = _backpacks;
GVAR(car_unlocks) = _garage_data select 0;
GVAR(armor_unlocks) = _garage_data select 1;
GVAR(heli_unlocks) = _garage_data select 2;
GVAR(plane_unlocks) = _garage_data select 3;
GVAR(naval_unlocks) = _garage_data select 4;
GVAR(static_unlocks) = _garage_data select 5;
GVAR(car_unlocks) = _cars;
GVAR(armor_unlocks) = _armor;
GVAR(heli_unlocks) = _helis;
GVAR(plane_unlocks) = _planes;
GVAR(naval_unlocks) = _naval;
GVAR(static_unlocks) = _statics;
{
[_x] call FUNC(addVirtualVehicles);
} forEach GVAR(garage_unlocks);
TRACE_2("Arsenal System Initialized with defaults",count GVAR(armory_unlocks),count GVAR(garage_unlocks));
private _armoryCount = count (_armory_data select { count _x > 0 });
private _garageCount = count (_garage_data select { count _x > 0 });
TRACE_2("Arsenal System Initialized",_armoryCount,_garageCount);

View File

@ -2,6 +2,7 @@ PREP(buyItem);
PREP(buyVehicle);
PREP(changeFilter);
PREP(changePayment);
PREP(handleDelivery);
PREP(handlePurchase);
PREP(initStore);
PREP(openStore);

View File

@ -30,10 +30,7 @@ private _locker = GETVAR(player,FORGE_Locker,[]);
if !([_price] call FUNC(handlePurchase)) exitWith {};
switch (_configType) do {
case "item": {
_displayName = getText (configFile >> "CfgWeapons" >> _className >> "displayName");
_locker pushBack [_itemType, _className];
};
case "item";
case "weapon": {
_displayName = getText (configFile >> "CfgWeapons" >> _className >> "displayName");
_locker pushBack [_itemType, _className];
@ -48,7 +45,7 @@ switch (_configType) do {
};
};
SETPVAR(player,FORGE_Locker,_locker);
[_locker] spawn FUNC(handleDelivery);
[_className, _itemType] call EFUNC(arsenal,addArmoryItem);

View File

@ -38,14 +38,7 @@ private _items = _data select 1;
if (_category == _selectedCategory) then {
switch (_configType) do {
case "item": {
private _displayName = getText (configFile >> "CfgWeapons" >> _item >> "displayName");
private _picture = getText (configFile >> "CfgWeapons" >> _item >> "picture");
_index = _productList lbAdd _displayName;
_productList lbSetData [_index, str [_item, _price, _category, _configType, _itemType]];
_productList lbSetPicture [_index, _picture];
};
case "item";
case "weapon": {
private _displayName = getText (configFile >> "CfgWeapons" >> _item >> "displayName");
private _picture = getText (configFile >> "CfgWeapons" >> _item >> "picture");
@ -62,14 +55,7 @@ private _items = _data select 1;
_productList lbSetData [_index, str [_item, _price, _category, _configType, _itemType]];
_productList lbSetPicture [_index, _picture];
};
case "backpack": {
private _displayName = getText (configFile >> "CfgVehicles" >> _item >> "displayName");
private _picture = getText (configFile >> "CfgVehicles" >> _item >> "picture");
_index = _productList lbAdd _displayName;
_productList lbSetData [_index, str [_item, _price, _category, _configType, _itemType]];
_productList lbSetPicture [_index, _picture];
};
case "backpack";
case "vehicle": {
private _displayName = getText (configFile >> "CfgVehicles" >> _item >> "displayName");
private _picture = getText (configFile >> "CfgVehicles" >> _item >> "picture");

View File

@ -0,0 +1,69 @@
#include "..\script_component.hpp"
/*
* Function: forge_store_fnc_handleDelivery
* Description:
* Handles the delivery timer and locker updates for purchased items
*
* Parameters:
* 0: New Locker Contents <ARRAY>
*
* Returns:
* None
*
* Example:
* [_newLocker] spawn forge_store_fnc_handleDelivery
*/
params [["_newLocker", [], [[]]]];
if (_newLocker isEqualTo []) exitWith {
["Error: Empty locker contents", "error", 5] call FUNC(notify);
};
private _deliveryTime = ["DT", 0] call BIS_fnc_getParamValue;
if (_deliveryTime > 0) then {
[
format [
"<t align='left'>Order Processing</t><br/><t size='0.8' align='left'>Estimated delivery: %1</t>",
[_deliveryTime, "MM:SS"] call BIS_fnc_secondsToString
],
"info",
3,
"left"
] call FUNC(notify);
sleep (_deliveryTime / 2);
[
"<t align='left'>Package in transit</t>",
"warning",
2,
"left"
] call FUNC(notify);
sleep (_deliveryTime / 2);
SETPVAR(player,FORGE_Locker,_newLocker);
[
"<t align='left'>Order Delivered!</t><br/><t size='0.8' align='left'>Check your locker</t>",
"success",
5,
"left"
] call FUNC(notify);
if (hasInterface) then {
playSound "FD_Finish_F";
};
} else {
SETPVAR(player,FORGE_Locker,_newLocker);
[
"<t align='left'>Order Complete!</t><br/><t size='0.8' align='left'>Items added to locker</t>",
"success",
3,
"left"
] call FUNC(notify);
};

View File

@ -47,14 +47,13 @@ if (_payment select 0 == "Organization") then {
};
};
private _varType = _payment select 2;
private _varType = toLower (_payment select 2);
private _varName = _payment param [1, "", [""]];
private _balance = switch (_varType) do {
case "organization": {
_store call ["getFunds", []];
};
case "player": { player getVariable [_payment select 1, 0] };
case "mission": { missionNamespace getVariable [_payment select 1, 0] };
default { 0 };
case "organization": { _store call ["getFunds", []] };
case "player": { GETVAR(player,_varName,0) };
case "mission": { GETVAR(missionNamespace,_varName,0) };
default { diag_log "[FORGE Store] Error: Unknown payment type"; 0 };
};
if (_balance < _price) exitWith {
@ -63,14 +62,14 @@ if (_balance < _price) exitWith {
};
switch (_varType) do {
case "organization": {
_store call ["updateFunds", -_price];
};
case "organization": { _store call ["updateFunds", -_price] };
case "player": {
player setVariable [_payment select 1, (_balance - _price), true];
private _newBalance = _balance - _price;
SETPVAR(player,_varName,_newBalance);
};
case "mission": {
missionNamespace setVariable [_payment select 1, (_balance - _price), true];
private _newBalance = _balance - _price;
SETPVAR(missionNamespace,_varName,_newBalance);
};
};

View File

@ -30,14 +30,11 @@ private _display = findDisplay IDD_STOREDIALOG;
private _categoryList = _display displayCtrl IDC_CATEGORYLIST;
private _paymentList = _display displayCtrl IDC_PAYMENTLIST;
private _storeName = _display displayCtrl IDC_DIALOGNAME;
private _data = _store getVariable "storeData";
private _categories = _data select 0;
private _products = _data select 1;
private _name = _data select 2;
private _paymentMethods = _data select 3;
private _data = _store getVariable ["storeData", []];
_data params [["_categories", [], [[]]], ["_products", [], [[]]], ["_name", "", [""]], ["_paymentMethods", [], [[]]]];
GVAR(currentStore) = _data;
_storeName ctrlSetText _name;
{

View File

@ -23,12 +23,9 @@ private _display = findDisplay IDD_STOREDIALOG;
private _productList = _display displayCtrl IDC_PRODUCTLIST;
private _productIndex = lbCurSel _productList;
private _productData = lbData [IDC_PRODUCTLIST, _productIndex];
private _product = call compile _productData;
private _item = _product select 0;
private _price = _product select 1;
private _configType = _product select 3;
private _itemType = _product select 4;
_product params [["_item", "", [""]], ["_price", 0, [0]], ["_category", "", [""]], ["_configType", "", [""]], ["_itemType", "", [""]]];
switch (_configType) do {
case "item";