From 58902f0c298a969d36f91c3303d17b147da737dd Mon Sep 17 00:00:00 2001 From: Jacob Schmidt Date: Fri, 6 Feb 2026 06:22:32 -0600 Subject: [PATCH] feat: implement initial in-game store system with web-based UI. --- .../actor/functions/fnc_handleUIEvents.sqf | 4 +- arma/client/addons/actor/ui/_site/script.js | 7 ++ arma/client/addons/store/$PBOPREFIX$ | 1 + arma/client/addons/store/CfgEventHandlers.hpp | 19 ++++ arma/client/addons/store/README.md | 4 + arma/client/addons/store/XEH_PREP.hpp | 3 + arma/client/addons/store/XEH_postInit.sqf | 1 + .../addons/store/XEH_postInitClient.sqf | 3 + arma/client/addons/store/XEH_preInit.sqf | 10 ++ .../client/addons/store/XEH_preInitClient.sqf | 1 + arma/client/addons/store/XEH_preStart.sqf | 2 + arma/client/addons/store/config.cpp | 21 ++++ .../store/functions/fnc_handleUIEvents.sqf | 38 +++++++ .../store/functions/fnc_initStoreClass.sqf | 38 +++++++ .../addons/store/functions/fnc_openUI.sqf | 35 +++++++ arma/client/addons/store/initKeybinds.inc.sqf | 1 + arma/client/addons/store/initSettings.inc.sqf | 1 + arma/client/addons/store/script_component.hpp | 9 ++ arma/client/addons/store/stringtable.xml | 8 ++ arma/client/addons/store/ui/RscCommon.hpp | 98 +++++++++++++++++++ arma/client/addons/store/ui/RscStore.hpp | 21 ++++ .../store.html => store/ui/_site/index.html} | 22 ++--- .../store.js => store/ui/_site/script.js} | 62 ++++++------ .../store.css => store/ui/_site/style.css} | 12 ++- 24 files changed, 371 insertions(+), 50 deletions(-) create mode 100644 arma/client/addons/store/$PBOPREFIX$ create mode 100644 arma/client/addons/store/CfgEventHandlers.hpp create mode 100644 arma/client/addons/store/README.md create mode 100644 arma/client/addons/store/XEH_PREP.hpp create mode 100644 arma/client/addons/store/XEH_postInit.sqf create mode 100644 arma/client/addons/store/XEH_postInitClient.sqf create mode 100644 arma/client/addons/store/XEH_preInit.sqf create mode 100644 arma/client/addons/store/XEH_preInitClient.sqf create mode 100644 arma/client/addons/store/XEH_preStart.sqf create mode 100644 arma/client/addons/store/config.cpp create mode 100644 arma/client/addons/store/functions/fnc_handleUIEvents.sqf create mode 100644 arma/client/addons/store/functions/fnc_initStoreClass.sqf create mode 100644 arma/client/addons/store/functions/fnc_openUI.sqf create mode 100644 arma/client/addons/store/initKeybinds.inc.sqf create mode 100644 arma/client/addons/store/initSettings.inc.sqf create mode 100644 arma/client/addons/store/script_component.hpp create mode 100644 arma/client/addons/store/stringtable.xml create mode 100644 arma/client/addons/store/ui/RscCommon.hpp create mode 100644 arma/client/addons/store/ui/RscStore.hpp rename arma/client/addons/{actor/ui/_site/store.html => store/ui/_site/index.html} (89%) rename arma/client/addons/{actor/ui/_site/store.js => store/ui/_site/script.js} (74%) rename arma/client/addons/{actor/ui/_site/store.css => store/ui/_site/style.css} (98%) diff --git a/arma/client/addons/actor/functions/fnc_handleUIEvents.sqf b/arma/client/addons/actor/functions/fnc_handleUIEvents.sqf index 8c565e0..e8fd035 100644 --- a/arma/client/addons/actor/functions/fnc_handleUIEvents.sqf +++ b/arma/client/addons/actor/functions/fnc_handleUIEvents.sqf @@ -4,7 +4,7 @@ * File: fnc_handleUIEvents.sqf * Author: IDSolutions * Date: 2026-01-28 - * Last Update: 2026-02-04 + * Last Update: 2026-02-06 * Public: No * * Description: @@ -41,7 +41,7 @@ switch (_event) do { case "actor::open::vlocker": { [FORGE_Locker_Box, player, false] spawn AFUNC(arsenal,openBox) }; case "actor::open::phone": { hint "Phone interaction is not yet implemented."; }; case "actor::open::iplayer": { hint "Player interaction is not yet implemented." }; - case "actor::open::store": { hint "Store interaction is not yet implemented."; }; + case "actor::open::store": { [] spawn EFUNC(store,openUI); }; default { hint format ["Unhandled UI event: %1", _event]; }; }; diff --git a/arma/client/addons/actor/ui/_site/script.js b/arma/client/addons/actor/ui/_site/script.js index e1f1d58..a5392cf 100644 --- a/arma/client/addons/actor/ui/_site/script.js +++ b/arma/client/addons/actor/ui/_site/script.js @@ -75,6 +75,13 @@ const baseMenuItems = [ icon: "", action: "actor::open::org", }, + { + id: "store", + title: "Store", + description: "Browse and purchase items from the store", + icon: "", + action: "actor::open::store", + }, ]; const actionDefinitions = { diff --git a/arma/client/addons/store/$PBOPREFIX$ b/arma/client/addons/store/$PBOPREFIX$ new file mode 100644 index 0000000..b7ca134 --- /dev/null +++ b/arma/client/addons/store/$PBOPREFIX$ @@ -0,0 +1 @@ +forge\forge_client\addons\store diff --git a/arma/client/addons/store/CfgEventHandlers.hpp b/arma/client/addons/store/CfgEventHandlers.hpp new file mode 100644 index 0000000..c6e25db --- /dev/null +++ b/arma/client/addons/store/CfgEventHandlers.hpp @@ -0,0 +1,19 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + clientInit = QUOTE(call COMPILE_SCRIPT(XEH_preInitClient)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + clientInit = QUOTE(call COMPILE_SCRIPT(XEH_postInitClient)); + }; +}; diff --git a/arma/client/addons/store/README.md b/arma/client/addons/store/README.md new file mode 100644 index 0000000..95092aa --- /dev/null +++ b/arma/client/addons/store/README.md @@ -0,0 +1,4 @@ +forge_client_store +=================== + +Description for this addon diff --git a/arma/client/addons/store/XEH_PREP.hpp b/arma/client/addons/store/XEH_PREP.hpp new file mode 100644 index 0000000..5e46271 --- /dev/null +++ b/arma/client/addons/store/XEH_PREP.hpp @@ -0,0 +1,3 @@ +PREP(handleUIEvents); +PREP(initStoreClass); +PREP(openUI); diff --git a/arma/client/addons/store/XEH_postInit.sqf b/arma/client/addons/store/XEH_postInit.sqf new file mode 100644 index 0000000..421c54b --- /dev/null +++ b/arma/client/addons/store/XEH_postInit.sqf @@ -0,0 +1 @@ +#include "script_component.hpp" diff --git a/arma/client/addons/store/XEH_postInitClient.sqf b/arma/client/addons/store/XEH_postInitClient.sqf new file mode 100644 index 0000000..d7019c2 --- /dev/null +++ b/arma/client/addons/store/XEH_postInitClient.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +call FUNC(initStoreClass); diff --git a/arma/client/addons/store/XEH_preInit.sqf b/arma/client/addons/store/XEH_preInit.sqf new file mode 100644 index 0000000..dbef1ae --- /dev/null +++ b/arma/client/addons/store/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +// private _category = [QUOTE(MOD_NAME), LLSTRING(displayName)]; + +// #include "initSettings.inc.sqf" +// #include "initKeybinds.inc.sqf" diff --git a/arma/client/addons/store/XEH_preInitClient.sqf b/arma/client/addons/store/XEH_preInitClient.sqf new file mode 100644 index 0000000..421c54b --- /dev/null +++ b/arma/client/addons/store/XEH_preInitClient.sqf @@ -0,0 +1 @@ +#include "script_component.hpp" diff --git a/arma/client/addons/store/XEH_preStart.sqf b/arma/client/addons/store/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/arma/client/addons/store/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/arma/client/addons/store/config.cpp b/arma/client/addons/store/config.cpp new file mode 100644 index 0000000..8a8ad6f --- /dev/null +++ b/arma/client/addons/store/config.cpp @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + author = AUTHOR; + authors[] = {"J.Schmidt"}; + url = ECSTRING(main,url); + name = COMPONENT_NAME; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "forge_client_main" + }; + units[] = {}; + weapons[] = {}; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "ui\RscCommon.hpp" +#include "ui\RscStore.hpp" diff --git a/arma/client/addons/store/functions/fnc_handleUIEvents.sqf b/arma/client/addons/store/functions/fnc_handleUIEvents.sqf new file mode 100644 index 0000000..26bddf7 --- /dev/null +++ b/arma/client/addons/store/functions/fnc_handleUIEvents.sqf @@ -0,0 +1,38 @@ +#include "..\script_component.hpp" + +/* + * File: fnc_handleUIEvents.sqf + * Author: IDSolutions + * Date: 2026-01-28 + * Last Update: 2026-02-06 + * Public: No + * + * Description: + * Handles the UI events. + * + * Arguments: + * 0: [CONTROL] - The control that triggered the event + * 1: [BOOL] - Whether the event is from a confirm dialog + * 2: [STRING] - The message containing the event data + * + * Return Value: + * UI events handled [BOOL] + * + * Example: + * call forge_client_store_fnc_handleUIEvents; + */ + +params ["_control", "_isConfirmDialog", "_message"]; + +private _alert = fromJSON _message; +private _event = _alert get "event"; +private _data = _alert get "data"; + +diag_log format ["[FORGE:Client:Store] Handling UI event: %1 with data: %2", _event, _data]; + +switch (_event) do { + case "store::close": { closeDialog 1; }; + default { hint format ["Unhandled UI event: %1", _event]; }; +}; + +true; diff --git a/arma/client/addons/store/functions/fnc_initStoreClass.sqf b/arma/client/addons/store/functions/fnc_initStoreClass.sqf new file mode 100644 index 0000000..e87c712 --- /dev/null +++ b/arma/client/addons/store/functions/fnc_initStoreClass.sqf @@ -0,0 +1,38 @@ +#include "..\script_component.hpp" + +/* + * File: fnc_initStoreClass.sqf + * Author: IDSolutions + * Date: 2026-01-28 + * Last Update: 2026-02-06 + * Public: Yes + * + * Description: + * Initializes the store class for managing store data. + * Provides methods for loading and applying store data. + * + * Arguments: + * None + * + * Return Value: + * Store class object [HASHMAP OBJECT] + * + * Example: + * call forge_client_store_fnc_initStoreClass + */ + +#pragma hemtt ignore_variables ["_self"] +GVAR(StoreClass) = createHashMapObject [[ + ["#type", "IStoreClass"], + ["#create", { + _self set ["uid", getPlayerUID player]; + _self set ["store", createHashMap]; + _self set ["isLoaded", false]; + _self set ["lastSave", time]; + + systemChat format ["Store class initialized for %1", (name player)]; + diag_log "[FORGE:Client:Store] Store Class Initialized!"; + }] +]]; + +GVAR(StoreClass) diff --git a/arma/client/addons/store/functions/fnc_openUI.sqf b/arma/client/addons/store/functions/fnc_openUI.sqf new file mode 100644 index 0000000..f5988ec --- /dev/null +++ b/arma/client/addons/store/functions/fnc_openUI.sqf @@ -0,0 +1,35 @@ +#include "..\script_component.hpp" + +/* + * File: fnc_openUI.sqf + * Author: IDSolutions + * Date: 2026-01-28 + * Last Update: 2026-02-06 + * Public: No + * + * Description: + * Opens the store interface. + * + * Arguments: + * None + * + * Return Value: + * UI opened [BOOL] + * + * Example: + * call forge_client_store_fnc_openUI; + */ + +private _display = createDialog ["RscStore", true]; +private _ctrl = _display displayCtrl 1004; + +_ctrl ctrlAddEventHandler ["JSDialog", { + params ["_control", "_isConfirmDialog", "_message"]; + + [_control, _isConfirmDialog, _message] call FUNC(handleUIEvents); +}]; + +_ctrl ctrlWebBrowserAction ["LoadFile", QPATHTOF2(ui\_site\index.html)]; +// _ctrl ctrlWebBrowserAction ["OpenDevConsole"]; + +true; diff --git a/arma/client/addons/store/initKeybinds.inc.sqf b/arma/client/addons/store/initKeybinds.inc.sqf new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/arma/client/addons/store/initKeybinds.inc.sqf @@ -0,0 +1 @@ + diff --git a/arma/client/addons/store/initSettings.inc.sqf b/arma/client/addons/store/initSettings.inc.sqf new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/arma/client/addons/store/initSettings.inc.sqf @@ -0,0 +1 @@ + diff --git a/arma/client/addons/store/script_component.hpp b/arma/client/addons/store/script_component.hpp new file mode 100644 index 0000000..5416b30 --- /dev/null +++ b/arma/client/addons/store/script_component.hpp @@ -0,0 +1,9 @@ +#define COMPONENT store +#define COMPONENT_BEAUTIFIED Store +#include "\forge\forge_client\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define ENABLE_PERFORMANCE_COUNTERS + +#include "\forge\forge_client\addons\main\script_macros.hpp" diff --git a/arma/client/addons/store/stringtable.xml b/arma/client/addons/store/stringtable.xml new file mode 100644 index 0000000..f0a0c86 --- /dev/null +++ b/arma/client/addons/store/stringtable.xml @@ -0,0 +1,8 @@ + + + + + Store + + + diff --git a/arma/client/addons/store/ui/RscCommon.hpp b/arma/client/addons/store/ui/RscCommon.hpp new file mode 100644 index 0000000..8b57936 --- /dev/null +++ b/arma/client/addons/store/ui/RscCommon.hpp @@ -0,0 +1,98 @@ +// Control types +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 +#define CT_STRUCTURED_TEXT 13 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_SHORTCUTBUTTON 16 +#define CT_HITZONES 17 +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 +#define CT_ANIMATED_TEXTURE 45 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT_CONTAINER 82 +#define CT_OBJECT_CONT_ANIM 83 +#define CT_LINEBREAK 98 +#define CT_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define CT_LISTNBOX 102 +#define CT_ITEMSLOT 103 +#define CT_CHECKBOX 77 + +// Static styles +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0C + +#define ST_TYPE 0xF0 +#define ST_SINGLE 0x00 +#define ST_MULTI 0x10 +#define ST_TITLE_BAR 0x20 +#define ST_PICTURE 0x30 +#define ST_FRAME 0x40 +#define ST_BACKGROUND 0x50 +#define ST_GROUP_BOX 0x60 +#define ST_GROUP_BOX2 0x70 +#define ST_HUD_BACKGROUND 0x80 +#define ST_TILE_PICTURE 0x90 +#define ST_WITH_RECT 0xA0 +#define ST_LINE 0xB0 +#define ST_UPPERCASE 0xC0 +#define ST_LOWERCASE 0xD0 + +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 +#define ST_KEEP_ASPECT_RATIO 0x800 + +// Slider styles +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 + +#define SL_TEXTURES 0x10 + +// progress bar +#define ST_VERTICAL 0x01 +#define ST_HORIZONTAL 0 + +// Listbox styles +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 + +// Tree styles +#define TR_SHOWROOT 1 +#define TR_AUTOCOLLAPSE 2 + +// Default text sizes +#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8) +#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1) +#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2) + +// Pixel grid +#define pixelScale 0.50 +#define GRID_W (pixelW * pixelGrid * pixelScale) +#define GRID_H (pixelH * pixelGrid * pixelScale) + +class RscText; diff --git a/arma/client/addons/store/ui/RscStore.hpp b/arma/client/addons/store/ui/RscStore.hpp new file mode 100644 index 0000000..a68c8d4 --- /dev/null +++ b/arma/client/addons/store/ui/RscStore.hpp @@ -0,0 +1,21 @@ +class RscStore { + idd = 1003; + fadeIn = 0; + fadeOut = 0; + duration = 1e011; + onLoad = "uiNamespace setVariable ['RscStore', _this select 0]"; + onUnLoad = "uinamespace setVariable ['RscStore', nil]"; + + class controlsBackground {}; + class controls { + class IFrame: RscText { + type = 106; + idc = 1004; + x = "safeZoneXAbs"; + y = "safeZoneY"; + w = "safeZoneWAbs"; + h = "safeZoneH"; + colorBackground[] = {0, 0, 0, 0}; + }; + }; +}; diff --git a/arma/client/addons/actor/ui/_site/store.html b/arma/client/addons/store/ui/_site/index.html similarity index 89% rename from arma/client/addons/actor/ui/_site/store.html rename to arma/client/addons/store/ui/_site/index.html index debed7c..dfa4c5c 100644 --- a/arma/client/addons/actor/ui/_site/store.html +++ b/arma/client/addons/store/ui/_site/index.html @@ -5,7 +5,7 @@ Store - + diff --git a/arma/client/addons/actor/ui/_site/store.js b/arma/client/addons/store/ui/_site/script.js similarity index 74% rename from arma/client/addons/actor/ui/_site/store.js rename to arma/client/addons/store/ui/_site/script.js index 8d85756..b2d0ee6 100644 --- a/arma/client/addons/actor/ui/_site/store.js +++ b/arma/client/addons/store/ui/_site/script.js @@ -8,36 +8,36 @@ const mockData = { balance: 45750, items: [ // Weapons - { id: 1, name: "Assault Rifle", category: "weapons", icon: "🔫", description: "Standard military-grade rifle", price: 2500 }, - { id: 2, name: "Sniper Rifle", category: "weapons", icon: "🎯", description: "Long-range precision weapon", price: 4500 }, - { id: 3, name: "SMG", category: "weapons", icon: "🔫", description: "Close-quarters combat", price: 1800 }, - { id: 4, name: "Pistol", category: "weapons", icon: "🔫", description: "Sidearm backup weapon", price: 800 }, - { id: 5, name: "Shotgun", category: "weapons", icon: "🔫", description: "Close-range powerhouse", price: 1500 }, - { id: 6, name: "LMG", category: "weapons", icon: "🔫", description: "Heavy suppression weapon", price: 3500 }, - { id: 7, name: "Grenade Launcher", category: "weapons", icon: "💣", description: "Explosive ordnance", price: 5000 }, - { id: 8, name: "Rocket Launcher", category: "weapons", icon: "🚀", description: "Anti-vehicle weapon", price: 8000 }, + { id: 1, name: "Assault Rifle", category: "weapons", image: "", price: 2500 }, + { id: 2, name: "Sniper Rifle", category: "weapons", image: "", price: 4500 }, + { id: 3, name: "SMG", category: "weapons", image: "", price: 1800 }, + { id: 4, name: "Pistol", category: "weapons", image: "", price: 800 }, + { id: 5, name: "Shotgun", category: "weapons", image: "", price: 1500 }, + { id: 6, name: "LMG", category: "weapons", image: "", price: 3500 }, + { id: 7, name: "Grenade Launcher", category: "weapons", image: "", price: 5000 }, + { id: 8, name: "Rocket Launcher", category: "weapons", image: "", price: 8000 }, // Equipment - { id: 9, name: "Body Armor", category: "equipment", icon: "🎽", description: "Ballistic protection", price: 3000 }, - { id: 10, name: "Helmet", category: "equipment", icon: "⛑️", description: "Head protection", price: 1200 }, - { id: 11, name: "Night Vision", category: "equipment", icon: "🕶️", description: "See in the dark", price: 2500 }, - { id: 12, name: "GPS Device", category: "equipment", icon: "📡", description: "Navigation system", price: 800 }, - { id: 13, name: "Radio", category: "equipment", icon: "📻", description: "Team communication", price: 600 }, - { id: 14, name: "Backpack", category: "equipment", icon: "🎒", description: "Extra storage capacity", price: 500 }, + { id: 9, name: "Body Armor", category: "equipment", image: "", price: 3000 }, + { id: 10, name: "Helmet", category: "equipment", image: "", price: 1200 }, + { id: 11, name: "Night Vision", category: "equipment", image: "", price: 2500 }, + { id: 12, name: "GPS Device", category: "equipment", image: "", price: 800 }, + { id: 13, name: "Radio", category: "equipment", image: "", price: 600 }, + { id: 14, name: "Backpack", category: "equipment", image: "", price: 500 }, // Medical - { id: 15, name: "First Aid Kit", category: "medical", icon: "💊", description: "Basic medical supplies", price: 400 }, - { id: 16, name: "Med Kit", category: "medical", icon: "⚕️", description: "Advanced medical kit", price: 1000 }, - { id: 17, name: "Bandages", category: "medical", icon: "🩹", description: "Stop bleeding", price: 150 }, - { id: 18, name: "Morphine", category: "medical", icon: "💉", description: "Pain management", price: 300 }, - { id: 19, name: "Blood Bag", category: "medical", icon: "🩸", description: "Restore blood level", price: 500 }, + { id: 15, name: "First Aid Kit", category: "medical", image: "", price: 400 }, + { id: 16, name: "Med Kit", category: "medical", image: "", price: 1000 }, + { id: 17, name: "Bandages", category: "medical", image: "", price: 150 }, + { id: 18, name: "Morphine", category: "medical", image: "", price: 300 }, + { id: 19, name: "Blood Bag", category: "medical", image: "", price: 500 }, // Supplies - { id: 20, name: "Ammunition Box", category: "supplies", icon: "📦", description: "Mixed ammunition", price: 800 }, - { id: 21, name: "Explosive Charges", category: "supplies", icon: "💣", description: "Demolition supplies", price: 1500 }, - { id: 22, name: "Toolkit", category: "supplies", icon: "🔧", description: "Repair equipment", price: 600 }, - { id: 23, name: "Food Rations", category: "supplies", icon: "🥫", description: "Emergency supplies", price: 200 }, - { id: 24, name: "Water Canteen", category: "supplies", icon: "🧃", description: "Hydration supply", price: 150 } + { id: 20, name: "Ammunition Box", category: "supplies", image: "", price: 800 }, + { id: 21, name: "Explosive Charges", category: "supplies", image: "", price: 1500 }, + { id: 22, name: "Toolkit", category: "supplies", image: "", price: 600 }, + { id: 23, name: "Food Rations", category: "supplies", image: "", price: 200 }, + { id: 24, name: "Water Canteen", category: "supplies", image: "", price: 150 } ] }; @@ -64,7 +64,7 @@ function setupEventHandlers() { if (closeBtn) { closeBtn.addEventListener('click', () => { console.log('Closing store...'); - sendEvent('actor::close::store', {}); + sendEvent('store::close', {}); }); } @@ -136,8 +136,7 @@ function renderItems() { if (searchQuery) { filteredItems = filteredItems.filter(item => - item.name.toLowerCase().includes(searchQuery) || - item.description.toLowerCase().includes(searchQuery) + item.name.toLowerCase().includes(searchQuery) ); } @@ -147,9 +146,8 @@ function renderItems() { card.className = 'item-card'; card.innerHTML = ` -
${item.icon}
+
${item.name}
${item.name}
-
${item.description}
$${item.price.toLocaleString()}
@@ -207,7 +205,7 @@ function renderCart() { if (cart.length === 0) { cartItems.innerHTML = `
- 🛒 + Your cart is empty
`; @@ -266,7 +264,7 @@ function handleCheckout() { const grandTotal = total + tax; if (grandTotal > mockData.balance) { - alert('Insufficient funds!'); + // alert('Insufficient funds!'); return; } @@ -283,7 +281,7 @@ function handleCheckout() { }; console.log('Purchase request:', purchaseData); - sendEvent('actor::store::purchase', purchaseData); + sendEvent('store::purchase', purchaseData); // Clear cart after purchase cart = []; diff --git a/arma/client/addons/actor/ui/_site/store.css b/arma/client/addons/store/ui/_site/style.css similarity index 98% rename from arma/client/addons/actor/ui/_site/store.css rename to arma/client/addons/store/ui/_site/style.css index 4974a9b..9db24a7 100644 --- a/arma/client/addons/actor/ui/_site/store.css +++ b/arma/client/addons/store/ui/_site/style.css @@ -128,7 +128,7 @@ body { } .cart-icon { - font-size: 1.25rem; + font-size: 1rem; } .cart-count { @@ -202,7 +202,6 @@ body { .panel-content { flex: 1; padding: 1.5rem; - overflow-y: auto; } /* Custom Scrollbar */ @@ -312,6 +311,8 @@ body { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; + overflow-y: auto; + height: 590px; } .item-card { @@ -324,7 +325,8 @@ body { transition: all 0.15s ease; display: flex; flex-direction: column; - gap: 0.75rem; + gap: 0.5rem; + height: 300px !important; } .item-card:hover { @@ -335,8 +337,8 @@ body { inset 0 0 20px rgba(100, 150, 200, 0.05); } -.item-icon { - font-size: 3rem; +.item-image { + height: 256px; text-align: center; }