Thread Tools Display Modes
09/12/14, 12:10 AM   #1
niocwy
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
Help with GetUnitBuffInfo()

Hi all,

I'm using GetUnitBuffInfo('player',buffIndex) to check for food/beverage buff. It works well, as it returns the buff name (among other uninteresting values). For example, an health regen beverage buff will return the string "Health Recovery" :

But I fear that this string is localized, because the buff has the same name on the character window. If it's the case I shouldn't check directly against it. Then I have two options :
- use some kind of custom localization, luckily I already have a system up and running, and I just need the translations for food and beverages buffs in german and french
- get the SI_ variable that the buff name is refering to...but I didn't spot it in the SI_ table (I used zgoo to check it in game, I don't know other ways to do it).

Can anyone help me with this ? The latter solution seems to be more elegant but I guess both will work for me.
Also, I don't necessarily have to use the getUnitBuffInfo() function, I just want to know when the player has a food or beverage buff.

Last edited by niocwy : 09/12/14 at 12:48 AM.
  Reply With Quote
09/12/14, 06:14 AM   #2
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 167
Seems Health recovery is in one of the SI variables (SI_DERIVEDSTATS8). But my file is from back in May. so maybe it's not entirely accurate anymore.
Warning: Spoiler
  Reply With Quote
09/12/14, 06:56 AM   #3
niocwy
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
I totally missed it, but unfortunately, I'm not sure this is going to work...it fits for the "Health Recovery" buff, but the max stam+mag food buff (for instance) is called "Increase Max Magicka & Stamina" and I couldn't find it either.

Do you know a way that I can dump all the SI_ table in a file and then simply search through it ?
  Reply With Quote
09/12/14, 07:05 AM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by niocwy View Post
I totally missed it, but unfortunately, I'm not sure this is going to work...it fits for the "Health Recovery" buff, but the max stam+mag food buff (for instance) is called "Increase Max Magicka & Stamina" and I couldn't find it either.

Do you know a way that I can dump all the SI_ table in a file and then simply search through it ?
Searching EsoStrings table won't help, there are no buff or ability names in there. The only way to get buff name is using the mentioned function:

GetUnitBuffInfo(string unitTag, luaindex buffIndex)
- Returns: string buffName, number timeStarted, number timeEnding, integer buffSlot, integer stackCount, textureName iconFilename, string buffType, BuffEffectType effectType, AbilityType abilityType, StatusEffectType statusEffectType
  Reply With Quote
09/12/14, 07:32 AM   #5
niocwy
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
Originally Posted by Garkin View Post
Searching EsoStrings table won't help, there are no buff or ability names in there.
That's I was starting to think too. Thanks for clearing this up.

So what you're telling me is that the GetUnitBuffInfo() will always return the english name of the buff (even on a french and german client) ?

I would gladly test this myself but my internet connection is slow as hell and I didn't finish dowloading the french files yet.
  Reply With Quote
09/12/14, 08:28 AM   #6
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by niocwy View Post
That's I was starting to think too. Thanks for clearing this up.

So what you're telling me is that the GetUnitBuffInfo() will always return the english name of the buff (even on a french and german client) ?

I would gladly test this myself but my internet connection is slow as hell and I didn't finish dowloading the french files yet.
No, function will return localized names. However you don't need to download french or german client to test it out. Just switch client language using the SetCVar("language.2", "fr") or SetCVar("language.2", "de") function (it will reload UI in the selected language). I have defined the following slash commands in my private addon so I can test another languages:

Lua Code:
  1. SLASH_COMMANDS["/langen"] = function() SetCVar("language.2", "en") end
  2. SLASH_COMMANDS["/langde"] = function() SetCVar("language.2", "de") end
  3. SLASH_COMMANDS["/langfr"] = function() SetCVar("language.2", "fr") end

If you don't want to define your own slash commands, just use /script:
Code:
/script SetCVar("language.2", "fr")
  Reply With Quote
09/12/14, 08:31 AM   #7
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
Originally Posted by niocwy View Post
I'm using GetUnitBuffInfo('player',buffIndex) to check for food/beverage buff. It works well, as it returns the buff name (among other uninteresting values). For example, an health regen beverage buff will return the string "Health Recovery"
I have not worked with GetUnitBuffInfo yet, but why do you think the return values besides buffName are uninteresting? If I had to identify a food buff, I would first look at string buffType, BuffEffectType effectType, AbilityType abilityType, StatusEffectType statusEffectType as they seem to be exactly what I would need to identify what buff I am looking at, without having to worry about localization issues?

If they do not help, I would take a look at textureName iconFilename next before using buffName.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Help with GetUnitBuffInfo()


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