Skip to main content

Order Generation

Detailed guide to the automatic order generation system.

Overview

The order generation system automatically creates orders at configurable intervals, selecting items from configured pools and calculating prices dynamically.

Generation Process

  1. Scheduler Check: Checks if it's time to generate orders
  2. Player Check: Verifies minimum players online
  3. Item Selection: Randomly selects item from pools
  4. Price Calculation: Calculates price using shop integration or fallback
  5. Order Creation: Creates order via Sigma Orders API
  6. Next Schedule: Schedules next generation

Configuration

Generation Intervals

generation:
min-interval-minutes: 5
max-interval-minutes: 15

The system generates orders at random intervals between min and max.

Player Requirements

generation:
min-players-online: 1 # 0 = disabled

Orders only generate when minimum players are online.

Order Limits

generation:
max-orders-per-interval: 3

Maximum orders generated per generation cycle.

Player Count Scaling

When enabled, generation frequency scales with player count:

generation:
player-count-scaling: true
player-thresholds:
low: 5
medium: 15
high: 30
  • Below low: Slower generation
  • Between low and high: Normal generation
  • Above high: Faster generation

Peak Hours

Increase generation during peak hours:

generation:
peak-hour-multiplier: 1.5
peak-hours:
- start: 18
end: 22

Multiple peak hour ranges supported.

Item Selection

Items are selected from configured material pools:

  1. Select pool based on weights
  2. Select material from pool
  3. Generate quantity based on pool ranges
  4. Apply enchantments (if enabled)

Order Creation

Orders are created with:

  • System UUID (UUID(0, 0))
  • Selected item and quantity
  • Calculated price
  • Priority (normal or urgent)
  • Timestamp

Auto-Collection System

System orders (addon-generated orders) are automatically collected when fully delivered:

  • Automatic Collection: When a random order is fully delivered, it's automatically collected
  • Database Cleanup: Prevents data accumulation in the database
  • Performance: Improves server performance by removing completed orders
  • No Manual Action: No player action required - happens automatically

This feature ensures that completed random orders don't accumulate in the database, keeping the system clean and performant.

Database Reconnection Handling

The addon includes improved database reconnection handling:

  • Single Retry: If database connection fails, the addon attempts one retry after a short delay
  • No Infinite Loops: Prevents infinite retry loops that could cause performance issues
  • Error Detection: Automatically detects database initialization errors
  • Graceful Degradation: If reconnection fails, the order is skipped for that iteration

This ensures reliable order generation even when the core plugin's database is temporarily unavailable.

Next Steps