This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
What does the provided patch do?
Guild tag.
Please provide any additional information below.
--- K:/WoW/Interface/PitBull4-v4.0.0-beta8/PitBull4_LuaTexts/ScriptEnv.lua Fri Dec 11 09:37:40 2009 +++ K:/WoW/Interface/AddOns/PitBull4_LuaTexts/ScriptEnv.lua Tue Jan 26 20:15:01 2010 @@ -114,6 +114,16 @@ end ScriptEnv.Name = Name +local function Guild(unit) + if UnitIsPlayer(unit) then + local guildName, _, _ = GetGuildInfo(unit) + return guildName + else + return '' + end +end +ScriptEnv.Guild = Guild + local L_DAY_ONELETTER_ABBR = DAY_ONELETTER_ABBR:gsub("%s*%%d%s*", "") local L_HOUR_ONELETTER_ABBR = HOUR_ONELETTER_ABBR:gsub("%s*%%d%s*", "") local L_MINUTE_ONELETTER_ABBR = MINUTE_ONELETTER_ABBR:gsub("%s*%%d%s*", "")
Declining. The functions in ScriptEnv are there to either mirror functionality in DogTags to make it easier to convert DogTagTexts or to do things that are not reasonably possible to do within the text code itself.
This qualifies as neither.
Erm, there is a "Guild" dogtag (in PB3 at least).
Sure you can do it with text code, but a tag makes it much cleaner:
return '%s %s%s%s%s',Name(unit),Angle(AFK(unit) or DND(unit)),Angle(Guild(unit))
If you're going to deny this, then you should probably remove "Class" too since I used it as the template. ;)
Class exists to mimic the Class tag in DogTags which had the Unknown text return for units that have no class. There's also the whole complexity of UnitClass vs UnitClassBase.
The Guild tag in DogTagTexts does a hell of a lot more than what you're doing. In specific it does tooltip scanning. To get the <> text under NPCs name that is available no other way.
I'm resisting putting a Guild tag into PB4 because:
a) It's not needed to mimic a commonly used DogTag tag, especially it's not used by any of the default texts and very few people have come looking for it. I've never intended to duplicate the entire DogTagText tags, just the most commonly used ones.
b) One of the problems with DogTagTexts is that in order to have some functionality it had to be added to the library. So it grew and grew and grew as people asked for more and more things. I wish to avoid this with LuaTexts. LuaTexts doesn't have to go down this road because unusual things can still be done with direct API calls.
Your code is nothing but a wrapper around a Blizzard function that isn't really that helpful. Tags in general return nil when the info is not available not '' because '' hides the real return. The only exception to this are Angle and Paren which exist to avoid doing some format calls that blow memory.
return "%s %s%s%s %s%s%s",Name(unit),Angle(AFK(unit) or DND(unit)),Angle(GetGuildInfo(unit) or '')
is really not that much longer or harder to do.
Actually if you're using Angle you can just do:
return "%s %s%s%s %s%s%s",Name(unit),Angle(AFK(unit) or DND(unit)),Angle(GetGuildInfo(unit))
Lastly, you introduce an extraneous call to UnitIsPlayer() that's not really necessary.
So please explain to me why Guild(unit) is really that much better than GetGuildInfo(unit)?
Actually on further thought. That tag will never ever work. Because of limitations of Lua Angle and Paren can only be used as the last set. So all of the code below using Angle twice will never work.
return "%s %s%s%s",Name(unit),Angle(AFK(unit) or DND(unit) or GetGuildInfo(unit))
That will work. Showing the guild if they aren't afk or dnd. To be perfectly honest I regret adding Angle and Paren.
This seems to works too:
return '%s %s%s%s%s',Name(unit),Angle(AFK(unit) or DND(unit)),Angle(GetGuildInfo(unit))
To post a comment, please login or register a new account.