InfoMe = {} if not ace:LoadTranslation("InfoMe") then InfoMe.Const = { ChatCmd = {"/infome", "/im"}, ChatOpt = { { option = "dress", desc = "dress in an item.", method = "DressUp", input = TRUE, args = { { option = "help", desc = "if you supply an item-link to this option, it will show you equipped with said item in the dress-up pane." } } } }, Title = "InfoMe Phoenix", Version = "a/R.5S.0", Desc = "Player information via whisper!", Misc = { Info = "Tags: head, neck, shldr, back, chest, shirt, tabd, wrist, hand, waist, legs, feet, 1fin, 2fin, 1tri, 2tri, mainh, offh, range, ammo, 1bag, 2bag, 3bag, 4bag, xp, xptgo, rxp, money, where, str, agi, sta, int, spi, apwr, aspd & tankp (separate with spaces).", Head = "Head: %s", Neck = "Neck: %s", Shldr = "Shoulders: %s", Back = "Back: %s", Chest = "Chest: %s", Shirt = "Shirt: %s", Tabd = "Tabbard: %s", Wrist = "Wrists: %s", Hand = "Hands: %s", Waist = "Waist: %s", Legs = "Legs: %s", Feet = "Feet: %s", Fin1 = "Finger 1: %s", Fin2 = "Finger 2: %s", Tri1 = "Trinket 1: %s", Tri2 = "Trinket 2: %s", MainH = "Main Hand: %s", OffH = "Off Hand: %s", Range = "Ranged: %sx%s", Ammo = "Ammo: %sx%s", Bag1 = "Bag 1: %s (%s/%s)", Bag2 = "Bag 2: %s (%s/%s)", Bag3 = "Bag 3: %s (%s/%s)", Bag4 = "Bag 4: %s (%s/%s)", Pack = "Pack: %s (%s/%s)", XP = "XP: %s/%s (%s)", XP2Go = "XP2Go: %s (%s)", RXP = "Rested XP: %s (%s)", Money = "Money: %s", Where = "Where: %s (%s.%s)", Stat = "%s: %s", Ar = "Armour: %s", APwr = "Attack Power: %s", ASpd = "Attack Speed: %s", TankP = "TankPoints: %s", NoTP = "Not Installed", Tell = "infome", BP = "[BackPack]", None = "[None]" } } ace:RegisterGlobals({ version = 1.0, ACE_HEX = {0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f"}, ACE_COLOR_HEX_GOLD = "ffd700", ACE_COLOR_HEX_SILVER = "c7c7cf", ACE_COLOR_HEX_COPPER = "eda55f", ACE_COLOR_HEX_CASH = "00ff00", ACE_TEXT_GOLD = "gold", ACE_TEXT_SILVER = "silver", ACE_TEXT_COPPER = "copper", ACE_LETTER_GOLD = "g", ACE_LETTER_SILVER = "s", ACE_LETTER_COPPER = "c", }) end local const = InfoMe.Const InfoMe.Obj = AceAddonClass:new({ name = const.Title, version = const.Version, description = const.Desc, author = "Rowne", authorEmail = "wuffxiii@gmail.com", aceCompatible = "100", category = ACE_CATEGORY_INVENTORY, db = AceDbClass:new("InfoMeDB"), defaults = {}, cmd = AceChatCmdClass:new(const.ChatCmd, const.ChatOpt), Enable = function(self) self:RegisterEvent("CHAT_MSG_WHISPER") end, DressUp = function(self, i) DressUpItemLink(i) end, BuildInfo = function(self) local v, w, x, y, z, t return { list = function() return const.Misc.Info end, head = function() return format(const.Misc.Head, self:GetItemLink("HeadSlot")) end, neck = function() return format(const.Misc.Neck, self:GetItemLink("NeckSlot")) end, shldr = function() return format(const.Misc.Shldr, self:GetItemLink("ShoulderSlot")) end, back = function() return format(const.Misc.Back, self:GetItemLink("BackSlot")) end, chest = function() return format(const.Misc.Chest, self:GetItemLink("ChestSlot")) end, shirt = function() return format(const.Misc.Shirt, self:GetItemLink("ShirtSlot")) end, tabd = function() return format(const.Misc.Tabd, self:GetItemLink("TabardSlot")) end, wrist = function() return format(const.Misc.Wrist, self:GetItemLink("WristSlot")) end, hand = function() return format(const.Misc.Hand, self:GetItemLink("HandsSlot")) end, waist = function() return format(const.Misc.Waist, self:GetItemLink("WaistSlot")) end, legs = function() return format(const.Misc.Legs, self:GetItemLink("LegsSlot")) end, feet = function() return format(const.Misc.Feet, self:GetItemLink("FeetSlot")) end, ["1fin"] = function() return format(const.Misc.Fin1, self:GetItemLink("Finger0Slot")) end, ["2fin"] = function() return format(const.Misc.Fin2, self:GetItemLink("Finger1Slot")) end, ["1tri"] = function() return format(const.Misc.Tri1, self:GetItemLink("Trinket0Slot")) end, ["2tri"] = function() return format(const.Misc.Tri2, self:GetItemLink("Trinket1Slot")) end, mainh = function() return format(const.Misc.MainH, self:GetItemLink("MainHandSlot")) end, offh = function() return format(const.Misc.OffH, self:GetItemLink("SecondaryHandSlot")) end, range = function() x, y = self:GetAmmoInfo("rangedSlot") return format(const.Misc.Range, x, y) end, ammo = function() x, y = self:GetAmmoInfo("ammoSlot") return format(const.Misc.Ammo, x, y) end, ["1bag"] = function() x, y, z = self:GetBagInfo("Bag0Slot") return format(const.Misc.Bag1, x, y, z) end, ["2bag"] = function() x, y, z = self:GetBagInfo("Bag1Slot") return format(const.Misc.Bag2, x, y, z) end, ["3bag"] = function() x, y, z = self:GetBagInfo("Bag2Slot") return format(const.Misc.Bag3, x, y, z) end, ["4bag"] = function() x, y, z = self:GetBagInfo("Bag3Slot") return format(const.Misc.Bag4, x, y, z) end, pack = function() x, y, z = self:GetBagInfo() return format(const.Misc.Pack, x, y, z) end, xp = function() t = self:GetXPInfo() return format(const.Misc.XP, t.xp, t.mxp, t.xpp) end, xptgo = function() t = self:GetXPInfo() return format(const.Misc.XP2Go, t.xp2, t.xp2p) end, rxp = function() t = self:GetXPInfo() return format(const.Misc.RXP, t.rxp, t.rxpp) end, money = function() return format(const.Misc.Money, self.CashTextLetters(GetMoney(), ".", 1)) end, where = function() z, x, y = self:GetLocation() return format(const.Misc.Where, z, x, y) end, str = function() x = UnitStat("player", 1) z = SPELL_STAT0_NAME return format(const.Misc.Stat, z, x) end, agi = function() x = UnitStat("player", 2) z = SPELL_STAT1_NAME return format(const.Misc.Stat, z, x) end, sta = function() x = UnitStat("player", 3) z = SPELL_STAT2_NAME return format(const.Misc.Stat, z, x) end, int = function() x = UnitStat("player", 4) z = SPELL_STAT3_NAME return format(const.Misc.Stat, z, x) end, spi = function() x = UnitStat("player", 5) z = SPELL_STAT4_NAME return format(const.Misc.Stat, z, x) end, ar = function() z = UnitArmor("player") return format(const.Misc.Ar, z) end, apwr = function() z = UnitAttackPower("player") return format(const.Misc.APwr, z) end, aspd = function() z = UnitAttackSpeed("player") z = format("%.2f", z) return format(const.Misc.ASpd, z) end, tankp = function() ShowUIPanel(CharacterFrame) z = TankPointsFrame z = z and floor(z.tankPoints) or const.Misc.NoTP HideUIPanel(CharacterFrame) return format(const.Misc.TankP, z) end } end, CHAT_MSG_WHISPER = function(self) if not arg1 or not arg2 then return end if not strfind(strlower(arg1 or ""), const.Misc.Tell) then return end local a = gsub(arg1, "infome ", "") self.Whisper(self.WordsToInfo(a, self:BuildInfo()), arg2) end, GetItemLink = function(self, i) local s = GetInventorySlotInfo(i) i = GetInventoryItemLink("player", s) if not i then return const.Misc.None end return i, s end, GetAmmoInfo = function(self, i) local _, s, q if i == "rangedSlot" then i, s = self:GetItemLink(i) else i = self:GetItemLink("rangedSlot") s = GetInventorySlotInfo("ammoSlot") end if i == const.Misc.None then q = 0 else q = GetInventoryItemCount("player", s) end return i, q end, GetBagInfo = function(self, i) local b, st, sz, su if not i then b = 0 i = const.Misc.BP else b = tonumber(gsub(i, "%a", "") or 0) + 1 i = self:GetItemLink(i) end sz = GetContainerNumSlots(b) if sz <= 0 then return i, 0, 0 end for st = 1, sz do if GetContainerItemInfo(b, st) then su = (su or 0) + 1 end end return i, (su or 0), sz end, GetXPInfo = function(self) local t = {} t.xp = UnitXP("player") t.mxp = UnitXPMax("player") t.rxp = GetXPExhaustion() or 0 t.xpp = floor(t.xp * 100 / t.mxp) t.xp2 = t.mxp - t.xp t.xp2p = floor(t.xp2 * 100 / t.mxp) + 1 t.rxpp = floor(t.rxp * 100 / t.mxp) return t end, GetLocation = function(self) local x, y = GetPlayerMapPosition("player") return GetMinimapZoneText(), floor(x * 100), floor(y * 100) end }) InfoMe.Obj:RegisterForLoad() ace:RegisterFunctions(InfoMe.Obj, { version = 1.0, WordsToInfo = function(i, db) i = ace.ParseWords(i) for k, v in i do if db[v] then i[k] = db[v]() end end return ace.concat(i, ", ").."." end, ParseCash = function(c) local c = ace.round(c or 0) return floor(c / (100*100)), mod(floor(c / 100), 100), mod(floor(c), 100) end, CashTextLetters = function(cash, sep, nocol) if ((sep == TRUE) or (sep == true)) then sep = nocol nocol = TRUE end local doCoin = function(var, ltr, hex) if (var > 0) then str = str ~= "" and str..(sep or " ") or "" str = nocol and str..var..ltr or str..ace.ColorText(hex, s..ltr) end end local g, s, c = ace.ParseCash(cash or 0) local str = "" doCoin(g, ACE_LETTER_GOLD, ACE_COLOR_HEX_GOLD) doCoin(s, ACE_LETTER_SILVER, ACE_COLOR_HEX_SILVER) doCoin(c, ACE_LETTER_COPPER, ACE_COLOR_HEX_COPPER) return str end, Whisper = function(msg, name, ...) SendChatMessage(format(msg, unpack(arg)), "WHISPER", DEFAULT_CHAT_FRAME.language, name) end })