2021-03-09 19:34:12 -05:00
|
|
|
local f, ATMe, events = CreateFrame("Frame"), {}, {}
|
2020-12-19 19:51:36 -05:00
|
|
|
|
|
|
|
StaticPopupDialogs["REPAIR_ALERT"] = {
|
|
|
|
text = "Remember to repair your gear",
|
|
|
|
button1 = "Ok",
|
|
|
|
timeout = 10,
|
|
|
|
whileDead = false,
|
|
|
|
hideOnEscape = true,
|
|
|
|
preferredIndex = 3
|
|
|
|
}
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
SLASH_ATME1 = "/ta"
|
2021-03-01 21:42:16 -05:00
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
ATMe.keyItemID = 180653
|
|
|
|
ATMe.taunts = {
|
2021-01-12 21:37:01 -05:00
|
|
|
[56222] = true, -- Dark Command
|
|
|
|
[51399] = true, -- Death Grip
|
|
|
|
[185245] = true, -- Torment
|
|
|
|
[6795] = true, -- Growl
|
|
|
|
[115546] = true, -- Provke
|
2022-11-01 09:39:45 -04:00
|
|
|
[62124] = true, -- Hand of Reckoning
|
2021-01-12 21:37:01 -05:00
|
|
|
[355] = true, -- Taunt
|
|
|
|
|
|
|
|
[1161] = true, -- Challenging Shout
|
|
|
|
[204079] = true -- Final Stand
|
|
|
|
}
|
2021-03-09 19:34:12 -05:00
|
|
|
ATMe.slots = {
|
2021-02-21 12:27:01 -05:00
|
|
|
"HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot",
|
|
|
|
"WaistSlot", "LegsSlot", "FeetSlot", "MainHandSlot", "SecondaryHandSlot"
|
|
|
|
}
|
2021-03-01 20:45:14 -05:00
|
|
|
inspectInitialized = false
|
|
|
|
local InspectFontStrings = {}
|
2021-01-11 21:35:31 -05:00
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.SlashHandler(cmd)
|
2021-03-01 21:42:16 -05:00
|
|
|
end
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.OnEvent(self, event, ...)
|
2020-12-19 19:51:36 -05:00
|
|
|
events[event](self, ...)
|
|
|
|
end
|
|
|
|
|
2021-03-01 20:45:14 -05:00
|
|
|
function GetUnitFromGuid(guid)
|
|
|
|
if UnitGUID("target") == guid then return "target"
|
|
|
|
elseif IsInRaid() then
|
|
|
|
for i = 1, MAX_RAID_MEMBERS do
|
|
|
|
if UnitGUID("raid"..i) == guid then return "raid"..i end
|
|
|
|
end
|
|
|
|
elseif IsInGroup() then
|
|
|
|
for i = 1, MAX_PARTY_MEMBERS do
|
|
|
|
if UnitGUID("party"..i) == guid then return "party"..i end
|
|
|
|
end
|
|
|
|
else return nil end
|
|
|
|
end
|
|
|
|
|
|
|
|
function events:INSPECT_READY(guid)
|
|
|
|
if not inspectInitialized and InspectFrame then
|
|
|
|
InspectFontStrings["itemLevel"] = InspectFrame:CreateFontString(nil, "OVERLAY")
|
2022-11-01 09:39:45 -04:00
|
|
|
InspectFontStrings["itemLevel"]:SetPoint("BOTTOMLEFT", 10, 5)
|
2021-03-01 20:45:14 -05:00
|
|
|
InspectFontStrings["itemLevel"]:SetFont("Fonts\\FRIZQT__.ttf", 24, "OUTLINE")
|
|
|
|
InspectFontStrings["itemLevel"]:SetTextColor(1, 1, 1)
|
|
|
|
|
|
|
|
inspectInitialized = true
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
unit = GetUnitFromGuid(guid)
|
2021-03-01 21:42:16 -05:00
|
|
|
if unit and CanInspect(unit) and inspectInitialized then
|
2021-03-01 20:45:14 -05:00
|
|
|
local itemLevel = C_PaperDollInfo.GetInspectItemLevel(unit)
|
|
|
|
InspectFontStrings["itemLevel"]:SetText(itemLevel)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-01-11 21:35:31 -05:00
|
|
|
function events:CHAT_MSG_PARTY_LEADER(message, ...)
|
|
|
|
if message == '!keys' then
|
2021-03-09 19:34:12 -05:00
|
|
|
ATMe.announceKey()
|
2021-01-11 21:35:31 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function events:CHAT_MSG_PARTY(message, ...)
|
|
|
|
if message == '!keys' then
|
2021-03-09 19:34:12 -05:00
|
|
|
ATMe.announceKey()
|
2021-01-11 21:35:31 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-01-12 21:37:01 -05:00
|
|
|
function events:COMBAT_LOG_EVENT_UNFILTERED(...)
|
2021-03-09 19:34:12 -05:00
|
|
|
ATMe.announceTaunts(CombatLogGetCurrentEventInfo())
|
2020-12-19 19:51:36 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
function events:MERCHANT_SHOW(...)
|
|
|
|
-- Sell all gray items
|
2021-03-09 19:34:12 -05:00
|
|
|
ATMe.sellGrayItems()
|
2020-12-19 19:51:36 -05:00
|
|
|
|
|
|
|
-- Repair if we need to and merchant allows it
|
2021-03-09 19:34:12 -05:00
|
|
|
if CanMerchantRepair() and ATMe.needsRepair() then
|
2020-12-19 19:51:36 -05:00
|
|
|
RepairAllItems(CanGuildBankRepair())
|
2021-02-08 18:34:29 -05:00
|
|
|
print("Your items have been repaired")
|
2020-12-19 19:51:36 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-01-12 21:37:01 -05:00
|
|
|
function events:PLAYER_LOGIN(...)
|
|
|
|
-- found from some forums
|
|
|
|
local b=ActionButton8 _MH=_MH or(b:SetAttribute("*type5","macro")or SecureHandlerWrapScript(b,"PreClick",b,'Z=IsAltKeyDown()and 0 or(Z or 0)%8+1 self:SetAttribute("macrotext5","/wm [nomod]"..Z)'))or 1
|
2020-12-19 19:51:36 -05:00
|
|
|
end
|
|
|
|
|
2021-03-09 17:36:04 -05:00
|
|
|
function events:PLAYER_REGEN_DISABLED(...)
|
|
|
|
StopwatchFrame:Show()
|
|
|
|
Stopwatch_Clear()
|
|
|
|
Stopwatch_Play()
|
|
|
|
end
|
|
|
|
|
|
|
|
function events:PLAYER_REGEN_ENABLED(...)
|
|
|
|
Stopwatch_Pause()
|
|
|
|
end
|
|
|
|
|
|
|
|
function events:PLAYER_DEAD(...)
|
|
|
|
Stopwatch_Pause()
|
|
|
|
end
|
|
|
|
|
2020-12-19 19:51:36 -05:00
|
|
|
function events:PLAYER_ROLES_ASSIGNED(...)
|
2021-03-09 19:34:12 -05:00
|
|
|
if ATMe.amTankInParty() then ATMe.markSelfSquare() end
|
2020-12-19 19:51:36 -05:00
|
|
|
end
|
|
|
|
|
2021-01-12 21:37:01 -05:00
|
|
|
function events:PLAYER_UPDATE_RESTING(...)
|
|
|
|
-- Notify that we should repair
|
2021-03-09 19:34:12 -05:00
|
|
|
if ATMe.needsRepair() then StaticPopup_Show("REPAIR_ALERT") end
|
2021-01-12 21:37:01 -05:00
|
|
|
end
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.announceKey()
|
2022-11-17 21:03:27 -05:00
|
|
|
for bag = BACKPACK_CONTAINER, NUM_TOTAL_EQUIPPED_BAG_SLOTS do
|
|
|
|
for slot = 1, C_ContainerGetContainerNumSlots(bag)do
|
|
|
|
itemID = C_Container.GetContainerItemID(bag, slot)
|
|
|
|
if C_Container.GetContainerItemID(bag, slot) == ATMe.keyItemID then
|
|
|
|
local link = C_Container.GetContainerItemLink(bag, slot)
|
2021-01-11 21:35:31 -05:00
|
|
|
SendChatMessage(link, "PARTY")
|
|
|
|
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.announceTaunts(...)
|
2021-01-12 21:37:01 -05:00
|
|
|
event = select(2, ...)
|
|
|
|
spellId = select(12, ...)
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
if event ~= 'SPELL_CAST_SUCCESS' or ATMe.taunts[spellId] ~= true then
|
2021-01-12 21:37:01 -05:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
srcName = select(5, ...)
|
|
|
|
destName = select(9, ...)
|
|
|
|
spellName = select(13, ...)
|
|
|
|
|
|
|
|
message = format("|cffFF0000TAUNT:|r %s used %s", srcName, spellName)
|
|
|
|
if destName ~= nil then
|
|
|
|
message = format("%s on %s", message, destName)
|
|
|
|
end
|
|
|
|
|
|
|
|
print(message)
|
|
|
|
end
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.needsRepair()
|
|
|
|
for slot = 1, #ATMe.slots do
|
|
|
|
local id = GetInventorySlotInfo(ATMe.slots[slot])
|
2020-12-19 19:51:36 -05:00
|
|
|
local cur, max = GetInventoryItemDurability(id)
|
|
|
|
|
|
|
|
if max and cur ~= max then return true end
|
|
|
|
end
|
|
|
|
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.sellGrayItems()
|
2021-02-21 11:44:11 -05:00
|
|
|
sellTotal = 0
|
2022-11-17 21:03:27 -05:00
|
|
|
for bag = BACKPACK_CONTAINER, NUM_TOTAL_EQUIPPED_BAG_SLOTS do
|
|
|
|
for slot = 1, C_Container.GetContainerNumSlots(bag) do
|
|
|
|
local item = C_Container.GetContainerItemInfo(bag, slot)
|
|
|
|
|
|
|
|
local count = item and item.stackCount
|
|
|
|
local quality = item and item.quality
|
|
|
|
local link = item and item.hyperlink
|
|
|
|
|
2021-02-21 11:44:11 -05:00
|
|
|
if quality and quality == 0 then
|
|
|
|
local price = select(11, GetItemInfo(link))
|
|
|
|
sellTotal = sellTotal + (price * count)
|
|
|
|
print("Selling "..count.."x"..link)
|
2022-11-17 21:03:27 -05:00
|
|
|
C_Container.UseContainerItem(bag, slot)
|
2020-12-19 19:51:36 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-02-21 11:44:11 -05:00
|
|
|
if sellTotal ~= 0 then
|
|
|
|
print("Made "..GetCoinTextureString(sellTotal))
|
|
|
|
end
|
2020-12-19 19:51:36 -05:00
|
|
|
end
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.amTankInParty()
|
2020-12-19 19:51:36 -05:00
|
|
|
local isParty = UnitInRaid("player") == nil
|
|
|
|
local isTank = UnitGroupRolesAssigned("player") == "TANK"
|
|
|
|
local notAlreadyMarked = GetRaidTargetIndex("player") == nil
|
|
|
|
|
2021-02-08 18:34:29 -05:00
|
|
|
return isParty and isTank and notAlreadyMarked
|
2020-12-19 19:51:36 -05:00
|
|
|
end
|
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
function ATMe.markSelfSquare()
|
2020-12-19 19:51:36 -05:00
|
|
|
SetRaidTarget("player", 6)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Register events
|
|
|
|
for event, method in pairs(events) do
|
|
|
|
f:RegisterEvent(event)
|
|
|
|
end
|
2021-03-09 19:34:12 -05:00
|
|
|
f:SetScript("OnEvent", ATMe.OnEvent)
|
2020-12-19 19:51:36 -05:00
|
|
|
|
2021-01-11 21:35:31 -05:00
|
|
|
function PaperDollFrame_SetMovementSpeed(statFrame, unit)
|
|
|
|
statFrame.wasSwimming = nil
|
|
|
|
statFrame.unit = unit
|
|
|
|
MovementSpeed_OnUpdate(statFrame)
|
|
|
|
|
|
|
|
statFrame.onEnterFunc = MovementSpeed_OnEnter
|
|
|
|
statFrame:SetScript("OnUpdate", MovementSpeed_OnUpdate)
|
|
|
|
statFrame:Show()
|
|
|
|
end
|
|
|
|
|
|
|
|
CharacterStatsPane.statsFramePool.resetterFunc =
|
|
|
|
function(pool, frame)
|
|
|
|
frame:SetScript("OnUpdate", nil)
|
|
|
|
frame.onEnterFunc = nil
|
|
|
|
frame.UpdateTooltip = nil
|
|
|
|
FramePool_HideAndClearAnchors(pool, frame)
|
|
|
|
end
|
|
|
|
table.insert(PAPERDOLL_STATCATEGORIES[1].stats, { stat = "MOVESPEED"})
|
2021-01-19 11:09:16 -05:00
|
|
|
|
2021-03-09 19:34:12 -05:00
|
|
|
SlashCmdList["ATME"] = ATMe.SlashHandler
|