[PR #128] [MERGED] SMP 0.17.0: the auction house (/ah) #131

Closed
opened 2026-11-03 04:03:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon-mods/pull/128
Author: @ludovic111
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: feat/smp-auction


📝 Commits (1)

  • 7c850a3 SMP 0.17.0: the auction house (/ah)

📊 Changes

7 files changed (+1858 additions, -10 deletions)

View changed files

📝 native/smp/Cargo.lock (+1 -1)
📝 native/smp/Cargo.toml (+1 -1)
📝 native/smp/README.md (+25 -4)
📝 native/smp/mixins/smp/glue.rs (+212 -3)
📝 native/smp/mixins/smp/horizon-mixin.toml (+7 -1)
➕ native/smp/mixins/smp/smp_auction.rs (+1610 -0)
📝 native/smp/src/lib.rs (+2 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #127 (the Treasury). This PR targets main so CI runs; its own change is the last commit, 83e941c… After #127 merges, the diff shrinks to just that commit.

The auction house, a realistic player-to-player market:

  • /ah opens a chest menu: categories (the shop's plus guesses for ores, wood, crops, tools, then "Other"), "All listings", or a search (/ah search <words>). Listings are sorted cheapest per unit first. Each button shows #id count Item · price (x.xx each) · seller · time left; auctions are gold. Clicking a listing opens a confirm page (buy for X / bid X); "Back" returns to the list.
  • /ah sell <price> [count] lists the stack in your hand at a fixed price for 48 h. /ah auction <start> [hours] runs a timed auction (1–24 h, default 12).
  • Sinks, into the Treasury: a 1% listing fee (min 1 coin, never refunded, which stops spam and price-fishing), and 5% VAT on every sale, paid by the seller.
  • Mail: unsold listings, auction wins and whatever didn't fit go to the player's mail (/ah claim, or the mail page in the menu). As much as fits is given; the rest stays.
  • Bids are held in an auction pool. The outbid player gets their bid back at once, and raising your own bid only holds the difference. Anti-sniping: a bid in the last 60 s pushes the end back to 60 s.
  • Offline sellers are paid directly and get a note the next time they join.

Anti-exploit:

  • No dupes: items leave the inventory before a listing exists. A purchase removes the listing first, then moves the items, then the money. If a give fails, the listing is restored and no money moves.
  • Two buyers at once: every click runs on the server thread under the SMP's lock, so the second buyer gets "That listing is gone" (tested).
  • Crash-safe: listings, bids, mail and notes are written in economy.json with the balances and pools (ext.auction), in one atomic write. A crash can't keep the coins and lose the items, or the reverse. Tested across a restart mid-auction.
  • Alt farming / wash trading: an alt overpaying its main is just a transfer that loses 5% VAT plus the fee; no money is created anywhere.
  • No listing on your own behalf, no buying or bidding your own listing, survival/adventure only, at most 8 listings per player. An auction with a bid can't be withdrawn.

Limits: plain items only (not worn, named or enchanted) until Horizon's native_give_stack is stamped. That hook gives whole stacks with components; it is still a pending fragment on main. That's the follow-up.

Perf: nothing per tick. Once a second: one pass over open listings for ended ones (cheap), plus note delivery only when notes exist. The menu is redrawn only on a click.

Tests: 80 unit tests (5 new): a fixed sale with fee + VAT and two concurrent buyers; refusals that move nothing (own listing, too poor, no room, a failed give, the listing cap, creative mode); auctions (hold, refund, own raise, snipe extension, restart mid-auction, offline seller paid + note, claim once); expiry to mail with a full inventory; the browser's sort, filter, search and click flow. fmt and clippy are clean. The game-side check is CI's (the Mac mini is at its disk floor); proof.py has no AH step yet.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon-mods/pull/128 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/smp-auction` --- ### 📝 Commits (1) - [`7c850a3`](https://github.com/horizon-rust/horizon-mods/commit/7c850a3056c4af0cc4b5a2c42c5908bb93bf9848) SMP 0.17.0: the auction house (/ah) ### 📊 Changes **7 files changed** (+1858 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `native/smp/Cargo.lock` (+1 -1) 📝 `native/smp/Cargo.toml` (+1 -1) 📝 `native/smp/README.md` (+25 -4) 📝 `native/smp/mixins/smp/glue.rs` (+212 -3) 📝 `native/smp/mixins/smp/horizon-mixin.toml` (+7 -1) ➕ `native/smp/mixins/smp/smp_auction.rs` (+1610 -0) 📝 `native/smp/src/lib.rs` (+2 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Stacked on #127** (the Treasury). This PR targets main so CI runs; its own change is the last commit, 83e941c… After #127 merges, the diff shrinks to just that commit. **The auction house**, a realistic player-to-player market: - `/ah` opens a chest menu: categories (the shop's plus guesses for ores, wood, crops, tools, then "Other"), "All listings", or a search (`/ah search <words>`). Listings are sorted cheapest per unit first. Each button shows `#id count Item · price (x.xx each) · seller · time left`; auctions are gold. Clicking a listing opens a confirm page (buy for X / bid X); "Back" returns to the list. - `/ah sell <price> [count]` lists the stack in your hand at a fixed price for 48 h. `/ah auction <start> [hours]` runs a timed auction (1–24 h, default 12). - **Sinks, into the Treasury:** a 1% listing fee (min 1 coin, never refunded, which stops spam and price-fishing), and 5% VAT on every sale, paid by the seller. - **Mail:** unsold listings, auction wins and whatever didn't fit go to the player's mail (`/ah claim`, or the mail page in the menu). As much as fits is given; the rest stays. - **Bids** are held in an `auction` pool. The outbid player gets their bid back at once, and raising your own bid only holds the difference. **Anti-sniping:** a bid in the last 60 s pushes the end back to 60 s. - **Offline sellers** are paid directly and get a note the next time they join. **Anti-exploit:** - **No dupes:** items leave the inventory before a listing exists. A purchase removes the listing first, then moves the items, then the money. If a give fails, the listing is restored and no money moves. - **Two buyers at once:** every click runs on the server thread under the SMP's lock, so the second buyer gets "That listing is gone" (tested). - **Crash-safe:** listings, bids, mail and notes are written in `economy.json` with the balances and pools (`ext.auction`), in one atomic write. A crash can't keep the coins and lose the items, or the reverse. Tested across a restart mid-auction. - **Alt farming / wash trading:** an alt overpaying its main is just a transfer that loses 5% VAT plus the fee; no money is created anywhere. - No listing on your own behalf, no buying or bidding your own listing, survival/adventure only, at most 8 listings per player. An auction with a bid can't be withdrawn. **Limits:** plain items only (not worn, named or enchanted) until Horizon's `native_give_stack` is stamped. That hook gives whole stacks with components; it is still a pending fragment on main. That's the follow-up. **Perf:** nothing per tick. Once a second: one pass over open listings for ended ones (cheap), plus note delivery only when notes exist. The menu is redrawn only on a click. **Tests:** 80 unit tests (5 new): a fixed sale with fee + VAT and two concurrent buyers; refusals that move nothing (own listing, too poor, no room, a failed give, the listing cap, creative mode); auctions (hold, refund, own raise, snipe extension, restart mid-auction, offline seller paid + note, claim once); expiry to mail with a full inventory; the browser's sort, filter, search and click flow. fmt and clippy are clean. The game-side `check` is CI's (the Mac mini is at its disk floor); `proof.py` has no AH step yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:03:30 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon-mods#131
No description provided.