Download
(2 Kb)
Download
Updated: 09-26-12 03:38 PM
Pictures
File Info
Compatibility:
Mists of Pandaria (5.0.4)
Updated:09-26-12 03:38 PM
Created:12-17-10 03:35 PM
Downloads:4,860
Favorites:52
MD5:
AiL
Version: 0.9.3
by: havoc74 [More]
Simply adds your average item level to your character frame, and adds other players' average item level to the tooltip.

*** NOTICE *** Version 0.9.1 may require you to actually click on your target to get correct results. This is a bug in Blizzard's API, sorry for the inconvenience.
12-30-2010: AiL-0.4: Bug Fix: While Inspect Frame is open, mousing over another player throws an exception. Thank you zaphon.

12-29-2010: AiL-0.3: Bug Fix: GetAiL() returning nil on a naked player unit. Thank you Krellmax and zaphon.

6-13-2012: AiL-0.6: As per comment requests, I updated AiL to update the Character Frame when an item is swapped with another. Also, as far as I can tell, the Transmog doesn't affect the addon in any way. All tests on self and other players proved to be accurate. Thank you again for the comments, and again, I apologize for not updating this addon more frequently.

6-13-2012: AiL-0.7: Quick Bug Fix - iLevel reporting as nil at load.

7-20-2012: AiL-0.8: Responded to a request to remove the "AiL -VERSION- Loaded." Chat Frame Notification.

9-1-2012: AiL-0.9: Updated to MoP Pre-Release patch 5.0.4.

9-7-2012: AiL-0.9.1: Using Skarj's suggestion, AiL works, but you may have to actually click on your target to get correct results.

9-23-2012: AiL-0.9.2: Fixed the issue of not being able to inspect a unit if AiL is enabled.

9-26-2012: AiL-0.9.3: Removed the un-needed Character Frame. This also eliminated an LUA error on showing the Character Frame.
Optional Files (0)


Archived Files (1)
File Name
Version
Size
Author
Date
 AiL
0.9.2
2kB
havoc74
09-23-12 11:26 AM


Post A Reply Comment Options
Old 01-18-13, 08:31 AM  
Tomate
A Defias Bandit
 
