ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Get the weapon/armor type of an item (https://www.esoui.com/forums/showthread.php?t=764)

Todo 04/10/14 12:59 PM

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 :)

Seerah 04/10/14 08:36 PM

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... :)

Todo 04/11/14 01:56 AM

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 :)

Mandrakia 04/14/14 07:21 PM

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


All times are GMT -6. The time now is 06:46 AM.

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