Character Lock & Forgot PIN Recovery

Advanced Character Security with Secret Code Recovery System

Tutorial Video

What is Character Lock & Forgot PIN Recovery?

Character Lock & Forgot PIN Recovery is a premium security system that protects your character from unauthorized access with a 4-digit PIN code and Secret Code recovery mechanism. Lock your character to prevent inventory operations, item usage, stall activities, and more. If you forget your PIN, recover it instantly using your Secret Code - no admin intervention required!

How It Works

🔐 Character Lock Interface

  • Status Display: Real-time lock status (UNLOCKED / LOCKED) shown at top
  • NumPad Interface: Beautiful 3x4 grid with digits 1-9, Clear (C), Zero (0), and Backspace (<)
  • PIN Entry Field: Masked input showing dots for entered digits (Enter PIN: ____)
  • Lock Button: Lock character instantly with your 4-digit PIN
  • Remove Lock Button: Remove lock completely (requires PIN verification)
  • Forgot PIN Button: Access recovery system if you forget your PIN

🔑 Secret Code System

  • Create Secret Code Window: Set up recovery code when creating first lock
  • Flexible Length: Secret Code can be 4-10 digits (longer = more secure)
  • Use Secret Code Toggle: Checkbox to enable Secret Code recovery mode
  • Active Status: Green "< Active" indicator when Secret Code is ready
  • NumPad Input: Same elegant interface for entering Secret Code
  • Create/Cancel Buttons: Confirm or cancel Secret Code creation

🔓 Forgot PIN Recovery

  • Change Your PIN Mode: Golden title "Change Your PIN" when recovery activated
  • Create Secret Option: Button to create Secret Code if you don't have one
  • Your Secret Code Field: Enter your registered Secret Code for verification
  • New PIN Field: Set new 4-digit PIN after Secret Code verification
  • Switch Button: Toggle between old PIN and Secret Code recovery modes
  • Verify Button: Confirm recovery and set new PIN instantly

🛡️ Protection Features

  • Inventory Operations: Blocks all inventory actions (move, drop, equip items)
  • Item Usage: Prevents using potions, scrolls, and consumables
  • Stall System: Blocks opening stall, buying from stalls, and modifying stall items
  • Item Mall Access: Prevents accessing Item Mall purchase interface
  • Main Actions: Blocks buff cancellation, trace skills, and special actions
  • In-Game Notices: Clear messages explaining why actions are blocked

Database Architecture

🔐 _CharLocked Table

Purpose: Store character lock information with PIN and Secret Code

  • CharName: VARCHAR(64) NOT NULL PRIMARY KEY - Character name
  • Password: VARCHAR(4) NOT NULL - 4-digit PIN code
  • SecretCode: VARCHAR(10) NULL - Recovery code (4-10 digits)
  • CreatedAt: DATETIME NOT NULL DEFAULT GETDATE() - Lock creation timestamp

Security: SecretCode is optional (NULL) for older locks, but recommended for all new locks

Key Features

🎯 Premium Lock Interface

  • Elegant Design: Dark theme with golden accents and brown buttons
  • Real-Time Status: UNLOCKED (green) / LOCKED (status) display at top
  • NumPad Layout: Professional 3x4 button grid (1-9, C, 0, <)
  • Visual Feedback: PIN entry field shows underscore placeholders (____)
  • Draggable Window: Position lock window anywhere on screen
  • Close Button: X button in top-right corner for quick dismissal

🔑 Advanced Secret Code System

  • Flexible Security: Choose Secret Code length (4-10 digits) based on preference
  • First-Time Setup: Create Secret Code window appears when creating first lock
  • NumPad Entry: Same elegant interface for entering Secret Code
  • Validation: System enforces digits-only input (no letters or symbols)
  • Green Indicator: "< Active" status shows Secret Code is registered
  • Optional Creation: Skip Secret Code creation and add it later via !addsecret command

🔓 Forgot PIN Recovery System

  • Two Recovery Modes: Use Old PIN or Use Secret Code (toggle with Switch button)
  • Old PIN Mode: Change PIN by verifying current PIN (standard password change)
  • Secret Code Mode: Recover forgotten PIN using registered Secret Code
  • Instant Recovery: No waiting, no admin intervention - immediate PIN reset
  • Dual Input Fields: Your Secret Code + New PIN entry fields
  • Verification Button: One-click verification and PIN change

🛡️ Comprehensive Protection

  • Inventory Lock: Prevents moving, dropping, equipping items when locked
  • Item Usage Block: Cannot use potions, scrolls, or any consumables
  • Stall Protection: Blocks opening stall, buying, and modifying stall items
  • Item Mall Block: Prevents purchasing from Item Mall interface
  • Action Prevention: Blocks buff cancel, trace skills, and main actions
  • Clear Notifications: "Character is locked! Use !lock [PIN] to unlock." messages

Chat Commands

🔐 Lock/Unlock Commands

!lock [PIN]      - Lock your character with 4-digit PIN
!unlock [PIN]    - Unlock your character using your PIN

Example:
!lock 1234       - Locks character with PIN 1234
!unlock 1234     - Unlocks character using PIN 1234

🔑 PIN Management Commands

!changepin  
- Change your PIN by verifying old PIN

Example:
!changepin 1234 5678
- Changes PIN from 1234 to 5678

