ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Help with GetUnitBuffInfo() (https://www.esoui.com/forums/showthread.php?t=2225)

niocwy 09/12/14 12:10 AM

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.

Shinni 09/12/14 06:14 AM

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

niocwy 09/12/14 06:56 AM

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 ?

Garkin 09/12/14 07:05 AM

Quote:

Originally Posted by niocwy (Post 12084)
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

niocwy 09/12/14 07:32 AM

Quote:

Originally Posted by Garkin (Post 12085)
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.

Garkin 09/12/14 08:28 AM

Quote:

Originally Posted by niocwy (Post 12086)
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")

sirinsidiator 09/12/14 08:31 AM

Quote:

Originally Posted by niocwy (Post 12080)
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.

niocwy 09/12/14 08:52 AM

I feel like an idiot now trying to download 5GB :p I guess it's just the audio files.

Quote:

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.

sirinsidiator 09/12/14 09:33 AM

Okay, that's sad, but not entirely unexpected. :D
Good luck anyways.

Atropos 09/15/14 12:04 AM

Quote:

Originally Posted by Garkin (Post 12088)
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 :) / :( / ???

Wykkyd 09/15/14 09:49 AM

Very nice, Garkin. Didn't know you could do that ;)

Garkin 09/15/14 11:12 AM

Quote:

Originally Posted by Wykkyd (Post 12137)
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

Wykkyd 09/15/14 11:28 AM

Quote:

Originally Posted by Garkin (Post 12139)
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!


All times are GMT -6. The time now is 08:43 PM.

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