Module: Lich::Gemstone::Bank::Pattern

Defined in:
documented/gemstone/bank.rb

Overview

Regex patterns that match server responses to bank verbs.

Constant Summary collapse

DEPOSIT =

Matches teller responses to DEPOSIT commands across all banks.

Captures the silver amount deposited (including from notes and multiple coins), or indicates no coins were available or notes were handed over.

Examples:

"You deposit 5000 silvers into your account"

"You deposit your note worth 50000 into your account"

"You have no coins to deposit"

See Also:

Regexp.union(
  /^You deposit (?<silver>[\d,]+) silvers? into your account/,
  /^That's a total of (?<silver>[\d,]+) silvers?/,
  /^You deposit your note worth (?<silver>[\d,]+) into your account/,
  /They add up to (?<silver>[\d,]+) silvers?/,
  /^You have no coins to deposit/,
  /takes your silvers?/,
  /^You hand your notes to the teller/,
).freeze
WITHDRAW_RESULT =

The teller's answer to a withdrawal, without the debt notice: that comes first and the real answer follows it.

Regexp.union(
  /^Very well, a withdrawal of (?<silver>[\d,]+) silvers?/,
  /teller scribbles the transaction into a book and hands you (?<silver>[\d,]+) silvers?/,
  /teller carefully records the transaction, (?:and then )?hands you (?<silver>[\d,]+) silvers?/,
  /^The banker nods and says, "Alright, here ye go/,
  /^The teller (?:carefully|hands you|makes|taps her quill|purses her lips)/,
  /seem to have that much/,
  /debt collector/,
  /looks at you suspiciously/,
  /chuckles at you/,
).freeze
DEBT =

Matches a debt collector notice that precedes a withdrawal result.

Captures the debt amount. The actual withdrawal answer follows this line.

Examples:

"I have a bill of 2500 silvers to collect."

See Also:

  • Lich::Gemstone::Bank.withdraw_reply
/I have a bill of (?<debt>[\d,]+) silvers?/.freeze
NO_ACCESS =

Matches the bank's refusal when the character has no account there.

Returned by deposit, withdrawal, and account queries.

Examples:

"Sorry, you don't have access to that."

See Also:

/you don't have access/i.freeze
WITHDRAW =

A bank the character has no account at answers a WITHDRAW with the no-access line, so it has to end the wait like any other answer.

Regexp.union(WITHDRAW_RESULT, DEBT, NO_ACCESS).freeze
WITHDRAW_REFUSED =

Replies that mean the withdrawal did not happen. The teller's non-committal lines ("makes a note", "taps her quill") carry no silver figure, so anything that is not an explicit handover counts as refused.

Regexp.union(
  /seem to have that much/,
  /looks at you suspiciously/,
  /chuckles at you/,
  /taps her quill/,
  /purses her lips/,
  /^The teller makes/,
  NO_ACCESS,
).freeze
NOTE_HANDED =

Matches the teller handing over a note in response to a withdrawal.

The face value is the requested amount; the teller's confirmation lacks a figure.

Examples:

"The teller carefully records the transaction and hands you a note."

See Also:

/hands you a (?:bank )?note/.freeze
PINEFAR_HANDED =

Matches the Pinefar banker's confirmation to a withdrawal.

The banker uses distinct phrasing and does not echo the amount, unlike other banks.

Examples:

"Alright, here ye go."

See Also:

/Alright, here ye go/.freeze
ACCOUNT_START =

Matches the opening line of a BANK ACCOUNT response across all banks.

Signals the start of the account listing (or a no-access refusal).

Examples:

"You currently have the following amounts on deposit:"

See Also:

/You currently have the following amounts on deposit|You currently have an account|you don't have access/i.freeze
ACCOUNT_LINE =

Matches a per-town account balance line in BANK ACCOUNT output.

Captures the town/bank name and silver balance for that branch.

Examples:

" Four Winds Bank: 50000"

See Also:

/^\s+(?<bank>.+?) Bank: (?<silver>[\d,]+)$/.freeze
ACCOUNT_TOTAL =

Matches the total balance line in BANK ACCOUNT output.

Captures the sum of silver across all bank branches the character has accounts in.

Examples:

" Total: 175000"

See Also:

/^\s+Total: (?<silver>[\d,]+)$/.freeze
ACCOUNT_BALANCE =

Matches the balance line for single-branch accounts (no per-town listing).

Captures the account balance when BANK ACCOUNT returns only one amount.

Examples:

"You have an account in the amount of 100000 silvers."

See Also:

/in the amount of (?<silver>[\d,]+) silvers?/.freeze
ACCOUNT_MAX =

Matches the free-to-play account cap announced by the bank.

Captures the maximum balance a f2p account may hold; overflow must be withdrawn as notes.

Examples:

"You may maintain a maximum of 50000 silvers on account."

See Also:

/a maximum of (?<silver>[\d,]+) silvers?/.freeze
ACCOUNT_END =

Matches the final line of a BANK ACCOUNT response, signaling the end of output.

Marks completion of the account listing for parsing.

Examples:

"<prompt 2024/1/1>"

See Also:

/urchin bank runner uses remaining|a maximum of|you don't have access|<prompt/i.freeze
NOTE_VALUE =

Matches the note value description in a READ response.

Captures the face value of the note; the bank will credit this amount if deposited.

Examples:

"This note has a value of 25000 silvers and reads:"

See Also:

/has a value of (?<silver>[\d,]+) silvers? and reads/.freeze
NOTE_READ =

Matches the opening lines of a READ note response.

Signals that the note is in hand and readable; paired with NOTE_VALUE to extract the amount.

Examples:

"Hold in right hand to use."

See Also:

/Hold in right hand to use|has a value of/.freeze