Jail System

Comprehensive jail/prison system with arrest, bail, jailbreak, and PvP mechanics. Get arrested for: (1) high wanted level (PvP kills) OR (2) evil alignment below -20 (configurable). Pay bond (3000 gold per VE, max 50k) or use court system (2 witnesses + barrister for trial). Jailbreak option: dig tunnel (costs 3 turns, 10% success default): outcomes include freedom, death (dig under bank/into shades), fight sheriff (1.3x stats), circle back to cell, or escape with "Escapee" title (gold → 3, -30% attack/defense buff for 20 rounds). Jail Visit allows PvP against sleeping prisoners, protected by sheriff (1.7x attack/defense, 2.0x HP default), losing = sent to jail. Daily features: town cries for help, suicide attempts, soup healing (1 gem). Newday auto-release with -10% evil reduction. Most Wanted Hall of Fame listing. Three integrated modules by Sixf00t4/Niksolo/Lonny/Dager. Where crime doesn't pay but jailbreaks involve potentially digging under the bank and dying from falling gold coins.

Overview

What Is the Jail System?:

  • Punishment/prison system for wanted or evil players
  • Arrest triggers: Wanted level (PvP) OR evil alignment (< min threshold)
  • Located in each village (configurable to one location only)
  • Sheriff NPC: Andy Griffith (default, configurable name)
  • Release methods: Pay bond, court trial, jailbreak, newday, or PvP death
  • While jailed: Limited actions, vulnerable to Jail Visit PvP

Three Integrated Modules:

  • jail: Main system (arrest, bail, court, daily actions)
  • jailbreak: Escape attempt system (tunnel digging, random outcomes)
  • jailvisit: PvP against jailed players (sheriff protection)

Getting Arrested

Arrest Triggers:

  • Wanted Level (if usewanted = 1, default):
    • wantedlevel pref > 0
    • Increased by PvP kills/crimes (implementation varies)
    • Village description warns: "You tread lightly, avoiding eye contact with anyone who may have seen your face on a wanted poster"
  • Evil Alignment (if useevil = 1, default):
    • alignment (from alignment module) < minevil setting (default: -20)
    • "Sheriff can smell your evil from miles away, has finally caught up to you"

Arrest Event (Forest):

  • Random forest event: encounter sheriff searching for evildoers
  • If wanted > 0: "Sheriff recognizes you from wanted posters! You're going to jail."
  • If evil < minevil: "Sheriff smells your evil from miles away. You're going to jail."
  • If neither: "Sheriff passes you by" (safe)
  • News: "The sheriff arrested %s in the forest!"
  • Redirect to jail cell immediately
  • injail pref set to 1

Arrest Redirect:

  • Village hook checks injail pref
  • If injail = 1: Automatic redirect to runmodule.php?module=jail
  • Blocks access to standard village until released

While In Jail

Available Actions:

  • Get a Court Date: If you have 2 witnesses + 1 barrister
  • Use Your Town Cry: Limited uses per day (default: 1)
  • Twiddle Your Thumbs: Do nothing, waste time
  • Go to Sleep: Advance to newday (auto-release)
  • Pay Bond: Gold-based release
  • Attempt Suicide: Try to kill yourself (limited attempts)
  • Ask for Soup: 1 gem → heal HP
  • LotGD Forum: If showforum = 1 and forum module active
  • Superuser: Newday: Admin escape hatch
  • Jailbreak (if jailbreak module active): Tunnel escape attempt

Blocked Actions:

  • Cannot access village (auto-redirected to jail)
  • Newday blocked (except via jail "Go to Sleep")
  • News blocked
  • Most village navigation blocked

Paying Bond

Bond Cost Calculation:

  • Base cost per VE: bond setting (default: 3000 gold)
  • Formula: bond × dragonkills
  • Maximum: maxbond setting (default: 50,000 gold)
  • Additional factors (if configured):
    • baillvl per level (default: 3000)
    • baildk per dragon kill (default: 1)

