promotional bannermobile promotional banner

Krowi's Currency

A comprehensive currency formatting library providing flexible formatting for in-game currency and other currency values

A comprehensive currency formatting library for World of Warcraft addon development, providing flexible and customizable formatting for in-game currency (gold, silver, copper) and other currency values.

Features

Currency Formatting (Krowi_Currency_2)

  • Money Formatting: Format copper values into gold, silver, and copper with customizable display options
  • Custom Separators: Support for comma, period, or space thousands separators
  • Abbreviations: Abbreviate large values with "k" (thousands) or "m" (millions) - automatically localized
  • Color Options: Optional colored currency text matching WoW's visual style
  • Icon Support: Display currency with WoW's official coin icons or text labels
  • Flexible Display: Show gold only or include silver and copper
  • Menu Generation: Automatically generate options menus for currency and money settings
  • Krowi LibMan: Integrated with Krowi's Library Manager for dependency management

Usage Examples

Basic Setup

local currency = KROWI_LIBMAN:GetLibrary('Krowi_Currency_2')

Format Money

-- Format 1234567 copper (123g 45s 67c)
local formatted = currency:FormatMoney(1234567, {
    ThousandsSeparator = "Comma",      -- "Comma", "Period", "Space", or ""
    MoneyAbbreviate = "None",          -- "None", "1k", or "1m"
    MoneyColored = true,               -- Colorize currency
    MoneyLabel = "Text",               -- "None", "Text", or "Icon"
    MoneyGoldOnly = false,             -- Show only gold
    TextureSize = 14                   -- Icon size (if using icons)
})
-- Result: "|cffffd100123g|r |cffe6e6e645s|r |cffc8602c67c|r" (colored)
-- Note: Labels are automatically localized based on MoneyLabel setting

Format Currency

-- Format arbitrary currency values
local formatted = currency:FormatCurrency(1500000, {
    ThousandsSeparator = "Comma",
    CurrencyAbbreviate = "1m"          -- Abbreviate millions
})
-- Result: "1m"

API Reference

Currency Functions

Function Parameters Returns Description
FormatMoney value, options string Formats copper value into gold/silver/copper with custom options and localized abbreviations
FormatCurrency value, options string Formats numeric currency value with separators and localized abbreviations
CreateCurrencyOptionsMenu parentMenu, menuBuilder, options, addTitle void Generates a submenu for currency abbreviation options. Set addTitle to false to skip title creation (defaults to true)
CreateMoneyOptionsMenu parentMenu, menuBuilder, options, addTitle void Generates a submenu for money formatting options including label, abbreviation, separator, and display settings. Set addTitle to false to skip title creation (defaults to true)

Options Table

FormatMoney Options

Option Type Values Description
ThousandsSeparator string "Comma", "Period", "Space", "" Thousands separator style
MoneyAbbreviate string "None", "1k", "1m" Abbreviation level
MoneyColored boolean true/false Whether to colorize currency
MoneyLabel string "None", "Text", "Icon" Label display type (localized automatically)
MoneyGoldOnly boolean true/false Show only gold portion
TextureSize number any Icon texture size (default: 14)

FormatCurrency Options

Option Type Values Description
ThousandsSeparator string "Comma", "Period", "Space", "" Thousands separator style
CurrencyAbbreviate string "None", "1k", "1m" Abbreviation level

Examples

Gold Only Display

local gold = currency:FormatMoney(1234567, {
    MoneyGoldOnly = true,
    MoneyColored = true,
    MoneyLabel = "Text"
})
-- Result: "|cffffd100123g|r"

Icon Display

local withIcons = currency:FormatMoney(1234567, {
    MoneyLabel = "Icon",
    TextureSize = 16
})
-- Result: WoW's official gold, silver, and copper icons with values

Abbreviated Currency

local abbreviated = currency:FormatCurrency(1500000, {
    ThousandsSeparator = "Comma",
    CurrencyAbbreviate = "1m"
})
-- Result: "1m"

local thousands = currency:FormatCurrency(5500, {
    CurrencyAbbreviate = "1k"
})
-- Result: "5k"

Menu Generation

-- Create currency options menu (for use with a menu builder system)
local parentMenu = {} -- Your menu system's parent menu
local menuBuilder = {} -- Your menu builder object with required methods
local options = {} -- Your addon's options table

currency:CreateCurrencyOptionsMenu(parentMenu, menuBuilder, options)
-- Creates submenu with:
--   - Currency Abbreviate (None/1k/1m)

currency:CreateMoneyOptionsMenu(parentMenu, menuBuilder, options)
-- Creates submenu with:
--   - Money Label (None/Text/Icon)
--   - Money Abbreviate (None/1k/1m)
--   - Thousands Separator (Space/Period/Comma)
--   - Money Gold Only (checkbox)
--   - Money Colored (checkbox)

Note: Abbreviations are automatically localized (e.g., "k/m" for English, "T/M" for German, "千/百万" for Chinese).

Use Cases

  • Display player gold in custom UI frames
  • Format auction house prices
  • Show currency costs in tooltips
  • Display quest rewards
  • Format currency in chat messages
  • Create custom currency displays with consistent formatting
  • Generate options menus for currency/money formatting settings in your addon

Requirements

  • Krowi's Library Manager (KROWI_LIBMAN)

The Krowi's Currency Team

profile avatar
Owner
  • 15
    Followers
  • 14
    Projects
  • 2.4M
    Downloads
Donate

More from KrowiView all

  • Krowi's Achievement Filter project image

    Krowi's Achievement Filter

    • 2.2M
    • Addons

    Achievement Filter completely replaces the default Achievements tab and adds several tabs to the Achievement Window that order the achievements by expansion, pvp, events or other curated lists.

    • 2.2M
    • June 19, 2026
    • Addons
    • +2
  • Krowi's Util project image

    Krowi's Util

    • 466
    • Addons

    A comprehensive utility library providing reusable functions for string manipulation, table operations, color management, and metadata handling

    • 466
    • June 10, 2026
    • Addons
  • Krowi's World Map Buttons project image

    Krowi's World Map Buttons

    • 13.4K
    • Addons

    A library for World of Warcraft addon development that simplifies adding custom buttons to the world map interface with automatic positioning and dynamic layout management

    • 13.4K
    • June 6, 2026
    • Addons
  • Krowi's Progress Bar project image

    Krowi's Progress Bar

    • 347
    • Addons

    A progress bar library for displaying multi-segment bars with up to 4 stacked values and customizable colors, including GameTooltip integration

    • 347
    • May 21, 2026
    • Addons
  • Krowi's Achievement Filter project image

    Krowi's Achievement Filter

    • 2.2M
    • Addons

    Achievement Filter completely replaces the default Achievements tab and adds several tabs to the Achievement Window that order the achievements by expansion, pvp, events or other curated lists.

    • 2.2M
    • June 19, 2026
    • Addons
    • +2
  • Krowi's Util project image

    Krowi's Util

    • 466
    • Addons

    A comprehensive utility library providing reusable functions for string manipulation, table operations, color management, and metadata handling

    • 466
    • June 10, 2026
    • Addons
  • Krowi's World Map Buttons project image

    Krowi's World Map Buttons

    • 13.4K
    • Addons

    A library for World of Warcraft addon development that simplifies adding custom buttons to the world map interface with automatic positioning and dynamic layout management

    • 13.4K
    • June 6, 2026
    • Addons
  • Krowi's Progress Bar project image

    Krowi's Progress Bar

    • 347
    • Addons

    A progress bar library for displaying multi-segment bars with up to 4 stacked values and customizable colors, including GameTooltip integration

    • 347
    • May 21, 2026
    • Addons