Skip to content

Commit

Permalink
chore: check if target is player
Browse files Browse the repository at this point in the history
  • Loading branch information
zikk committed Nov 17, 2023
1 parent 93ac018 commit 940d087
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ClassicArmoryLink.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local function CreateArmoryFrame(characterName, realmName)

local armoryFrame = CreateFrame("Frame", "ArmoryFrame", UIParent, "BackdropTemplate")
armoryFrame:SetPoint("CENTER")
armoryFrame:SetSize(600, 70)
armoryFrame:SetSize(600, 80)
armoryFrame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
Expand All @@ -38,6 +38,12 @@ local function CreateArmoryFrame(characterName, realmName)
editBox:SetAutoFocus(true)
editBox:SetScript("OnEscapePressed", function() armoryFrame:Hide() end)

-- give the editbox a title
local title = armoryFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
title:SetPoint("BOTTOM", editBox, "TOP", 0, 5)
title:SetText("Classic Armory Link")


-- Create a Close Button
local closeButton = CreateFrame("Button", "ArmoryCloseButton", armoryFrame, "UIPanelCloseButton")
closeButton:SetPoint("TOPRIGHT", armoryFrame, "TOPRIGHT")
Expand Down Expand Up @@ -117,7 +123,6 @@ eventFrame:SetScript("OnEvent", function(self, event, arg1)
if event == "ADDON_LOADED" and arg1 == "ClassicArmoryLink" then
CreateArmoryButton(CharacterFrame, false)
elseif event == "INSPECT_READY" then
-- print(arg1)
lastInspectedGUID = arg1
CreateArmoryButton(InspectFrame, true)
end
Expand All @@ -130,6 +135,11 @@ local function SlashCommandHandler(param)

local realmName

if not UnitIsPlayer("target") then
print("Target is not a player.")
return
end

local characterName, realmName = UnitName("target", true)

if not realmName or realmName == "" then
Expand Down

0 comments on commit 940d087

Please sign in to comment.