Move addon to nested directory structure #21

Merged
atomaka merged 1 commit from ATMe into master 2021-03-09 19:34:12 -05:00
3 changed files with 35 additions and 36 deletions

View file

@ -1,4 +1,4 @@
local f, MyAddon, events = CreateFrame("Frame"), {}, {} local f, ATMe, events = CreateFrame("Frame"), {}, {}
StaticPopupDialogs["REPAIR_ALERT"] = { StaticPopupDialogs["REPAIR_ALERT"] = {
text = "Remember to repair your gear", text = "Remember to repair your gear",
@ -21,10 +21,10 @@ StaticPopupDialogs["GOLIATH_MISSING"] = {
preferredIndex = 3 preferredIndex = 3
} }
SLASH_MYADDON1 = "/ta" SLASH_ATME1 = "/ta"
MyAddon.keyItemID = 180653 ATMe.keyItemID = 180653
MyAddon.taunts = { ATMe.taunts = {
[56222] = true, -- Dark Command [56222] = true, -- Dark Command
[51399] = true, -- Death Grip [51399] = true, -- Death Grip
[185245] = true, -- Torment [185245] = true, -- Torment
@ -36,20 +36,20 @@ MyAddon.taunts = {
[1161] = true, -- Challenging Shout [1161] = true, -- Challenging Shout
[204079] = true -- Final Stand [204079] = true -- Final Stand
} }
MyAddon.slots = { ATMe.slots = {
"HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot", "HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot",
"WaistSlot", "LegsSlot", "FeetSlot", "MainHandSlot", "SecondaryHandSlot" "WaistSlot", "LegsSlot", "FeetSlot", "MainHandSlot", "SecondaryHandSlot"
} }
inspectInitialized = false inspectInitialized = false
local InspectFontStrings = {} local InspectFontStrings = {}
function MyAddon.SlashHandler(cmd) function ATMe.SlashHandler(cmd)
if cmd == "frames" then if cmd == "frames" then
MyAddon.moveFrames() ATMe.moveFrames()
end end
end end
function MyAddon.OnEvent(self, event, ...) function ATMe.OnEvent(self, event, ...)
events[event](self, ...) events[event](self, ...)
end end
@ -88,31 +88,31 @@ function events:GOSSIP_SHOW()
local isNecroticWake = GetZoneText() == 'The Necrotic Wake' local isNecroticWake = GetZoneText() == 'The Necrotic Wake'
local isSteward = GetUnitName('npc') == 'Steward' local isSteward = GetUnitName('npc') == 'Steward'
if isNecroticWake and isSteward then MyAddon.activateGoliath() end if isNecroticWake and isSteward then ATMe.activateGoliath() end
end end
function events:CHAT_MSG_PARTY_LEADER(message, ...) function events:CHAT_MSG_PARTY_LEADER(message, ...)
if message == '!keys' then if message == '!keys' then
MyAddon.announceKey() ATMe.announceKey()
end end
end end
function events:CHAT_MSG_PARTY(message, ...) function events:CHAT_MSG_PARTY(message, ...)
if message == '!keys' then if message == '!keys' then
MyAddon.announceKey() ATMe.announceKey()
end end
end end
function events:COMBAT_LOG_EVENT_UNFILTERED(...) function events:COMBAT_LOG_EVENT_UNFILTERED(...)
MyAddon.announceTaunts(CombatLogGetCurrentEventInfo()) ATMe.announceTaunts(CombatLogGetCurrentEventInfo())
end end
function events:MERCHANT_SHOW(...) function events:MERCHANT_SHOW(...)
-- Sell all gray items -- Sell all gray items
MyAddon.sellGrayItems() ATMe.sellGrayItems()
-- Repair if we need to and merchant allows it -- Repair if we need to and merchant allows it
if CanMerchantRepair() and MyAddon.needsRepair() then if CanMerchantRepair() and ATMe.needsRepair() then
RepairAllItems(CanGuildBankRepair()) RepairAllItems(CanGuildBankRepair())
print("Your items have been repaired") print("Your items have been repaired")
end end
@ -159,16 +159,16 @@ function events:PLAYER_DEAD(...)
end end
function events:PLAYER_ROLES_ASSIGNED(...) function events:PLAYER_ROLES_ASSIGNED(...)
if MyAddon.amTankInParty() then MyAddon.markSelfSquare() end if ATMe.amTankInParty() then ATMe.markSelfSquare() end
end end
function events:PLAYER_UPDATE_RESTING(...) function events:PLAYER_UPDATE_RESTING(...)
-- Notify that we should repair -- Notify that we should repair
if MyAddon.needsRepair() then StaticPopup_Show("REPAIR_ALERT") end if ATMe.needsRepair() then StaticPopup_Show("REPAIR_ALERT") end
end end
function MyAddon.moveFrames() function ATMe.moveFrames()
print("Moving frames to MyAddon default locations") print("Moving frames to ATMe default locations")
PlayerFrame:ClearAllPoints() PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint("CENTER",UIParent,-350,-225)PlayerFrame:SetUserPlaced(true) PlayerFrame:SetPoint("CENTER",UIParent,-350,-225)PlayerFrame:SetUserPlaced(true)
@ -179,11 +179,11 @@ function MyAddon.moveFrames()
FocusFrame:SetPoint("CENTER",UIParent,-350,150)TargetFrame:SetUserPlaced(true) FocusFrame:SetPoint("CENTER",UIParent,-350,150)TargetFrame:SetUserPlaced(true)
end end
function MyAddon.announceKey() function ATMe.announceKey()
for bag = 0, NUM_BAG_SLOTS do for bag = 0, NUM_BAG_SLOTS do
for slot = 1, GetContainerNumSlots(bag)do for slot = 1, GetContainerNumSlots(bag)do
itemID = GetContainerItemID(bag, slot) itemID = GetContainerItemID(bag, slot)
if GetContainerItemID(bag, slot) == MyAddon.keyItemID then if GetContainerItemID(bag, slot) == ATMe.keyItemID then
local link = GetContainerItemLink(bag, slot) local link = GetContainerItemLink(bag, slot)
SendChatMessage(link, "PARTY") SendChatMessage(link, "PARTY")
@ -193,11 +193,11 @@ function MyAddon.announceKey()
end end
end end
function MyAddon.announceTaunts(...) function ATMe.announceTaunts(...)
event = select(2, ...) event = select(2, ...)
spellId = select(12, ...) spellId = select(12, ...)
if event ~= 'SPELL_CAST_SUCCESS' or MyAddon.taunts[spellId] ~= true then if event ~= 'SPELL_CAST_SUCCESS' or ATMe.taunts[spellId] ~= true then
return return
end end
@ -213,7 +213,7 @@ function MyAddon.announceTaunts(...)
print(message) print(message)
end end
function MyAddon.activateGoliath() function ATMe.activateGoliath()
options = C_GossipInfo.GetOptions() options = C_GossipInfo.GetOptions()
found = false found = false
@ -228,9 +228,9 @@ function MyAddon.activateGoliath()
if not found then StaticPopup_Show("GOLIATH_MISSING") end if not found then StaticPopup_Show("GOLIATH_MISSING") end
end end
function MyAddon.needsRepair() function ATMe.needsRepair()
for slot = 1, #MyAddon.slots do for slot = 1, #ATMe.slots do
local id = GetInventorySlotInfo(MyAddon.slots[slot]) local id = GetInventorySlotInfo(ATMe.slots[slot])
local cur, max = GetInventoryItemDurability(id) local cur, max = GetInventoryItemDurability(id)
if max and cur ~= max then return true end if max and cur ~= max then return true end
@ -239,7 +239,7 @@ function MyAddon.needsRepair()
return false return false
end end
function MyAddon.sellGrayItems() function ATMe.sellGrayItems()
sellTotal = 0 sellTotal = 0
for bag = 0, NUM_BAG_SLOTS do for bag = 0, NUM_BAG_SLOTS do
for slot = 1, GetContainerNumSlots(bag) do for slot = 1, GetContainerNumSlots(bag) do
@ -257,7 +257,7 @@ function MyAddon.sellGrayItems()
end end
end end
function MyAddon.amTankInParty() function ATMe.amTankInParty()
local isParty = UnitInRaid("player") == nil local isParty = UnitInRaid("player") == nil
local isTank = UnitGroupRolesAssigned("player") == "TANK" local isTank = UnitGroupRolesAssigned("player") == "TANK"
local notAlreadyMarked = GetRaidTargetIndex("player") == nil local notAlreadyMarked = GetRaidTargetIndex("player") == nil
@ -265,7 +265,7 @@ function MyAddon.amTankInParty()
return isParty and isTank and notAlreadyMarked return isParty and isTank and notAlreadyMarked
end end
function MyAddon.markSelfSquare() function ATMe.markSelfSquare()
SetRaidTarget("player", 6) SetRaidTarget("player", 6)
end end
@ -273,7 +273,7 @@ end
for event, method in pairs(events) do for event, method in pairs(events) do
f:RegisterEvent(event) f:RegisterEvent(event)
end end
f:SetScript("OnEvent", MyAddon.OnEvent) f:SetScript("OnEvent", ATMe.OnEvent)
--[[ hooksecurefunc("TalkingHeadFrame_PlayCurrent", function() --[[ hooksecurefunc("TalkingHeadFrame_PlayCurrent", function()
TalkingHeadFrame:Hide() TalkingHeadFrame:Hide()
@ -306,4 +306,4 @@ for i = 1, 7 do
chat:SetShadowColor(0, 0, 0, 0) chat:SetShadowColor(0, 0, 0, 0)
end end
SlashCmdList["MYADDON"] = MyAddon.SlashHandler SlashCmdList["ATME"] = ATMe.SlashHandler

View file

@ -1,6 +1,6 @@
## Interface: 90005 ## Interface: 90005
## Title: MyAddon ## Title: ATMe
## Author: Andrew Tomaka ## Author: Andrew Tomaka
## Version: 0.1 ## Version: 0.1
MyAddon.lua ATMe.lua

View file

@ -1,6 +1,5 @@
install: install:
cp MyAddon.lua $$WOW_ADDON_DIR/MyAddon/ cp -r ATMe/ $$WOW_ADDON_DIR
cp MyAddon.toc $$WOW_ADDON_DIR/MyAddon/
update: update:
cp -r $$WOW_ADDON_DIR/MyAddon/* . cp -r $$WOW_ADDON_DIR/ATMe .