WoW:API GetGuildInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Move page script moved page API GetGuildInfo to API GetGuildInfo without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:


===Returns===
===Returns===
:;guildName : String - The name of the guild the unit is in (or nil?).
:;guildName
:;guildRankName : String - unit's rank in unit's guild.
:: String - The name of the guild the unit is in (or nil?).
:;guildRankIndex : Integer - unit's rank (index). - zero based index (0 is Guild Master, 1 and above are lower ranks)
:;guildRankName
:: String - unit's rank in unit's guild.
:;guildRankIndex
:: Integer - unit's rank (index). - zero based index (0 is Guild Master, 1 and above are lower ranks)
:;realmName
:: String - the host realm name for connected realms, otherwise nil (same as player's realm).


==Details==
==Details==
:*You may use a name in the argument for this function
:*You may use a name in the argument for this function
:*This function only works in close proximity to the unit you are trying to get info from.  I don't know the distance, but it is the same distance that the character portrait loads if you are in party with them.  It will abandon the data shortly after you leave the area, even if the portrait is remembered.
:*This function only works in close proximity to the unit you are trying to get info from.  I don't know the distance, but it is the same distance that the character portrait loads if you are in party with them.  It will abandon the data shortly after you leave the area, even if the portrait is remembered.
:*If using with [[UnitId]] "player" on loading it happens that this value is nil even if the player is in a guild. I wrote a little function which checks in the [[G#GUILD_ROSTER_UPDATE|GUILD_ROSTER_UPDATE]] and [[#PLAYER_GUILD_UPDATE|PLAYER_GUILD_UPDATE]] events, if guild name is available. As long as it is not, no actions are fired by my guild event handling.
:*If using with [[UnitId]] "player" on loading it happens that this value is nil even if the player is in a guild. I wrote a little function which checks in the [[Events/Guild#GUILD_ROSTER_UPDATE|GUILD_ROSTER_UPDATE]] and [[Events/Guild#PLAYER_GUILD_UPDATE|PLAYER_GUILD_UPDATE]] events, if guild name is available. As long as it is not, no actions are fired by my guild event handling.





Latest revision as of 04:45, 15 August 2023

WoW API < GetGuildInfo

Returns guild-related information about a unit.

guildName, guildRankName, guildRankIndex = GetGuildInfo(unit);

Parameters

Arguments

unit
UnitId - The unit whose guild information you wish to query.

Returns

guildName
String - The name of the guild the unit is in (or nil?).
guildRankName
String - unit's rank in unit's guild.
guildRankIndex
Integer - unit's rank (index). - zero based index (0 is Guild Master, 1 and above are lower ranks)
realmName
String - the host realm name for connected realms, otherwise nil (same as player's realm).

Details

  • You may use a name in the argument for this function
  • This function only works in close proximity to the unit you are trying to get info from. I don't know the distance, but it is the same distance that the character portrait loads if you are in party with them. It will abandon the data shortly after you leave the area, even if the portrait is remembered.
  • If using with UnitId "player" on loading it happens that this value is nil even if the player is in a guild. I wrote a little function which checks in the GUILD_ROSTER_UPDATE and PLAYER_GUILD_UPDATE events, if guild name is available. As long as it is not, no actions are fired by my guild event handling.


   local status = true
   if IsInGuild()
   then
       local test = GetGuildInfo("player")
       if (test == nil)
       then
           status = false 
       end
   end
   
   return status