Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

Commit

Permalink
Overlaying item levels on inventory slots in Character Info
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonweiss committed Jul 19, 2014
0 parents commit 4e2b5b4
Show file tree
Hide file tree
Showing 21 changed files with 831 additions and 0 deletions.
79 changes: 79 additions & 0 deletions ItemLevelOverlay.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
local ItemUpgradeInfo = LibStub('LibItemUpgradeInfo-1.0')

local inventorySlotNames = {
"HeadSlot",
"NeckSlot",
"ShoulderSlot",
"BackSlot",
"ChestSlot",
"WristSlot",
"HandsSlot",
"WaistSlot",
"LegsSlot",
"FeetSlot",
"Finger0Slot",
"Finger1Slot",
"Trinket0Slot",
"Trinket1Slot",
"MainHandSlot",
"SecondaryHandSlot"
}

local inventoryItemOverlayCache = {}

local function getInventoryItemLevelFromInventorySlotName(inventorySlotName)
local inventorySlotNumber = select(1, GetInventorySlotInfo(inventorySlotName))
local inventoryItemLink = GetInventoryItemLink("player", inventorySlotNumber)
return ItemUpgradeInfo:GetUpgradedItemLevel(inventoryItemLink)
end

local function updateItemOverlay(overlayFrame, inventorySlotName, itemLevel)
local cachedInventoryItemOverlay = inventoryItemOverlayCache[inventorySlotName]

if cachedInventoryItemOverlay then
cachedInventoryItemOverlay:SetText(itemLevel)
else
local text = overlayFrame:CreateFontString(nil, "OVERLAY", "NumberFontNormal")
text:SetPoint("TOPLEFT", "Character" .. inventorySlotName, 3, -3)
text:Hide()
text:SetText(itemLevel)
text:Show()
inventoryItemOverlayCache[inventorySlotName] = text
end
end

local function updateItemOverlays(overlayFrame)
for index, inventorySlotName in ipairs(inventorySlotNames) do
local itemLevel = getInventoryItemLevelFromInventorySlotName(inventorySlotName)

if itemLevel then
updateItemOverlay(overlayFrame, inventorySlotName, itemLevel)
end
end
end

local function createOverlayFrame()
local overlayFrame = CreateFrame("Frame", nil, PaperDollItemsFrame)

overlayFrame:SetScript("OnShow", function(self)
updateItemOverlays(self)
end)

overlayFrame:SetScript("OnEvent", function(self, event, ...)
if (event == "PLAYER_EQUIPMENT_CHANGED") then
updateItemOverlays(self)
end
end)

overlayFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED")
overlayFrame:Show()

return overlayFrame
end

local function initialize()
local overlayFrame = createOverlayFrame()
updateItemOverlays(overlayFrame)
end

initialize()
11 changes: 11 additions & 0 deletions ItemLevelOverlay.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Interface: 50400
## Title: Item Level Overlay
## Version: 0.1.0
## Notes: Displays your item levels overlayed on inventory slots in Character Info
## Author: Brandon Weiss
## X-Website: https://github.com/brandonweiss/item_level_overlay

libs\LibStub\LibStub.lua
libs\LibItemUpgradeInfo-1.0\LibItemUpgradeInfo-1.0.xml

ItemLevelOverlay.lua
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Brandon Weiss

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Item Level Overlay

A very small World of Warcraft addon that overlays individual item levels over inventory slots in Character Info.

## Installation

Download the [latest release](https://github.com/brandonweiss/wow-item-level-overlay/releases), unzip it, and drop it into your `Interface/AddOns` directory.

## Usage

You don't have to do anything—it works automatically.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tag v1.0.6
f0f2c50a2e359738133297add375a1e734eac3b3
Kevin Ballard <kevin@sb.org>
2014-05-20 18:14:03 -0700

Tagging as v1.0.6


--------------------

Kevin Ballard:
- Add upgrade info for 5.4.8
Bump version to v1.0.6.
Loading

0 comments on commit 4e2b5b4

Please sign in to comment.