Money

The Money module provides various APIs which wrap MoneyFormatter objects to format currency values for different purposes within a UI.

API

class UI.Money: LibTSMModule
staticmethod ToStringForAH(value: number, color?: string, disabled?: boolean): string

Converts a money value to a string with settings suitable for the auction house.

Parameters:
  • value (number) – The value in copper

  • color? (string) – An optional color value

  • disabled? (boolean) – Optionally use the disabled tokens

staticmethod ToStringForUI(value: number, color?: string): string

Converts a money value to a string with settings suitable for the UI.

Parameters:
  • value (number) – The value in copper

  • color? (string) – An optional color value

staticmethod ToStringForUIShort(value: number): string

Converts a money value to as short of a string as possible for display in the UI.

Parameters:

value (number) – The value in copper

staticmethod ToStringExact(value: number, color?: string): string

Converts a money value to a string with maximum precision.

Parameters:
  • value (number) – The value in copper

  • color? (string) – An optional color value

staticmethod ToStringForTooltip(
    value: number,
    color?: string,
    useIcon?: boolean,
    disabled?: boolean
): string

Converts a money value to a string with maximum precision.

Parameters:
  • value (number) – The value in copper

  • color? (string) – The color value

  • useIcon? (boolean) – Use icons instead of text

  • disabled? (boolean) – Use the disabled format

staticmethod FromString(value: string): number?

Converts a string money value to a number value (in copper). The value passed to this function can contain colored text, but must use g/s/c for the denominations and not icons.

Parameters:

value (string) – The money value to be converted as a string