🔓 Recovery Commands

!forgotpin  
- Recover forgotten PIN using Secret Code

!addsecret 
- Add Secret Code to existing lock (if you created lock before Secret Code system)

Examples:
!forgotpin 123456 5678
- Verifies Secret Code 123456 and sets new PIN to 5678

!addsecret 987654
- Adds Secret Code 987654 to your existing lock

Professional Tips

For Players - Security Best Practices

  • Strong PIN Selection: Avoid obvious PINs (1234, 0000, 1111) - use random combinations
  • Secret Code Length: Use 8-10 digits for maximum security (harder to guess)
  • Save Your Codes: Write down both PIN and Secret Code in secure location
  • Lock Before AFK: Always lock character before going AFK to prevent theft
  • Lock During Trading: Lock character when not actively trading to prevent scams
  • Test Recovery: Test Secret Code recovery once to ensure it works before you need it

For Players - Using the System

  • Interface Access: Open Character Lock window from F9 Filter PlayerBox menu
  • First-Time Setup: Create both PIN and Secret Code during first lock creation
  • Quick Lock: Click Lock button OR use !lock [PIN] command for instant locking
  • Quick Unlock: Click Remove Lock OR use !unlock [PIN] when you're ready to play
  • Forgot PIN Recovery: Click "Forgot PIN?" button and use Secret Code mode
  • NumPad Shortcuts: Use keyboard numpad (if available) for faster PIN entry

For Administrators - System Management

  • Database Setup: Run COMPLETE_UNLOCK_SYSTEM.sql to create _CharLocked table
  • Enable Feature: Set CharacterLock = true in X9 Filter GUI settings
  • Legacy Locks: Old locks without Secret Code can still use !changepin command
  • Manual Recovery: Admins can manually update Password field in _CharLocked table
  • Security Logging: Enable CharacterLock logging to monitor all lock/unlock activities
  • Player Support: Guide players to use !addsecret if they have old locks without Secret Code

Practical Examples

Scenario 1: Creating Your First Lock

  1. Open Character Lock: Access via F9 Filter PlayerBox → Character Lock
  2. Status Shows UNLOCKED: Green text confirms no lock exists yet
  3. Create Secret Code Window Appears: System prompts for Secret Code creation
  4. Enter Secret Code: Use NumPad to enter 6-10 digit recovery code (e.g., 987654)
  5. Click Create: Secret Code saved, window shows "< Active" status
  6. Enter Your PIN: Use NumPad to enter 4-digit PIN (e.g., 1234)
  7. Click Lock Button: Character instantly locked, status changes to LOCKED
  8. Test Unlock: Use !unlock 1234 command to verify lock works correctly

Scenario 2: Forgot PIN Recovery

  1. Panic Moment: You forgot your PIN and character is locked!
  2. Open Character Lock: Access lock interface from F9 Filter PlayerBox
  3. Click "Forgot PIN?" Button: Recovery window opens with "Change Your PIN" title
  4. Click Switch Button: Toggle to "Use Secret Code" mode if needed
  5. Enter Secret Code: Type your registered Secret Code in first field (987654)
  6. Enter New PIN: Choose new 4-digit PIN in second field (5678)
  7. Click Verify: System verifies Secret Code and sets new PIN instantly
  8. Success! Green notice: "Secret Code verified! PIN successfully changed."
  9. Unlock Character: Use !unlock 5678 with your new PIN

Technical Implementation

PIN Validation Logic

// PIN must be exactly 4 digits only
if (string.IsNullOrEmpty(pin) ||
    !IsDigitsOnly(pin) ||
    pin.Length != 4)
{
    session.SendNotice("PIN must be exactly 4 digits!");
    return false;
}

Secret Code Validation

// Secret Code must be 4-10 digits only
if (string.IsNullOrEmpty(secretCode) || 
    !IsDigitsOnly(secretCode) ||
    secretCode.Length < 4 ||
    secretCode.Length > 10)
{
    session.SendNotice("Secret Code must be 4-10 digits!");
    return false;
}

Forgot PIN Recovery Query

// Retrieve PIN and Secret Code
SELECT CAST(Password AS VARCHAR(4)) + '|' + ISNULL(SecretCode, '') 
FROM _CharLocked 
WHERE CharName = @CharName

// Verify Secret Code matches
if (providedCode != registeredCode)
{
    session.SendNotice("Secret Code does not match!");
    return false;
}

// Update PIN
UPDATE _CharLocked 
SET Password = @NewPIN 
WHERE CharName = @CharName

Inventory Operation Protection

// Block inventory operations when locked
if (Config.GetGUISettings.CharacterLock && session.State.IsLocked)
{
    session.SendNotice("Character is locked! Use !lock [PIN] to unlock.");
    LoggerConfig.Log("CharacterLock", 
        $"BLOCKING inventory operation for {session.State.CharName}");
    return new PacketResult(PacketResultType.Block);
}

Summary

Character Lock & Forgot PIN Recovery provides bank-grade security with elegant interface, comprehensive protection, and instant self-service recovery - no admin needed!

Core Benefits

🔐

4-digit PIN protection

🔑

Secret Code recovery

🛡️

Comprehensive blocking

Instant recovery

Lock it. Protect it. Never lose access - recover instantly with Secret Code!

by X9 Filter New Feature!

Enhancing your Silkroad Online experience