Skip to content

Instantly share code, notes, and snippets.

@meribold
Created May 16, 2015 00:44
Show Gist options
  • Save meribold/a6d4d72d2a1c708bbfdf to your computer and use it in GitHub Desktop.
Save meribold/a6d4d72d2a1c708bbfdf to your computer and use it in GitHub Desktop.
_G.addMoneyLootMessage = function(money) -- In copper. I don't know if you can get this information.
local gold = _G.math.floor(money / 10000)
local silver = _G.math.floor((money - 10000 * gold) / 100)
local copper = money % 100
local goldString = gold > 0 and _G.string.format(_G.GOLD_AMOUNT .. ", ", gold) or ""
local silverString = (gold > 0 or silver > 0) and _G.string.format(_G.SILVER_AMOUNT .. ", ", silver) or ""
local copperString = _G.string.format(_G.COPPER_AMOUNT, copper)
local message = _G.string.format(_G.YOU_LOOT_MONEY .. "%s%s%s", "", goldString, silverString, copperString)
local info = _G.ChatTypeInfo["MONEY"]
for i = 1, _G.NUM_CHAT_WINDOWS do
local chatFrame = _G["ChatFrame" .. i]
if chatFrame:IsEventRegistered("CHAT_MSG_MONEY") then
chatFrame:AddMessage(message, info.r, info.g, info.b, info.id)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment