[PR #105] [MERGED] SMP 0.12.0: /shop menu, daily selling limits, no profitable recipe loop, /money and /eco give * #110

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon-mods/pull/105
Author: @ludovic111
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feat/smp-shop


📝 Commits (9)

  • dca26bf SMP: a sidebar of the richest players, /sidebar on|off, and the Tab list's header and footer
  • a11db16 SMP 0.10.0: /back after a death or a teleport, /playtime, /claim show
  • 3cf1b6a SMP 0.11.0: first-join welcome, daily reward, AFK out of the sleep count, a command rate limit
  • c1ce388 WIP shop
  • a301fcc SMP: pinned to horizon main with #5390 (API 49)
  • ddab3fa Merge branch 'feat/smp-board' into feat/smp-polish
  • 238d9cd Merge branch 'feat/smp-polish' into feat/smp-presence
  • 455a8b8 Merge branch 'feat/smp-presence' into feat/smp-shop
  • f56752d SMP 0.12.0: /shop menu, daily selling limits, no profitable recipe loop, /money and /eco give *

📊 Changes

16 files changed (+3468 additions, -143 deletions)

View changed files

📝 native/smp/Cargo.lock (+1 -1)
📝 native/smp/Cargo.toml (+1 -1)
📝 native/smp/README.md (+73 -8)
📝 native/smp/compatibility.json (+2 -2)
📝 native/smp/mixins/smp/glue.rs (+506 -18)
📝 native/smp/mixins/smp/horizon-mixin.toml (+27 -3)
➕ native/smp/mixins/smp/smp_board.rs (+439 -0)
📝 native/smp/mixins/smp/smp_claims.rs (+47 -1)
📝 native/smp/mixins/smp/smp_economy.rs (+161 -26)
📝 native/smp/mixins/smp/smp_market.rs (+582 -66)
📝 native/smp/mixins/smp/smp_places.rs (+93 -3)
➕ native/smp/mixins/smp/smp_presence.rs (+382 -0)
➕ native/smp/mixins/smp/smp_recipes.rs (+454 -0)
➕ native/smp/mixins/smp/smp_shop.rs (+489 -0)
📝 native/smp/proof.py (+203 -14)
📝 native/smp/src/lib.rs (+8 -0)

📄 Description

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

Stacked on #102 (presence), #101, #97 (pinned to horizon main 5272f3a, hooks 49). Ludovic's ask for the official
server: a shop on the economy, and no way to get ultra rich from it.

What (SMP 0.12.0)

  • /shop: the market as a 6-row chest menu.
    • First page: the categories of config.json's new shop section (an item in none goes under "Other").
    • A category's page: its items, named with their prices. A click buys one, a shift-click buys 64.
    • A click on a stack of your own, below the menu, sells it. "Sell all" sells everything the market buys.
    • Bottom row: balance, today's selling limit, help, back/pages, close.
    • It goes through the market's own rules: survival or adventure only, items then money, logged, refunded on
      refusal. The items move by the console's clear and give (menu clicks run outside the player's swap), and are
      measured on the inventory before and after, so the money follows what really moved.
  • No way to get rich:
    • Buying always costs more than selling: an item priced otherwise isn't bought (logged at start).
    • New smp_recipes: the cheapest way to get each item from the market, through any chain of crafting, smelting,
      stonecutting or smithing (Bellman-Ford). An item the market would buy for more than that isn't bought. The
      server checks the written chains (compression blocks, wheat/bread, logs/planks/sticks, food...) at each start.
      The tests also walk all 1,700+ vanilla recipe files and the item tags when SMP_VANILLA_DATA points at them;
      CI has no Mojang data, so there only the chains run.
    • Daily limits per player, per UTC day: daily_sell_coins 2,000 and daily_sell_items 640 of each item. Kept in
      the new market.json, shown in /worth and in the shop.
    • Checked arithmetic everywhere (no price above MAX_AMOUNT, checked_mul), and item ids validated before they
      reach a command line.
    • The coinflip and the lottery stay zero-sum (fee_percent 0 by default), and the daily reward stays 50.
  • Prices: 56 defaults in 7 categories (farming, mining, wood, mob drops, building, food, tools), listed in the
    README. A config.json still holding the 18 old defaults, never edited, gets them at the first start. The live
    server's config is exactly those 18, so it migrates. Balances are never touched.
  • Operators' money: /money give|take|set <player> <amount> (the same command as /eco), and
    /eco give * <amount> (and /money give * ...) for everyone on. The player given money is told. Every change is
    logged with the operator's UUID. On the live server luzW, lu4ovic and bunchy7s are level 4 in ops.json
    (/eco needs 3).

