NickTag-1.0

10.2k Downloads

This is a library used by others addons. If you aren't a addon developer, downloading this may have no effect in your game.

NickTag is a library developed for share your "Persona" between guild mates.
Many players have more then one characters and most of then are know by nicknames inside the guild environment.
With this library, addons can request nicknames, avatars and show then instead your character name.

Installing:
Install NickTag as you install any other library, but make sure to load NickTag after AceComm-3.0, AceSerializer-3.0, AceTimer-3.0 and CallbackHandler-1.0.

Cache Setup:
After install, you may want to use cache to store nicktag data received from others guild members.
For this, call YourAddonObject:NickTagSetCache ( MyTable ), were "MyTable" is a table which is any table saved with your "SavedVariablesPerCharacter".
Make sure to use "NickTagSetCache" after your addon load your saved data.

Player Nickname
Create a editbox and use the method YourAddonObject:SetNickname ( text ), NickTag will check the text passed, format and return if is a valid nickname.
In order to keep game smooth, the nickname passed is verified with same filters:
- Nickname can't be large then 12 characters.
- Isn't allowed numbers and others special characters.
- Can't repeat more then 2 times the same characters in a row.
- Can't have more then 2 spaces.
- Nickname is formated to fit title case, for instance, "SussY HArLey" is automatically formated to "Sussy Harley", "frank roger" to "Frank Roger".
- trim.

Player Avatar
NickTag have a built-in frame to choose player avatar: _G.AvatarPickFrame
A short example should be like this:

local AvatarCallBack = function (textureAvatar, textureAvatarTexCoord, textureBackground, textureBackgroundTexCoord, textureBackgroundColor)
	YourAddonObject:SetNicknameBackground (textureBackground, textureBackgroundTexCoord, textureBackgroundColor)
	YourAddonObject:SetNicknameAvatar (textureAvatar, textureAvatarTexCoord)
	_G.AvatarPickFrame.callback = nil
end

_G.AvatarPickFrame.callback = AvatarCallBack
_G.AvatarPickFrame:Show()

Get Nickname and Avatar
Getting a nickname or avatar is quite simple, use the following methods:

YourAddonObject:GetNickname (GUID, default, silent)
YourAddonObject:GetNicknameAvatar (GUID, default, silent)
YourAddonObject:GetNicknameBackground (GUID, defaultPath, defaultTexCoord, defaultColor, silent)