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,578
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
09/12/14, 08:52 AM   #8
niocwy
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
I feel like an idiot now trying to download 5GB I guess it's just the audio files.

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?
You're right, and I did look at them at first, but they actually don't help at all :
- buffType is an empty string
- effectType =1 , or BUFF_EFFECT_TYPE_BUFF that means it's a buff (2 is BUFF_EFFECT_TYPE_DEBUFF and 0 is BUFF_EFFECT_TYPE_NOT_AN_EFFECT )
- statusEffectType = 0, or STATUS_EFFECT_TYPE_NONE
- abilityType = 0 or ABILITY_NONE for beverages and 5 or ABILITY_BONUS for foods

As for the icon, for all food an beverage it's the same : "/esoui/art/icons/icon_potion_full.dds"


So, as you see, at first sight that's not really helpful for food/beverage buff identification, so that's why I decided to use the buffName. I guess I'll use it in combination with the icon name and effectType, just to be sure, but I believe testing buffName should be more than enough.

Anyway, thanks a lot for your answers, now I can make this work

PS : for those wondering why I'm doing all this, I'm playing around with UNIT_ATTRIBUTE_VISUALS and the way the game calculate regeneration values is either weird or plain broken, especially when you add beverages and HOT ticks crits into the mix...so identfying clearly if I have a beverage buff helps a lot.

Last edited by niocwy : 09/12/14 at 08:57 AM.
  Reply With Quote
09/12/14, 09:33 AM   #9
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Okay, that's sad, but not entirely unexpected.
Good luck anyways.
  Reply With Quote
09/15/14, 12:04 AM   #10
Atropos
 
Atropos's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 19
Originally Posted by Garkin View Post
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")
Holy cow, this is gold. I had NO IDEA you could do this. I guess I don't really have any more excuses for not testing other language localizations in FTC / / ???
  Reply With Quote
09/15/14, 09:49 AM   #11
Wykkyd
Are you Wykkyd Gaming?
 
Wykkyd's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 107
Very nice, Garkin. Didn't know you could do that
  Reply With Quote
09/15/14, 11:12 AM   #12
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Wykkyd View Post
Very nice, Garkin. Didn't know you could do that
It is not from my head, it was originally posted by ins here:
http://www.esoui.com/forums/showthre...=5157#post5157
  Reply With Quote
09/15/14, 11:28 AM   #13
Wykkyd
Are you Wykkyd Gaming?
 
Wykkyd's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 107
Originally Posted by Garkin View Post
It is not from my head, it was originally posted by ins here:
http://www.esoui.com/forums/showthre...=5157#post5157
Take the compliment, sir!
  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