ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Determine character's crafting improvement skill (https://www.esoui.com/forums/showthread.php?t=5341)

@tinydog 11/29/15 11:19 PM

Determine character's crafting improvement skill
 
Greetings. I need a reliable and language/localization-independent way to determine the character's item improvement ability rank (Temper Expertise, etc.). I'm currently using GetSkillAbilityUpgradeInfo(skillType, skillIndex, abilityIndex). For my crafting add-on, the skillType is always the global constant SKILL_TYPE_TRADESKILL. The skillIndex refers to the order in which the different trade skills (Alchemy, Blacksmithing...) appear in the Skills dialog. Similarly, the abilityIndex refers to the order in which the selected trade skill's passive abilities (such as Temper Expertise) appear in the Skills dialog.

Refer to the following screenshot: http://imgur.com/Zpg38VZ

The problem is that not all editions of the game display the trade skills in the same order.
For EN/US players, the crafting skills appear in the following order:
  1. Alchemy
  2. Blacksmithing
  3. Clothing
  4. Enchanting
  5. Provisioning
  6. Woodworking
For German players, the crafting skills appear in a slightly different order:
  1. Alchemy
  2. Blacksmithing
  3. Clothing
  4. Woodworking
  5. Provisioning
  6. Enchanting

Woodworking and Enchanting are swapped. Unfortunately this difference isn't just aesthetic - it prevents the GetSkillAbilityUpgradeInfo function from working properly for German (and possibly other) users.

I've looked into various possible solutions, including:
  • My first thought is that there must be a global constant or function that indicates which crafting skill occupies which skill tree index, just as there are globals that represent the crafting skills themselves (e.g., CRAFTING_TYPE_BLACKSMITHING). However, I was unable to find any such global or function.

  • The equipment crafting skills (Blacksmithing, Clothing, Woodworking) all have 6 passive abilities, but Enchanting only has 5. I could assume that if skill index 6 only contains 5 passives, that it is Enchanting - and that Woodworking is at index 4. This seems kludgey to me though. I'd prefer a solution that uses the game's built-in constants and functions.

  • There are global constants called NON_COMBAT_BONUS_BLACKSMITHING_BOOSTER_BONUS (and equivalent for CLOTHIER and WOODWORKING). However, it's just a LUA table index number constant, not an actual ability rank number. The only known use of these constants is in smithing_common.lua, where they are used to define entries in the global-scoped SMITHING_BONUSES table. All of these table entries get set to true. You can see this value by executing this command in-game:
    /script d(SMITHING_BONUSES[NON_COMBAT_BONUS_BLACKSMITHING_BOOSTER_BONUS])

  • There's also a function ZO_SharedSmithingImprovement_GetBoosterChartStringForCraftingType(craftingType), but all it does is return a number such as 3555 that gets applied to a "BoosterContainerHeader" something-or-other control.

  • There are other functions that pertain to crafting skills, but they are dependent upon the player actually selecting a skill in the Skills dialog. My add-on can be run any time, anywhere, and doesn't rely upon other dialogs being active.
Any ideas?

Wandamey 11/30/15 12:23 AM

skillType,skillIndex = GetCraftingSkillLineIndices(CRAFTING_TYPE_PROVISIONING) etc...
currentlvl, maxlevel = GetSkillAbilityUpgradeInfo(skillType,skillIndex ,abilityIndex)

should do it if the abilityIndex keeps the order.

merlight 11/30/15 03:31 AM

How about:

* GetNonCombatBonus(*[NonCombatBonusType|#NonCombatBonusType]* _nonCombatBonus_)
** _Returns:_ *integer* _bonusValue_

* EVENT_NON_COMBAT_BONUS_CHANGED (*integer* _nonCombatBonus_, *integer* _oldValue_, *integer* _newValue_)

@tinydog 11/30/15 06:49 AM

Quote:

Originally Posted by Wandamey (Post 24458)
skillType,skillIndex = GetCraftingSkillLineIndices(CRAFTING_TYPE_PROVISIONING) etc...

Aha, perfect! Thank you! :D Not sure why I didn't see that before.

Thank you both for your help!


All times are GMT -6. The time now is 12:22 AM.

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