Thread Tools Display Modes
06/09/24, 10:44 PM   #1
cyxui
AddOn Author - Click to view addons
Join Date: Nov 2015
Posts: 69
How to determine if an equipment is comapnion equipment or not?

Item type/specialized item type of companion equipment are exactly the same as player equipment. So is equip type. Whats the best way to distinguish between the two besides looking for the word "Companion" in the item name?
  Reply With Quote
06/09/24, 11:03 PM   #2
DakJaniels
AddOn Author - Click to view addons
Join Date: Mar 2021
Posts: 37
You might be able to use ZO_ItemFilterUtils.IsCompanionSlotInItemTypeDisplayCategoryAndSubcategory

https://github.com/esoui/esoui/blob/...tils.lua#L1553
  Reply With Quote
06/10/24, 04:12 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,068
GetItemlinkActorCategory returns category type for companions
  Reply With Quote
06/10/24, 07:09 AM   #4
Vilkasmanga
AddOn Author - Click to view addons
Join Date: Dec 2023
Posts: 17
Originally Posted by Baertram View Post
GetItemlinkActorCategory returns category type for companions
Once again, Baer to the rescue

I also was using the text search approach, didn't know about this but the following code seems to work and is much nicer than what I had:

Code:
 local numSlots = GetBagSize(BAG_BACKPACK)
 for bSlot = 1, numSlots do

   -- Look up item info
   local link  = GetItemLink(BAG_BACKPACK, bSlot)

   if link then -- (Hi siri...)
         if GetItemLinkActorCategory(link) == GAMEPLAY_ACTOR_CATEGORY_COMPANION then
              d("Found a companion item: " .. link);
         end -- if GILAC == 1
    end -- if link ! nil
  end -- bSlot loop

Last edited by Vilkasmanga : 06/10/24 at 07:13 AM.
  Reply With Quote
06/10/24, 03:01 PM   #5
cyxui
AddOn Author - Click to view addons
Join Date: Nov 2015
Posts: 69
Originally Posted by Baertram View Post
GetItemlinkActorCategory returns category type for companions
Thanks. knew i could count on you.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » How to determine if an equipment is comapnion equipment or not?


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