# Forge Store Module

## Overview
The Store module provides a comprehensive shopping system for the Forge client. It includes features for purchasing items, vehicles, and equipment, with support for multiple payment methods and integration with the organization system.

## Dependencies
- forge_client_main

## Authors
- J. Schmidt
- Creedcoder
- IDSolutions

## Features

### Store System
1. **Store Initialization** (`fnc_initStore.sqf`)
   - Initializes the store system
   - Sets up store locations and configurations
   - Manages store types and categories
   - Configures payment methods
   - Handles product catalog

2. **Store Interface**
   - **Open Store** (`fnc_openStore.sqf`)
     - Opens the store user interface
     - Displays store name and categories
     - Manages payment method selection
     - Handles product filtering

   - **Select Product** (`fnc_selectProduct.sqf`)
     - Handles product selection
     - Manages product categories
     - Processes product data
     - Coordinates purchase flow

   - **Change Filter** (`fnc_changeFilter.sqf`)
     - Manages product filtering
     - Updates product display
     - Handles category switching
     - Maintains filter state

   - **Change Payment** (`fnc_changePayment.sqf`)
     - Handles payment method selection
     - Manages payment options
     - Updates payment interface
     - Validates payment methods

3. **Purchase Management**
   - **Handle Purchase** (`fnc_handlePurchase.sqf`)
     - Processes purchase transactions
     - Validates payment methods
     - Manages organization funds
     - Handles transaction logging
     - Provides purchase feedback

   - **Buy Item** (`fnc_buyItem.sqf`)
     - Handles item purchases
     - Manages locker integration
     - Processes item delivery
     - Updates inventory
     - Provides purchase confirmation

   - **Buy Vehicle** (`fnc_buyVehicle.sqf`)
     - Manages vehicle purchases
     - Handles garage integration
     - Processes vehicle delivery
     - Updates garage inventory
     - Provides purchase confirmation

### Product Categories
1. **Equipment**
   - Vests
   - Headwear
   - Facewear
   - HMD (Night Vision)
   - Backpacks
   - Uniforms

2. **Vehicles**
   - Wheeled vehicles
   - Tracked vehicles
   - Aircraft
   - Watercraft
   - Static weapons

3. **Supplies**
   - Medical supplies
   - Ammunition
   - Food rations
   - Repair kits
   - Other consumables

### Payment System
1. **Payment Methods**
   - Personal funds
   - Organization funds
   - Mission funds
   - Custom payment types

2. **Transaction Management**
   - Payment validation
   - Fund verification
   - Balance updates
   - Transaction logging
   - Purchase confirmation

## Event Handlers
The module uses several event handlers for initialization and execution:
- `XEH_preInit.sqf`: Pre-initialization setup
- `XEH_postInit.sqf`: Post-initialization tasks
- `XEH_preStart.sqf`: Pre-start configuration

## Usage
To use the store module:
```sqf
// Initialize store system
[] call forge_client_store_fnc_initStore;

// Open store interface
[storeObject] call forge_client_store_fnc_openStore;

// Buy an item
["arifle_MX_F", 1000, "weapon", "weapon"] call forge_client_store_fnc_buyItem;

// Buy a vehicle
["B_APC_Tracked_01_rcws_F", 5000, "tank"] call forge_client_store_fnc_buyVehicle;
```

## Integration
The store module integrates with other Forge client systems:
1. **Organization System**
   - Fund management
   - Purchase authorization
   - Transaction processing
   - Balance updates
   - Purchase history

2. **Locker System**
   - Item storage
   - Equipment management
   - Inventory updates
   - Item delivery
   - Storage validation

3. **Garage System**
   - Vehicle storage
   - Vehicle management
   - Purchase delivery
   - Inventory updates
   - Vehicle validation

4. **Notification System**
   - Purchase confirmations
   - Error messages
   - Transaction updates
   - Status notifications
   - System alerts

## Debugging
Debug mode can be enabled by uncommenting the following in `script_component.hpp`:
```cpp
#define DEBUG_MODE_FULL
```

## Version Information
Version information is managed through the main Forge client system configuration.

## Technical Details
- Real-time transaction processing
- Multi-payment system support
- Product catalog management
- Category filtering system
- Payment validation
- Transaction logging
- Purchase verification
- Inventory management
- Cross-module integration
- Event system integration
- UI state management
- Error handling
- Resource management 