[codex] add economy system#10
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (39)
📝 WalkthroughSummary by CodeRabbitRelease NotesNew Features
Bug Fixes & Improvements
WalkthroughAdds a full server-authoritative economy system. Users start with a dollar balance ( ChangesEconomy Feature
Sequence Diagram(s)sequenceDiagram
participant Browser as Browser (createApp)
participant InventoryClient
participant GameWS as Game WebSocket
participant HTTPRouter as HTTP Router
participant DrizzleEconomyStore
participant Database
rect rgba(100, 150, 200, 0.5)
note over Browser, Database: Furniture purchase via HTTP
Browser->>InventoryClient: purchaseItem(itemType)
InventoryClient->>HTTPRouter: POST /inventory/purchase
HTTPRouter->>DrizzleEconomyStore: purchase(userId, itemType)
DrizzleEconomyStore->>Database: transaction: decrement dollars, upsert inventory
Database-->>DrizzleEconomyStore: updated balance + items
DrizzleEconomyStore-->>HTTPRouter: PurchaseResult
HTTPRouter->>GameWS: publishUserMessage balance.updated
HTTPRouter->>GameWS: publishUserMessage inventory.updated
HTTPRouter-->>InventoryClient: 200 { balance, items }
InventoryClient-->>Browser: PurchaseResult
Browser->>Browser: updateBalanceDisplay, furniturePanel.setInventory
end
rect rgba(100, 200, 150, 0.5)
note over Browser, Database: Furniture placement via WebSocket
Browser->>GameWS: place furniture
GameWS->>DrizzleEconomyStore: reserveItem(userId, itemType)
DrizzleEconomyStore-->>GameWS: reserved: true
GameWS->>Database: persist room item
GameWS->>Browser: room.item.placed
GameWS->>DrizzleEconomyStore: getInventory(userId)
GameWS->>Browser: inventory.updated (userTopic)
end
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Adds a server-authoritative economy system for Tilezo: starting balances, room creation costs, catalogue purchases, persistent inventory, and inventory-aware furniture placement/pickup.
What changed
users.dollars,user_inventory, migration metadata, andDrizzleEconomyStore.POST /rooms, added inventory list/purchase HTTP endpoints, and broadcasted balance/inventory updates.Validation
bun run typecheckbun run lintbun testbun run test:integrationbun run test:coveragebun run coverage:checkgit diff --checkNotes
Browser automation was not run because the repository instructions require explicit approval before automated browser testing.