WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Item Mixins (https://www.wowinterface.com/forums/showthread.php?t=56791)

Lolzen 10-18-18 09:25 AM

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.

MuffinManKen 10-18-18 10:05 AM

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.

sezz 10-18-18 04:30 PM

Quote:

Originally Posted by MuffinManKen (Post 330504)
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

Lolzen 10-21-18 11:12 AM

Thank you both for the input


All times are GMT -6. The time now is 09:30 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI