# community-marketplace > Builds player auction house and trading functionality for L2J server. Use when: implementing player-to-player item trading, auction listings, marketplace UI, buy/sell transactions, offline payment systems, or marketplace fee/tax calculations - Author: valeriybaranyshyn-pixel - Repository: valeriybaranyshyn-pixel/Tales-of-Aden - Version: 20260202145225 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/valeriybaranyshyn-pixel/Tales-of-Aden - Web: https://mule.run/skillshub/@@valeriybaranyshyn-pixel/Tales-of-Aden~community-marketplace:20260202145225 --- --- name: community-marketplace description: | Builds player auction house and trading functionality for L2J server. Use when: implementing player-to-player item trading, auction listings, marketplace UI, buy/sell transactions, offline payment systems, or marketplace fee/tax calculations allowed-tools: Read, Edit, Write, Glob, Grep, Bash --- # Community Marketplace Skill Player auction house system for Tales of Aden L2J server. The marketplace uses the Community Board (BBS) UI with bypass handlers for navigation. Items are stored in `auction_table` with concurrent memory cache via `ConcurrentHashMap`. Supports both online and offline seller payment, configurable fees, and item filtering by grade/category. ## Quick Start ### Opening Marketplace ```java // Voiced command: .MarketPlace public class CommandMarketPlace implements IVoicedCommandHandler { private static final String[] _voicedCommands = {"MarketPlace"}; @Override public boolean useVoicedCommand(String command, Player activeChar, String params) { if (command.equals("MarketPlace")) MarketplaceCBBypasses.showMarketBoard(activeChar, 1, "*null*"); return true; } } ``` ### Listing an Item for Sale ```java // Create auction entry with fee validation int feeId = Config.MARKETPLACE_FEE[0]; int feeAmount = Config.MARKETPLACE_FEE[1]; if (activeChar.getInventory().getInventoryItemCount(feeId, -1) < feeAmount) { activeChar.sendMessage("You don't have enough to pay the fee."); return false; } AuctionTableCommunity.getInstance().addItem(new AuctionHolder( AuctionTableCommunity.getInstance().getNextAuctionId(), activeChar.getObjectId(), item.getItemId(), itemAmount, item.getEnchantLevel(), costId, costCount )); activeChar.destroyItemByItemId("Auction Fee", feeId, feeAmount, activeChar, true); activeChar.destroyItem("Auction Item", itemId, itemAmount, activeChar, true); ``` ### Processing a Purchase ```java // Calculate tax and pay seller long cost = item.getCostCount(); long tax = 0; if (cost >= Config.AUCTION_TAX_MINIMUM_ITEM_COUNT) tax = (long) Math.ceil(cost * Config.AUCTION_TAX_RATE); long finalAmount = Math.max(0, cost - tax); Player owner = L2World.getInstance().getPlayer(item.getOwnerId()); if (owner != null && owner.isOnline()) { owner.addItem("Auction", item.getCostId(), (int) finalAmount, null, true); } else { addItemToOffline(item.getOwnerId(), item.getCostId(), (int) finalAmount); } ``` ## Key Concepts | Concept | Usage | Example | |---------|-------|---------| | AuctionHolder | Data container for listings | `new AuctionHolder(id, owner, itemId, count, enchant, costId, costCount)` | | AuctionTableCommunity | Singleton manager + DB persistence | `AuctionTableCommunity.getInstance().addItem(item)` | | IBypassHandler | Community Board navigation | `handleBypass("bp_buy 123", player)` | | HtmlBuilder | L2 client HTML with length limits | `new HtmlBuilder(HtmlType.COMUNITY)` | ## Configuration | Config Key | Purpose | Default | |------------|---------|---------| | `MARKETPLACE_FEE` | Listing fee `[itemId, amount]` | Server-specific | | `TICKET_MARKE_PLACE` | Sale currency item ID | `9511` (Donate coin) | | `AUCTION_TAX_RATE` | Percentage taken from sale | `0.05` (5%) | | `AUCTION_TAX_MINIMUM_ITEM_COUNT` | Minimum price for tax | `5` | | `ENABLE_GRADE_ITEMS_MARKETPLACE` | Restrict by item grade | `false` | ## See Also - [patterns](references/patterns.md) - [workflows](references/workflows.md) ## Related Skills - See the **mariadb** skill for database schema and connection pooling - See the **l2j-gameserver** skill for bypass handler registration and packet handling - See the **item-handlers** skill for inventory operations - See the **database-schema** skill for the `auction_table` structure