Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C_ChatInfo.RegisterAddonMessagePrefix("TSMPCWA")
- aura_env.people = {}
- local aura_env = aura_env
- function askIfSend()
- table.sort(aura_env.people, function(a,b) return (a.time > b.time) or (a.time == b.time and a.name > b.name) end)
- local myName = UnitName("PLAYER")
- local myScantime = aura_env.lastScan
- if myScantime == aura_env.people[1].time and myName == aura_env.people[1].name then
- SendChatMessage(getTSMPrice(aura_env.itemID), "GUILD")
- end
- wipe(aura_env.people)
- end
- function getTSMPrice(itemID)
- local itemInfo = { GetItemInfo(itemID) }
- local bindType = select(14, itemInfo)
- if bindType == 1 then return "That item is BoP" end
- local regional = false
- local dbmarket = tonumber(TSM_API.GetCustomPriceValue("dbmarket", "i:"..itemID))
- local dbminbuyout = tonumber(TSM_API.GetCustomPriceValue("dbminbuyout", "i:"..itemID))
- local dbregion = tonumber(TSM_API.GetCustomPriceValue("dbregionmarketavg", "i:"..itemID))
- if not dbmarket and not dbminbuyout and not dbregion then return end
- local string = nil
- if dbmarket and dbminbuyout then
- dbmarket = (dbmarket > 10000 and math.floor(dbmarket/100)/100 .."g")
- or (dbmarket > 100 and math.floor(dbmarket/100).."s") or dbmarket .. "c"
- dbminbuyout = (dbminbuyout > 10000 and math.floor(dbminbuyout/100)/100 .."g")
- or (dbminbuyout > 100 and math.floor(dbminbuyout/100).."s") or dbmarket
- string = "Lowest auction ~"..dbminbuyout..", market value ~" .. dbmarket
- elseif dbmarket and not dbminbuyout then
- dbmarket = (dbmarket > 10000 and math.floor(dbmarket/100)/100 .."g")
- or (dbmarket > 100 and math.floor(dbmarket/100).."s") or dbmarket .. "c"
- string = "Market value ~"..dbmarket..", no auctions posted atm"
- else
- dbregion = (dbregion > 10000 and math.floor(dbregion/100)/100 .."g")
- or (dbregion > 100 and math.floor(dbregion/100).."s") or dbregion .. "c"
- string = "No realm data for this item, regional data at ~".. dbregion
- end
- return string
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement