Quantcast Item Mixins - WoWInterface
Thread Tools Display Modes
10-18-18, 09:25 AM   #1
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 33
Item Mixins

So i'm just diving in to the whole Mixin stuff and am not sure if this is possible.

As GetDetailedItemLevelInfo() is still not returning the correct value all the time, i stumbled upon this thread which worked wonders for me.
Code:
local function getItemlvl(unit, slotIndex)
	if slotIndex == 18 then
		slotIndex = 19
	end
	if unit and UnitExists(unit) then
		local item = Item:CreateFromEquipmentSlot(slotIndex)

		if item then
			return item:GetCurrentItemLevel()
		end
	end
end
This will return the correct values on the PaperdollFrame, however i'm now hitting a wall to understand how i can do the exact same thing for the InspectFrame.
As CreateFromEquipmentSlot will only take the slotIndex, it somewhere hast to point to the player's inventory. If i could replicate that and point to the inspected unit's inventory this would open the door to the solution.

Is this even possible somewhow with using this/a Mixin?

EDIT: also using the CreateFromItemLink Mixin doesn't show the correct itemLevel else this wouldn't be an issue.

Last edited by Lolzen : 10-18-18 at 09:36 AM.
  Reply With Quote
10-18-18, 10:05 AM   #2
MuffinManKen
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 95
The mixin isn't doing any magic here. If you look at the GetCurrentItemLevel call from the mixin:
Lua Code:
  1. function ItemMixin:GetCurrentItemLevel() -- requires item data to be loaded
  2.     if self.itemLink then
  3.         return (GetDetailedItemLevelInfo(self.itemLink));
  4.     end
  5.     if not self:IsItemEmpty() then
  6.         return C_Item.GetCurrentItemLevel(self:GetItemLocation());
  7.     end
  8.     return nil;
  9. end
You can see it's just calling GetDetailedItemLevelInfo with an item link. So item links *do* work, you just need the right one. The link encodes a bunch of info in addition to the item id and I would guess that it needs that. Looking at the definition of an itemstring, (http://wowwiki.wikia.com/wiki/ItemString) "linkLevel" might be the important bit.
  Reply With Quote
10-18-18, 04:30 PM   #3
sezz
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 100
Originally Posted by MuffinManKen View Post
Looking at the definition of an itemstring, (http://wowwiki.wikia.com/wiki/ItemString) "linkLevel" might be the important bit.
In beta I had to change the linkLevel to the level of the character wearing the item, otherwise the itemLevel would be scaled to my own level.
https://www.wowinterface.com/forums/...214#post328214
  Reply With Quote
10-21-18, 11:12 AM   #4
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 33
Thank you both for the input
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Item Mixins

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off