The Economy system drives player progression by allowing the exchange of currency (Money) for items and resources. It integrates tightly with Jobs, Quests, and Progression systems.
- Requirements:
- The item must be Buyable (configured in database).
- The player must have Sufficient Funds (Money).
- The item must be Unlocked (via Progression Tree).
- Price Calculation:
Base Price= Configured item value.- Weekly Sale Discount: If
feature_weekly_discountis unlocked, items in the weekly sale category receive a discount (e.g., 20% off Weapons).
- XP Reward: Buying items awards Merchant XP (
Cost / 10). - Quest Tracking: Purchases count towards relevant Weekly Quests.
- Requirements:
- The player must have the item in their Inventory.
- The item must be Sellable (configured in database).
- Price Calculation:
Base Sell Price=Item Base Value * SellPriceRatio(Default: 0.5).- Economy Bonus: If unlocked, the
economy_bonusprogression node increases the sell price multiplier.
- XP Reward: Selling items awards Merchant XP (
Value / 10). - Quest Tracking: Sales count towards relevant Weekly Quests.
- Rotation: Discounts rotate weekly between item categories (e.g., Weapon -> Armor -> Consumable).
- Schedule: Defined in
configs/economy/weekly_sales.json. - Eligibility: Requires
feature_weekly_discountto be unlocked.
GET /api/v1/pricesReturns a list of all sellable items and their current sell prices (including bonuses).
GET /api/v1/prices/buyReturns a list of all buyable items and their current buy prices (including discounts).
POST /api/v1/user/item/buyBody:
{
"platform": "twitch",
"platform_id": "12345",
"username": "buyer",
"item_name": "wood_sword",
"quantity": 1
}POST /api/v1/user/item/sellBody:
{
"platform": "twitch",
"platform_id": "12345",
"username": "seller",
"item_name": "wood_sword",
"quantity": 1
}- Service:
internal/economy/service.go - Repository:
internal/repository/economy.go - Configuration:
configs/economy/weekly_sales.json - Integration:
JobService(Award Merchant XP)QuestService(Track Quest Progress)ProgressionService(Check Unlocks & Bonuses)