WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Print amount of money for repair (https://www.wowinterface.com/forums/showthread.php?t=58942)

darhanger 09-28-21 02:32 AM

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

Rilgamon 09-28-21 06:21 AM

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)

Fizzlemizz 09-28-21 11:52 AM

There is also build-in function to return the breakdown with icons.
Lua Code:
  1. print("All Items Repaired:", GetMoneyString(cost, true))


All times are GMT -6. The time now is 10:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI