Migrate frame placement to addon

This commit is contained in:
Andrew Tomaka 2021-03-01 21:23:42 -05:00
parent 061bf0a3ca
commit b2bb8d895e
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -21,6 +21,8 @@ StaticPopupDialogs["GOLIATH_MISSING"] = {
preferredIndex = 3
}
SLASH_MYADDON1 = "/ta"
MyAddon.keyItemID = 180653
MyAddon.taunts = {
[56222] = true, -- Dark Command
@ -41,6 +43,12 @@ MyAddon.slots = {
inspectInitialized = false
local InspectFontStrings = {}
function MyAddon.SlashHandler(cmd)
if cmd == "frames" then
MyAddon.moveFrames()
end
end
function MyAddon.OnEvent(self, event, ...)
events[event](self, ...)
end
@ -70,7 +78,7 @@ function events:INSPECT_READY(guid)
unit = GetUnitFromGuid(guid)
if unit and CanInspect(unit) then
if unit and CanInspect(unit) and inspectInitialized then
local itemLevel = C_PaperDollInfo.GetInspectItemLevel(unit)
InspectFontStrings["itemLevel"]:SetText(itemLevel)
end
@ -124,6 +132,18 @@ function events:PLAYER_UPDATE_RESTING(...)
if MyAddon.needsRepair() then StaticPopup_Show("REPAIR_ALERT") end
end
function MyAddon.moveFrames()
print("Moving frames to MyAddon default locations")
PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint("CENTER",UIParent,-350,-225)PlayerFrame:SetUserPlaced(true)
TargetFrame:ClearAllPoints()
TargetFrame:SetPoint("CENTER",UIParent,350,-225)TargetFrame:SetUserPlaced(true)
FocusFrame:ClearAllPoints()
FocusFrame:SetPoint("CENTER",UIParent,-350,70)TargetFrame:SetUserPlaced(true)
end
function MyAddon.announceKey()
for bag = 0, NUM_BAG_SLOTS do
for slot = 1, GetContainerNumSlots(bag)do
@ -250,3 +270,5 @@ for i = 1, 7 do
chat:SetShadowOffset(0, 0)
chat:SetShadowColor(0, 0, 0, 0)
end
SlashCmdList["MYADDON"] = MyAddon.SlashHandler