Bondexample Costs:

  • 1 VE: 3,000 gold
  • 5 VE: 15,000 gold
  • 10 VE: 30,000 gold
  • 17+ VE: 50,000 gold (capped at maxbond)

Bond Consequences:

  • Gold deducted from player
  • injail pref → 0 (released)
  • wantedlevel pref → 0 (cleared)
  • Evil reduction: alignment × bailevil% (default: 1%)
  • Example: -100 alignment → -99 alignment (1% reduction toward good)

Courthouse System

Court Requirements:

  • 2 Witnesses (witness1, witness2 prefs = player account IDs)
  • 1 Barrister (barrister pref = player account ID)
  • All three must be recruited by jailed player
  • wenttocourt pref = 0 (haven't gone today)

Recruiting Helpers:

  • Witnesses:
    • Minimum level: minlvl setting (default: 4)
    • Costs turnwit turns (default: 3 turns)
    • Players volunteer/accept to be witnesses
  • Barrister:
    • Must be bardk VEs above jailed player (default: 3 VE higher)
    • Minimum level: minlvl setting (default: 4)
    • Costs turnbar turns (default: 5 turns)

Court Outcome:

  • Navigation: "Get a Court Date" appears when all three recruited
  • Trial proceeds (implementation in lib/jail.php)
  • Potential outcomes: Release, reduced sentence, or stay jailed
  • wenttocourt pref → 1 (can't go again today)
  • Location Events NPC may be involved (eventid setting)

Town Cries

Cry for Help System:

  • Limited uses per day: towncries pref (max: maxtowncries setting, default: 1)
  • Broadcast message to other players
  • Request witnesses/barrister recruitment
  • Request bond assistance
  • Navigation: "Use your town cry" (if towncries > 0)

After Using:

  • towncries pref decremented
  • Resets to maxtowncries at newday

Newday Release

Automatic Release:

  • At newday: If injail = 1 → injail = 0
  • wantedlevel → 0 (cleared)
  • Evil alignment reduction (if evil < minevil):
  • Formula: alignment + (|alignment| × evilremoved% / 100)
  • Default evilremoved: 10%
  • Example: -100 alignment → -90 alignment (+10 toward good)

Wakeup Page:

  • Redirect to runmodule.php?module=jail&op=wakeup
  • Release message displayed
  • Navigation to village restored

Preference Resets:

  • barrister → 0
  • witness1 → 0
  • witness2 → 0
  • towncries → maxtowncries
  • suicideattempts → 0
  • wenttocourt → 0

Jailbreak System

Escape Attempt Mechanics:

  • Navigation: Discover loose tile → metal digging pick
  • Cost: 3 turns to dig tunnel
  • Attempts per day: breaksallowed setting (default: 1)
  • Success chance: breakpercent setting (default: 10%)
  • If attempts >= allowed: "You have already tried to escape today!"

Success (10% chance default):

  • "`4`bYOU'RE FREE!!!`b"
  • "Nobody even knows you escaped. Keep this on the down low, unless you want a hefty bounty."
  • injail → 0
  • Navigation to village
  • Clean escape (no penalties)

Failure Outcomes (90% chance, 6 possibilities):

1. Dig Under Bank → Death (1/6 of failures)

  • "Wrong turn in tunnel. Ended up below the bank!"
  • "Compromised bank foundation. bank floor collapses!"
  • "`4Hit by falling ton of gold coins and sharp gems for `110038378 `4damage!"
  • hitpoints → 0, alive → false
  • News: "%s died during attempted jail escape when they dug under bank, causing vault to collapse"
  • Redirect to shades
  • alignment -3 (if alignment module active)

2. Dig Into Sheriff's Chambers → Fight (1/6 of failures)

  • "Dug right into `3%s's`@ chambers!"
  • "Interrupted his reading, he looks at you with wild stare"
  • "Enraged, %s lunges at you!"
  • Sheriff Combat:
    • Level: Your level
    • Attack: Your attack × 1.3
    • Defense: Your defense × 1.3
    • HP: Your max HP × 1.5
    • Weapon: "Anger"
  • Victory: injail → 0, alignment -10, news "%s has killed the sheriff!", flee to forest
  • Defeat: Death, alignment -5, news "%s tried to break out but ended up in sheriff's house!"

3. Dig to Shades → Death (1/6 of failures)

  • "Dug a tad too south. Ended up in the shades!"
  • "`4\"How funny. I never felt myself die\"`3"
  • hitpoints → 0, alive → false
  • News: "%s dug a tunnel and escaped from jail -- a tunnel to the Shades!"
  • Redirect to shades
  • injail → 0

4. Dig Back to Cell → Wasted Effort (1/6 of failures)

  • "Pull yourself out. only to realize, you're back where you started!"
  • "If only you didn't waste all your energy digging. might've been able to try again!"
  • "`1All dirty and smelly. `4Oh well."
  • No release, no consequences beyond wasted 3 turns
  • Still jailed

5. Escape with "Escapee" Title → Severe Penalties (1/6 of failures)

  • "You're back in the village, hooray!"
  • "You feel lighter, somehow, and different than how you normally would"
  • injail → 0
  • gold → 3 (lose all gold!)
  • title → "Escapee"
  • News: "%s escaped from prison! Be on the lookout!"
  • Escapee Buff Applied:
    • Name: "`#Escapee"
    • Rounds: 20
    • atkmod: 0.7 (-30% attack)
    • defmod: 0.7 (-30% defense)
    • Roundmsg: "`%Too paranoid about being caught to concentrate on battle"
    • Wearoff: "`#No longer paranoid about escaping"
  • Technically "success" but severe penalties make it worse than staying jailed

6. Clean Escape (1/6 of failures)

  • "Reach upwards and pull yourself out, breathing in fresh `bfree`b air"
  • injail → 0
  • Navigation to village
  • No penalties (same as success outcome)

Jailbreak Strategy

Should You Attempt Jailbreak?:

  • Yes, if:
    • You can't afford bond
    • You can't recruit court helpers
    • You have 3+ turns to spare
    • You're willing to risk death (33% chance: bank/shades/sheriff)
  • No, if:
    • You can afford bond (safer, guaranteed release)
    • You're close to newday (auto-release coming)
    • You're risk-averse (90% failure rate default)
    • You can't survive combat with sheriff (1.3x stats)

Outcome Probabilities (assuming 10% success, 90% failure):

  • 10%: Clean success (freedom)
  • 15% (90% × 1/6): Dig under bank → death
  • 15%: Dig into sheriff → combat (50/50 win/loss estimate)
  • 15%: Dig to shades → death
  • 15%: Dig back to cell → wasted turns, still jailed
  • 15%: Escapee title → gold loss + -30% combat for 20 rounds
  • 15%: Clean escape

Mathematical EV:

  • ~25% clean freedom (10% success + 15% case 6)
  • ~30% death (bank + shades)
  • ~15% combat (variable outcome)
  • ~15% wasted effort (still jailed)
  • ~15% freedom but severe penalties (Escapee)
  • Recommendation: High risk, only attempt if desperate

Jail Visit PvP

Attacking Jailed Players:

  • Navigation: "Visit a foe" (sheriff-jail hook)
  • Requires playerfights > 0
  • Target list: Players in jail (playerloc pref = jail location)
  • Level range: Your level ±1 to +2 (standard PvP range)
  • Victim must be offline (laston < timeout OR loggedin = 0)

Sheriff Protection:

  • If sheriff setting = 1 (default)
  • sheriffchance setting (default: 100% sheriff appears)
  • whensheriff setting:
    • 1 = After PvP (fight prisoner first, then sheriff)
    • 2 = Before PvP (fight sheriff first to access prisoners)

Sheriff Combat Stats:

  • Name: sheriffname setting (default: from jail module, e.g., "Andy Griffith")
  • Level: Your level + 5
  • Weapon: "Club"
  • Attack: Your attack × atk multiplier (default: 1.7)
  • Defense: Your defense × def multiplier (default: 1.7)
  • HP: Your max HP × hp multiplier (default: 2.0)

Sheriff Victory (You Win):

  • News: "%s defeated the sheriff while visiting a foe!"
  • If whensheriff = 2: Proceed to prisoner list
  • If whensheriff = 1: Escape to village
  • alignment -alatk (default: -5 if aliaff = 1)

Sheriff Defeat (You Lose):

  • "Sheriff strikes you down with final blow and knocks you out cold"
  • News: "%s fell at the feet of the Sheriff while trying to visit a foe"
  • If jailloss = 1 (default):
    • injail → 1 (YOU get sent to jail)
    • hitpoints → 1 (survive but imprisoned)
    • Redirect to jail cell
  • If jailloss = 0:
    • Death (hitpoints → 0)
    • -10% experience loss
    • Redirect to shades

Prisoner PvP Victory:

  • News: "`4%s`3 defeated `4%s`3 while they were in the jail"
  • Standard PvP rewards (gold, experience)
  • If whensheriff = 1: Sheriff appears after victory (fight again)
  • alignment -alatk (attacking jailed = evil act)

Prisoner PvP Defeat:

  • News: "`4%s`3 was defeated while attacking `4%s`3 in the Jail"
  • Standard PvP defeat penalties
  • Death, redirect to shades

Most Wanted List

Hall of Fame Integration:

  • Hook: footer-hof
  • Navigation: "Most Wanted"
  • Lists players by wantedlevel pref (highest first)
  • Public ranking of wanted criminals
  • runmodule.php?module=jail&op=hof

Soup Healing

Ask for Soup:

  • Cost: 1 gem
  • Effect: HP restoration (amount varies, implementation in lib/jail.php)
  • Available while jailed
  • Useful if injured before/during jail time

Suicide Attempts

Attempt Suicide Action:

  • suicideattempts pref tracks attempts today
  • Outcome varies (implementation in lib/jail.php)
  • Possible: Death, failure (stay jailed), HP loss
  • Resets at newday (suicideattempts → 0)
  • Desperate option for players who want to exit jail via death

Integration with Alignment Module

Required Dependency:

  • Jail module requires alignment module (Lonnyl)
  • Uses alignment pref for arrest trigger (evil threshold)
  • Modifies alignment on: bond payment, newday release, jailbreak outcomes, Jail Visit PvP

Alignment Changes:

  • Bond/bail: +bailevil% toward good (default: +1%)
  • Newday release: +evilremoved% toward good (default: +10%)
  • Jailbreak bank death: -3 alignment
  • Jailbreak sheriff kill: -10 alignment
  • Jailbreak sheriff death: -5 alignment
  • Jail Visit attack: -alatk alignment (default: -5)

Settings & Configuration

Jail Settings:

  • oneloc: Jail in one village only? (default: false)
  • jailloc: If oneloc=true, which village? (default: capital)
  • sheriffname: "Andy Griffith" (default)
  • bond: 3000 gold per VE (default)
  • maxbond: 50,000 gold max (default)
  • baillvl: 3000 gold per level (default)
  • baildk: 1 gold per VE (default)
  • bailevil: 1% evil removed on bond (default)
  • maxtowncries: 1 per day (default)
  • evilremoved: 10% evil removed on newday (default)
  • usewanted: Use wanted for arrest? (default: true)
  • useevil: Use evil for arrest? (default: true)
  • minevil: -20 alignment threshold (default)
  • showforum: Show forum in jail? (default: true)

Jailbreak Settings:

  • sheriffname: "Sheriff John" (default)
  • breaksallowed: 1 attempt per day (default)
  • breakpercent: 10% success chance (default)
  • allowspecial: Allow specials during sheriff fight? (default: true)

Jail Visit Settings:

  • aliaff: Alignment affected by visiting? (default: true)
  • alatk: -5 alignment per attack (default)
  • sheriff: Sheriff protects jailed? (default: true)
  • whensheriff: 1=After PvP, 2=Before PvP (default: varies)
  • sheriffchance: 100% chance sheriff appears (default)
  • atk: 1.7x multiplier (default)
  • def: 1.7x multiplier (default)
  • hp: 2.0x multiplier (default)
  • jailloss: Send to jail on sheriff loss? (default: true)

Strategy Guide

Avoiding Arrest:

  • Keep alignment > minevil (default: stay above -20)
  • Avoid PvP if it raises wanted level
  • Be cautious in forest if wanted/evil (sheriff event)

If Arrested - Best Release Options:

  • 1. Pay Bond: Safest, guaranteed release (if you have gold)
  • 2. Wait for Newday: Free, guaranteed release, -10% evil
  • 3. Court System: If you can recruit helpers (2 witnesses + barrister)
  • 4. Jailbreak: High risk (30% death, 15% wasted), only if desperate

Jail Visit Strategies:

  • Attackers: Be prepared to fight sheriff (1.7x/2.0x stats), losing = you go to jail
  • Jailed Players: You're vulnerable to PvP while offline/jailed, heal before sleeping

Limitations

  • Requires Alignment Module: Cannot install without alignment system
  • High Jailbreak Risk: 90% failure rate (default), 30% death chance
  • Sheriff Protection: Makes Jail Visit PvP very dangerous (1.7x/2.0x stats)
  • Bond Costs Scale: Expensive for high VE players (17+ VE = 50k gold)
  • Court Recruitment Hard: Need 3 other players to help (2 witnesses + barrister)
  • Daily Limits: Town cries, jailbreak attempts, court attempts all once per day
  • Vulnerable PvP: While jailed, open to Jail Visit attacks

Jail System: where getting too evil (alignment < -20 default) or accumulating too many wanted levels from PvP crimes triggers a random forest event where the sheriff (default name: Andy Griffith) either "recognizes you from wanted posters" or "can smell your evil from miles away" and arrests you on the spot, teleporting you to a jail cell with extremely limited options: (1) pay exorbitant bond (3000 gold per VE, capped at 50k), (2) recruit 2 witnesses (costs them 3 turns each) plus 1 barrister who must be 3+ VEs above you (costs them 5 turns) to get a court date for potential release, (3) use your 1 daily town cry to beg for help, (4) wait for automatic newday release with -10% evil reduction, or (5) attempt jailbreak by finding a metal digging pick under a loose floor tile and spending 3 turns to dig a tunnel with only 10% success chance (default), where the 90% failure outcomes include: digging under the bank and dying from "10038378 damage" of falling gold coins and sharp gems, digging into the sheriff's chambers and fighting him at 1.3x your stats (death or -10 alignment for killing him), digging straight to the shades and instantly dying, digging in a circle back to your own cell (wasted 3 turns), escaping with "Escapee" title but your gold drops to 3 and you get -30% attack/defense debuff for 20 rounds while "too paranoid about being caught to concentrate on battle," or rarely just clean freedom. Meanwhile, OTHER players can use Jail Visit to PvP attack you while you're sleeping/offline, but they must first fight the sheriff (1.7x attack/defense, 2.0x HP defaults) who appears either before or after their PvP attempt depending on configuration, and if they LOSE to the sheriff they get sent to jail themselves (jailloss=1 default) or die with -10% experience (jailloss=0), plus attacking jailed players is inherently evil (-5 alignment default) because you're kicking people while they're down. The entire system is a punishment/deterrent for evil alignment or wanted-level crimes, with newday auto-release as the safest option for most players unless you're wealthy enough to afford bond or connected enough to recruit a legal team.