Tomate's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 246
Uploads: 3
I have made an updated version of AiL which works much better than the current version. It still need some tweaking but the value display seams to be correct.
This version correct issue with Transmo and upgraded items.
In addition to that, ilvl is displayed with two decimal places.
Lua Code:
  1. local MINCOLOR = 0.5
  2. local COLORINC = 0.2
  3. local INCMOD = 0.5
  4. local MinIL = 463
  5. local MaxIL = 580
  6.  
  7. local slotName = {
  8.     "HeadSlot","NeckSlot","ShoulderSlot","BackSlot","ChestSlot","WristSlot",
  9.     "HandsSlot","WaistSlot","LegsSlot","FeetSlot","Finger0Slot","Finger1Slot",
  10.     "Trinket0Slot","Trinket1Slot","MainHandSlot","SecondaryHandSlot"
  11. }
  12.  
  13. -- Construct your saarch pattern based on the existing global string:)
  14. local S_ITEM_LEVEL   = "^" .. gsub(ITEM_LEVEL, "%%d", "(%%d+)")
  15. -- Create the tooltip:
  16. local scantip = CreateFrame("GameTooltip", "MyScanningTooltip", nil, "GameTooltipTemplate")
  17. scantip:SetOwner(UIParent, "ANCHOR_NONE")
  18.  
  19. local function GetAiL(unit)
  20.     i = 0
  21.     total = 0
  22.     itn = 0
  23.    
  24.     if unit ~= nil then
  25.         for i in ipairs(slotName) do
  26.             itemLink = GetInventoryItemLink(unit, GetInventorySlotInfo(slotName[i]));
  27.            
  28.             if itemLink ~= nil then
  29.                 -- Pass the item link to the tooltip:
  30.                 scantip:SetHyperlink(itemLink)
  31.  
  32.                 -- Scan the tooltip:
  33.                 for i = 2, scantip:NumLines() do -- Line 1 is always the name so you can skip it.
  34.                     local text = _G["MyScanningTooltipTextLeft"..i]:GetText()
  35.                     if text and text ~= "" then
  36.                         local currentUpgradedItemLevel = strmatch(text, S_ITEM_LEVEL)
  37.                         if currentUpgradedItemLevel then
  38.                             itn = itn + 1
  39.                             total = total + currentUpgradedItemLevel
  40.                         end
  41.                     end
  42.                 end
  43.             end
  44.         end
  45.     end
  46.  
  47.     if total < 1 or itn < 1 then
  48.         return 0
  49.     end
  50.  
  51.     return (total / itn)
  52. end
  53.  
  54. local function GetAiLColor(ail)
  55.     local r, gb
  56.    
  57.     if ail < MinIL then
  58.         r = (ail / MinIL)
  59.         gb = r
  60.     else
  61.         r = MINCOLOR + ((ail / MaxIL) * INCMOD)
  62.         gb = 1.0 - ((ail / MaxIL) * INCMOD)
  63.     end
  64.    
  65.     if r < MINCOLOR then
  66.         r = MINCOLOR
  67.         gb = r
  68.     end
  69.    
  70.     return r, gb
  71. end
  72.  
  73.  
  74.  
  75.  
  76. local function Setup()
  77.     local tooltipGuid
  78.     local tooltipUnit
  79.    
  80.     GameTooltip:HookScript("OnTooltipSetUnit", function(self, ...)
  81.         local ail, r, gb
  82.         local _, unit = GameTooltip:GetUnit()
  83.         tooltipUnit = unit
  84.         tooltipGuid = UnitGUID(unit)
  85.         if (unit and CanInspect(unit)) then
  86.             local isInspectOpen = (InspectFrame and InspectFrame:IsShown()) or (Examiner and Examiner:IsShown())
  87.             if unit and CanInspect(unit) and not isInspectOpen then
  88.                 NotifyInspect(unit)
  89.             end
  90.         end
  91.     end)
  92.    
  93.    
  94.     AiLFrame = CreateFrame("Frame", nil, CharacterModelFrame);
  95.     AiLFrame.s = AiLFrame:CreateFontString(nil, "OVERLAY");
  96.     AiLFrame.s:SetPoint("TOPRIGHT", CharacterModelFrame, "TOPRIGHT", -2, -2);
  97.     AiLFrame.s:SetJustifyH("RIGHT");
  98.     AiLFrame.s:SetFontObject(GameFontNormal);
  99.     AiLFrame:RegisterEvent("UNIT_INVENTORY_CHANGED");
  100.     AiLFrame:RegisterEvent("INSPECT_READY")
  101.     AiLFrame:SetScript("OnEvent", function(self, event, unit)
  102.         if (event == "UNIT_INVENTORY_CHANGED") then
  103.             AiLFrame.s:SetText(format("AiL: " .. string.format("%0.2f", GetAiL("player"))));
  104.         end
  105.         if (event == "INSPECT_READY") then
  106.             if unit == tooltipGuid then
  107.                 ail = GetAiL(tooltipUnit)
  108.                 if ail ~= 0 then
  109.                     r, gb = GetAiLColor(floor(ail))
  110.                     ClearInspectPlayer()
  111.                     GameTooltip:AddLine(format("AiL: " .. string.format("%0.2f", ail)), r, gb, gb)
  112.                     GameTooltip:Show()
  113.                 end
  114.             end
  115.         end
  116.     end);
  117.     AiLFrame:Show();
  118.  
  119.     CharacterModelFrame:HookScript("OnShow", function(self)
  120.         AiLFrame.s:SetText(format("AiL: " .. string.format("%0.2f", GetAiL("player"))))
  121.     end)
  122.    
  123.     local VERSION = GetAddOnMetadata("AiL", "Version");
  124.     DEFAULT_CHAT_FRAME:AddMessage("NOTICE: AiL " .. VERSION .. " sometimes requires you to click on your target for the correct results");
  125. end
  126.  
  127. Setup()

LAST UPDATE 05-12-2014
Last edited by Tomate : 05-12-14 at 12:28 PM.
Tomate is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: