Thread Tools Display Modes
04/10/14, 12:59 PM   #1
Todo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 5
Get the weapon/armor type of an item

Hello everyone,

(First forgive me for my english ,it's not my native language )
I just have a question about the information we have on an item.

I use this two functions

Code:
GetItemInfo(integer bagId, integer slotIndex)
Returns: textureName icon, integer stack, integer sellPrice, bool meetsUsageRequirement, bool locked, integer equipType, integer itemStyle, integer quality

GetItemType(integer bagId, integer slotIndex)
Returns: ItemType itemType
Neither of boths returns parameters could give me the information about the type the item.
I only have the global type (1 hand weapon, 2 hand weapon, boots, head etc...)
I wanted to know if there is a way to get the precise type of an item. According to the Globals in the API there is such a group :

Code:
http://wiki.esoui.com/Globals#WeaponType
WeaponType
WEAPONTYPE_AXE
WEAPONTYPE_BOW
WEAPONTYPE_DAGGER
WEAPONTYPE_FIRE_STAFF
WEAPONTYPE_FROST_STAFF
WEAPONTYPE_HAMMER
WEAPONTYPE_HEALING_STAFF
WEAPONTYPE_LIGHTNING_STAFF
WEAPONTYPE_NONE
WEAPONTYPE_RUNE
WEAPONTYPE_SHIELD
WEAPONTYPE_SWORD
WEAPONTYPE_TWO_HANDED_AXE
WEAPONTYPE_TWO_HANDED_HAMMER
WEAPONTYPE_TWO_HANDED_SWORD
And there is the same for the Armor to know if the armor is light/medium/heavy.
I wish there is a function that return that type or a way to obtain it.

Thank you in advance guys
  Reply With Quote
04/10/14, 08:36 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
For weapon types, I had to resort to grabbing that info out of the file path to the icon texture. Here's hoping that ZOS sticks with that method...
  Reply With Quote
04/11/14, 01:56 AM   #3
Todo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 5
That's exactly what I thought I would do if there is anything possible.
I hope they will fix it soon

I will do the same with armor type (light/medium/heavy) with the path to the icon .dds
  Reply With Quote
04/14/14, 07:21 PM   #4
Mandrakia
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 3
Lua Code:
  1. function TNAL.GetArmorType(bagId,slotId)
  2.     local icon = GetItemInfo(bagId,slotId)
  3.     if (string.find(icon, "heavy")) then
  4.       return ARMORTYPE_HEAVY
  5.     elseif string.find(icon,"medium") then
  6.         return ARMORTYPE_MEDIUM
  7.     elseif string.find(icon,"light") then
  8.         return ARMORTYPE_LIGHT
  9.     else
  10.         return ARMORTYPE_NONE
  11.     end
  12. end
  13.  
  14. function TNAL.GetWeaponType(bagId,slotId)
  15.     local icon = GetItemInfo(bagId,slotId)
  16.    
  17.     if (string.find(icon, "1hsword")) then
  18.       return WEAPONTYPE_SWORD
  19.     elseif string.find(icon,"2hsword") then
  20.         return WEAPONTYPE_TWO_HANDED_SWORD
  21.     elseif string.find(icon,"1haxe") then
  22.         return WEAPONTYPE_AXE
  23.     elseif string.find(icon,"2haxe") then
  24.         return WEAPONTYPE_TWO_HANDED_AXE
  25.     elseif string.find(icon,"1hhammer") then
  26.         return WEAPONTYPE_HAMMER
  27.     elseif string.find(icon,"2hhammer") then
  28.         return WEAPONTYPE_TWO_HANDED_HAMMER
  29.     elseif string.find(icon,"dagger") then
  30.         return WEAPONTYPE_DAGGER
  31.     elseif string.find(icon,"shield") then
  32.         return WEAPONTYPE_SHIELD
  33.     elseif string.find(icon,"bow") then
  34.         return WEAPONTYPE_BOW
  35.     elseif string.find(icon,"staff") then
  36.         return WEAPONTYPE_FIRE_STAFF
  37.     else
  38.         return WEAPONTYPE_NONE
  39.     end
  40. end

The two functions I made. No way to distinguish between staves it seems so I defaulted to fire staff for all
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Get the weapon/armor type of an item


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