PlayerLocationMixin
Jump to navigation
Jump to search
A PlayerLocation object refers to a player, for example by their unit id, chat line message or guid.
Source: FrameXML\ObjectAPI\PlayerLocation.lua
API
- PlayerLocation:CreateFromGUID(guid) : playerLocation - Creates an object from a UnitGUID.
- PlayerLocation:CreateFromUnit(unit) : playerLocation - Creates an object from a UnitId.
- PlayerLocation:CreateFromChatLineID(lineID) : playerLocation - Creates an object from a chat lineID.
- PlayerLocation:CreateFromCommunityChatData(clubID, streamID, epoch, position) : playerLocation - Creates an object from a community message.
- PlayerLocation:CreateFromCommunityInvitation(clubID, guid) : playerLocation - Creates an object from a community invitation.
- PlayerLocation:CreateFromBattlefieldScoreIndex(battlefieldScoreIndex) : playerLocation - Creates an object from a Battleground player.
- PlayerLocation:CreateFromVoiceID(memberID, channelID) : playerLocation - Creates an object from voice chat.
- PlayerLocation:CreateFromBattleNetID(battleNetID) : playerLocation - Creates an object from a Battle.net ID.
Methods
- PlayerLocationMixin:SetGUID(guid)
- PlayerLocationMixin:IsValid() : boolean
- PlayerLocationMixin:IsGUID() : boolean
- PlayerLocationMixin:IsBattleNetGUID() : boolean
- PlayerLocationMixin:GetGUID() : guid
- PlayerLocationMixin:SetUnit(unit)
- PlayerLocationMixin:IsUnit() : boolean
- PlayerLocationMixin:GetUnit() : unit
- PlayerLocationMixin:SetChatLineID(lineID)
- PlayerLocationMixin:IsChatLineID() : boolean
- PlayerLocationMixin:GetChatLineID() : chatLineID
- PlayerLocationMixin:SetBattlefieldScoreIndex(index)
- PlayerLocationMixin:IsBattlefieldScoreIndex() : boolean
- PlayerLocationMixin:GetBattlefieldScoreIndex() : battlefieldScoreIndex
- PlayerLocationMixin:SetVoiceID(memberID, channelID)
- PlayerLocationMixin:IsVoiceID() : boolean
- PlayerLocationMixin:GetVoiceID() : voiceMemberID, voiceChannelID
- PlayerLocationMixin:SetBattleNetID(battleNetID)
- PlayerLocationMixin:IsBattleNetID() : boolean
- PlayerLocationMixin:GetBattleNetID() : battleNetID
- PlayerLocationMixin:SetCommunityData(clubID, streamID, epoch, position)
- PlayerLocationMixin:IsCommunityData() : boolean
- PlayerLocationMixin:SetCommunityInvitation(clubID, guid)
- PlayerLocationMixin:IsCommunityInvitation() : boolean
- PlayerLocationMixin:Clear()
- PlayerLocationMixin:ClearAndSetField(fieldName, field)
Example
Prints the race and class of your character.
local playerLoc = PlayerLocation:CreateFromUnit("player")
local raceId = C_PlayerInfo.GetRace(playerLoc)
local raceName = C_CreatureInfo.GetRaceInfo(raceId).raceName
local class = C_PlayerInfo.GetClass(playerLoc)
print(raceName, class) -- "Dwarf", "Priest"
The minimal representation is a table with e.g. the unit
, chatLineID
or guid
field.
/dump C_PlayerInfo.GetClass({unit = "player"})
Used by
Patch changes
Patch 8.0.1 (2018-07-17): Added.