Giter VIP home page Giter VIP logo

nicktag-1.0's Introduction

NickTag is a library that allows the player to set a nickname, addons using this library can get the nickname and use it instead of the player name. The nickname is shared among guild members and used instead of the regular player 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.

As an alternative you may use: _G.LibStub("NickTag-1.0"):Embed(YourAddonObject)

Cache Setup:

  • After install, set a cache to store nicknames data received from others guild members.
  • For this, call YourAddonObject:NickTagSetCache ( MyTable ), where "MyTable" is any table within your SavedVariablesPerCharacter.
  • Is important to call NickTagSetCache right after your addon loads saved variables data.

Handle Player Nicknames:

  • YourAddonObject:SetNickname(string), returns true if the string is a valid nickname.

The nickname must follow some rules:

  • 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 Avatars:

The library also has support for player avatar and avatar background, see the example:

--this function runs when the player hit the okay button on the avatar pick frame
local avatarCallback = function (avatarTexture, avatarTextureTexCoord, avatarBackground, avatarBackgroundTexCoord, avatarBackgroundColor) 
    YourAddonObject:SetNicknameBackground (avatarBackground, avatarBackgroundTexCoord, avatarBackgroundColor) 
    YourAddonObject:SetNicknameAvatar (avatarTexture, avatarTextureTexCoord) 
    _G.AvatarPickFrame.callback = nil 
end 

--set the callback function
_G.AvatarPickFrame.callback = AvatarCallBack 
--show the atatar pick frame
_G.AvatarPickFrame:Show()

Getting Nicknames and Avatars:

  • @playerGUID: target player GUID.
  • @default: a default if the player does not has a nickname
  • @silent: show no errors if something goes wrong.

YourAddonObject:GetNickname (playerGUID, default, silent)

  • @playerGUID: target player GUID.
  • @default: a default texture if the player does not has an avatar, can be an empty string for no avatars.
  • @silent: show no errors if something goes wrong.

YourAddonObject:GetNicknameAvatar (playerGUID, default, silent)

  • @playerGUID: target player GUID.
  • @defaultPath: returns this value texture path if no background is found.
  • @defaultTexCoord: returns this value texture path if no background is found.
  • @defaultColor: returns this value texture path if no background is found.
  • @silent: show no errors if something goes wrong.

YourAddonObject:GetNicknameBackground (playerGUID, defaultPath, defaultTexCoord, defaultColor, silent)

nicktag-1.0's People

Contributors

tercioo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

nicktag-1.0's Issues

Cross server

I am not sure if I am missing something but it appears the library isn't communicating cross server.

Edit: just overlooked it saying guildmates... doh maybe expand on this?

Anyway to get notified when group member changes nickname?

Hi Tercioo,

First off thank you for your amazing add-ons, use and love many of them!

I am the current maintainer of the add-on VuhDo, a unit frame add-on targeted primarily at healers. I've added support for NickTag nicknames to display in lieu of player names. However, I didn't see anything in your docs about being explicitly notified when a group member changes their nickname. Is there a way to do this today?

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.