Shop Restock System Update: Better High Rarity Management & Stock Control
🔄 What's Changing
🎯 Addressing Key Issues
- High Rarity Items (95+) Restocking Too Often - We've added restrictions to reduce frequency, especially for potions and elixirs
- Excessive Stock Accumulation - New system gradually removes items that aren't selling
- Better Inventory Management - Smarter system for tracking unpopular items
✨ New Features
1️⃣ Maximum Stock Limits
- Global Cap: No item can exceed 75 in stock (previously unlimited for common items)
- Rarity-Based Limits:
- Common/Uncommon items: 75 maximum (down from unlimited)
- Rare items (71-90): 75 maximum (down from 100)
- Very rare items (91-97): 25 maximum (down from 50)
- Ultra rare items (98-99): Still 1 maximum
2️⃣ High Rarity Item Controls
- Only 3 high rarity items maximum per restock
- 10% chance for any high rarity item to be included in a restock
- Special handling for potions and elixirs to make them less common
- Stricter removal of excess stock for high rarity items
3️⃣ Automatic Stock Cleanup
- Automated system runs every 15 minutes to gradually clear excess stock
- Removal percentage increases based on how long items sit unsold:
- 10% after 5 days unsold
- 20% after 7 days unsold
- 50% after 14 days unsold
- 90% after 30 days unsold
- High rarity items are removed 50% faster
4️⃣ Unpopular Item Management
- System now tracks purchase-to-stock ratio for all items
- Items with low purchase rates get flagged if they don't sell after 30 days
- Flagged items restocked at 50% normal rate
- Items that continue not selling get removed from rotation for 60 days
- After 60 days, items gradually get reintroduced for another chance
🧠 Technical Deep Dive
Algorithm Changes
The restock system now uses a multi-step selection process with weighted probabilities:
- Rarity Weighting:
- Common (1-10): 40% chance
- Uncommon (11-29): 30% chance
- Mid-range (30-70): 20% chance
- Rare (71-90): 8% chance
- Very rare (91-99): 2% chance
- Item Scoring Factors:
- Purchase frequency (50% of score)
- Purchase recency (30% of score)
- Profit margin (20% of score)
- Additional modifiers:
- +50% for unstocked items
- -70% for flagged unpopular items
- +100% for items being reintroduced
- -20% for high rarity items
- -50% for high rarity potions/elixirs
- Stock Cleanup Logic:
- Calculates "days since last purchase" for all items
- Removes percentage of stock based on age and rarity
- Tracks unpopular items across shop system
- Uses purchase ratio (purchases ÷ total stocked) to identify problematic items
- Items with <10% purchase ratio after 30 days get flagged
- Flagged items with continued poor performance get temporarily retired
The system now maintains a separate tracking record for each item in each shop, allowing for more nuanced inventory management. Items that perform well in some shops might be retired in others based on local purchase patterns.
A weekly deep cleanup process ensures long-term inventory health across all shops, preventing accumulation of unpopular items while still allowing periodic reintroduction to test if demand has changed.