NPC Shop Upgrade System

Dynamic Multi-Currency Shop & Massive Panel Update

Tutorial Video

What is NPC Shop Upgrade System?

NPC Shop Upgrade System is a comprehensive in-game shopping platform with two powerful shop systems: Dynamic Shop for cosmetics (Titles, Icons, Colors, Custom Titles) and NPC Shop for items. Features multi-currency support with 11 different payment types, category-based organization with up to 400 slots per category, and complete admin control via X9 Filter Panel!

How It Works

Dynamic Shop System

  • Access via F9 Filter PlayerBox interface with tabbed navigation
  • 6 categories: Titles, Icons, Colors, Custom Title, Guild Color, Name Tags
  • Each item supports up to 11 different currency types
  • Real-time currency balance display shows available funds
  • One-click purchase with instant delivery and confirmation

NPC Shop System

  • Category-based organization with unlimited categories
  • Each category supports 100-400 item slots (configurable)
  • Grid display with 10 items per row for easy browsing
  • Items show name, icon, and prices in all active currencies
  • Purchase with any configured currency type

Multi-Currency Payment

  • 11 currency types: X9 Coins, Silk, Arena Coins, Copper/Iron/Silver/Gold Coins, Gold, Gift Silk, Premium Silk, Honor Points
  • Each item can accept multiple currencies simultaneously
  • Players choose preferred payment method at checkout
  • Currency conversion rates configurable per item
  • Type "OFF" to disable specific currency for any item

Shop Systems Comparison

🎭 Dynamic Shop (Cosmetics)

Purpose: Sells cosmetic enhancements and visual customizations

  • Titles: HwanLevel titles (e.g., Knight, Baron, Viscount) - up to 255 titles
  • Icons: Character icons displayed next to name - unlimited icons
  • Colors: Name color and title color customization
  • Custom Title: Player-written custom titles (text input)
  • Guild Color: Guild name color customization
  • Name Tags: Decorative name tag styles

Tables: _X9Shop_Titles, _X9Shop_Icons, _X9Shop_Colors, _X9Shop_CustomTitle, X9GuildColor, X9NameDecoration

🛒 NPC Shop (Items)

Purpose: Sells actual in-game items and equipment

  • Categories: Organize items into logical groups (Weapons, Armor, Potions, etc.)
  • Slot System: Each category has 100-400 slots for item placement
  • Item Database: Links to _RefObjCommon via ItemCode (CodeName128)
  • Visual Grid: 10 columns × N rows display with item icons
  • Stock Control: Enable/disable items individually

Tables: _NPCShopCategories, _NPCShopItems

Database Architecture

💰 _X9Coins Table

Purpose: Stores player currency balances (main currency)

Key Fields:

  • CharName: Player character name (Primary Key)
  • X9Coins: Current X9 Coin balance (bigint)

🎭 Dynamic Shop Tables (6 Tables)

Common Structure: Each table has ID, Enabled flag, and 11 price columns

  • _X9Shop_Titles: TitleID (1-255), Enabled, 11 price fields
  • _X9Shop_Icons: IconID (any number), Enabled, 11 price fields
  • _X9Shop_Colors: ColorType ('NameColor'/'TitleColor'), Enabled, 11 price fields
  • _X9Shop_CustomTitle: Single row with pricing for custom title feature
  • X9GuildColor: Single row with pricing for guild color feature
  • X9NameDecoration: Single row with pricing for name tags feature

Price Fields (11): X9Coin_Price, Silk_Price, ArenaCoin_Price, CopperCoin_Price, IronCoin_Price, SilverCoin_Price, GoldCoin_Price, Gold_Price, GiftSilk_Price, PremiumSilk_Price, HonorPoint_Price

NULL = OFF: Setting price to NULL disables that currency for the item

📦 _NPCShopCategories Table

Purpose: Defines shop categories and their slot capacity

Key Fields:

  • ID: Unique category identifier (auto-increment)
  • CategoryName: Display name (e.g., "Weapons", "Potions")
  • SlotCount: Total slots in category (100, 200, 300, or 400)
  • IsActive: Enable/disable entire category
  • SortOrder: Display order in shop interface
  • CreatedDate: Timestamp of creation

🛍️ _NPCShopItems Table

Purpose: Stores all items available in NPC shop

