I see you have understood it
You can simply these kind of "if ..." code:
Code:
if (GetItemLinkItemType(linkFunc(...)) == ITEMTYPE_ARMOR) or (GetItemLinkItemType(linkFunc(...)) == ITEMTYPE_WEAPON) then -- Check if item is armor or a weapon (visual equipment with styles)
Build a local lookup table with the key = allowed itemTypes and value = boolean true, and then just check for if lookupTable[itemType] then
Lua Code:
local allowedItemtypes = {
[ITEMTYPE_ARMOR] = true,
[ITEMTYPE_WEAPON] = true
}
if (allowedItemtypes[GetItemLinkItemType(linkFunc(...))] then -- Check if item is armor or a weapon (visual equipment with styles)
...
end
And if you need linkFunc(...) more than once define a local like
local itemLink = linkFunc(...)
and then reuse itemLink instead of calling the function again and again and ...
For your other questions:
I never worked with the styles and motifs but there exist several API functions where you pass in an itemLink or bagId, slotIndex and you will get the needed info in return.
I guess IsItemLinkBookKnown(itemLink) could help you here for example
Search the API txt documentation file for "known" and you should find several functions that may help. Not sure if the IsItemLinkBookKnown also works on normal style books without motif pages, I hope so.