Proof

native.py proof smp (dedicated server built with the mod, real clients): "ok": true. New step shop, after the
restart:

  • /money give Alex 2000, /eco give * 10 → "Gave 10 coins to 1 player(s) on.";
  • /shop → Mining → a click: "Bought 1 iron ingot for 30 coins."; Building → shift-click: 64 cobblestone;
  • a click on her own iron: "Sold 1 iron ingot for 8 coins.";
  • 30 diamonds, "Sell all": "Sold 19 diamond for 1,900 coins." and "11 diamond kept: today's selling limit.";
  • the menu's clock reads "Selling today: 92 coins left of your 2,000 coins a day...", /worth diamond says "You may
    sell 621 more diamond today.";
  • audit.log ends with the two eco_give, both buys and both sells; market.json holds the day's counts; the
    money in the game adds up.

cargo test: 60 pass, 14 new:

  • the daily limits and their reset at midnight, and across a restart;
  • prices that would make money get closed, and overflow is refused;
  • the old-defaults migration;
  • the loop checker on iron blocks/ingots, bread, logs → planks → sticks;
  • the default prices have no loop, also through every vanilla recipe (run with SMP_VANILLA_DATA);
  • the shop's pages and clicks;
  • /money and /eco give *.

clippy --all-targets -D warnings clean.

Cost: no new per-tick work. The shop runs only on clicks, market.json is written only after a sale, and the tick
is unchanged.

