Print amount of money for repair - WoWInterface
09-28-21, 02:32 AM   #1
darhanger
A Deviate Faerie Dragon

Join Date: Jan 2017
Posts: 14
Print amount of money for repair

Wanna print massage in chat when function executed. Also wanna make printing with gold/silver/cooper logos in chat.

Lua Code:
1. if MerchantWindow then
2.   local Cost, NeedRapair = GetRepairAllCost()
3.    local function CalculateCost()
4.    local gold = floor(Cost / 10000)
5.    local silver = mod(floor(Cost / 100), 100)
6.    local cooper = mod(floor(Cost), 100)
7.         return format("%gold, %silver, %bronze", gold, silver, cooper)
8.    end;
9.    if NeedRapair
10.     and GetMoney() > (Cost * 4) then
11.             RepairAllItems()
12.             print("All Items Repaired"..CalculateCost())
13.         end
14.     end
15. end

09-28-21, 06:21 AM   #2
Rilgamon
Premium Member

Join Date: Sep 2009
Posts: 817
For the icons I use this

Lua Code:
1. local iconbase = "\124TInterface\\MoneyFrame\\UI-%sIcon:%d:%d:1:0\124t"
2. local iconSize = 14
3. local goldicon = format(iconbase, 'Gold', iconSize, iconSize)
4. local silvericon = format(iconbase, 'Silver', iconSize, iconSize)
5. local coppericon = format(iconbase, 'Copper', iconSize, iconSize)
__________________
The cataclysm broke the world ... and the pandas could not fix it!

09-28-21, 11:52 AM   #3
Fizzlemizz
I did that?

Join Date: Dec 2011
Posts: 1,439
There is also build-in function to return the breakdown with icons.
Lua Code:
1. print("All Items Repaired:", GetMoneyString(cost, true))
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

 WoWInterface » Print amount of money for repair

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off