Key Fields:

  • ID: Unique item entry identifier (auto-increment)
  • CategoryID: Reference to _NPCShopCategories.ID
  • ItemCode: Item CodeName128 from _RefObjCommon
  • ItemName: Display name for item
  • SlotNumber: Position in category grid (0-399)
  • 11 Price Fields: Same as Dynamic Shop (X9Coin_Price, Silk_Price, etc.)
  • IsActive: Enable/disable specific item
  • CreatedDate: Timestamp of creation

Slot Validation: Each CategoryID + SlotNumber combination must be unique

Multi-Currency System

💎 X9 Coins

  • Source: Custom currency stored in _X9Coins table
  • Usage: Primary shop currency, earned through gameplay
  • Column: X9Coin_Price

💰 Silk Types (3 Variants)

  • Silk (Own): Regular silk from SK_Silk.silk_own - Column: Silk_Price
  • Gift Silk: Gifted silk from SK_Silk.silk_gift - Column: GiftSilk_Price
  • Premium Silk: Premium silk from SK_Silk.silk_point - Column: PremiumSilk_Price

🪙 Game Coins (5 Types)

  • Arena Coins: PVP currency - Column: ArenaCoin_Price
  • Copper Coins: Low-tier currency - Column: CopperCoin_Price
  • Iron Coins: Mid-tier currency - Column: IronCoin_Price
  • Silver Coins: High-tier currency - Column: SilverCoin_Price
  • Gold Coins: Premium currency - Column: GoldCoin_Price

💵 In-Game Gold

  • Source: Character inventory gold from _Char.RemainGold
  • Usage: Direct gold payment for items
  • Column: Gold_Price (supports large amounts with bigint)

🏆 Honor Points

  • Source: Honor ranking system points
  • Usage: Prestigious items for top-ranked players
  • Column: HonorPoint_Price

Key Features

Massive Panel Update

  • Dual Shop Interface: Dynamic Shop tab + NPC Shop tab in X9 Filter Panel
  • Table Switcher: Dropdown to switch between Titles/Icons/Colors/etc. in Dynamic Shop
  • Category Switcher: Dropdown to switch between Items/Categories in NPC Shop
  • Live Preview: See all shop data in formatted list with scrollable view
  • Quick Edit: Click any row to edit, changes auto-save on field blur
  • Bulk Operations: Add, Delete, Delete All with confirmation

Flexible Pricing Control

  • 11 Price Fields Per Item: Configure multiple payment options simultaneously
  • Enable/Disable Currencies: Type "OFF" or leave empty to disable specific currency
  • Number = Enabled: Enter any positive number to enable that currency with that price
  • Real-Time Updates: Price changes reflect immediately in-game after save
  • Price Validation: Automatic validation prevents invalid entries

Category Management (NPC Shop)

  • Unlimited Categories: Create as many categories as needed
  • Slot Capacity: Choose 100, 200, 300, or 400 slots per category
  • Sort Order: Control category display order in shop UI
  • Enable/Disable: Toggle entire categories without deleting
  • Grid Layout: Automatic 10-column grid with icon display

Admin Control Features

  • X9 Filter Panel Integration: Complete shop management from Filter UI
  • Auto-Save System: Changes save automatically when you move to another field
  • Slot Collision Detection: Prevents duplicate slot assignments in same category
  • Real-Time Status: Status bar shows operation results and errors
  • Database Validation: Automatic validation of CategoryID and ItemCode references
  • Formatted Display: Clean columnar display with proper spacing

Configuration Guide

Setting Up Dynamic Shop

  1. Open X9 Filter Panel: Navigate to "Dynamic Shop" tab
  2. Select Table: Choose Titles, Icons, Colors, etc. from dropdown
  3. Add Item: Enter ID (for Titles/Icons/Colors) or click Add for others
  4. Set Prices: Enter numbers for enabled currencies, "OFF" for disabled
  5. Save: Click outside field or press Enter to auto-save
  6. Test In-Game: Open shop via F9 PlayerBox to verify

Setting Up NPC Shop

  1. Create Categories: Switch to "Categories" table, add categories with names and slot counts
  2. Set Sort Order: Assign SortOrder values to control display sequence
  3. Add Items: Switch to "Items" table, add items with CategoryID, ItemCode, SlotNumber
  4. Configure Prices: Set prices in desired currencies (1-11 types per item)
  5. Verify Slots: Ensure no duplicate CategoryID + SlotNumber combinations
  6. Enable/Disable: Use IsActive checkbox to control item availability