🤖 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/105 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/smp-shop` --- ### 📝 Commits (9) - [`dca26bf`](https://github.com/horizon-rust/horizon-mods/commit/dca26bf04488bebc25b1d8d0071b6228fb3c280d) SMP: a sidebar of the richest players, /sidebar on|off, and the Tab list's header and footer - [`a11db16`](https://github.com/horizon-rust/horizon-mods/commit/a11db16db33f3b1a4811073d0618b69a508e09d9) SMP 0.10.0: /back after a death or a teleport, /playtime, /claim show - [`3cf1b6a`](https://github.com/horizon-rust/horizon-mods/commit/3cf1b6aa8f82845d459d53db319cd97a82b10338) SMP 0.11.0: first-join welcome, daily reward, AFK out of the sleep count, a command rate limit - [`c1ce388`](https://github.com/horizon-rust/horizon-mods/commit/c1ce388d417f7afdb36f03457a315b352eac24b9) WIP shop - [`a301fcc`](https://github.com/horizon-rust/horizon-mods/commit/a301fcc469832e9afa941f5d8b4ab26b79fc1858) SMP: pinned to horizon main with #5390 (API 49) - [`ddab3fa`](https://github.com/horizon-rust/horizon-mods/commit/ddab3fa2695b7c81dd53b4e69f981630f5d6a60c) Merge branch 'feat/smp-board' into feat/smp-polish - [`238d9cd`](https://github.com/horizon-rust/horizon-mods/commit/238d9cd1f46c11e3852b9435914026046b98dd87) Merge branch 'feat/smp-polish' into feat/smp-presence - [`455a8b8`](https://github.com/horizon-rust/horizon-mods/commit/455a8b800fa78ae7e714ab9475ca9b42015dbb3f) Merge branch 'feat/smp-presence' into feat/smp-shop - [`f56752d`](https://github.com/horizon-rust/horizon-mods/commit/f56752d74fc02b96663ccba3000f437c17ae2c90) SMP 0.12.0: /shop menu, daily selling limits, no profitable recipe loop, /money and /eco give * ### 📊 Changes **16 files changed** (+3468 additions, -143 deletions) <details> <summary>View changed files</summary> 📝 `native/smp/Cargo.lock` (+1 -1) 📝 `native/smp/Cargo.toml` (+1 -1) 📝 `native/smp/README.md` (+73 -8) 📝 `native/smp/compatibility.json` (+2 -2) 📝 `native/smp/mixins/smp/glue.rs` (+506 -18) 📝 `native/smp/mixins/smp/horizon-mixin.toml` (+27 -3) ➕ `native/smp/mixins/smp/smp_board.rs` (+439 -0) 📝 `native/smp/mixins/smp/smp_claims.rs` (+47 -1) 📝 `native/smp/mixins/smp/smp_economy.rs` (+161 -26) 📝 `native/smp/mixins/smp/smp_market.rs` (+582 -66) 📝 `native/smp/mixins/smp/smp_places.rs` (+93 -3) ➕ `native/smp/mixins/smp/smp_presence.rs` (+382 -0) ➕ `native/smp/mixins/smp/smp_recipes.rs` (+454 -0) ➕ `native/smp/mixins/smp/smp_shop.rs` (+489 -0) 📝 `native/smp/proof.py` (+203 -14) 📝 `native/smp/src/lib.rs` (+8 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #102 (presence), #101, #97 (pinned to horizon main `5272f3a`, hooks 49). Ludovic's ask for the official server: a shop on the economy, and no way to get ultra rich from it. ## What (SMP 0.12.0) - **`/shop`**: the market as a 6-row chest menu. - First page: the categories of `config.json`'s new `shop` section (an item in none goes under "Other"). - A category's page: its items, named with their prices. A click buys one, a shift-click buys 64. - A click on a stack of your own, below the menu, sells it. "Sell all" sells everything the market buys. - Bottom row: balance, today's selling limit, help, back/pages, close. - It goes through the market's own rules: survival or adventure only, items then money, logged, refunded on refusal. The items move by the console's `clear` and `give` (menu clicks run outside the player's swap), and are measured on the inventory before and after, so the money follows what really moved. - **No way to get rich**: - Buying always costs more than selling: an item priced otherwise isn't bought (logged at start). - New `smp_recipes`: the cheapest way to get each item from the market, through any chain of crafting, smelting, stonecutting or smithing (Bellman-Ford). An item the market would buy for more than that isn't bought. The server checks the written chains (compression blocks, wheat/bread, logs/planks/sticks, food...) at each start. The tests also walk all 1,700+ vanilla recipe files and the item tags when `SMP_VANILLA_DATA` points at them; CI has no Mojang data, so there only the chains run. - Daily limits per player, per UTC day: `daily_sell_coins` 2,000 and `daily_sell_items` 640 of each item. Kept in the new `market.json`, shown in `/worth` and in the shop. - Checked arithmetic everywhere (no price above `MAX_AMOUNT`, `checked_mul`), and item ids validated before they reach a command line. - The coinflip and the lottery stay zero-sum (`fee_percent` 0 by default), and the daily reward stays 50. - **Prices**: 56 defaults in 7 categories (farming, mining, wood, mob drops, building, food, tools), listed in the README. A `config.json` still holding the 18 old defaults, never edited, gets them at the first start. The live server's config is exactly those 18, so it migrates. Balances are never touched. - **Operators' money**: `/money give|take|set <player> <amount>` (the same command as `/eco`), and `/eco give * <amount>` (and `/money give * ...`) for everyone on. The player given money is told. Every change is logged with the operator's UUID. On the live server luzW, lu4ovic and bunchy7s are level 4 in `ops.json` (`/eco` needs 3). ## Proof `native.py proof smp` (dedicated server built with the mod, real clients): `"ok": true`. New step `shop`, after the restart: - `/money give Alex 2000`, `/eco give * 10` → "Gave 10 coins to 1 player(s) on."; - `/shop` → Mining → a click: "Bought 1 iron ingot for 30 coins."; Building → shift-click: 64 cobblestone; - a click on her own iron: "Sold 1 iron ingot for 8 coins."; - 30 diamonds, "Sell all": "Sold 19 diamond for 1,900 coins." and "11 diamond kept: today's selling limit."; - the menu's clock reads "Selling today: 92 coins left of your 2,000 coins a day...", `/worth diamond` says "You may sell 621 more diamond today."; - `audit.log` ends with the two `eco_give`, both buys and both sells; `market.json` holds the day's counts; the money in the game adds up. `cargo test`: 60 pass, 14 new: - the daily limits and their reset at midnight, and across a restart; - prices that would make money get closed, and overflow is refused; - the old-defaults migration; - the loop checker on iron blocks/ingots, bread, logs → planks → sticks; - the default prices have no loop, also through every vanilla recipe (run with `SMP_VANILLA_DATA`); - the shop's pages and clicks; - `/money` and `/eco give *`. `clippy --all-targets -D warnings` clean. Cost: no new per-tick work. The shop runs only on clicks, `market.json` is written only after a sale, and the tick is unchanged. 🤖 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:20 +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#110
No description provided.