Thread Tools Display Modes
Today, 11:36 AM   #1
Saint-Ange
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 12
Thumbs up [SOLVED] Check if item is marked as junk

Hi,

How to check if an armor or weapon item is marked as junk?
I'd like my function to apply some FCOIS icon but only if the item is marked as junk.

Last edited by Saint-Ange : Today at 01:36 PM.
  Reply With Quote
Today, 11:55 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,162
Code:
* CanItemBeMarkedAsJunk(*[Bag|#Bag]* _bagId_, *integer* _slotIndex_)
** _Returns:_ *bool* _canBeMarkedAsJunk_

* IsItemJunk(*[Bag|#Bag]* _bagId_, *integer* _slotIndex_)
** _Returns:_ *bool* _junk_


* HasAnyJunk(*[Bag|#Bag]* _bagId_, *bool* _excludeStolenItems_)
** _Returns:_ *bool* _hasJunk_

* SetItemIsJunk(*[Bag|#Bag]* _bagId_, *integer* _slotIndex_, *bool* _junk_)
  Reply With Quote
Today, 01:35 PM   #3
Saint-Ange
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 12
Originally Posted by Baertram View Post
Code:
* CanItemBeMarkedAsJunk(*[Bag|#Bag]* _bagId_, *integer* _slotIndex_)
** _Returns:_ *bool* _canBeMarkedAsJunk_

* IsItemJunk(*[Bag|#Bag]* _bagId_, *integer* _slotIndex_)
** _Returns:_ *bool* _junk_


* HasAnyJunk(*[Bag|#Bag]* _bagId_, *bool* _excludeStolenItems_)
** _Returns:_ *bool* _hasJunk_

* SetItemIsJunk(*[Bag|#Bag]* _bagId_, *integer* _slotIndex_, *bool* _junk_)

Thank you very much, works like a charm!

Lua Code:
  1. -- Check if the item is marked as junk (junked).
  2. local isJunk = IsItemJunk(bagId, slotId)
  3. d("Item: " .. itemLink .. " | Is Junk: " .. tostring(isJunk))  -- Debug output
  4. end
  Reply With Quote
Today, 02:48 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,162
Regarding (bagId, slotId):

Just in case, guess it's only a variable name but you should pay attention in API functions that you use the correct values:
it's a slot "index" not a slot "ID".

-index changes
-IDs stay the same

e.g.
bagId is always 1 for BAG_BAGPACK (a constant)
slotIndex changes with each item and the same item could today be slotIndex 12 and tomorrow slotIndex 200
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Check if item is marked as junk


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