Price Configuration Tips

  • Multiple Currencies: Enable 2-3 currencies per item for player choice
  • Currency Balance: Set X9 Coins as primary, Silk as alternative, Gold as backup
  • Price Ratios: Maintain consistent ratios across items (e.g., 1 Silk = 100 X9 Coins)
  • Disable Unused: Type "OFF" in price fields for currencies you don't want to use
  • Test Extensively: Verify all currency types work correctly before going live

Professional Tips

For Administrators

  • Organize Logically: Group similar items in same categories for easy browsing
  • Use Slot Numbers Wisely: Leave gaps (e.g., 0, 10, 20) for future additions
  • Price Consistently: Maintain logical price progression across similar items
  • Test Before Launch: Verify all items purchasable with all enabled currencies
  • Monitor Economy: Track which currencies are most used and adjust prices
  • Backup Regularly: Export shop tables before major changes

For Players

  • Check All Tabs: Browse all Dynamic Shop categories for available cosmetics
  • Compare Prices: Items often accept multiple currencies - choose the best deal
  • Save Currency: Some rare items may require specific currency types
  • Balance Display: Always check your balance before attempting purchase
  • NPC Categories: Use category dropdown to browse different item types efficiently

Practical Example

Scenario: Player wants to buy a Knight title with X9 Coins

  1. Open Dynamic Shop: Press F9 and click "Dynamic Shop" button in PlayerBox
  2. Navigate to Titles: Click "Titles" tab at the top of shop window
  3. Browse Available Titles: Scroll through list of purchasable titles
  4. Check Balance: See "X9 Coins: 68425" displayed at top of window
  5. Select Knight Title: Click on Knight title (TitleID 1) - shows price: 200 X9 Coins
  6. Confirm Purchase: Click "Buy with X9 Coins" button
  7. Instant Delivery: Title appears in title collection immediately!
  8. Balance Updates: X9 Coins balance now shows 68225

Technical Implementation

Dynamic Shop Module

File: MainWindow.DynamicShop.cs

  • Table switching with ComboBox dropdown (7 tables: Titles/Icons/Colors/CustomTitle/GuildColor/NameTags/Coins)
  • Dynamic form visibility based on selected table type
  • Auto-ID generation for new entries (finds max ID + 1)
  • ParsePriceValue method converts "OFF"/empty to NULL, numbers to enabled
  • Auto-save on field blur with _isUpdatingDynamicShop flag prevents loops
  • 11 price field text boxes with OFF/number validation

NPC Shop Module

File: MainWindow.X9NPC.cs

  • Dual-table management: Items (_NPCShopItems) and Categories (_NPCShopCategories)
  • Slot collision detection prevents duplicate CategoryID + SlotNumber combinations
  • SaveCurrentX9NPCRow method with in-memory row updates for instant UI refresh
  • Formatted list display with proper column spacing for readability
  • Selection-based editing with form population from selected row
  • Regex parsing for row selection and ID extraction

Database Integration

  • Connection String: Built from Filter Panel SQL settings (Server, Database, User, Password)
  • SqlDataAdapter: Fills DataTable for efficient data manipulation
  • Parameterized Queries: All SQL commands use parameters to prevent injection
  • Transaction Safety: Each operation wrapped in try-catch with status feedback
  • Auto-Reconnect: Handles connection issues gracefully with error messages

UI Components

  • ListBox: Scrollable list with monospace font for data display
  • TextBox Headers: Column headers with proper spacing alignment
  • Status TextBox: Real-time operation feedback (success/error messages)
  • Form Panels: Dynamic visibility based on selected table/category
  • CheckBoxes: IsActive and Enabled flags with two-state logic
  • Buttons: Refresh, Add, Delete, Delete All, Save operations

Summary

NPC Shop Upgrade System delivers a powerful dual-shop platform with Dynamic Shop for cosmetics and NPC Shop for items, featuring 11 currency types, unlimited categories with up to 400 slots each, and complete administrative control through an intuitive X9 Filter Panel interface!

Core Benefits

🛒

Dual shop systems

💰

11 currency types

⚙️

Complete admin control

Massive shop upgrade with unlimited scalability - Dynamic Shop for cosmetics + NPC Shop for items with multi-currency support!

by X9 Filter New Feature!

Enhancing your Silkroad Online experience