You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14579 lines
612 KiB
14579 lines
612 KiB
----------------------------------------------------------------------
|
|
-- Leatrix Plus 11.2.00 (5th August 2025)
|
|
----------------------------------------------------------------------
|
|
|
|
-- 01:Functions 02:Locks, 03:Restart 40:Player
|
|
-- 60:Events 62:Profile 70:Logout 80:Commands, 90:Panel
|
|
|
|
----------------------------------------------------------------------
|
|
-- Leatrix Plus
|
|
----------------------------------------------------------------------
|
|
|
|
-- Create global table
|
|
_G.LeaPlusDB = _G.LeaPlusDB or {}
|
|
|
|
-- Create locals
|
|
local LeaPlusLC, LeaPlusCB, LeaConfigList, LeaLockList = {}, {}, {}, {}
|
|
local GameLocale = GetLocale()
|
|
local void
|
|
|
|
-- Version
|
|
LeaPlusLC["AddonVer"] = "11.2.00"
|
|
|
|
-- Get locale table
|
|
local void, Leatrix_Plus = ...
|
|
local L = Leatrix_Plus.L
|
|
|
|
-- Check Wow version is valid
|
|
do
|
|
local gameversion, gamebuild, gamedate, gametocversion = GetBuildInfo()
|
|
if gametocversion and gametocversion < 110000 then
|
|
-- Game client is Wow Classic
|
|
C_Timer.After(2, function()
|
|
print(L["LEATRIX PLUS: THIS IS FOR THE WAR WITHIN ONLY!"])
|
|
end)
|
|
return
|
|
end
|
|
if gametocversion and gametocversion >= 110200 then -- 11.2.0
|
|
LeaPlusLC.NewPatch = true
|
|
end
|
|
end
|
|
|
|
-- Check for ElvUI
|
|
if C_AddOns.IsAddOnLoaded("ElvUI") then LeaPlusLC.ElvUI = unpack(ElvUI) end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L00: Leatrix Plus
|
|
----------------------------------------------------------------------
|
|
|
|
-- Initialise variables
|
|
LeaPlusLC["ShowErrorsFlag"] = 1
|
|
LeaPlusLC["NumberOfPages"] = 9
|
|
LeaPlusLC["RaidColors"] = RAID_CLASS_COLORS
|
|
|
|
-- Create event frame
|
|
local LpEvt = CreateFrame("FRAME")
|
|
LpEvt:RegisterEvent("ADDON_LOADED")
|
|
LpEvt:RegisterEvent("PLAYER_LOGIN")
|
|
|
|
-- Set bindings translations
|
|
_G.BINDING_NAME_LEATRIX_PLUS_GLOBAL_TOGGLE = L["Toggle panel"]
|
|
_G.BINDING_NAME_LEATRIX_PLUS_GLOBAL_WEBLINK = L["Show web link"]
|
|
_G.BINDING_NAME_LEATRIX_PLUS_GLOBAL_RARE = L["Announce rare"]
|
|
_G.BINDING_NAME_LEATRIX_PLUS_GLOBAL_MOUNTSPECIAL = L["Mount special"]
|
|
|
|
-- Disable sticky editbox
|
|
-- Open 2 chat windows
|
|
-- Press enter in general chat to open editbox, type anything but don't press enter
|
|
-- Undock the second chat window and dock it again
|
|
-- Press enter in general chat to open editbox, type anything but don't press enter
|
|
-- Right-click General chat tab and enter Edit Mode
|
|
|
|
----------------------------------------------------------------------
|
|
-- L01: Functions
|
|
----------------------------------------------------------------------
|
|
|
|
-- Print text
|
|
function LeaPlusLC:Print(text)
|
|
DEFAULT_CHAT_FRAME:AddMessage(L[text], 1.0, 0.85, 0.0)
|
|
end
|
|
|
|
-- Lock and unlock an item
|
|
function LeaPlusLC:LockItem(item, lock)
|
|
if lock then
|
|
item:Disable()
|
|
item:SetAlpha(0.3)
|
|
else
|
|
item:Enable()
|
|
item:SetAlpha(1.0)
|
|
end
|
|
end
|
|
|
|
-- Hide configuration panels
|
|
function LeaPlusLC:HideConfigPanels()
|
|
for k, v in pairs(LeaConfigList) do
|
|
v:Hide()
|
|
end
|
|
end
|
|
|
|
-- Create a close button without using a template
|
|
function LeaPlusLC:CreateCloseButton(parent, w, h, anchor, x, y)
|
|
local btn = CreateFrame("BUTTON", nil, parent)
|
|
btn:SetSize(w, h)
|
|
btn:SetPoint(anchor, x, y)
|
|
btn:SetNormalTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Up")
|
|
btn:SetHighlightTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Highlight")
|
|
btn:SetPushedTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Down")
|
|
btn:SetDisabledTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Disabled")
|
|
return btn
|
|
end
|
|
|
|
-- Decline a shared quest if needed
|
|
function LeaPlusLC:CheckIfQuestIsSharedAndShouldBeDeclined()
|
|
if LeaPlusLC["NoSharedQuests"] == "On" then
|
|
local npcName = UnitName("questnpc")
|
|
if npcName and UnitIsPlayer(npcName) then
|
|
if UnitInParty(npcName) or UnitInRaid(npcName) then
|
|
if not LeaPlusLC:FriendCheck(npcName) then
|
|
DeclineQuest()
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Display on-screen message
|
|
function LeaPlusLC:DisplayMessage(self)
|
|
ActionStatus:DisplayMessage(self)
|
|
end
|
|
|
|
-- Show a single line prefilled editbox with copy functionality
|
|
function LeaPlusLC:ShowSystemEditBox(word, focuschat)
|
|
if not LeaPlusLC.FactoryEditBox then
|
|
-- Create frame for first time
|
|
local eFrame = CreateFrame("FRAME", nil, UIParent)
|
|
LeaPlusLC.FactoryEditBox = eFrame
|
|
eFrame:SetSize(700, 110)
|
|
eFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 150)
|
|
eFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
eFrame:SetFrameLevel(5000)
|
|
eFrame:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then
|
|
eFrame:Hide()
|
|
end
|
|
end)
|
|
-- Add background color
|
|
eFrame.t = eFrame:CreateTexture(nil, "BACKGROUND")
|
|
eFrame.t:SetAllPoints()
|
|
eFrame.t:SetColorTexture(0.05, 0.05, 0.05, 0.9)
|
|
-- Add copy title
|
|
eFrame.f = eFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
eFrame.f:SetPoint("TOPLEFT", x, y)
|
|
eFrame.f:SetPoint("TOPLEFT", eFrame, "TOPLEFT", 12, -52)
|
|
eFrame.f:SetWidth(676)
|
|
eFrame.f:SetJustifyH("LEFT")
|
|
eFrame.f:SetWordWrap(false)
|
|
-- Add copy label
|
|
eFrame.c = eFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
eFrame.c:SetPoint("TOPLEFT", x, y)
|
|
eFrame.c:SetText(L["Press CTRL/C to copy"])
|
|
eFrame.c:SetPoint("TOPLEFT", eFrame, "TOPLEFT", 12, -82)
|
|
-- Add cancel label
|
|
eFrame.x = eFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
eFrame.x:SetPoint("TOPRIGHT", x, y)
|
|
eFrame.x:SetText(L["Right-click to close"])
|
|
eFrame.x:SetPoint("TOPRIGHT", eFrame, "TOPRIGHT", -12, -82)
|
|
-- Create editbox
|
|
eFrame.b = CreateFrame("EditBox", nil, eFrame, "InputBoxTemplate")
|
|
eFrame.b:ClearAllPoints()
|
|
eFrame.b:SetPoint("TOPLEFT", eFrame, "TOPLEFT", 16, -12)
|
|
eFrame.b:SetSize(672, 24)
|
|
eFrame.b:SetFontObject("GameFontNormalLarge")
|
|
eFrame.b:SetTextColor(1.0, 1.0, 1.0, 1)
|
|
eFrame.b:SetBlinkSpeed(0)
|
|
eFrame.b:SetHitRectInsets(99, 99, 99, 99)
|
|
eFrame.b:SetAutoFocus(true)
|
|
eFrame.b:SetAltArrowKeyMode(true)
|
|
-- Editbox texture
|
|
eFrame.t = CreateFrame("FRAME", nil, eFrame.b, "BackdropTemplate")
|
|
eFrame.t:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = false, tileSize = 16, edgeSize = 16, insets = { left = 5, right = 5, top = 5, bottom = 5 }})
|
|
eFrame.t:SetPoint("LEFT", -6, 0)
|
|
eFrame.t:SetWidth(eFrame.b:GetWidth() + 6)
|
|
eFrame.t:SetHeight(eFrame.b:GetHeight())
|
|
eFrame.t:SetBackdropColor(1.0, 1.0, 1.0, 0.3)
|
|
-- Handler
|
|
eFrame.b:SetScript("OnKeyDown", function(void, key)
|
|
if key == "C" and IsControlKeyDown() then
|
|
C_Timer.After(0.1, function()
|
|
eFrame:Hide()
|
|
LeaPlusLC:DisplayMessage(L["Copied to clipboard."], true)
|
|
if LeaPlusLC.FactoryEditBoxFocusChat then
|
|
local eBox = ChatEdit_ChooseBoxForSend()
|
|
ChatEdit_ActivateChat(eBox)
|
|
end
|
|
end)
|
|
end
|
|
end)
|
|
-- Prevent changes
|
|
eFrame.b:SetScript("OnEscapePressed", function() eFrame:Hide() end)
|
|
eFrame.b:SetScript("OnEnterPressed", eFrame.b.HighlightText)
|
|
eFrame.b:SetScript("OnMouseDown", eFrame.b.ClearFocus)
|
|
eFrame.b:SetScript("OnMouseUp", eFrame.b.HighlightText)
|
|
eFrame.b:SetFocus(true)
|
|
eFrame.b:HighlightText()
|
|
eFrame:Show()
|
|
end
|
|
if focuschat then LeaPlusLC.FactoryEditBoxFocusChat = true else LeaPlusLC.FactoryEditBoxFocusChat = nil end
|
|
LeaPlusLC.FactoryEditBox:Show()
|
|
LeaPlusLC.FactoryEditBox.b:SetText(word)
|
|
LeaPlusLC.FactoryEditBox.b:HighlightText()
|
|
LeaPlusLC.FactoryEditBox.b:SetScript("OnChar", function() LeaPlusLC.FactoryEditBox.b:SetFocus(true) LeaPlusLC.FactoryEditBox.b:SetText(word) LeaPlusLC.FactoryEditBox.b:HighlightText() end)
|
|
LeaPlusLC.FactoryEditBox.b:SetScript("OnKeyUp", function() LeaPlusLC.FactoryEditBox.b:SetFocus(true) LeaPlusLC.FactoryEditBox.b:SetText(word) LeaPlusLC.FactoryEditBox.b:HighlightText() end)
|
|
end
|
|
|
|
-- Load a string variable or set it to default if it's not set to "On" or "Off"
|
|
function LeaPlusLC:LoadVarChk(var, def)
|
|
if LeaPlusDB[var] and type(LeaPlusDB[var]) == "string" and LeaPlusDB[var] == "On" or LeaPlusDB[var] == "Off" then
|
|
LeaPlusLC[var] = LeaPlusDB[var]
|
|
else
|
|
LeaPlusLC[var] = def
|
|
LeaPlusDB[var] = def
|
|
end
|
|
end
|
|
|
|
-- Load a numeric variable and set it to default if it's not within a given range
|
|
function LeaPlusLC:LoadVarNum(var, def, valmin, valmax)
|
|
if LeaPlusDB[var] and type(LeaPlusDB[var]) == "number" and LeaPlusDB[var] >= valmin and LeaPlusDB[var] <= valmax then
|
|
LeaPlusLC[var] = LeaPlusDB[var]
|
|
else
|
|
LeaPlusLC[var] = def
|
|
LeaPlusDB[var] = def
|
|
end
|
|
end
|
|
|
|
-- Load an anchor point variable and set it to default if the anchor point is invalid
|
|
function LeaPlusLC:LoadVarAnc(var, def)
|
|
if LeaPlusDB[var] and type(LeaPlusDB[var]) == "string" and LeaPlusDB[var] == "CENTER" or LeaPlusDB[var] == "TOP" or LeaPlusDB[var] == "BOTTOM" or LeaPlusDB[var] == "LEFT" or LeaPlusDB[var] == "RIGHT" or LeaPlusDB[var] == "TOPLEFT" or LeaPlusDB[var] == "TOPRIGHT" or LeaPlusDB[var] == "BOTTOMLEFT" or LeaPlusDB[var] == "BOTTOMRIGHT" then
|
|
LeaPlusLC[var] = LeaPlusDB[var]
|
|
else
|
|
LeaPlusLC[var] = def
|
|
LeaPlusDB[var] = def
|
|
end
|
|
end
|
|
|
|
-- Load a string variable and set it to default if it is not a string (used with minimap exclude list)
|
|
function LeaPlusLC:LoadVarStr(var, def)
|
|
if LeaPlusDB[var] and type(LeaPlusDB[var]) == "string" then
|
|
LeaPlusLC[var] = LeaPlusDB[var]
|
|
else
|
|
LeaPlusLC[var] = def
|
|
LeaPlusDB[var] = def
|
|
end
|
|
end
|
|
|
|
-- Show tooltips for checkboxes
|
|
function LeaPlusLC:TipSee()
|
|
GameTooltip:SetOwner(self, "ANCHOR_NONE")
|
|
local parent = self:GetParent()
|
|
if parent:GetParent() and parent:GetParent():GetObjectType() == "ScrollFrame" then
|
|
-- Scrolling frame tooltips have different parent
|
|
parent = self:GetParent():GetParent():GetParent():GetParent()
|
|
end
|
|
local pscale = parent:GetEffectiveScale()
|
|
local gscale = UIParent:GetEffectiveScale()
|
|
local tscale = GameTooltip:GetEffectiveScale()
|
|
local gap = ((UIParent:GetRight() * gscale) - (parent:GetRight() * pscale))
|
|
if gap < (250 * tscale) then
|
|
GameTooltip:SetPoint("TOPRIGHT", parent, "TOPLEFT", 0, 0)
|
|
else
|
|
GameTooltip:SetPoint("TOPLEFT", parent, "TOPRIGHT", 0, 0)
|
|
end
|
|
GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
|
|
end
|
|
|
|
-- Show tooltips for dropdown menu tooltips
|
|
function LeaPlusLC:ShowDropTip()
|
|
GameTooltip:SetOwner(self, "ANCHOR_NONE")
|
|
local parent = self:GetParent():GetParent():GetParent()
|
|
local pscale = parent:GetEffectiveScale()
|
|
local gscale = UIParent:GetEffectiveScale()
|
|
local tscale = GameTooltip:GetEffectiveScale()
|
|
local gap = ((UIParent:GetRight() * gscale) - (parent:GetRight() * pscale))
|
|
if gap < (250 * tscale) then
|
|
GameTooltip:SetPoint("TOPRIGHT", parent, "TOPLEFT", 0, 0)
|
|
else
|
|
GameTooltip:SetPoint("TOPLEFT", parent, "TOPRIGHT", 0, 0)
|
|
end
|
|
GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
|
|
end
|
|
|
|
-- Show tooltips for configuration buttons and dropdown menus
|
|
function LeaPlusLC:ShowTooltip()
|
|
GameTooltip:SetOwner(self, "ANCHOR_NONE")
|
|
local parent = LeaPlusLC["PageF"]
|
|
local pscale = parent:GetEffectiveScale()
|
|
local gscale = UIParent:GetEffectiveScale()
|
|
local tscale = GameTooltip:GetEffectiveScale()
|
|
local gap = ((UIParent:GetRight() * gscale) - (LeaPlusLC["PageF"]:GetRight() * pscale))
|
|
if gap < (250 * tscale) then
|
|
GameTooltip:SetPoint("TOPRIGHT", parent, "TOPLEFT", 0, 0)
|
|
else
|
|
GameTooltip:SetPoint("TOPLEFT", parent, "TOPRIGHT", 0, 0)
|
|
end
|
|
GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
|
|
end
|
|
|
|
-- Show tooltips for interface settings (not currently used)
|
|
function LeaPlusLC:ShowFacetip()
|
|
GameTooltip:SetOwner(self, "ANCHOR_TOP")
|
|
GameTooltip:SetText(self.tiptext, nil, nil, nil, nil, true)
|
|
end
|
|
|
|
-- Create configuration button
|
|
function LeaPlusLC:CfgBtn(name, parent)
|
|
local CfgBtn = CreateFrame("BUTTON", nil, parent)
|
|
LeaPlusCB[name] = CfgBtn
|
|
CfgBtn:SetWidth(20)
|
|
CfgBtn:SetHeight(20)
|
|
CfgBtn:SetPoint("LEFT", parent.f, "RIGHT", 0, 0)
|
|
|
|
CfgBtn.t = CfgBtn:CreateTexture(nil, "BORDER")
|
|
CfgBtn.t:SetAllPoints()
|
|
CfgBtn.t:SetTexture("Interface\\WorldMap\\Gear_64.png")
|
|
CfgBtn.t:SetTexCoord(0, 0.50, 0, 0.50);
|
|
CfgBtn.t:SetVertexColor(1.0, 0.82, 0, 1.0)
|
|
|
|
CfgBtn:SetHighlightTexture("Interface\\WorldMap\\Gear_64.png")
|
|
CfgBtn:GetHighlightTexture():SetTexCoord(0, 0.50, 0, 0.50);
|
|
|
|
CfgBtn.tiptext = L["Click to configure the settings for this option."]
|
|
CfgBtn:SetScript("OnEnter", LeaPlusLC.ShowTooltip)
|
|
CfgBtn:SetScript("OnLeave", GameTooltip_Hide)
|
|
end
|
|
|
|
-- Create a help button to the right of a fontstring
|
|
function LeaPlusLC:CreateHelpButton(frame, panel, parent, tip)
|
|
LeaPlusLC:CfgBtn(frame, panel)
|
|
LeaPlusCB[frame]:ClearAllPoints()
|
|
LeaPlusCB[frame]:SetPoint("LEFT", parent, "RIGHT", -parent:GetWidth() + parent:GetStringWidth(), 0)
|
|
LeaPlusCB[frame]:SetSize(25, 25)
|
|
LeaPlusCB[frame].t:SetTexture("Interface\\COMMON\\help-i.blp")
|
|
LeaPlusCB[frame].t:SetTexCoord(0, 1, 0, 1)
|
|
LeaPlusCB[frame].t:SetVertexColor(0.9, 0.8, 0.0)
|
|
LeaPlusCB[frame]:SetHighlightTexture("Interface\\COMMON\\help-i.blp")
|
|
LeaPlusCB[frame]:GetHighlightTexture():SetTexCoord(0, 1, 0, 1)
|
|
LeaPlusCB[frame].tiptext = L[tip]
|
|
LeaPlusCB[frame]:SetScript("OnEnter", LeaPlusLC.TipSee)
|
|
end
|
|
|
|
-- Show a footer
|
|
function LeaPlusLC:MakeFT(frame, text, left, width, bottom)
|
|
local footer = LeaPlusLC:MakeTx(frame, text, left, bottom)
|
|
footer:SetWidth(width); footer:SetJustifyH("LEFT"); footer:SetWordWrap(true); footer:ClearAllPoints()
|
|
footer:SetPoint("BOTTOMLEFT", left, bottom)
|
|
end
|
|
|
|
-- Capitalise first character in a string
|
|
function LeaPlusLC:CapFirst(str)
|
|
return gsub(string.lower(str), "^%l", strupper)
|
|
end
|
|
|
|
-- Toggle Zygor addon
|
|
function LeaPlusLC:ZygorToggle()
|
|
if select(2, C_AddOns.GetAddOnInfo("ZygorGuidesViewer")) then
|
|
if not C_AddOns.IsAddOnLoaded("ZygorGuidesViewer") then
|
|
if LeaPlusLC:PlayerInCombat() then
|
|
return
|
|
else
|
|
C_AddOns.EnableAddOn("ZygorGuidesViewer")
|
|
ReloadUI();
|
|
end
|
|
else
|
|
C_AddOns.DisableAddOn("ZygorGuidesViewer")
|
|
ReloadUI();
|
|
end
|
|
else
|
|
-- Zygor cannot be found
|
|
LeaPlusLC:Print("Zygor addon not found.");
|
|
end
|
|
return
|
|
end
|
|
|
|
-- Show memory usage stat
|
|
function LeaPlusLC:ShowMemoryUsage(frame, anchor, x, y)
|
|
|
|
-- Create frame
|
|
local memframe = CreateFrame("FRAME", nil, frame)
|
|
memframe:ClearAllPoints()
|
|
memframe:SetPoint(anchor, x, y)
|
|
memframe:SetWidth(100)
|
|
memframe:SetHeight(20)
|
|
|
|
-- Create labels
|
|
local pretext = memframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
pretext:SetPoint("TOPLEFT", 0, 0)
|
|
pretext:SetText(L["Memory Usage"])
|
|
|
|
local memtext = memframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
memtext:SetPoint("TOPLEFT", 0, 0 - 30)
|
|
|
|
-- Create stat
|
|
local memstat = memframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
memstat:SetPoint("BOTTOMLEFT", memtext, "BOTTOMRIGHT")
|
|
memstat:SetText("(calculating...)")
|
|
|
|
-- Create update script
|
|
local memtime = -1
|
|
memframe:SetScript("OnUpdate", function(self, elapsed)
|
|
if memtime > 2 or memtime == -1 then
|
|
UpdateAddOnMemoryUsage();
|
|
memtext = GetAddOnMemoryUsage("Leatrix_Plus")
|
|
memtext = math.floor(memtext + .5) .. " KB"
|
|
memstat:SetText(memtext);
|
|
memtime = 0;
|
|
end
|
|
memtime = memtime + elapsed;
|
|
end)
|
|
|
|
-- Release memory
|
|
LeaPlusLC.ShowMemoryUsage = nil
|
|
|
|
end
|
|
|
|
-- Check if player is in LFG queue
|
|
function LeaPlusLC:IsInLFGQueue()
|
|
if GetLFGMode(LE_LFG_CATEGORY_LFD) or
|
|
GetLFGMode(LE_LFG_CATEGORY_LFR) or
|
|
GetLFGMode(LE_LFG_CATEGORY_RF) or
|
|
GetLFGMode(LE_LFG_CATEGORY_SCENARIO) or
|
|
GetLFGMode(LE_LFG_CATEGORY_FLEXRAID) then
|
|
return true
|
|
end
|
|
end
|
|
|
|
-- Check if player is in combat
|
|
function LeaPlusLC:PlayerInCombat()
|
|
if (UnitAffectingCombat("player")) then
|
|
LeaPlusLC:Print("You cannot do that in combat.")
|
|
return true
|
|
end
|
|
end
|
|
|
|
-- Hide panel and pages
|
|
function LeaPlusLC:HideFrames()
|
|
|
|
-- Hide option pages
|
|
for i = 0, LeaPlusLC["NumberOfPages"] do
|
|
if LeaPlusLC["Page"..i] then
|
|
LeaPlusLC["Page"..i]:Hide();
|
|
end;
|
|
end
|
|
|
|
-- Hide options panel
|
|
LeaPlusLC["PageF"]:Hide();
|
|
|
|
end
|
|
|
|
-- Find out if Leatrix Plus is showing (main panel or config panel)
|
|
function LeaPlusLC:IsPlusShowing()
|
|
if LeaPlusLC["PageF"]:IsShown() then return true end
|
|
for k, v in pairs(LeaConfigList) do
|
|
if v:IsShown() then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Check if a name is in your friends list, guild or community (does not check realm as realm is unknown for some checks)
|
|
function LeaPlusLC:FriendCheck(name, guid)
|
|
|
|
-- Do nothing if name is empty (such as whispering from the Battle.net app)
|
|
if not name then return end
|
|
|
|
-- Update friends list
|
|
C_FriendList.ShowFriends()
|
|
|
|
-- Remove realm (since we have GUID checking)
|
|
name = strsplit("-", name, 2)
|
|
|
|
-- Check character friends
|
|
for i = 1, C_FriendList.GetNumFriends() do
|
|
-- Return true is character name matches and GUID matches if there is one (realm is not checked)
|
|
local friendInfo = C_FriendList.GetFriendInfoByIndex(i)
|
|
local charFriendName = C_FriendList.GetFriendInfoByIndex(i).name
|
|
charFriendName = strsplit("-", charFriendName, 2)
|
|
if (name == charFriendName) and (guid and (guid == friendInfo.guid) or true) then
|
|
return true
|
|
end
|
|
end
|
|
|
|
-- Check Battle.net friends
|
|
local numfriends = BNGetNumFriends()
|
|
for i = 1, numfriends do
|
|
local numtoons = C_BattleNet.GetFriendNumGameAccounts(i)
|
|
for j = 1, numtoons do
|
|
local gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(i, j)
|
|
local characterName = gameAccountInfo.characterName
|
|
local client = gameAccountInfo.clientProgram
|
|
if client == "WoW" and characterName == name then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Check guild members if guild is enabled (new members may need to press J to refresh roster)
|
|
if LeaPlusLC["FriendlyGuild"] == "On" then
|
|
local gCount = GetNumGuildMembers()
|
|
for i = 1, gCount do
|
|
local gName, void, void, void, void, void, void, void, gOnline, void, void, void, void, gMobile, void, void, gGUID = GetGuildRosterInfo(i)
|
|
if gOnline and not gMobile then
|
|
gName = strsplit("-", gName, 2)
|
|
-- Return true if character name matches including GUID if there is one
|
|
if (name == gName) and (guid and (guid == gGUID) or true) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Check communities if communities is enabled
|
|
if LeaPlusLC["FriendlyCommunities"] == "On" then
|
|
local communities = C_Club.GetSubscribedClubs()
|
|
for void, community in pairs(communities) do
|
|
if community.clubType == Enum.ClubType.Character then
|
|
local cMemberIds = CommunitiesUtil.GetMemberIdsSortedByName(community.clubId)
|
|
local cMembersInfo = CommunitiesUtil.GetMemberInfo(community.clubId, cMemberIds)
|
|
for void, member in pairs(cMembersInfo) do
|
|
if member and member.name and member.presence and member.presence ~= Enum.ClubMemberPresence.Offline and member.presence ~= Enum.ClubMemberPresence.OnlineMobile then
|
|
local cName = strsplit("-", member.name, 2)
|
|
-- Return true if character name matches including GUID if there is one
|
|
if (name == cName) and (guid and member.guid and (guid == member.guid) or true) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L02: Locks
|
|
----------------------------------------------------------------------
|
|
|
|
-- Function to set lock state for configuration buttons
|
|
function LeaPlusLC:LockOption(option, item, reloadreq)
|
|
if reloadreq then
|
|
-- Option change requires UI reload
|
|
if LeaPlusLC[option] ~= LeaPlusDB[option] or LeaPlusLC[option] == "Off" then
|
|
LeaPlusLC:LockItem(LeaPlusCB[item], true)
|
|
else
|
|
LeaPlusLC:LockItem(LeaPlusCB[item], false)
|
|
end
|
|
else
|
|
-- Option change does not require UI reload
|
|
if LeaPlusLC[option] == "Off" then
|
|
LeaPlusLC:LockItem(LeaPlusCB[item], true)
|
|
else
|
|
LeaPlusLC:LockItem(LeaPlusCB[item], false)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Set lock state for configuration buttons
|
|
function LeaPlusLC:SetDim()
|
|
LeaPlusLC:LockOption("AutomateQuests", "AutomateQuestsBtn", false) -- Automate quests
|
|
LeaPlusLC:LockOption("AutoAcceptRes", "AutoAcceptResBtn", false) -- Accept resurrection
|
|
LeaPlusLC:LockOption("AutoReleasePvP", "AutoReleasePvPBtn", false) -- Release in PvP
|
|
LeaPlusLC:LockOption("AutoSellJunk", "AutoSellJunkBtn", true) -- Sell junk automatically
|
|
LeaPlusLC:LockOption("AutoRepairGear", "AutoRepairBtn", false) -- Repair automatically
|
|
LeaPlusLC:LockOption("InviteFromWhisper", "InvWhisperBtn", false) -- Invite from whispers
|
|
LeaPlusLC:LockOption("NoChatButtons", "NoChatButtonsBtn", true) -- Hide chat buttons
|
|
LeaPlusLC:LockOption("SetChatFontSize", "SetChatFontSizeBtn", true) -- Set chat font size
|
|
LeaPlusLC:LockOption("FilterChatMessages", "FilterChatMessagesBtn", true) -- Filter chat messages
|
|
LeaPlusLC:LockOption("MailFontChange", "MailTextBtn", true) -- Resize mail text
|
|
LeaPlusLC:LockOption("QuestFontChange", "QuestTextBtn", true) -- Resize quest text
|
|
LeaPlusLC:LockOption("MinimapModder", "ModMinimapBtn", true) -- Enhance minimap
|
|
LeaPlusLC:LockOption("TipModEnable", "MoveTooltipButton", true) -- Enhance tooltip
|
|
LeaPlusLC:LockOption("EnhanceDressup", "EnhanceDressupBtn", true) -- Enhance dressup
|
|
LeaPlusLC:LockOption("ShowCooldowns", "CooldownsButton", true) -- Show cooldowns
|
|
LeaPlusLC:LockOption("ShowBorders", "ModBordersBtn", true) -- Show borders
|
|
LeaPlusLC:LockOption("ShowPlayerChain", "ModPlayerChain", true) -- Show player chain
|
|
LeaPlusLC:LockOption("ShowWowheadLinks", "ShowWowheadLinksBtn", true) -- Show Wowhead links
|
|
LeaPlusLC:LockOption("ManageWidgetTop", "ManageWidgetTopButton", true) -- Manage widget top
|
|
LeaPlusLC:LockOption("ManageControl", "ManageControlButton", true) -- Manage control
|
|
LeaPlusLC:LockOption("ClassColFrames", "ClassColFramesBtn", true) -- Class colored frames
|
|
LeaPlusLC:LockOption("SetWeatherDensity", "SetWeatherDensityBtn", false) -- Set weather density
|
|
LeaPlusLC:LockOption("MuteGameSounds", "MuteGameSoundsBtn", false) -- Mute game sounds
|
|
LeaPlusLC:LockOption("MuteMountSounds", "MuteMountSoundsBtn", false) -- Mute mount sounds
|
|
LeaPlusLC:LockOption("MuteCustomSounds", "MuteCustomSoundsBtn", false) -- Mute custom sounds
|
|
LeaPlusLC:LockOption("FasterLooting", "FasterLootingBtn", true) -- Faster auto loot
|
|
LeaPlusLC:LockOption("NoTransforms", "NoTransformsBtn", false) -- Remove transforms
|
|
LeaPlusLC:LockOption("SetAddtonOptions", "SetAddtonOptionsBtn", true) -- Set additional options
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L03: Restarts
|
|
----------------------------------------------------------------------
|
|
|
|
-- Set the reload button state
|
|
function LeaPlusLC:ReloadCheck()
|
|
|
|
-- Automation
|
|
if (LeaPlusLC["AutoSellJunk"] ~= LeaPlusDB["AutoSellJunk"]) -- Sell junk automatically
|
|
|
|
-- Chat
|
|
or (LeaPlusLC["UseEasyChatResizing"] ~= LeaPlusDB["UseEasyChatResizing"]) -- Use easy resizing
|
|
or (LeaPlusLC["NoCombatLogTab"] ~= LeaPlusDB["NoCombatLogTab"]) -- Hide the combat log
|
|
or (LeaPlusLC["NoChatButtons"] ~= LeaPlusDB["NoChatButtons"]) -- Hide chat buttons
|
|
or (LeaPlusLC["NoSocialButton"] ~= LeaPlusDB["NoSocialButton"]) -- Hide social button
|
|
or (LeaPlusLC["UnclampChat"] ~= LeaPlusDB["UnclampChat"]) -- Unclamp chat frame
|
|
or (LeaPlusLC["MoveChatEditBoxToTop"] ~= LeaPlusDB["MoveChatEditBoxToTop"]) -- Move editbox to top
|
|
or (LeaPlusLC["SetChatFontSize"] ~= LeaPlusDB["SetChatFontSize"]) -- Set chat font size
|
|
or (LeaPlusLC["NoStickyChat"] ~= LeaPlusDB["NoStickyChat"]) -- Disable sticky chat
|
|
or (LeaPlusLC["UseArrowKeysInChat"] ~= LeaPlusDB["UseArrowKeysInChat"]) -- Use arrow keys in chat
|
|
or (LeaPlusLC["NoChatFade"] ~= LeaPlusDB["NoChatFade"]) -- Disable chat fade
|
|
or (LeaPlusLC["RecentChatWindow"] ~= LeaPlusDB["RecentChatWindow"]) -- Recent chat window
|
|
or (LeaPlusLC["MaxChatHstory"] ~= LeaPlusDB["MaxChatHstory"]) -- Increase chat history
|
|
or (LeaPlusLC["FilterChatMessages"] ~= LeaPlusDB["FilterChatMessages"]) -- Filter chat messages
|
|
or (LeaPlusLC["RestoreChatMessages"] ~= LeaPlusDB["RestoreChatMessages"]) -- Restore chat messages
|
|
|
|
-- Text
|
|
or (LeaPlusLC["HideErrorMessages"] ~= LeaPlusDB["HideErrorMessages"]) -- Hide error messages
|
|
or (LeaPlusLC["NoHitIndicators"] ~= LeaPlusDB["NoHitIndicators"]) -- Hide portrait numbers
|
|
or (LeaPlusLC["HideZoneText"] ~= LeaPlusDB["HideZoneText"]) -- Hide zone text
|
|
or (LeaPlusLC["HideKeybindText"] ~= LeaPlusDB["HideKeybindText"]) -- Hide keybind text
|
|
or (LeaPlusLC["HideMacroText"] ~= LeaPlusDB["HideMacroText"]) -- Hide macro text
|
|
|
|
or (LeaPlusLC["MailFontChange"] ~= LeaPlusDB["MailFontChange"]) -- Resize mail text
|
|
or (LeaPlusLC["QuestFontChange"] ~= LeaPlusDB["QuestFontChange"]) -- Resize quest text
|
|
|
|
-- Interface
|
|
or (LeaPlusLC["MinimapModder"] ~= LeaPlusDB["MinimapModder"]) -- Enhance minimap
|
|
or (LeaPlusLC["SquareMinimap"] ~= LeaPlusDB["SquareMinimap"]) -- Square minimap
|
|
or (LeaPlusLC["HideMiniAddonMenu"] ~= LeaPlusDB["HideMiniAddonMenu"]) -- Hide addon menu
|
|
or (LeaPlusLC["UnclampMinimap"] ~= LeaPlusDB["UnclampMinimap"]) -- Unclamp minimap cluster
|
|
or (LeaPlusLC["CombineAddonButtons"] ~= LeaPlusDB["CombineAddonButtons"]) -- Combine addon buttons
|
|
or (LeaPlusLC["MiniExcludeList"] ~= LeaPlusDB["MiniExcludeList"]) -- Minimap exclude list
|
|
or (LeaPlusLC["TipModEnable"] ~= LeaPlusDB["TipModEnable"]) -- Enhance tooltip
|
|
or (LeaPlusLC["TipNoHealthBar"] ~= LeaPlusDB["TipNoHealthBar"]) -- Tooltip hide health bar
|
|
or (LeaPlusLC["EnhanceDressup"] ~= LeaPlusDB["EnhanceDressup"]) -- Enhance dressup
|
|
or (LeaPlusLC["DressupWiderPreview"] ~= LeaPlusDB["DressupWiderPreview"]) -- Enhance dressup wider character preview
|
|
or (LeaPlusLC["DressupMoreZoomOut"] ~= LeaPlusDB["DressupMoreZoomOut"]) -- Enhance dressup increase zoom out distance
|
|
or (LeaPlusLC["ShowVolume"] ~= LeaPlusDB["ShowVolume"]) -- Show volume slider
|
|
or (LeaPlusLC["ShowCooldowns"] ~= LeaPlusDB["ShowCooldowns"]) -- Show cooldowns
|
|
or (LeaPlusLC["DurabilityStatus"] ~= LeaPlusDB["DurabilityStatus"]) -- Show durability status
|
|
or (LeaPlusLC["ShowPetSaveBtn"] ~= LeaPlusDB["ShowPetSaveBtn"]) -- Show pet save button
|
|
or (LeaPlusLC["ShowRaidToggle"] ~= LeaPlusDB["ShowRaidToggle"]) -- Show raid button
|
|
or (LeaPlusLC["ShowTrainAllButton"] ~= LeaPlusDB["ShowTrainAllButton"]) -- Show train all button
|
|
or (LeaPlusLC["ShowBorders"] ~= LeaPlusDB["ShowBorders"]) -- Show borders
|
|
or (LeaPlusLC["ShowPlayerChain"] ~= LeaPlusDB["ShowPlayerChain"]) -- Show player chain
|
|
or (LeaPlusLC["ShowReadyTimer"] ~= LeaPlusDB["ShowReadyTimer"]) -- Show ready timer
|
|
or (LeaPlusLC["ShowWowheadLinks"] ~= LeaPlusDB["ShowWowheadLinks"]) -- Show Wowhead links
|
|
|
|
-- Frames
|
|
or (LeaPlusLC["ManageWidgetTop"] ~= LeaPlusDB["ManageWidgetTop"]) -- Manage widget top
|
|
or (LeaPlusLC["ManageControl"] ~= LeaPlusDB["ManageControl"]) -- Manage control
|
|
or (LeaPlusLC["ClassColFrames"] ~= LeaPlusDB["ClassColFrames"]) -- Class colored frames
|
|
|
|
or (LeaPlusLC["NoAlerts"] ~= LeaPlusDB["NoAlerts"]) -- Hide alerts
|
|
or (LeaPlusLC["HideBodyguard"] ~= LeaPlusDB["HideBodyguard"]) -- Hide bodyguard gossip
|
|
or (LeaPlusLC["HideTalkingFrame"] ~= LeaPlusDB["HideTalkingFrame"]) -- Hide talking frame
|
|
or (LeaPlusLC["HideCleanupBtns"] ~= LeaPlusDB["HideCleanupBtns"]) -- Hide clean-up buttons
|
|
or (LeaPlusLC["HideBossBanner"] ~= LeaPlusDB["HideBossBanner"]) -- Hide boss banner
|
|
or (LeaPlusLC["HideEventToasts"] ~= LeaPlusDB["HideEventToasts"]) -- Hide event toasts
|
|
or (LeaPlusLC["NoClassBar"] ~= LeaPlusDB["NoClassBar"]) -- Hide stance bar
|
|
or (LeaPlusLC["NoCommandBar"] ~= LeaPlusDB["NoCommandBar"]) -- Hide order hall bar
|
|
or (LeaPlusLC["NoRestedSleep"] ~= LeaPlusDB["NoRestedSleep"]) -- Hide rested sleep
|
|
|
|
-- System
|
|
or (LeaPlusLC["NoRestedEmotes"] ~= LeaPlusDB["NoRestedEmotes"]) -- Silence rested emotes
|
|
or (LeaPlusLC["KeepAudioSynced"] ~= LeaPlusDB["KeepAudioSynced"]) -- Keep audio synced
|
|
or (LeaPlusLC["NoBagAutomation"] ~= LeaPlusDB["NoBagAutomation"]) -- Disable bag automation
|
|
or (LeaPlusLC["NoPetAutomation"] ~= LeaPlusDB["NoPetAutomation"]) -- Disable pet automation
|
|
or (LeaPlusLC["FasterLooting"] ~= LeaPlusDB["FasterLooting"]) -- Faster auto loot
|
|
or (LeaPlusLC["FasterMovieSkip"] ~= LeaPlusDB["FasterMovieSkip"]) -- Faster movie skip
|
|
or (LeaPlusLC["CombatPlates"] ~= LeaPlusDB["CombatPlates"]) -- Combat plates
|
|
or (LeaPlusLC["EasyItemDestroy"] ~= LeaPlusDB["EasyItemDestroy"]) -- Easy item destroy
|
|
or (LeaPlusLC["SetAddtonOptions"] ~= LeaPlusDB["SetAddtonOptions"]) -- Set additional options
|
|
or (LeaPlusLC["AddOptNoCombatBox"] ~= LeaPlusDB["AddOptNoCombatBox"]) -- Uncheck combat animation checkbox
|
|
or (LeaPlusLC["AddOptNoMountBox"] ~= LeaPlusDB["AddOptNoMountBox"]) -- Uncheck mount special animation checkbox
|
|
|
|
then
|
|
-- Enable the reload button
|
|
LeaPlusLC:LockItem(LeaPlusCB["ReloadUIButton"], false)
|
|
LeaPlusCB["ReloadUIButton"].f:Show()
|
|
else
|
|
-- Disable the reload button
|
|
LeaPlusLC:LockItem(LeaPlusCB["ReloadUIButton"], true)
|
|
LeaPlusCB["ReloadUIButton"].f:Hide()
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L40: Player
|
|
----------------------------------------------------------------------
|
|
|
|
function LeaPlusLC:Player()
|
|
|
|
----------------------------------------------------------------------
|
|
-- Set additional options
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["SetAddtonOptions"] == "On" then
|
|
|
|
-- Create scrolling configuration panel
|
|
local addOptPanel = LeaPlusLC:CreatePanel("Set additional options", "addOptPanel", true)
|
|
|
|
-- Initialise row count
|
|
local row = -1
|
|
|
|
-- Add checkboxes
|
|
row = row + 2; LeaPlusLC:MakeTx(addOptPanel.scrollChild, "Trading post", 16, -((row - 1) * 20) - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(addOptPanel.scrollChild, "AddOptNoCombatBox", "Uncheck combat animation checkbox", 16, -((row - 1) * 20) - 2, true, "If checked, the trading post combat animation checkbox will be unchecked by default.")
|
|
row = row + 1; LeaPlusLC:MakeCB(addOptPanel.scrollChild, "AddOptNoMountBox", "Uncheck mount special animation checkbox", 16, -((row - 1) * 20) - 2, true, "If checked, the mount special animation checkbox will be unchecked by default.")
|
|
|
|
-- Help button hidden
|
|
addOptPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
addOptPanel.b:SetScript("OnClick", function()
|
|
addOptPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page7"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
addOptPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Refresh panel
|
|
addOptPanel:Hide(); addOptPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Reset button hidden
|
|
addOptPanel.r:Hide()
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["SetAddtonOptionsBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
else
|
|
addOptPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Run options on startup
|
|
do
|
|
|
|
-- Uncheck combat animation checkbox
|
|
if LeaPlusLC["AddOptNoCombatBox"] == "On" then
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_PerksProgram", function()
|
|
hooksecurefunc(PerksProgramFrame.FooterFrame.ToggleAttackAnimation, "SetChecked", function(self)
|
|
if self:GetChecked() then self:Click() end
|
|
end)
|
|
end)
|
|
end
|
|
|
|
-- Uncheck mount special animation checkbox
|
|
if LeaPlusLC["AddOptNoMountBox"] == "On" then
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_PerksProgram", function()
|
|
hooksecurefunc(PerksProgramFrame.FooterFrame.ToggleMountSpecial, "SetChecked", function(self)
|
|
if self:GetChecked() then
|
|
self:Click()
|
|
PerksProgramFrame:SetMountSpecialPreviewOnClick(false)
|
|
RunNextFrame(function()
|
|
PerksProgramFrame:SetMountSpecialPreviewOnClick(false)
|
|
end)
|
|
end
|
|
end)
|
|
end)
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Block requested invites (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function()
|
|
if LeaPlusLC["NoRequestedInvites"] == "On" then
|
|
local groupInvitePopUp = StaticPopup_FindVisible("GROUP_INVITE_CONFIRMATION")
|
|
if groupInvitePopUp and groupInvitePopUp.data then
|
|
local void, name, guid = GetInviteConfirmationInfo(groupInvitePopUp.data)
|
|
if LeaPlusLC:FriendCheck(name, guid) then
|
|
return
|
|
else
|
|
-- If not a friend, decline
|
|
RespondToInviteConfirmation(groupInvitePopUp.data, false)
|
|
StaticPopup_Hide("GROUP_INVITE_CONFIRMATION")
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["NoRequestedInvites"] == "On" then
|
|
frame:RegisterEvent("GROUP_INVITE_CONFIRMATION")
|
|
else
|
|
frame:UnregisterEvent("GROUP_INVITE_CONFIRMATION")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["NoRequestedInvites"] == "On" then SetEvent() end
|
|
LeaPlusCB["NoRequestedInvites"]:HookScript("OnClick", SetEvent)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Block friend requests (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to decline friend requests
|
|
local function DeclineReqs()
|
|
if LeaPlusLC["NoFriendRequests"] == "On" then
|
|
for i = BNGetNumFriendInvites(), 1, -1 do
|
|
local id, player = BNGetFriendInviteInfo(i)
|
|
if id and player then
|
|
BNDeclineFriendInvite(id)
|
|
C_Timer.After(0.1, function()
|
|
LeaPlusLC:Print(L["A friend request from"] .. " " .. player .. " " .. L["was automatically declined."])
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Event frame for incoming friend requests
|
|
local DecEvt = CreateFrame("FRAME")
|
|
DecEvt:SetScript("OnEvent", DeclineReqs)
|
|
|
|
-- Function to register or unregister the event
|
|
local function ControlEvent()
|
|
if LeaPlusLC["NoFriendRequests"] == "On" then
|
|
DecEvt:RegisterEvent("BN_FRIEND_INVITE_ADDED")
|
|
DeclineReqs()
|
|
else
|
|
DecEvt:UnregisterEvent("BN_FRIEND_INVITE_ADDED")
|
|
end
|
|
end
|
|
|
|
-- Set event status when option is clicked and on startup
|
|
LeaPlusCB["NoFriendRequests"]:HookScript("OnClick", ControlEvent)
|
|
ControlEvent()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Block duels (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Handler for event
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function(self, event, arg1)
|
|
if not LeaPlusLC:FriendCheck(arg1) then
|
|
CancelDuel()
|
|
StaticPopup_Hide("DUEL_REQUESTED")
|
|
return
|
|
end
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["NoDuelRequests"] == "On" then
|
|
frame:RegisterEvent("DUEL_REQUESTED")
|
|
else
|
|
frame:UnregisterEvent("DUEL_REQUESTED")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["NoDuelRequests"] == "On" then SetEvent() end
|
|
LeaPlusCB["NoDuelRequests"]:HookScript("OnClick", SetEvent)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Block pet battle duels (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Handler for event
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function(self, event, arg1)
|
|
if not LeaPlusLC:FriendCheck(arg1) then
|
|
C_PetBattles.CancelPVPDuel()
|
|
return
|
|
end
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["NoPetDuels"] == "On" then
|
|
frame:RegisterEvent("PET_BATTLE_PVP_DUEL_REQUESTED")
|
|
else
|
|
frame:UnregisterEvent("PET_BATTLE_PVP_DUEL_REQUESTED")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["NoPetDuels"] == "On" then SetEvent() end
|
|
LeaPlusCB["NoPetDuels"]:HookScript("OnClick", SetEvent)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Queue from friends (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set option
|
|
local function RoleFunc()
|
|
if LeaPlusLC["AutoConfirmRole"] == "On" then
|
|
LFDRoleCheckPopupAcceptButton:SetScript("OnShow", function()
|
|
local leader, leaderGUID = "", ""
|
|
for i = 1, GetNumSubgroupMembers() do
|
|
if UnitIsGroupLeader("party" .. i) then
|
|
leader = UnitName("party" .. i)
|
|
leaderGUID = UnitGUID("party" .. i)
|
|
break
|
|
end
|
|
end
|
|
if LeaPlusLC:FriendCheck(leader, leaderGUID) then
|
|
LFDRoleCheckPopupAcceptButton:Click()
|
|
end
|
|
end)
|
|
else
|
|
LFDRoleCheckPopupAcceptButton:SetScript("OnShow", nil)
|
|
end
|
|
end
|
|
|
|
-- Set option on startup if enabled and when option is clicked
|
|
if LeaPlusLC["AutoConfirmRole"] == "On" then RoleFunc() end
|
|
LeaPlusCB["AutoConfirmRole"]:HookScript("OnClick", RoleFunc)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Invite from whispers (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function(self, event, arg1, arg2, ...)
|
|
if (not UnitExists("party1") or UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) and strlower(strtrim(arg1)) == strlower(LeaPlusLC["InvKey"]) then
|
|
if not LeaPlusLC:IsInLFGQueue() then
|
|
if event == "CHAT_MSG_WHISPER" then
|
|
local void, void, void, void, viod, void, void, void, void, guid = ...
|
|
if LeaPlusLC:FriendCheck(arg2, guid) or LeaPlusLC["InviteFriendsOnly"] == "Off" then
|
|
-- If whisper name is same realm, remove realm name
|
|
local theWhisperName, theWhisperRealm = strsplit("-", arg2, 2)
|
|
if theWhisperRealm then
|
|
local void, theCharRealm = UnitFullName("player")
|
|
if theCharRealm then
|
|
if theWhisperRealm == theCharRealm then arg2 = theWhisperName end
|
|
end
|
|
end
|
|
|
|
-- Invite whisper player
|
|
C_PartyInfo.InviteUnit(arg2)
|
|
end
|
|
elseif event == "CHAT_MSG_BN_WHISPER" then
|
|
local presenceID = select(11, ...)
|
|
if presenceID and BNIsFriend(presenceID) then
|
|
local index = BNGetFriendIndex(presenceID)
|
|
if index then
|
|
local accountInfo = C_BattleNet.GetFriendAccountInfo(index)
|
|
local gameAccountInfo = accountInfo.gameAccountInfo
|
|
local gameAccountID = gameAccountInfo.gameAccountID
|
|
if gameAccountID then
|
|
BNInviteFriend(gameAccountID)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["InviteFromWhisper"] == "On" then
|
|
frame:RegisterEvent("CHAT_MSG_WHISPER")
|
|
frame:RegisterEvent("CHAT_MSG_BN_WHISPER")
|
|
else
|
|
frame:UnregisterEvent("CHAT_MSG_WHISPER")
|
|
frame:UnregisterEvent("CHAT_MSG_BN_WHISPER")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["InviteFromWhisper"] == "On" then SetEvent() end
|
|
LeaPlusCB["InviteFromWhisper"]:HookScript("OnClick", SetEvent)
|
|
|
|
-- Create configuration panel
|
|
local InvPanel = LeaPlusLC:CreatePanel("Invite from whispers", "InvPanel")
|
|
|
|
-- Add editbox
|
|
LeaPlusLC:MakeTx(InvPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(InvPanel, "InviteFriendsOnly", "Restrict to friends", 16, -92, false, "If checked, group invites will only be sent to friends.|n|nIf unchecked, group invites will be sent to everyone.")
|
|
|
|
LeaPlusLC:MakeTx(InvPanel, "Keyword", 356, -72)
|
|
local KeyBox = LeaPlusLC:CreateEditBox("KeyBox", InvPanel, 140, 10, "TOPLEFT", 356, -92, "KeyBox", "KeyBox")
|
|
|
|
-- Function to show the keyword in the option tooltip
|
|
local function SetKeywordTip()
|
|
LeaPlusCB["InviteFromWhisper"].tiptext = gsub(LeaPlusCB["InviteFromWhisper"].tiptext, "(|cffffffff)[^|]*(|r)", "%1" .. LeaPlusLC["InvKey"] .. "%2")
|
|
end
|
|
|
|
-- Function to save the keyword
|
|
local function SetInvKey()
|
|
local keytext = KeyBox:GetText()
|
|
if keytext and keytext ~= "" then
|
|
LeaPlusLC["InvKey"] = strtrim(KeyBox:GetText())
|
|
else
|
|
LeaPlusLC["InvKey"] = "inv"
|
|
end
|
|
-- Show the keyword in the option tooltip
|
|
SetKeywordTip()
|
|
end
|
|
|
|
-- Show the keyword in the option tooltip on startup
|
|
SetKeywordTip()
|
|
|
|
-- Save the keyword when it changes
|
|
KeyBox:SetScript("OnTextChanged", SetInvKey)
|
|
|
|
-- Refresh editbox with trimmed keyword when edit focus is lost (removes additional spaces)
|
|
KeyBox:SetScript("OnEditFocusLost", function()
|
|
KeyBox:SetText(LeaPlusLC["InvKey"])
|
|
end)
|
|
|
|
-- Help button hidden
|
|
InvPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
InvPanel.b:SetScript("OnClick", function()
|
|
-- Save the keyword
|
|
SetInvKey()
|
|
-- Show the options panel
|
|
InvPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page2"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Add reset button
|
|
InvPanel.r:SetScript("OnClick", function()
|
|
-- Settings
|
|
LeaPlusLC["InviteFriendsOnly"] = "Off"
|
|
-- Reset the keyword to default
|
|
LeaPlusLC["InvKey"] = "inv"
|
|
-- Set the editbox to default
|
|
KeyBox:SetText("inv")
|
|
-- Save the keyword
|
|
SetInvKey()
|
|
-- Refresh panel
|
|
InvPanel:Hide(); InvPanel:Show()
|
|
end)
|
|
|
|
-- Ensure keyword is a string on startup
|
|
LeaPlusLC["InvKey"] = tostring(LeaPlusLC["InvKey"]) or "inv"
|
|
|
|
-- Set editbox value when shown
|
|
KeyBox:HookScript("OnShow", function()
|
|
KeyBox:SetText(LeaPlusLC["InvKey"])
|
|
end)
|
|
|
|
-- Configuration button handler
|
|
LeaPlusCB["InvWhisperBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["InviteFriendsOnly"] = "On"
|
|
LeaPlusLC["InvKey"] = "inv"
|
|
KeyBox:SetText(LeaPlusLC["InvKey"])
|
|
SetInvKey()
|
|
else
|
|
-- Show panel
|
|
InvPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Party from friends (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function(self, event, arg1, ...)
|
|
|
|
-- If a friend, accept if you're accepting friends and not queued
|
|
local void, void, void, void, void, guid = ...
|
|
if (LeaPlusLC["AcceptPartyFriends"] == "On" and LeaPlusLC:FriendCheck(arg1, guid)) then
|
|
if not LeaPlusLC:IsInLFGQueue() then
|
|
AcceptGroup()
|
|
for i=1, STATICPOPUP_NUMDIALOGS do
|
|
if _G["StaticPopup"..i].which == "PARTY_INVITE" then
|
|
_G["StaticPopup"..i].inviteAccepted = 1
|
|
StaticPopup_Hide("PARTY_INVITE")
|
|
break
|
|
elseif _G["StaticPopup"..i].which == "PARTY_INVITE_XREALM" then
|
|
_G["StaticPopup"..i].inviteAccepted = 1
|
|
StaticPopup_Hide("PARTY_INVITE_XREALM")
|
|
break
|
|
end
|
|
end
|
|
-- Confirm invite to party sync group request
|
|
if QuestSessionManager.ConfirmInviteToGroupReceivedDialog.ButtonContainer.Confirm:IsShown() then
|
|
QuestSessionManager.ConfirmInviteToGroupReceivedDialog.ButtonContainer.Confirm:Click()
|
|
end
|
|
return
|
|
end
|
|
end
|
|
return
|
|
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["AcceptPartyFriends"] == "On" then
|
|
frame:RegisterEvent("PARTY_INVITE_REQUEST")
|
|
else
|
|
frame:UnregisterEvent("PARTY_INVITE_REQUEST")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["AcceptPartyFriends"] == "On" then SetEvent() end
|
|
LeaPlusCB["AcceptPartyFriends"]:HookScript("OnClick", SetEvent)
|
|
|
|
end
|
|
----------------------------------------------------------------------
|
|
-- Block party invites (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function(self, event, arg1, ...)
|
|
-- If not a friend and you're blocking invites, decline
|
|
local void, void, void, void, void, guid = ...
|
|
if LeaPlusLC["NoPartyInvites"] == "On" then
|
|
if LeaPlusLC:FriendCheck(arg1, guid) then
|
|
return
|
|
else
|
|
DeclineGroup()
|
|
StaticPopup_Hide("PARTY_INVITE")
|
|
StaticPopup_Hide("PARTY_INVITE_XREALM")
|
|
-- Decline invite to party sync group request
|
|
if QuestSessionManager.ConfirmInviteToGroupReceivedDialog.ButtonContainer.Decline:IsShown() then
|
|
QuestSessionManager.ConfirmInviteToGroupReceivedDialog.ButtonContainer.Decline:Click()
|
|
end
|
|
return
|
|
end
|
|
end
|
|
return
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["NoPartyInvites"] == "On" then
|
|
frame:RegisterEvent("PARTY_INVITE_REQUEST")
|
|
else
|
|
frame:UnregisterEvent("PARTY_INVITE_REQUEST")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["NoPartyInvites"] == "On" then SetEvent() end
|
|
LeaPlusCB["NoPartyInvites"]:HookScript("OnClick", SetEvent)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Automatic summon (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Event function
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function(self, event, arg1)
|
|
if not UnitAffectingCombat("player") then
|
|
local sName = C_SummonInfo.GetSummonConfirmSummoner()
|
|
local sLocation = C_SummonInfo.GetSummonConfirmAreaName()
|
|
LeaPlusLC:Print(L["The summon from"] .. " " .. sName .. " (" .. sLocation .. ") " .. L["will be automatically accepted in 10 seconds unless cancelled."])
|
|
C_Timer.After(10, function()
|
|
local sNameNew = C_SummonInfo.GetSummonConfirmSummoner()
|
|
local sLocationNew = C_SummonInfo.GetSummonConfirmAreaName()
|
|
if sName == sNameNew and sLocation == sLocationNew then
|
|
-- Automatically accept summon after 10 seconds if summoner name and location have not changed
|
|
C_SummonInfo.ConfirmSummon()
|
|
StaticPopup_Hide("CONFIRM_SUMMON")
|
|
end
|
|
end)
|
|
end
|
|
return
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["AutoAcceptSummon"] == "On" then
|
|
frame:RegisterEvent("CONFIRM_SUMMON")
|
|
else
|
|
frame:UnregisterEvent("CONFIRM_SUMMON")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["AutoAcceptSummon"] == "On" then SetEvent() end
|
|
LeaPlusCB["AutoAcceptSummon"]:HookScript("OnClick", SetEvent)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Disable loot warnings (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", function(self, event, arg1, arg2, ...)
|
|
|
|
-- Disable warnings for attempting to roll Need or Disenchant on loot
|
|
if event == "CONFIRM_LOOT_ROLL" or event == "CONFIRM_DISENCHANT_ROLL" then
|
|
ConfirmLootRoll(arg1, arg2)
|
|
StaticPopup_Hide("CONFIRM_LOOT_ROLL")
|
|
return
|
|
end
|
|
|
|
-- Disable warning for attempting to loot a Bind on Pickup item
|
|
if event == "LOOT_BIND_CONFIRM" then
|
|
ConfirmLootSlot(arg1, arg2)
|
|
StaticPopup_Hide("LOOT_BIND",...)
|
|
return
|
|
end
|
|
|
|
-- Disable warning for attempting to vendor an item within its refund window
|
|
if event == "MERCHANT_CONFIRM_TRADE_TIMER_REMOVAL" then
|
|
SellCursorItem()
|
|
return
|
|
end
|
|
|
|
-- Disable warning for attempting to mail an item within its refund window
|
|
if event == "MAIL_LOCK_SEND_ITEMS" then
|
|
RespondMailLockSendItem(arg1, true)
|
|
return
|
|
end
|
|
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetEvent()
|
|
if LeaPlusLC["NoConfirmLoot"] == "On" then
|
|
frame:RegisterEvent("CONFIRM_LOOT_ROLL")
|
|
frame:RegisterEvent("CONFIRM_DISENCHANT_ROLL")
|
|
frame:RegisterEvent("LOOT_BIND_CONFIRM")
|
|
frame:RegisterEvent("MERCHANT_CONFIRM_TRADE_TIMER_REMOVAL")
|
|
frame:RegisterEvent("MAIL_LOCK_SEND_ITEMS")
|
|
else
|
|
frame:UnregisterEvent("CONFIRM_LOOT_ROLL")
|
|
frame:UnregisterEvent("CONFIRM_DISENCHANT_ROLL")
|
|
frame:UnregisterEvent("LOOT_BIND_CONFIRM")
|
|
frame:UnregisterEvent("MERCHANT_CONFIRM_TRADE_TIMER_REMOVAL")
|
|
frame:UnregisterEvent("MAIL_LOCK_SEND_ITEMS")
|
|
end
|
|
end
|
|
|
|
-- Set event on startup if enabled and when option is clicked
|
|
if LeaPlusLC["NoConfirmLoot"] == "On" then SetEvent() end
|
|
LeaPlusCB["NoConfirmLoot"]:HookScript("OnClick", SetEvent)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Mute mount sounds (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Get mute table
|
|
local mountTable = Leatrix_Plus["mountTable"]
|
|
|
|
-- Give table file level scope (its used during logout and for wipe and admin commands)
|
|
LeaPlusLC["mountTable"] = mountTable
|
|
|
|
-- Load saved settings or set default values
|
|
for k, v in pairs(mountTable) do
|
|
if LeaPlusDB[k] and type(LeaPlusDB[k]) == "string" and LeaPlusDB[k] == "On" or LeaPlusDB[k] == "Off" then
|
|
LeaPlusLC[k] = LeaPlusDB[k]
|
|
else
|
|
LeaPlusLC[k] = "Off"
|
|
LeaPlusDB[k] = "Off"
|
|
end
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local MountPanel = LeaPlusLC:CreatePanel("Mute mount sounds", "MountPanel")
|
|
|
|
-- Add checkboxes
|
|
LeaPlusLC:MakeTx(MountPanel, "Mounts", 16, -72)
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteAerials", "Aerials", 16, -92, false, "If checked, jet aerial units will be quieter.|n|nThis applies to Aerial Unit R-21X and Rustbolt Resistor.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteAirships", "Airships", 16, -112, false, "If checked, airships will be muted.|n|nThis applies to airship mounts and transports.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteBikes", "Bikes", 16, -132, false, "If checked, most of the bike mount sounds will be muted.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteBrooms", "Brooms", 16, -152, false, "If checked, broom mounts will be muted.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteDragonriding", "Dragonriding", 16, -172, false, "If checked, dragonriding mounts will be quieter.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteFish", "Fish", 16, -192, false, "If checked, fish mounts will be quieter.|n|nThis applies to Wondrous Wavewhisker.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteFurlines", "Furlines", 16, -212, false, "If checked, furlines will be muted.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteGyrocopters", "Gyrocopters", 16, -232, false, "If checked, gyrocopters will be muted.|n|nThis applies to Mimiron's Head, Mecha-Mogul MK2 and other gyrocopter mounts.|n|nEnabling this option will also mute airplane gear shift sounds.")
|
|
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteHovercraft", "Hovercraft", 150, -92, false, "If checked, hovercraft will be quieter.|n|nThis applies to Xiwyllag ATV.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteLunarwing", "Lunarwing", 150, -112, false, "If checked, Archdruid's Lunarwing Form will be quieter.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteMechSteps", "Mechsteps", 150, -132, false, "If checked, footsteps for mechanical mounts will be muted.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteStriders", "Mechstriders", 150, -152, false, "If checked, mechanostriders will be quieter.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteMechsuits", "Mechsuits", 150, -172, false, "If checked, mechsuits will be quieter.|n|nThis applies to Felsteel Annihilator, Lightforged Warframe, Sky Golem and other mechsuits.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteOttuks", "Ottuks", 150, -192, false, "If checked, ottuks will be quieter.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MutePanthers", "Panthers", 150, -212, false, "If checked, the jewelcrafting panther mounts will be quieter.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteRabbits", "Rabbits", 150, -232, false, "If checked, divine rabbit mounts will be quieter.|n|nThis applies to Jade, Bright Foreseer.")
|
|
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteRazorwings", "Razorwings", 284, -92, false, "If checked, razorwings will be muted.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteRockets", "Rockets", 284, -112, false, "If checked, rockets will be muted.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteSoulEaters", "Soul Eaters", 284, -132, false, "If checked, Gladiator Soul Eater mounts will be quieter.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteSoulseekers", "Soulseekers", 284, -152, false, "If checked, soulseekers will be quieter.|n|nThis applies to Corridor Creeper, Mawsworn Soulhunter and Bound Shadehound.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteTravelers", "Travelers", 284, -172, false, "If checked, traveling merchant greetings and farewells will be muted.|n|nThis applies to Traveler's Tundra Mammoth, Grand Expedition Yak and Mighty Caravan Brutosaur.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteUnicorns", "Unicorns", 284, -192, false, "If checked, unicorns will be quieter.|n|nThis applies to Lucid Nightmare, Wild Dreamrunner, Pureheart Courser and other unicorn mounts.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteZeppelins", "Zeppelins", 284, -212, false, "If checked, zeppelins will be muted.|n|nThis applies to zeppelin mounts and transports.")
|
|
|
|
LeaPlusLC:MakeTx(MountPanel, "Specific", 418, -72)
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteBanLu", "Ban-Lu", 418, -92, false, "If checked, Ban-Lu will no longer talk to you.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteSoar", "Soar", 418, -112, false, "If checked, Soar (Dracthyr) will be quieter.")
|
|
LeaPlusLC:MakeCB(MountPanel, "MuteTempest", "Tempest", 418, -132, false, "If checked, the Coldflame Tempest mount will be quieter.")
|
|
|
|
-- Set click width for sounds checkboxes
|
|
for k, v in pairs(mountTable) do
|
|
LeaPlusCB[k].f:SetWidth(90)
|
|
if LeaPlusCB[k].f:GetStringWidth() > 90 then
|
|
LeaPlusCB[k]:SetHitRectInsets(0, -80, 0, 0)
|
|
else
|
|
LeaPlusCB[k]:SetHitRectInsets(0, -LeaPlusCB[k].f:GetStringWidth() + 4, 0, 0)
|
|
end
|
|
end
|
|
|
|
-- Function to mute and unmute sounds
|
|
local function SetupMute()
|
|
for k, v in pairs(mountTable) do
|
|
if LeaPlusLC["MuteMountSounds"] == "On" and LeaPlusLC[k] == "On" then
|
|
for i, e in pairs(v) do
|
|
local file, soundID = e:match("([^,]+)%#([^,]+)")
|
|
MuteSoundFile(soundID)
|
|
end
|
|
else
|
|
for i, e in pairs(v) do
|
|
local file, soundID = e:match("([^,]+)%#([^,]+)")
|
|
UnmuteSoundFile(soundID)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Setup mute on startup if option is enabled
|
|
if LeaPlusLC["MuteMountSounds"] == "On" then SetupMute() end
|
|
|
|
-- Mute sounds when UNIT_FACTION is loaded (required for Soar)
|
|
local delayMute = CreateFrame("FRAME")
|
|
delayMute:RegisterEvent("UNIT_FACTION")
|
|
delayMute:SetScript("OnEvent", function() if LeaPlusLC["MuteMountSounds"] == "On" then SetupMute() end end)
|
|
|
|
-- Setup mute when options are clicked
|
|
for k, v in pairs(mountTable) do
|
|
LeaPlusCB[k]:HookScript("OnClick", SetupMute)
|
|
end
|
|
LeaPlusCB["MuteMountSounds"]:HookScript("OnClick", SetupMute)
|
|
|
|
-- Help button hidden
|
|
MountPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
MountPanel.b:SetScript("OnClick", function()
|
|
MountPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page7"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
MountPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
for k, v in pairs(mountTable) do
|
|
LeaPlusLC[k] = "Off"
|
|
end
|
|
SetupMute()
|
|
|
|
-- Refresh panel
|
|
MountPanel:Hide(); MountPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["MuteMountSoundsBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
for k, v in pairs(mountTable) do
|
|
LeaPlusLC[k] = "On"
|
|
end
|
|
SetupMute()
|
|
else
|
|
MountPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Mute game sounds (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Get mute table
|
|
local muteTable = Leatrix_Plus["muteTable"]
|
|
|
|
-- Give table file level scope (its used during logout and for wipe and admin commands)
|
|
LeaPlusLC["muteTable"] = muteTable
|
|
|
|
-- Load saved settings or set default values
|
|
for k, v in pairs(muteTable) do
|
|
if LeaPlusDB[k] and type(LeaPlusDB[k]) == "string" and LeaPlusDB[k] == "On" or LeaPlusDB[k] == "Off" then
|
|
LeaPlusLC[k] = LeaPlusDB[k]
|
|
else
|
|
LeaPlusLC[k] = "Off"
|
|
LeaPlusDB[k] = "Off"
|
|
end
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local SoundPanel = LeaPlusLC:CreatePanel("Mute game sounds", "SoundPanel")
|
|
|
|
-- Add checkboxes
|
|
LeaPlusLC:MakeTx(SoundPanel, "General", 16, -72)
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteChimes", "Chimes", 16, -92, false, "If checked, clock hourly chimes will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteEvents", "Events", 16, -112, false, "If checked, holiday event sounds will be muted.|n|nThis applies to Headless Horseman.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteFizzle", "Fizzle", 16, -132, false, "If checked, the spell fizzle sounds will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteInterface", "Interface", 16, -152, false, "If checked, the interface button sound, the chat frame tab click sound and the game menu toggle sound will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteLogin", "Login", 16, -172, false, "If checked, login screen sounds will be muted when you logout of the game.|n|nNote that login screen sounds will not be muted when you initially launch the game.|n|nThey will only be muted when you logout of the game. This includes manually logging out as well as being forcefully logged out by the game server for reasons such as being away for an extended period of time.|n|nNo more dragons roaring when you fall asleep while the game is running!")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteReady", "Ready", 16, -192, false, "If checked, the ready check sound will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteSniffing", "Sniffing", 16, -212, false, "If checked, the worgen sniffing sounds will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteTrains", "Trains", 16, -232, false, "If checked, train sounds will be muted.")
|
|
|
|
LeaPlusLC:MakeTx(SoundPanel, "General", 150, -72)
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteVaults", "Vaults", 150, -92, false, "If checked, the mechanical guild vault idle sound will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteVigor", "Vigor", 150, -112, false, "If checked, the dragonriding vigor recharging sound will be muted.")
|
|
|
|
LeaPlusLC:MakeTx(SoundPanel, "Pets", 150, -152)
|
|
LeaPlusLC:MakeCB(SoundPanel, "MutePierre", "Pierre", 150, -172, false, "If checked, Pierre will be quieter.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteSunflower", "Sunflower", 150, -192, false, "If checked, the Singing Sunflower pet will be muted.")
|
|
|
|
LeaPlusLC:MakeTx(SoundPanel, "Toys", 284, -72)
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteAnima", "Anima", 284, -92, false, "If checked, the Experimental Anima Cell toy will be quieter.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteBalls", "Balls", 284, -112, false, "If checked, the Foot Ball sounds will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteHarp", "Harp", 284, -132, false, "If checked, the Fae Harp toy will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteMeerah", "Meerah", 284, -152, false, "If checked, Meerah's Jukebox wil be muted.")
|
|
|
|
LeaPlusLC:MakeTx(SoundPanel, "Combat", 284, -192)
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteArena", "Arena", 284, -212, false, "If checked, arena announcers will be muted.")
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteBattleShouts", "Shouts", 284, -232, false, "If checked, your character will not shout and wail during combat.")
|
|
|
|
LeaPlusLC:MakeTx(SoundPanel, "Misc", 418, -72)
|
|
LeaPlusLC:MakeCB(SoundPanel, "MuteDucks", "Ducks", 418, -92, false, "If checked, duck greetings will be muted.|n|nUse this if you like to do your Valdrakken banking in peace.")
|
|
|
|
-- Set click width for sounds checkboxes
|
|
for k, v in pairs(muteTable) do
|
|
LeaPlusCB[k].f:SetWidth(90)
|
|
if LeaPlusCB[k].f:GetStringWidth() > 90 then
|
|
LeaPlusCB[k]:SetHitRectInsets(0, -80, 0, 0)
|
|
else
|
|
LeaPlusCB[k]:SetHitRectInsets(0, -LeaPlusCB[k].f:GetStringWidth() + 4, 0, 0)
|
|
end
|
|
end
|
|
|
|
-- Function to mute and unmute sounds
|
|
local function SetupMute()
|
|
for k, v in pairs(muteTable) do
|
|
if LeaPlusLC["MuteGameSounds"] == "On" and LeaPlusLC[k] == "On" then
|
|
for i, e in pairs(v) do
|
|
local file, soundID = e:match("([^,]+)%#([^,]+)")
|
|
MuteSoundFile(soundID)
|
|
end
|
|
else
|
|
for i, e in pairs(v) do
|
|
local file, soundID = e:match("([^,]+)%#([^,]+)")
|
|
UnmuteSoundFile(soundID)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Setup mute on startup if option is enabled
|
|
if LeaPlusLC["MuteGameSounds"] == "On" then SetupMute() end
|
|
|
|
-- Setup mute when options are clicked
|
|
for k, v in pairs(muteTable) do
|
|
LeaPlusCB[k]:HookScript("OnClick", SetupMute)
|
|
end
|
|
LeaPlusCB["MuteGameSounds"]:HookScript("OnClick", SetupMute)
|
|
|
|
-- Help button hidden
|
|
SoundPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
SoundPanel.b:SetScript("OnClick", function()
|
|
SoundPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page7"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
SoundPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
for k, v in pairs(muteTable) do
|
|
LeaPlusLC[k] = "Off"
|
|
end
|
|
SetupMute()
|
|
|
|
-- Refresh panel
|
|
SoundPanel:Hide(); SoundPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["MuteGameSoundsBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
for k, v in pairs(muteTable) do
|
|
LeaPlusLC[k] = "On"
|
|
end
|
|
LeaPlusLC["MuteReady"] = "Off"
|
|
LeaPlusLC["MuteVigor"] = "Off"
|
|
SetupMute()
|
|
else
|
|
SoundPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Login setting
|
|
----------------------------------------------------------------------
|
|
|
|
-- Handle sounds that get muted or unmuted when logging out
|
|
local muteLogoutTable = Leatrix_Plus["muteLogoutTable"]
|
|
local logoutEvent = CreateFrame("FRAME")
|
|
logoutEvent:RegisterEvent("PLAYER_LOGOUT")
|
|
|
|
-- Mute or unmute sounds when logging out
|
|
logoutEvent:SetScript("OnEvent", function()
|
|
if LeaPlusLC["MuteGameSounds"] == "On" and LeaPlusLC["MuteLogin"] == "On" then
|
|
-- Mute logout table sounds on logout
|
|
for void, soundID in pairs(muteLogoutTable) do
|
|
MuteSoundFile(soundID)
|
|
end
|
|
else
|
|
-- Unmute logout table sounds on logout
|
|
for void, soundID in pairs(muteLogoutTable) do
|
|
UnmuteSoundFile(soundID)
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Unmute sounds when logging in
|
|
for void, soundID in pairs(muteLogoutTable) do
|
|
UnmuteSoundFile(soundID)
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Faster movie skip
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["FasterMovieSkip"] == "On" then
|
|
|
|
-- Allow space bar, escape key and enter key to cancel cinematic without confirmation
|
|
CinematicFrame:HookScript("OnKeyDown", function(self, key)
|
|
if key == "ESCAPE" then
|
|
if CinematicFrame:IsShown() and CinematicFrame.closeDialog and CinematicFrameCloseDialogConfirmButton then
|
|
CinematicFrameCloseDialog:Hide()
|
|
end
|
|
end
|
|
end)
|
|
CinematicFrame:HookScript("OnKeyUp", function(self, key)
|
|
if key == "SPACE" or key == "ESCAPE" or key == "ENTER" then
|
|
if CinematicFrame:IsShown() and CinematicFrame.closeDialog and CinematicFrameCloseDialogConfirmButton then
|
|
CinematicFrameCloseDialogConfirmButton:Click()
|
|
end
|
|
end
|
|
end)
|
|
MovieFrame:HookScript("OnKeyUp", function(self, key)
|
|
if key == "SPACE" or key == "ESCAPE" or key == "ENTER" then
|
|
if MovieFrame:IsShown() and MovieFrame.CloseDialog and MovieFrame.CloseDialog.ConfirmButton then
|
|
MovieFrame.CloseDialog.ConfirmButton:Click()
|
|
end
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Wowhead Links
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowWowheadLinks"] == "On" then
|
|
|
|
-- Create configuration panel
|
|
local WowheadPanel = LeaPlusLC:CreatePanel("Show Wowhead links", "WowheadPanel")
|
|
|
|
LeaPlusLC:MakeTx(WowheadPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(WowheadPanel, "WowheadLinkComments", "Links go directly to the comments section", 16, -92, false, "If checked, Wowhead links will go directly to the comments section.")
|
|
|
|
-- Help button hidden
|
|
WowheadPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
WowheadPanel.b:SetScript("OnClick", function()
|
|
WowheadPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
WowheadPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset controls
|
|
LeaPlusLC["WowheadLinkComments"] = "Off"
|
|
|
|
-- Refresh configuration panel
|
|
WowheadPanel:Hide(); WowheadPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["ShowWowheadLinksBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["WowheadLinkComments"] = "Off"
|
|
else
|
|
WowheadPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Get localised Wowhead URL
|
|
local wowheadLoc
|
|
if GameLocale == "deDE" then wowheadLoc = "de.wowhead.com"
|
|
elseif GameLocale == "esMX" then wowheadLoc = "mx.wowhead.com"
|
|
elseif GameLocale == "esES" then wowheadLoc = "es.wowhead.com"
|
|
elseif GameLocale == "frFR" then wowheadLoc = "fr.wowhead.com"
|
|
elseif GameLocale == "itIT" then wowheadLoc = "it.wowhead.com"
|
|
elseif GameLocale == "ptBR" then wowheadLoc = "pt.wowhead.com"
|
|
elseif GameLocale == "ruRU" then wowheadLoc = "ru.wowhead.com"
|
|
elseif GameLocale == "koKR" then wowheadLoc = "ko.wowhead.com"
|
|
elseif GameLocale == "zhCN" then wowheadLoc = "cn.wowhead.com"
|
|
elseif GameLocale == "zhTW" then wowheadLoc = "tw.wowhead.com"
|
|
else wowheadLoc = "wowhead.com"
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Achievements frame
|
|
----------------------------------------------------------------------
|
|
|
|
-- Achievement link function
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_AchievementUI",function()
|
|
|
|
-- Create editbox
|
|
local aEB = CreateFrame("EditBox", nil, AchievementFrame)
|
|
aEB:ClearAllPoints()
|
|
aEB:SetPoint("BOTTOMRIGHT", -50, 1)
|
|
aEB:SetHeight(16)
|
|
aEB:SetFontObject("GameFontNormalSmall")
|
|
aEB:SetBlinkSpeed(0)
|
|
aEB:SetJustifyH("RIGHT")
|
|
aEB:SetAutoFocus(false)
|
|
aEB:EnableKeyboard(false)
|
|
aEB:SetHitRectInsets(90, 0, 0, 0)
|
|
aEB:SetScript("OnKeyDown", function() end)
|
|
aEB:SetScript("OnMouseUp", function()
|
|
if aEB:IsMouseOver() then
|
|
aEB:HighlightText()
|
|
else
|
|
aEB:HighlightText(0, 0)
|
|
end
|
|
end)
|
|
|
|
-- Create hidden font string (used for setting width of editbox)
|
|
aEB.z = aEB:CreateFontString(nil, 'ARTWORK', 'GameFontNormalSmall')
|
|
aEB.z:Hide()
|
|
|
|
-- Store last link in case editbox is cleared
|
|
local lastAchievementLink
|
|
|
|
-- Function to set editbox value
|
|
local function SetAchievementFunc(self, achievementID)
|
|
if achievementID then
|
|
-- Set editbox text
|
|
if LeaPlusLC["WowheadLinkComments"] == "On" then
|
|
aEB:SetText("https://" .. wowheadLoc .. "/achievement=" .. achievementID .. "#comments")
|
|
else
|
|
aEB:SetText("https://" .. wowheadLoc .. "/achievement=" .. achievementID)
|
|
end
|
|
lastAchievementLink = aEB:GetText()
|
|
-- Set hidden fontstring then resize editbox to match
|
|
aEB.z:SetText(aEB:GetText())
|
|
aEB:SetWidth(aEB.z:GetStringWidth() + 90)
|
|
-- Get achievement title for tooltip
|
|
local achievementLink = GetAchievementLink(achievementID)
|
|
if achievementLink then
|
|
aEB.tiptext = achievementLink:match("%[(.-)%]") .. "|n" .. L["Press CTRL/C to copy."]
|
|
end
|
|
-- Show the editbox
|
|
aEB:Show()
|
|
end
|
|
end
|
|
hooksecurefunc(AchievementTemplateMixin, "DisplayObjectives", SetAchievementFunc)
|
|
hooksecurefunc("AchievementFrameComparisonTab_OnClick", function(self) aEB:Hide() end)
|
|
|
|
-- Create tooltip
|
|
aEB:HookScript("OnEnter", function()
|
|
aEB:HighlightText()
|
|
aEB:SetFocus()
|
|
GameTooltip:SetOwner(aEB, "ANCHOR_TOP", 0, 10)
|
|
GameTooltip:SetText(aEB.tiptext, nil, nil, nil, nil, true)
|
|
GameTooltip:Show()
|
|
end)
|
|
|
|
aEB:HookScript("OnLeave", function()
|
|
-- Set link text again if it's changed since it was set
|
|
if aEB:GetText() ~= lastAchievementLink then aEB:SetText(lastAchievementLink) end
|
|
aEB:HighlightText(0, 0)
|
|
aEB:ClearFocus()
|
|
GameTooltip:Hide()
|
|
end)
|
|
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- World map frame
|
|
----------------------------------------------------------------------
|
|
|
|
-- Hide the title text
|
|
WorldMapFrameTitleText:Hide()
|
|
|
|
-- Create editbox
|
|
local mEB = CreateFrame("EditBox", nil, WorldMapFrame.BorderFrame)
|
|
mEB:SetFrameLevel(501)
|
|
mEB:ClearAllPoints()
|
|
mEB:SetPoint("TOPLEFT", 100, -4)
|
|
mEB:SetHeight(16)
|
|
mEB:SetFontObject("GameFontNormal")
|
|
mEB:SetBlinkSpeed(0)
|
|
mEB:SetAutoFocus(false)
|
|
mEB:EnableKeyboard(false)
|
|
mEB:SetHitRectInsets(0, 90, 0, 0)
|
|
mEB:SetScript("OnKeyDown", function() end)
|
|
mEB:SetScript("OnMouseUp", function()
|
|
if mEB:IsMouseOver() then
|
|
mEB:HighlightText()
|
|
else
|
|
mEB:HighlightText(0, 0)
|
|
end
|
|
end)
|
|
|
|
-- Create hidden font string (used for setting width of editbox)
|
|
mEB.z = mEB:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
mEB.z:Hide()
|
|
|
|
-- Function to set editbox value
|
|
local function SetQuestInBox()
|
|
local questID
|
|
if QuestMapFrame.DetailsFrame:IsShown() then
|
|
-- Get quest ID from currently showing quest in details panel
|
|
questID = QuestMapFrame_GetDetailQuestID()
|
|
else
|
|
-- Get quest ID from currently selected quest on world map
|
|
questID = C_SuperTrack.GetSuperTrackedQuestID()
|
|
end
|
|
if questID then
|
|
-- Hide editbox if quest ID is invalid
|
|
if questID == 0 then mEB:Hide() else mEB:Show() end
|
|
-- Set editbox text
|
|
if LeaPlusLC["WowheadLinkComments"] == "On" then
|
|
mEB:SetText("https://" .. wowheadLoc .. "/quest=" .. questID .. "#comments")
|
|
else
|
|
mEB:SetText("https://" .. wowheadLoc .. "/quest=" .. questID)
|
|
end
|
|
-- Set hidden fontstring then resize editbox to match
|
|
mEB.z:SetText(mEB:GetText())
|
|
mEB:SetWidth(mEB.z:GetStringWidth() + 90)
|
|
-- Get quest title for tooltip
|
|
local questLink = GetQuestLink(questID) or nil
|
|
if questLink then
|
|
mEB.tiptext = questLink:match("%[(.-)%]") .. "|n" .. L["Press CTRL/C to copy."]
|
|
else
|
|
mEB.tiptext = ""
|
|
if mEB:IsMouseOver() and GameTooltip:IsShown() then GameTooltip:Hide() end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Set URL when super tracked quest changes and on startup
|
|
mEB:RegisterEvent("SUPER_TRACKING_CHANGED")
|
|
mEB:SetScript("OnEvent", SetQuestInBox)
|
|
SetQuestInBox()
|
|
|
|
-- Set URL when quest details frame is shown or hidden
|
|
hooksecurefunc("QuestMapFrame_ShowQuestDetails", SetQuestInBox)
|
|
hooksecurefunc("QuestMapFrame_CloseQuestDetails", SetQuestInBox)
|
|
|
|
-- Create tooltip
|
|
mEB:HookScript("OnEnter", function()
|
|
mEB:HighlightText()
|
|
mEB:SetFocus()
|
|
GameTooltip:SetOwner(mEB, "ANCHOR_BOTTOM", 0, -10)
|
|
GameTooltip:SetText(mEB.tiptext, nil, nil, nil, nil, true)
|
|
GameTooltip:Show()
|
|
end)
|
|
|
|
mEB:HookScript("OnLeave", function()
|
|
mEB:HighlightText(0, 0)
|
|
mEB:ClearFocus()
|
|
GameTooltip:Hide()
|
|
SetQuestInBox()
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Enhance dressup
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["EnhanceDressup"] == "On" then
|
|
|
|
-- Create configuration panel
|
|
local DressupPanel = LeaPlusLC:CreatePanel("Enhance dressup", "DressupPanel")
|
|
|
|
LeaPlusLC:MakeTx(DressupPanel, "Dressing room", 16, -72)
|
|
LeaPlusLC:MakeCB(DressupPanel, "DressupItemButtons", "Show item buttons", 16, -92, false, "If checked, item buttons will be shown in the dressing room. You can click the item buttons to remove individual items from the model.")
|
|
LeaPlusLC:MakeCB(DressupPanel, "DressupAnimControl", "Show animation slider", 16, -112, false, "If checked, an animation slider will be shown in the dressing room.")
|
|
|
|
LeaPlusLC:MakeTx(DressupPanel, "Transmogrify character preview", 16, -152)
|
|
LeaPlusLC:MakeCB(DressupPanel, "DressupWiderPreview", "Wider character preview", 16, -172, true, "If checked, the transmogrify character preview will be wider.")
|
|
LeaPlusLC:MakeCB(DressupPanel, "DressupMoreZoomOut", "Increase zoom out distance", 16, -192, true, "If checked, you will be able to zoom out further with the transmogrify character preview.")
|
|
LeaPlusLC:MakeCB(DressupPanel, "DressupTransmogAnim", "Show animation slider", 16, -212, false, "If checked, an animation slider will be shown in the transmogrify character preview.")
|
|
|
|
LeaPlusLC:MakeTx(DressupPanel, "Zoom speed", 356, -72)
|
|
LeaPlusLC:MakeSL(DressupPanel, "DressupFasterZoom", "Drag to set the character model zoom speed.", 1, 10, 1, 356, -92, "%.0f")
|
|
|
|
-- Refresh zoom speed slider when changed
|
|
LeaPlusCB["DressupFasterZoom"]:HookScript("OnValueChanged", function()
|
|
LeaPlusCB["DressupFasterZoom"].f:SetFormattedText("%.0f%%", LeaPlusLC["DressupFasterZoom"] * 100)
|
|
end)
|
|
|
|
-- Set zoom speed when dressup model is zoomed (wardrobe is set in wardrobe section further down)
|
|
DressUpFrame.ModelScene:SetScript("OnMouseWheel", function(self, delta)
|
|
for i = 1, LeaPlusLC["DressupFasterZoom"] do
|
|
if DressUpFrame.ModelScene.activeCamera then
|
|
DressUpFrame.ModelScene.activeCamera:OnMouseWheel(delta)
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Set zoom speed when character frame model is zoomed
|
|
CharacterModelScene:SetScript("OnMouseWheel", function(self, delta)
|
|
for i = 1, LeaPlusLC["DressupFasterZoom"] do
|
|
if CharacterModelScene.activeCamera then
|
|
CharacterModelScene.activeCamera:OnMouseWheel(delta)
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Help button hidden
|
|
DressupPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
DressupPanel.b:SetScript("OnClick", function()
|
|
DressupPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
DressupPanel.r.tiptext = DressupPanel.r.tiptext .. "|n|n" .. L["Note that this will not reset settings that require a UI reload."]
|
|
DressupPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset controls
|
|
LeaPlusLC["DressupFasterZoom"] = 3
|
|
|
|
-- Refresh configuration panel
|
|
DressupPanel:Hide(); DressupPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["EnhanceDressupBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["DressupFasterZoom"] = 3
|
|
else
|
|
DressupPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Item buttons
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local buttons = {}
|
|
local slotTable = {"HeadSlot", "ShoulderSlot", "BackSlot", "ChestSlot", "ShirtSlot", "TabardSlot", "WristSlot", "HandsSlot", "WaistSlot", "LegsSlot", "FeetSlot", "MainHandSlot", "SecondaryHandSlot"}
|
|
|
|
local function MakeSlotButton(slot, anchor, x, y)
|
|
|
|
-- Create slot button
|
|
local slotBtn = CreateFrame("Button", nil, DressUpFrame)
|
|
slotBtn:SetFrameStrata("HIGH")
|
|
slotBtn:SetSize(35, 35)
|
|
slotBtn.slot = slot
|
|
slotBtn:ClearAllPoints()
|
|
slotBtn:SetPoint(anchor, x, y)
|
|
slotBtn:RegisterForClicks("LeftButtonUp")
|
|
slotBtn:SetMotionScriptsWhileDisabled(true)
|
|
|
|
-- Ensure slot buttons only show with reset button
|
|
slotBtn:SetParent(DressUpFrameResetButton)
|
|
|
|
-- Slot button tooltip
|
|
slotBtn:SetScript("OnClick", function(self, btn)
|
|
if btn == "LeftButton" then
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
local slotID = GetInventorySlotInfo(self.slot)
|
|
playerActor:UndressSlot(slotID)
|
|
playerActor:SetSheathed(true)
|
|
end
|
|
end)
|
|
|
|
slotBtn:SetScript("OnEnter", function(self)
|
|
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
|
|
if self.item then
|
|
GameTooltip:SetHyperlink(self.item)
|
|
else
|
|
if self.slot then
|
|
GameTooltip:SetText(_G[string.upper(self.slot)])
|
|
end
|
|
end
|
|
end)
|
|
slotBtn:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Slot button textures
|
|
slotBtn.t = slotBtn:CreateTexture(nil, "BACKGROUND")
|
|
slotBtn.t:SetSize(35, 35)
|
|
slotBtn.t:SetPoint("CENTER")
|
|
|
|
slotBtn.h = slotBtn:CreateTexture()
|
|
slotBtn.h:SetSize(35, 35)
|
|
slotBtn.h:SetPoint("CENTER")
|
|
slotBtn.h:SetAtlas("bags-glow-white")
|
|
slotBtn.h:SetBlendMode("ADD")
|
|
slotBtn:SetHighlightTexture(slotBtn.h)
|
|
|
|
-- Add slot button to table
|
|
tinsert(buttons, slotBtn)
|
|
|
|
end
|
|
|
|
-- Show left column slot buttons
|
|
for i = 1, 7 do
|
|
MakeSlotButton(slotTable[i], "TOPLEFT", 10, -70 + -40 * (i - 1))
|
|
end
|
|
|
|
-- Show right column slot buttons
|
|
for i = 8, 13 do
|
|
MakeSlotButton(slotTable[i], "TOPRIGHT", -12, -70 + -40 * (i - 8))
|
|
end
|
|
|
|
-- Updates slots
|
|
hooksecurefunc(DressUpFrame.OutfitDropdown, "UpdateSaveButton", function()
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
if playerActor then
|
|
for slot, slotButtons in pairs(buttons) do
|
|
if slotTable[slot] and GetInventorySlotInfo(slotTable[slot]) then
|
|
local slotID, slotTexture = GetInventorySlotInfo(slotTable[slot])
|
|
local itemTransmogInfo = playerActor:GetItemTransmogInfo(slotID)
|
|
if itemTransmogInfo == nil then
|
|
buttons[slot].item = nil
|
|
buttons[slot].text = nil
|
|
buttons[slot].t:SetTexture(slotTexture)
|
|
else
|
|
local void, void, void, icon, void, link = C_TransmogCollection.GetAppearanceSourceInfo(itemTransmogInfo.appearanceID)
|
|
buttons[slot].item = link
|
|
buttons[slot].text = UNKNOWN
|
|
if C_TransmogCollection.IsAppearanceHiddenVisual(itemTransmogInfo.appearanceID) then
|
|
-- Hidden item
|
|
buttons[slot].t:SetAtlas("transmog-icon-hidden")
|
|
else
|
|
-- Visible item
|
|
buttons[slot].t:SetTexture(icon or "Interface\\Icons\\INV_Misc_QuestionMark")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Function to set item buttons
|
|
local function ToggleItemButtons()
|
|
if LeaPlusLC["DressupItemButtons"] == "On" then
|
|
for i = 1, #buttons do buttons[i]:Show() end
|
|
else
|
|
for i = 1, #buttons do buttons[i]:Hide() end
|
|
end
|
|
end
|
|
|
|
-- Assign file level scope to function (it's used in bottom row buttons)
|
|
LeaPlusLC.ToggleItemButtons = ToggleItemButtons
|
|
|
|
-- Set item buttons for option click, startup, reset click and preset click
|
|
LeaPlusCB["DressupItemButtons"]:HookScript("OnClick", ToggleItemButtons)
|
|
ToggleItemButtons()
|
|
DressupPanel.r:HookScript("OnClick", function()
|
|
LeaPlusLC["DressupItemButtons"] = "On"
|
|
ToggleItemButtons()
|
|
DressupPanel:Hide(); DressupPanel:Show()
|
|
end)
|
|
LeaPlusCB["EnhanceDressupBtn"]:HookScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
LeaPlusLC["DressupItemButtons"] = "On"
|
|
ToggleItemButtons()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Animation slider (must be before bottom row buttons)
|
|
----------------------------------------------------------------------
|
|
|
|
local animTable = {0, 4, 5, 143, 119, 26, 25, 27, 28, 108, 120, 51, 124, 52, 125, 126, 62, 63, 41, 42, 43, 44, 132, 38, 14, 115, 193, 48, 110, 109, 134, 197, 0}
|
|
local lastSetting
|
|
|
|
LeaPlusLC["DressupAnim"] = 0 -- Defined here since the setting is not saved
|
|
LeaPlusLC:MakeSL(DressUpFrame, "DressupAnim", "", 1, #animTable - 1, 1, 356, -92, "%.0f")
|
|
LeaPlusCB["DressupAnim"]:ClearAllPoints()
|
|
LeaPlusCB["DressupAnim"]:SetPoint("BOTTOM", 0, 32)
|
|
LeaPlusCB["DressupAnim"]:SetParent(DressUpFrameResetButton) -- So it only shows with reset button
|
|
LeaPlusCB["DressupAnim"]:SetWidth(240)
|
|
LeaPlusCB["DressupAnim"]:SetFrameLevel(5)
|
|
LeaPlusCB["DressupAnim"]:HookScript("OnValueChanged", function(self, setting)
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
setting = math.floor(setting + 0.5)
|
|
if playerActor and setting ~= lastSetting then
|
|
lastSetting = setting
|
|
playerActor:SetAnimation(animTable[setting], 0, 1, 1)
|
|
-- print(animTable[setting]) -- Debug
|
|
end
|
|
end)
|
|
|
|
-- Function to show animation control
|
|
local function SetAnimationSlider()
|
|
if LeaPlusLC["DressupAnimControl"] == "On" then
|
|
LeaPlusCB["DressupAnim"]:Show()
|
|
else
|
|
LeaPlusCB["DressupAnim"]:Hide()
|
|
end
|
|
LeaPlusCB["DressupAnim"]:SetValue(1)
|
|
end
|
|
|
|
-- Set animation control with option, startup, preset and reset
|
|
LeaPlusCB["DressupAnimControl"]:HookScript("OnClick", SetAnimationSlider)
|
|
SetAnimationSlider()
|
|
LeaPlusCB["EnhanceDressupBtn"]:HookScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
LeaPlusLC["DressupAnimControl"] = "On"
|
|
SetAnimationSlider()
|
|
end
|
|
end)
|
|
DressupPanel.r:HookScript("OnClick", function()
|
|
LeaPlusLC["DressupAnimControl"] = "On"
|
|
SetAnimationSlider()
|
|
DressupPanel:Hide(); DressupPanel:Show()
|
|
end)
|
|
|
|
-- Reset animation when dressup frame is shown and model is reset
|
|
hooksecurefunc(DressUpFrame, "Show", SetAnimationSlider)
|
|
DressUpFrameResetButton:HookScript("OnClick", SetAnimationSlider)
|
|
|
|
-- Skin slider for ElvUI
|
|
if LeaPlusLC.ElvUI then
|
|
_G.LeaPlusGlobalDressupAnim = LeaPlusCB["DressupAnim"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleSliderFrame(_G.LeaPlusGlobalDressupAnim, false)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Bottom row buttons
|
|
----------------------------------------------------------------------
|
|
|
|
-- Function to modify a button
|
|
local function SetButton(where, text, tip)
|
|
where:SetText(L[text])
|
|
where:SetWidth(where:GetFontString():GetStringWidth() + 20)
|
|
where:HookScript("OnEnter", function()
|
|
GameTooltip:SetOwner(where, "ANCHOR_NONE")
|
|
GameTooltip:SetPoint("BOTTOM", where, "TOP", 0, 10)
|
|
GameTooltip:SetText(L[tip], nil, nil, nil, nil, true)
|
|
end)
|
|
where:HookScript("OnLeave", GameTooltip_Hide)
|
|
end
|
|
|
|
SetButton(DressUpFrameCancelButton, "C", "Close")
|
|
SetButton(DressUpFrameResetButton, "R", "Reset")
|
|
|
|
-- Remove all items button (parented to reset button so they show with reset button)
|
|
LeaPlusLC:CreateButton("DressUpNudeBtn", DressUpFrameResetButton, "N", "BOTTOMLEFT", 106, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpNudeBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpNudeBtn"]:SetPoint("RIGHT", DressUpFrameResetButton, "LEFT", 0, 0)
|
|
SetButton(LeaPlusCB["DressUpNudeBtn"], "N", "Remove all items")
|
|
LeaPlusCB["DressUpNudeBtn"]:SetScript("OnClick", function()
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
playerActor:Undress()
|
|
end)
|
|
|
|
-- Show me button
|
|
LeaPlusLC:CreateButton("DressUpShowMeBtn", DressUpFrameResetButton, "M", "BOTTOMLEFT", 26, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpShowMeBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpShowMeBtn"]:SetPoint("RIGHT", LeaPlusCB["DressUpNudeBtn"], "LEFT", 0, 0)
|
|
SetButton(LeaPlusCB["DressUpShowMeBtn"], "M", "Show me")
|
|
LeaPlusCB["DressUpShowMeBtn"]:SetScript("OnClick", function()
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
playerActor:SetModelByUnit("player", true, true)
|
|
C_Timer.After(0.1, function()
|
|
playerActor:SetModelByUnit("player", true, true)
|
|
-- Set animation
|
|
playerActor:SetAnimation(0)
|
|
C_Timer.After(0.1,function()
|
|
playerActor:SetAnimation(animTable[math.floor(LeaPlusCB["DressupAnim"]:GetValue() + 0.5)], 0, 1, 1)
|
|
end)
|
|
end)
|
|
end)
|
|
|
|
-- Show my outfit on target button
|
|
LeaPlusLC:CreateButton("DressUpOutfitOnTargetBtn", DressUpFrameResetButton, "O", "BOTTOMLEFT", 26, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpOutfitOnTargetBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpOutfitOnTargetBtn"]:SetPoint("RIGHT", LeaPlusCB["DressUpShowMeBtn"], "LEFT", 0, 0)
|
|
SetButton(LeaPlusCB["DressUpOutfitOnTargetBtn"], "O", "Show my outfit on target")
|
|
LeaPlusCB["DressUpOutfitOnTargetBtn"]:SetScript("OnClick", function()
|
|
if UnitIsPlayer("target") then
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
playerActor:SetModelByUnit("player", true, true)
|
|
local modelTransmogList = playerActor:GetItemTransmogInfoList()
|
|
playerActor:SetModelByUnit("target", true, true)
|
|
C_Timer.After(0.01, function()
|
|
playerActor:SetModelByUnit("target", true, true)
|
|
playerActor:Undress()
|
|
DressUpItemTransmogInfoList(modelTransmogList)
|
|
-- Set animation
|
|
playerActor:SetAnimation(0)
|
|
C_Timer.After(0.1,function()
|
|
playerActor:SetAnimation(animTable[math.floor(LeaPlusCB["DressupAnim"]:GetValue() + 0.5)], 0, 1, 1)
|
|
end)
|
|
end)
|
|
end
|
|
end)
|
|
|
|
-- Show target outfit on me button
|
|
LeaPlusLC:CreateButton("DressUpTargetSelfBtn", DressUpFrameResetButton, "B", "BOTTOMLEFT", 26, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpTargetSelfBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpTargetSelfBtn"]:SetPoint("RIGHT", LeaPlusCB["DressUpOutfitOnTargetBtn"], "LEFT", 0, 0)
|
|
SetButton(LeaPlusCB["DressUpTargetSelfBtn"], "S", "Show target outfit on me")
|
|
LeaPlusCB["DressUpTargetSelfBtn"]:SetScript("OnClick", function()
|
|
if UnitIsPlayer("target") then
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
playerActor:SetModelByUnit("target", true, true)
|
|
C_Timer.After(0.01, function()
|
|
local modelTransmogList = playerActor:GetItemTransmogInfoList()
|
|
playerActor:SetModelByUnit("player", true, true)
|
|
SetupPlayerForModelScene(DressUpFrame.ModelScene, modelTransmogList, true, true)
|
|
playerActor:Undress()
|
|
DressUpItemTransmogInfoList(modelTransmogList)
|
|
-- Set animation
|
|
playerActor:SetAnimation(0)
|
|
C_Timer.After(0.1,function()
|
|
playerActor:SetAnimation(animTable[math.floor(LeaPlusCB["DressupAnim"]:GetValue() + 0.5)], 0, 1, 1)
|
|
end)
|
|
end)
|
|
end
|
|
end)
|
|
|
|
-- Show target model button
|
|
LeaPlusLC:CreateButton("DressUpTargetBtn", DressUpFrameResetButton, "T", "BOTTOMLEFT", 26, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpTargetBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpTargetBtn"]:SetPoint("RIGHT", LeaPlusCB["DressUpTargetSelfBtn"], "LEFT", 0, 0)
|
|
SetButton(LeaPlusCB["DressUpTargetBtn"], "T", "Show target model")
|
|
LeaPlusCB["DressUpTargetBtn"]:SetScript("OnClick", function()
|
|
if UnitIsPlayer("target") then
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
playerActor:SetModelByUnit("target", true, true)
|
|
C_Timer.After(0.1, function()
|
|
playerActor:SetModelByUnit("target", true, true)
|
|
-- Set animation
|
|
playerActor:SetAnimation(0)
|
|
C_Timer.After(0.1,function()
|
|
playerActor:SetAnimation(animTable[math.floor(LeaPlusCB["DressupAnim"]:GetValue() + 0.5)], 0, 1, 1)
|
|
end)
|
|
end)
|
|
end
|
|
end)
|
|
|
|
-- Hide link button
|
|
DressUpFrame.LinkButton:HookScript("OnShow", DressUpFrame.LinkButton.Hide)
|
|
|
|
-- Create editbox for link to slash command
|
|
local pFrame = CreateFrame("Frame", nil, DressUpFrame)
|
|
pFrame:ClearAllPoints()
|
|
pFrame:SetPoint("CENTER", DressUpFrame, "CENTER", 0, -10)
|
|
pFrame:SetSize(230,300)
|
|
pFrame:Hide()
|
|
pFrame:SetFrameLevel(5000)
|
|
pFrame:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then
|
|
pFrame:Hide()
|
|
end
|
|
end)
|
|
|
|
-- Add text
|
|
LeaPlusLC:MakeTx(pFrame, "Share outfit online", 16, -72)
|
|
pFrame.txt = LeaPlusLC:MakeWD(pFrame, "Press CTRL/C to copy this command to the clipboard for sharing your outfit online.", 16, -136)
|
|
pFrame.txt:SetWordWrap(true)
|
|
pFrame.txt:SetWidth(200)
|
|
|
|
pFrame.btn = LeaPlusLC:CreateButton("ShareOutfitDone", pFrame, "Okay", "TOPLEFT", 16, -212, 0, 25, true, "")
|
|
pFrame.btn:ClearAllPoints()
|
|
pFrame.btn:SetPoint("BOTTOMRIGHT", pFrame, "BOTTOMRIGHT", -10, 10)
|
|
|
|
pFrame.btn:SetScript("OnClick", function()
|
|
pFrame:Hide()
|
|
end)
|
|
|
|
-- Hide frame when outfit changes
|
|
hooksecurefunc(DressUpFrame.OutfitDropdown, "UpdateSaveButton", function() pFrame:Hide() end)
|
|
|
|
-- Add background color
|
|
pFrame.t = pFrame:CreateTexture(nil, "BACKGROUND")
|
|
pFrame.t:SetAllPoints()
|
|
pFrame.t:SetColorTexture(0.05, 0.05, 0.05, 0.8)
|
|
|
|
-- Create editbox
|
|
local petEB = CreateFrame("EditBox", nil, pFrame)
|
|
petEB:SetPoint("TOPLEFT", 15, -100)
|
|
petEB:SetSize(200, 16)
|
|
petEB:SetTextInsets(2, 2, 2, 2)
|
|
petEB:SetFontObject("GameFontNormal")
|
|
petEB:SetTextColor(1.0, 1.0, 1.0, 1)
|
|
petEB:SetBlinkSpeed(0)
|
|
petEB:SetAltArrowKeyMode(true)
|
|
|
|
-- Create tooltip
|
|
petEB.tiptext = L["Press CTRL/C to copy."]
|
|
petEB:HookScript("OnEnter", function()
|
|
GameTooltip:SetOwner(petEB, "ANCHOR_TOP", 0, 10)
|
|
GameTooltip:SetText(petEB.tiptext, nil, nil, nil, nil, true)
|
|
end)
|
|
petEB:HookScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Prevent changes
|
|
petEB:SetScript("OnEscapePressed", function() pFrame:Hide() end)
|
|
petEB:SetScript("OnEnterPressed", function() petEB:HighlightText() end)
|
|
petEB:SetScript("OnMouseDown", function(self, btn)
|
|
petEB:ClearFocus()
|
|
if btn == "RightButton" then
|
|
pFrame:Hide()
|
|
end
|
|
end)
|
|
petEB:SetScript("OnMouseUp", function() petEB:HighlightText() end)
|
|
|
|
-- Link to chat
|
|
LeaPlusLC:CreateButton("DressUpLinkChatBtn", DressUpFrameResetButton, "L", "BOTTOMLEFT", 26, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpLinkChatBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpLinkChatBtn"]:SetPoint("BOTTOMLEFT", DressUpFrame, "BOTTOMLEFT", 2, 4)
|
|
SetButton(LeaPlusCB["DressUpLinkChatBtn"], "L", "Link outfit in chat")
|
|
LeaPlusCB["DressUpLinkChatBtn"]:SetScript("OnClick", function()
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
local itemTransmogInfoList = playerActor and playerActor:GetItemTransmogInfoList()
|
|
local hyperlink = C_TransmogCollection.GetOutfitHyperlinkFromItemTransmogInfoList(itemTransmogInfoList)
|
|
if not ChatEdit_InsertLink(hyperlink) then
|
|
ChatFrame_OpenChat(hyperlink)
|
|
end
|
|
end)
|
|
|
|
-- Share outfit online
|
|
LeaPlusLC:CreateButton("DressUpLinkSlashBtn", DressUpFrameResetButton, "W", "BOTTOMLEFT", 26, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpLinkSlashBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpLinkSlashBtn"]:SetPoint("LEFT", LeaPlusCB["DressUpLinkChatBtn"], "RIGHT", 0, 0)
|
|
SetButton(LeaPlusCB["DressUpLinkSlashBtn"], "W", "Share outfit online")
|
|
LeaPlusCB["DressUpLinkSlashBtn"]:SetScript("OnClick", function()
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
local itemTransmogInfoList = playerActor and playerActor:GetItemTransmogInfoList()
|
|
local slashCommand = TransmogUtil.CreateOutfitSlashCommand(itemTransmogInfoList)
|
|
|
|
-- Function to refresh editbox text
|
|
local function RefreshEditBoxText()
|
|
petEB:SetText(slashCommand)
|
|
petEB:HighlightText()
|
|
petEB:SetFocus()
|
|
petEB:SetCursorPosition(0)
|
|
end
|
|
|
|
-- Prevent changes to editbox value
|
|
petEB:SetScript("OnChar", RefreshEditBoxText)
|
|
petEB:SetScript("OnKeyUp", RefreshEditBoxText)
|
|
RefreshEditBoxText()
|
|
|
|
if pFrame:IsShown() then pFrame:Hide() else pFrame:Show() end
|
|
end)
|
|
|
|
-- Toggle buttons
|
|
LeaPlusLC:CreateButton("DressUpButonsBtn", DressUpFrameResetButton, "B", "BOTTOMLEFT", 26, 79, 80, 22, false, "")
|
|
LeaPlusCB["DressUpButonsBtn"]:ClearAllPoints()
|
|
LeaPlusCB["DressUpButonsBtn"]:SetPoint("LEFT", LeaPlusCB["DressUpLinkSlashBtn"], "RIGHT", 0, 0)
|
|
SetButton(LeaPlusCB["DressUpButonsBtn"], "B", "Toggle buttons")
|
|
LeaPlusCB["DressUpButonsBtn"]:SetScript("OnClick", function()
|
|
if LeaPlusLC["DressupItemButtons"] == "On" then LeaPlusLC["DressupItemButtons"] = "Off" else LeaPlusLC["DressupItemButtons"] = "On" end
|
|
LeaPlusLC:ToggleItemButtons()
|
|
if DressupPanel:IsShown() then DressupPanel:Hide(); DressupPanel:Show() end
|
|
end)
|
|
|
|
-- Change player actor to player when reset button is clicked (needed because target button changes it)
|
|
DressUpFrameResetButton:HookScript("OnClick", function()
|
|
local playerActor = DressUpFrame.ModelScene:GetPlayerActor()
|
|
playerActor:SetModelByUnit("player", true, true)
|
|
end)
|
|
|
|
-- Skin buttons for ElvUI
|
|
if LeaPlusLC.ElvUI then
|
|
_G.LeaPlusGlobalDressUpButtonsButton = LeaPlusCB["DressUpButonsBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpButtonsButton)
|
|
|
|
_G.LeaPlusGlobalDressUpShowMeButton = LeaPlusCB["DressUpShowMeBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpShowMeButton)
|
|
|
|
_G.LeaPlusGlobalDressUpTargetButton = LeaPlusCB["DressUpTargetBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpTargetButton)
|
|
|
|
_G.LeaPlusGlobalDressUpNudeButton = LeaPlusCB["DressUpNudeBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpNudeButton)
|
|
|
|
_G.LeaPlusGlobalDressUpTargetSelfBtn = LeaPlusCB["DressUpTargetSelfBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpTargetSelfBtn)
|
|
|
|
_G.LeaPlusGlobalDressUpOutfitOnTargetBtn = LeaPlusCB["DressUpOutfitOnTargetBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpOutfitOnTargetBtn)
|
|
|
|
_G.LeaPlusGlobalDressUpLinkChatBtn = LeaPlusCB["DressUpLinkChatBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpLinkChatBtn)
|
|
|
|
_G.LeaPlusGlobalDressUpLinkSlashBtn = LeaPlusCB["DressUpLinkSlashBtn"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalDressUpLinkSlashBtn)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Controls
|
|
----------------------------------------------------------------------
|
|
|
|
-- Hide controls for character frame
|
|
CharacterModelScene.ControlFrame:HookScript("OnShow", function()
|
|
CharacterModelScene.ControlFrame:Hide()
|
|
end)
|
|
|
|
-- Hide controls for dressing room
|
|
DressUpFrame.ModelScene.ControlFrame:HookScript("OnShow", DressUpFrame.ModelScene.ControlFrame.Hide)
|
|
|
|
-- Hide controls for shop
|
|
ModelPreviewFrame.Display.ModelScene.ControlFrame:HookScript("OnShow", function()
|
|
if StorePreviewFrame and StorePreviewFrame:IsShown() then
|
|
ModelPreviewFrame.Display.ModelScene.ControlFrame:Hide()
|
|
end
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Wardrobe and inspect system
|
|
----------------------------------------------------------------------
|
|
|
|
-- Wardrobe (used by transmogrifier NPC) and mount journal
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_Collections",function()
|
|
|
|
-- Hide positioning controls for mount journal
|
|
MountJournal.MountDisplay.ModelScene.ControlFrame:HookScript("OnShow", MountJournal.MountDisplay.ModelScene.ControlFrame.Hide)
|
|
-- Hide positioning controls for wardrobe
|
|
WardrobeTransmogFrame.ModelScene.ControlFrame:HookScript("OnShow", WardrobeTransmogFrame.ModelScene.ControlFrame.Hide)
|
|
-- Set zoom speed for wardrobe
|
|
WardrobeTransmogFrame.ModelScene:SetScript("OnMouseWheel", function(self, delta)
|
|
for i = 1, LeaPlusLC["DressupFasterZoom"] do
|
|
if WardrobeTransmogFrame.ModelScene.activeCamera then
|
|
WardrobeTransmogFrame.ModelScene.activeCamera:OnMouseWheel(delta)
|
|
end
|
|
end
|
|
end)
|
|
-- Set zoom speed for mount journal
|
|
MountJournal.MountDisplay.ModelScene:SetScript("OnMouseWheel", function(self, delta)
|
|
for i = 1, LeaPlusLC["DressupFasterZoom"] do
|
|
if MountJournal.MountDisplay.ModelScene.activeCamera then
|
|
MountJournal.MountDisplay.ModelScene.activeCamera:OnMouseWheel(delta)
|
|
end
|
|
end
|
|
end)
|
|
-- Wider transmogrifier character preview
|
|
if LeaPlusLC["DressupWiderPreview"] == "On" then
|
|
|
|
local width = 1200 -- Default is 965
|
|
WardrobeFrame:SetWidth(width)
|
|
WardrobeTransmogFrame:SetWidth(width - 665)
|
|
WardrobeTransmogFrame.Inset.BG:SetWidth(width - 671)
|
|
WardrobeTransmogFrame.ModelScene:SetWidth(width - 671)
|
|
|
|
-- Left slots column
|
|
WardrobeTransmogFrame.HeadButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.HeadButton:SetPoint("TOPLEFT", 15, -40)
|
|
|
|
-- Right slots column
|
|
WardrobeTransmogFrame.HandsButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.HandsButton:SetPoint("TOPRIGHT", -15, -60)
|
|
|
|
-- Weapons
|
|
WardrobeTransmogFrame.SecondaryHandButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.SecondaryHandButton:SetPoint("TOP", WardrobeTransmogFrame.FeetButton, "BOTTOM", 0, -96)
|
|
WardrobeTransmogFrame.SecondaryHandEnchantButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.SecondaryHandEnchantButton:SetPoint("BOTTOM", WardrobeTransmogFrame.SecondaryHandButton, "BOTTOM", 0, -15)
|
|
|
|
WardrobeTransmogFrame.MainHandButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.MainHandButton:SetPoint("BOTTOM", WardrobeTransmogFrame.SecondaryHandButton, "TOP", 0, 30)
|
|
WardrobeTransmogFrame.MainHandEnchantButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.MainHandEnchantButton:SetPoint("BOTTOM", WardrobeTransmogFrame.MainHandButton, "BOTTOM", 0, -15)
|
|
|
|
-- Checkbox for transmog each shoulder separately
|
|
WardrobeTransmogFrame.ToggleSecondaryAppearanceCheckbox:ClearAllPoints()
|
|
WardrobeTransmogFrame.ToggleSecondaryAppearanceCheckbox:SetPoint("BOTTOMLEFT", WardrobeTransmogFrame, "BOTTOMLEFT", 583, 15)
|
|
|
|
else
|
|
|
|
-- Wider character preview is disabled so move the right column up
|
|
WardrobeTransmogFrame.HandsButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.HandsButton:SetPoint("TOPRIGHT", -6, -60)
|
|
|
|
-- Show weapons in the right column
|
|
WardrobeTransmogFrame.SecondaryHandButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.SecondaryHandButton:SetPoint("TOP", WardrobeTransmogFrame.FeetButton, "BOTTOM", 0, -96)
|
|
WardrobeTransmogFrame.SecondaryHandEnchantButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.SecondaryHandEnchantButton:SetPoint("BOTTOM", WardrobeTransmogFrame.SecondaryHandButton, "BOTTOM", 0, -15)
|
|
|
|
WardrobeTransmogFrame.MainHandButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.MainHandButton:SetPoint("BOTTOM", WardrobeTransmogFrame.SecondaryHandButton, "TOP", 0, 30)
|
|
WardrobeTransmogFrame.MainHandEnchantButton:ClearAllPoints()
|
|
WardrobeTransmogFrame.MainHandEnchantButton:SetPoint("BOTTOM", WardrobeTransmogFrame.MainHandButton, "BOTTOM", 0, -15)
|
|
|
|
end
|
|
|
|
-- Increase zoom out distance
|
|
if LeaPlusLC["DressupMoreZoomOut"] == "On" then
|
|
hooksecurefunc(WardrobeTransmogFrame.ModelScene, "TransitionToModelSceneID", function(self)
|
|
local activeCamera = self:GetActiveCamera()
|
|
if activeCamera then
|
|
local currentZoom = activeCamera:GetZoomDistance()
|
|
activeCamera:SetMaxZoomDistance(5)
|
|
activeCamera:SetZoomDistance(currentZoom)
|
|
end
|
|
end)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Transmogrify animation slider
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local transmogAnimTable = {0, 4, 5, 143, 119, 26, 25, 27, 28, 108, 120, 51, 124, 52, 125, 126, 62, 63, 41, 42, 43, 44, 132, 38, 14, 115, 193, 48, 110, 109, 134, 197, 0}
|
|
local transmogLastSetting
|
|
|
|
LeaPlusLC["TransmogAnim"] = 0 -- Defined here since the setting is not saved
|
|
LeaPlusLC:MakeSL(WardrobeTransmogFrame, "TransmogAnim", "", 1, #transmogAnimTable - 1, 1, 356, -92, "%.0f")
|
|
LeaPlusCB["TransmogAnim"]:ClearAllPoints()
|
|
LeaPlusCB["TransmogAnim"]:SetPoint("BOTTOM", 0, 6)
|
|
if LeaPlusLC["DressupWiderPreview"] == "On" then
|
|
LeaPlusCB["TransmogAnim"]:SetWidth(240)
|
|
else
|
|
LeaPlusCB["TransmogAnim"]:SetWidth(216)
|
|
end
|
|
LeaPlusCB["TransmogAnim"]:SetFrameLevel(5)
|
|
LeaPlusCB["TransmogAnim"]:HookScript("OnValueChanged", function(self, setting)
|
|
local playerActor = WardrobeTransmogFrame.ModelScene:GetPlayerActor()
|
|
setting = math.floor(setting + 0.5)
|
|
if playerActor and setting ~= lastSetting then
|
|
lastSetting = setting
|
|
playerActor:SetAnimation(transmogAnimTable[setting], 0, 1, 1)
|
|
end
|
|
end)
|
|
|
|
-- Function to show animation control
|
|
local function SetAnimationSlider()
|
|
if LeaPlusLC["DressupTransmogAnim"] == "On" then
|
|
LeaPlusCB["TransmogAnim"]:Show()
|
|
else
|
|
LeaPlusCB["TransmogAnim"]:Hide()
|
|
end
|
|
LeaPlusCB["TransmogAnim"]:SetValue(1)
|
|
end
|
|
|
|
-- Set animation control with option, startup, preset and reset
|
|
LeaPlusCB["DressupTransmogAnim"]:HookScript("OnClick", SetAnimationSlider)
|
|
SetAnimationSlider()
|
|
LeaPlusCB["EnhanceDressupBtn"]:HookScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
LeaPlusLC["DressupTransmogAnim"] = "On"
|
|
SetAnimationSlider()
|
|
end
|
|
end)
|
|
DressupPanel.r:HookScript("OnClick", function()
|
|
LeaPlusLC["DressupTransmogAnim"] = "Off"
|
|
SetAnimationSlider()
|
|
DressupPanel:Hide(); DressupPanel:Show()
|
|
end)
|
|
|
|
-- Reset animation when slider is shown
|
|
LeaPlusCB["TransmogAnim"]:HookScript("OnShow", SetAnimationSlider)
|
|
|
|
-- Skin slider for ElvUI
|
|
if LeaPlusLC.ElvUI then
|
|
_G.LeaPlusGlobalTransmogAnim = LeaPlusCB["TransmogAnim"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleSliderFrame(_G.LeaPlusGlobalTransmogAnim, false)
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
-- Inspect System
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_InspectUI",function()
|
|
-- Hide positioning controls
|
|
InspectModelFrameControlFrame:HookScript("OnShow", InspectModelFrameControlFrame.Hide)
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Automate gossip (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to skip gossip
|
|
local function SkipGossip(skipAltKeyRequirement)
|
|
if not skipAltKeyRequirement and not IsAltKeyDown() then return end
|
|
local gossipInfoTable = C_GossipInfo.GetOptions()
|
|
if gossipInfoTable[1] then
|
|
if gossipInfoTable[1].gossipOptionID then
|
|
C_GossipInfo.SelectOption(gossipInfoTable[1].gossipOptionID)
|
|
else
|
|
-- Some gossip options dont have a gossip option ID (such as Suspicious Noble NPCs in Court of Stars, Suramar)
|
|
if GossipFrame and GossipFrame:IsShown() then GossipFrame:SelectGossipOption(1) end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Create gossip event frame
|
|
local gossipFrame = CreateFrame("FRAME")
|
|
|
|
-- Function to setup events
|
|
local function SetupEvents()
|
|
if LeaPlusLC["AutomateGossip"] == "On" then
|
|
gossipFrame:RegisterEvent("GOSSIP_SHOW")
|
|
else
|
|
gossipFrame:UnregisterEvent("GOSSIP_SHOW")
|
|
end
|
|
end
|
|
|
|
-- Setup events when option is clicked and on startup (if option is enabled)
|
|
LeaPlusCB["AutomateGossip"]:HookScript("OnClick", SetupEvents)
|
|
if LeaPlusLC["AutomateGossip"] == "On" then SetupEvents() end
|
|
|
|
-- Event handler
|
|
gossipFrame:SetScript("OnEvent", function()
|
|
-- Special treatment for specific NPCs
|
|
local npcGuid = UnitGUID("npc") or nil -- target does not work with soft targeting
|
|
if npcGuid then
|
|
local void, void, void, void, void, npcID = strsplit("-", npcGuid)
|
|
if npcID then
|
|
-- Open rogue doors in Dalaran (Broken Isles) automatically
|
|
if npcID == "96782" -- Lucian Trias
|
|
or npcID == "93188" -- Mongar
|
|
or npcID == "97004" -- "Red" Jack Findle
|
|
then
|
|
SkipGossip()
|
|
return
|
|
end
|
|
-- Skip gossip with no alt key requirement
|
|
if npcID == "132969" -- Katy Stampwhistle (toy)
|
|
or npcID == "104201" -- Katy Stampwhistle (npc)
|
|
then
|
|
SkipGossip(true) -- true means skip alt key requirement
|
|
return
|
|
end
|
|
end
|
|
end
|
|
-- Process gossip
|
|
local gossipOptions = C_GossipInfo.GetOptions()
|
|
if gossipOptions and #gossipOptions == 1 and C_GossipInfo.GetNumAvailableQuests() == 0 and C_GossipInfo.GetNumActiveQuests() == 0 then
|
|
SkipGossip()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide order hall bar
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoCommandBar"] == "On" then
|
|
|
|
-- Function to hide the order hall bar
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_OrderHallUI",function()
|
|
OrderHallCommandBar:HookScript("OnShow", function()
|
|
OrderHallCommandBar:Hide()
|
|
end)
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Disable pet automation
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoPetAutomation"] == "On" then
|
|
|
|
-- Create frame to watch for combat
|
|
local petCombat = CreateFrame("FRAME")
|
|
local petTicker
|
|
|
|
-- Function to dismiss pet
|
|
local function DismissPetTimerFunc()
|
|
if UnitAffectingCombat("player") then
|
|
-- Player is in combat so cancel ticker and schedule it for when combat ends
|
|
if petTicker then petTicker:Cancel() end
|
|
petCombat:RegisterEvent("PLAYER_REGEN_ENABLED")
|
|
else
|
|
-- Player is not in combat so attempt to dismiss pet
|
|
local summonedPet = C_PetJournal.GetSummonedPetGUID()
|
|
if summonedPet then
|
|
C_PetJournal.SummonPetByGUID(summonedPet)
|
|
end
|
|
end
|
|
end
|
|
|
|
hooksecurefunc(C_PetJournal, "SetPetLoadOutInfo", function()
|
|
-- Cancel existing ticker if one already exists
|
|
if petTicker then petTicker:Cancel() end
|
|
-- Check for combat
|
|
if UnitAffectingCombat("player") then
|
|
-- Player is in combat so schedule ticker for when combat ends
|
|
petCombat:RegisterEvent("PLAYER_REGEN_ENABLED")
|
|
else
|
|
-- Player is not in combat so run ticker now
|
|
petTicker = C_Timer.NewTicker(0.5, DismissPetTimerFunc, 15)
|
|
end
|
|
end)
|
|
|
|
-- Script for when combat ends
|
|
petCombat:SetScript("OnEvent", function()
|
|
-- Combat has ended so run ticker now
|
|
petTicker = C_Timer.NewTicker(0.5, DismissPetTimerFunc, 15)
|
|
petCombat:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show pet save button
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowPetSaveBtn"] == "On" then
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_Collections",function()
|
|
|
|
-- Create panel
|
|
local pFrame = CreateFrame("Frame", nil, PetJournal)
|
|
pFrame:ClearAllPoints()
|
|
pFrame:SetPoint("TOPLEFT", PetJournalLoadoutBorder, "TOPLEFT", 4, 40)
|
|
pFrame:SetSize(PetJournalLoadoutBorder:GetWidth() -10, 16)
|
|
pFrame:Hide()
|
|
pFrame:SetFrameLevel(5000)
|
|
|
|
-- Add background color
|
|
pFrame.t = pFrame:CreateTexture(nil, "BACKGROUND")
|
|
pFrame.t:SetAllPoints()
|
|
pFrame.t:SetColorTexture(0.05, 0.05, 0.05, 0.7)
|
|
|
|
-- Create editbox
|
|
local petEB = CreateFrame("EditBox", nil, pFrame)
|
|
petEB:SetAllPoints()
|
|
petEB:SetTextInsets(2, 2, 2, 2)
|
|
petEB:SetFontObject("GameFontNormal")
|
|
petEB:SetTextColor(1.0, 1.0, 1.0, 1)
|
|
petEB:SetBlinkSpeed(0)
|
|
petEB:SetAltArrowKeyMode(true)
|
|
|
|
-- Prevent changes
|
|
petEB:SetScript("OnEscapePressed", function() pFrame:Hide() end)
|
|
petEB:SetScript("OnEnterPressed", function() petEB:HighlightText() end)
|
|
petEB:SetScript("OnMouseDown", function() petEB:ClearFocus() end)
|
|
petEB:SetScript("OnMouseUp", function() petEB:HighlightText() end)
|
|
|
|
-- Create tooltip
|
|
petEB.tiptext = L["This command will assign your current pet team and selected abilities.|n|nPress CTRL/C to copy the command then paste it into a macro or chat window with CTRL/V."]
|
|
petEB:HookScript("OnEnter", function()
|
|
GameTooltip:SetOwner(petEB, "ANCHOR_TOP")
|
|
GameTooltip:SetText(petEB.tiptext, nil, nil, nil, nil, true)
|
|
end)
|
|
petEB:HookScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Function to get pet data and build macro
|
|
local function RefreshPets()
|
|
-- Get pet data
|
|
local p1, p1a, p1b, p1c = C_PetJournal.GetPetLoadOutInfo(1)
|
|
local p2, p2a, p2b, p2c = C_PetJournal.GetPetLoadOutInfo(2)
|
|
local p3, p3a, p3b, p3c = C_PetJournal.GetPetLoadOutInfo(3)
|
|
if p1 and p1a and p1b and p1c and p2 and p2a and p2b and p2c and p3 and p3a and p3b and p3c then
|
|
-- Build macro string and show it in editbox
|
|
local comTeam = "/ltp team "
|
|
comTeam = comTeam .. p1 .. ',' .. p1a .. ',' .. p1b .. ',' .. p1c .. ","
|
|
comTeam = comTeam .. p2 .. ',' .. p2a .. ',' .. p2b .. ',' .. p2c .. ","
|
|
comTeam = comTeam .. p3 .. ',' .. p3a .. ',' .. p3b .. ',' .. p3c
|
|
petEB:SetText(comTeam)
|
|
petEB:HighlightText()
|
|
petEB:SetFocus()
|
|
end
|
|
end
|
|
|
|
-- Prevent changes to editbox value
|
|
petEB:SetScript("OnChar", RefreshPets)
|
|
petEB:SetScript("OnKeyUp", RefreshPets)
|
|
|
|
-- Refresh pet data when slots are changed
|
|
hooksecurefunc(C_PetJournal, "SetPetLoadOutInfo", RefreshPets)
|
|
|
|
-- Add macro button
|
|
local macroBtn = LeaPlusLC:CreateButton("PetMacroBtn", _G["PetJournalLoadoutPet1"], "", "TOPRIGHT", 0, 0, 32, 32, false, "")
|
|
macroBtn:SetFrameLevel(5000)
|
|
macroBtn:SetNormalTexture("Interface\\BUTTONS\\AdventureGuideMicrobuttonAlert")
|
|
macroBtn:SetScript("OnClick", function()
|
|
if C_PetJournal.GetPetLoadOutInfo(1) and C_PetJournal.GetPetLoadOutInfo(2) and C_PetJournal.GetPetLoadOutInfo(3) then
|
|
if pFrame:IsShown() then
|
|
-- Frame is already showing so hide it
|
|
pFrame:Hide()
|
|
else
|
|
-- Show macro panel
|
|
pFrame:Show()
|
|
RefreshPets()
|
|
end
|
|
else
|
|
LeaPlusLC:Print("You need a battle pet team.")
|
|
end
|
|
end)
|
|
macroBtn:HookScript("OnHide", function() pFrame:Hide() end)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Faster looting
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["FasterLooting"] == "On" then
|
|
|
|
|
|
-- Create configuration panel
|
|
local FasterLootPanel = LeaPlusLC:CreatePanel("Faster auto loot", "FasterLootPanel")
|
|
|
|
LeaPlusLC:MakeTx(FasterLootPanel, "Delay", 16, -72)
|
|
LeaPlusLC:MakeSL(FasterLootPanel, "LeaPlusFasterLootDelay", "Drag to set the delay between looting items.|n|nLower is faster but may not always give the best results.|n|nIt's recommended that you leave this setting at 0.3 but feel free to try lower values if you wish.", 0.1, 0.3, 0.1, 16, -92, "%.1f")
|
|
LeaPlusLC:MakeFT(FasterLootPanel, "The default delay setting is 0.3. Lower is faster but may not always give the best results. It's recommended that you leave this setting at 0.3.", 16, 510, 96)
|
|
|
|
-- Help button hidden
|
|
FasterLootPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
FasterLootPanel.b:SetScript("OnClick", function()
|
|
FasterLootPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page7"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
FasterLootPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset slider
|
|
LeaPlusLC["LeaPlusFasterLootDelay"] = 0.3
|
|
|
|
-- Refresh side panel
|
|
FasterLootPanel:Hide(); FasterLootPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["FasterLootingBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["LeaPlusFasterLootDelay"] = 0.3
|
|
FasterLootPanel:Hide(); FasterLootPanel:Show()
|
|
else
|
|
FasterLootPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Time delay
|
|
local tDelay = 0
|
|
|
|
-- Fast loot function
|
|
local function FastLoot()
|
|
if GetTime() - tDelay >= LeaPlusLC["LeaPlusFasterLootDelay"] then
|
|
tDelay = GetTime()
|
|
if GetCVarBool("autoLootDefault") ~= IsModifiedClick("AUTOLOOTTOGGLE") then
|
|
if TSMDestroyBtn and TSMDestroyBtn:IsShown() and TSMDestroyBtn:GetButtonState() == "DISABLED" then tDelay = GetTime() return end
|
|
for i = GetNumLootItems(), 1, -1 do
|
|
LootSlot(i)
|
|
end
|
|
tDelay = GetTime()
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Event frame
|
|
local faster = CreateFrame("Frame")
|
|
faster:RegisterEvent("LOOT_READY")
|
|
faster:SetScript("OnEvent", FastLoot)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide event toasts
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideEventToasts"] == "On" then
|
|
|
|
-- Hide event toasts when shown except toasts with a close button (Torghast final scores)
|
|
hooksecurefunc(EventToastManagerFrame, "Show", function()
|
|
if not EventToastManagerFrame.HideButton:IsShown() then
|
|
if EventToastManagerFrame.currentDisplayingToast then
|
|
if IsInJailersTower() then
|
|
-- Show floor summary
|
|
local title = EventToastManagerFrame.currentDisplayingToast.Title:GetText() or nil
|
|
if title and strfind(title, JAILERS_TOWER_SCENARIO_FLOOR) then
|
|
-- Add right-click to close floor summary
|
|
EventToastManagerFrame.currentDisplayingToast:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then
|
|
EventToastManagerFrame:CloseActiveToasts()
|
|
return
|
|
end
|
|
end)
|
|
return
|
|
end
|
|
end
|
|
EventToastManagerFrame.currentDisplayingToast:OnAnimatedOut()
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Force zone text to show while EventToastManagerFrame is showing
|
|
ZoneTextFrame:HookScript("OnEvent", function(self, event)
|
|
if EventToastManagerFrame:IsShown() then
|
|
if event == "ZONE_CHANGED_NEW_AREA" and not ZoneTextFrame:IsShown() then
|
|
FadingFrame_Show(ZoneTextFrame)
|
|
elseif event == "ZONE_CHANGED_INDOORS" and not SubZoneTextFrame:IsShown() then
|
|
FadingFrame_Show(SubZoneTextFrame)
|
|
end
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide boss banner
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideBossBanner"] == "On" then
|
|
BossBanner:UnregisterEvent("ENCOUNTER_LOOT_RECEIVED")
|
|
BossBanner:UnregisterEvent("BOSS_KILL")
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide clean-up buttons
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideCleanupBtns"] == "On" and not LeaLockList["HideCleanupBtns"] then
|
|
-- Hide backpack clean-up button and make item search box longer
|
|
BagItemAutoSortButton:HookScript("OnShow", BagItemAutoSortButton.Hide)
|
|
BagItemSearchBox:SetWidth(120)
|
|
|
|
-- Hide bank frame clean-up button and make item search box longer
|
|
if LeaPlusLC.NewPatch then
|
|
BankPanel.AutoSortButton:HookScript("OnShow", BankPanel.AutoSortButton.Hide)
|
|
else
|
|
BankItemAutoSortButton:HookScript("OnShow", BankItemAutoSortButton.Hide)
|
|
end
|
|
BankItemSearchBox:ClearAllPoints()
|
|
BankItemSearchBox:SetPoint("TOPRIGHT", BankFrame, "TOPRIGHT", -27, -33)
|
|
BankItemSearchBox:SetWidth(120)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide talking frame
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideTalkingFrame"] == "On" then
|
|
|
|
hooksecurefunc(TalkingHeadFrame, "PlayCurrent", function(self)
|
|
self:Hide()
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Disable bag automation
|
|
----------------------------------------------------------------------
|
|
|
|
-- Taint (old)
|
|
-- Open vendor, close vendor, open vendor
|
|
-- Click the bag icon to switch bag mode (either from single to combined or combined to single).
|
|
-- Buy alcohol if you don't have it already (if you do, skip this step) (tested with Bottle of Dalaran Noir).
|
|
-- Drink alcohol from bags.
|
|
|
|
if LeaPlusLC["NoBagAutomation"] == "On" and not LeaLockList["NoBagAutomation"] then
|
|
RunScript("hooksecurefunc('OpenAllBags', CloseAllBags)")
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Automate quests (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create configuration panel
|
|
local QuestPanel = LeaPlusLC:CreatePanel("Automate quests", "QuestPanel")
|
|
|
|
LeaPlusLC:MakeTx(QuestPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(QuestPanel, "AutoQuestRegular", "Accept regular quests automatically", 16, -92, false, "If checked, regular quests will be accepted automatically.|n|nThis does not apply to daily or weekly quests.")
|
|
LeaPlusLC:MakeCB(QuestPanel, "AutoQuestDaily", "Accept daily quests automatically", 16, -112, false, "If checked, daily quests will be accepted automatically.")
|
|
LeaPlusLC:MakeCB(QuestPanel, "AutoQuestWeekly", "Accept weekly quests automatically", 16, -132, false, "If checked, weekly quests will be accepted automatically.")
|
|
LeaPlusLC:MakeCB(QuestPanel, "AutoQuestCompleted", "Turn-in completed quests automatically", 16, -152, false, "If checked, completed quests will be turned-in automatically.")
|
|
LeaPlusLC:MakeCB(QuestPanel, "AutoQuestShift", "Require override key for quest automation", 16, -172, false, "If checked, you will need to hold the override key down for quests to be automated.|n|nIf unchecked, holding the override key will prevent quests from being automated.")
|
|
|
|
-- Add dropdown menu
|
|
LeaPlusLC:CreateDropdown("AutoQuestKeyMenu", "Override key", 146, "TOPLEFT", QuestPanel, "TOPLEFT", 356, -92, {{L["SHIFT"], 1}, {L["ALT"], 2}, {L["CONTROL"], 3}, {L["CMD (MAC)"], 4}})
|
|
|
|
-- Help button hidden
|
|
QuestPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
QuestPanel.b:SetScript("OnClick", function()
|
|
QuestPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page1"]:Show();
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
QuestPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
LeaPlusLC["AutoQuestShift"] = "Off"
|
|
LeaPlusLC["AutoQuestRegular"] = "On"
|
|
LeaPlusLC["AutoQuestDaily"] = "On"
|
|
LeaPlusLC["AutoQuestWeekly"] = "On"
|
|
LeaPlusLC["AutoQuestCompleted"] = "On"
|
|
LeaPlusLC["AutoQuestKeyMenu"] = 1
|
|
|
|
-- Refresh panel
|
|
QuestPanel:Hide(); QuestPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["AutomateQuestsBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["AutoQuestShift"] = "Off"
|
|
LeaPlusLC["AutoQuestRegular"] = "On"
|
|
LeaPlusLC["AutoQuestDaily"] = "On"
|
|
LeaPlusLC["AutoQuestWeekly"] = "On"
|
|
LeaPlusLC["AutoQuestCompleted"] = "On"
|
|
LeaPlusLC["AutoQuestKeyMenu"] = 1
|
|
else
|
|
QuestPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Function to determine if override key is being held
|
|
local function IsOverrideKeyDown()
|
|
if LeaPlusLC["AutoQuestKeyMenu"] == 1 and IsShiftKeyDown()
|
|
or LeaPlusLC["AutoQuestKeyMenu"] == 2 and IsAltKeyDown()
|
|
or LeaPlusLC["AutoQuestKeyMenu"] == 3 and IsControlKeyDown()
|
|
or LeaPlusLC["AutoQuestKeyMenu"] == 4 and IsMetaKeyDown()
|
|
then
|
|
return true
|
|
end
|
|
end
|
|
|
|
-- Funcion to ignore specific NPCs
|
|
local function isNpcBlocked(actionType)
|
|
local npcGuid = UnitGUID("npc") or nil -- npc works when cvar SoftTargetInteract set to 3 (was target)
|
|
if npcGuid then
|
|
local void, void, void, void, void, npcID = strsplit("-", npcGuid)
|
|
if npcID then
|
|
-- Ignore specific NPCs for selecting, accepting and turning-in quests (required if automation has consequences)
|
|
if npcID == "15192" -- Anachronos (Caverns of Time)
|
|
or npcID == "119388" -- Chieftain Hatuun (Krokul Hovel, Krokuun)
|
|
or npcID == "6566" -- Estelle Gendry (Heirloom Curator, Undercity)
|
|
or npcID == "45400" -- Fiona's Caravan (Eastern Plaguelands)
|
|
or npcID == "18166" -- Khadgar (Allegiance to Aldor/Scryer, Shattrath)
|
|
or npcID == "55402" -- Korgol Crushskull (Darkmoon Faire, Pit Master)
|
|
or npcID == "6294" -- Krom Stoutarm (Heirloom Curator, Ironforge)
|
|
or npcID == "109227" -- Meliah Grayfeather (Tradewind Roost, Highmountain)
|
|
or npcID == "99183" -- Renegade Ironworker (Tanaan Jungle, repeatable quest)
|
|
or npcID == "114719" -- Trader Caelen (Obliterum Forge, Dalaran, Broken Isles)
|
|
-- Seals of Fate
|
|
or npcID == "111243" -- Archmage Lan'dalock (Seal quest, Dalaran)
|
|
or npcID == "87391" -- Fate-Twister Seress (Seal quest, Stormshield)
|
|
or npcID == "88570" -- Fate-Twister Tiklal (Seal quest, Horde)
|
|
or npcID == "142063" -- Tezran (Seal quest, Boralus Harbor, Alliance)
|
|
or npcID == "141584" -- Zurvan (Seal quest, Dazar'alor, Horde)
|
|
-- Wartime Donations (Alliance)
|
|
or npcID == "142994" -- Brandal Darkbeard (Boralus)
|
|
or npcID == "142995" -- Charlane (Boralus)
|
|
or npcID == "142993" -- Chelsea Strand (Boralus)
|
|
or npcID == "142998" -- Faella (Boralus)
|
|
or npcID == "143004" -- Larold Kyne (Boralus)
|
|
or npcID == "143005" -- Liao (Boralus)
|
|
or npcID == "143007" -- Mae Wagglewand (Boralus)
|
|
or npcID == "143008" -- Norber Togglesprocket (Boralus)
|
|
or npcID == "142685" -- Paymaster Vauldren (Boralus)
|
|
or npcID == "142700" -- Quartermaster Peregrin (Boralus)
|
|
or npcID == "142997" -- Senedras (Boralus)
|
|
-- Wartime Donations (Horde)
|
|
or npcID == "142970" -- Kuma Longhoof (Dazar'alor)
|
|
or npcID == "142969" -- Logarr (Dazar'alor)
|
|
or npcID == "142973" -- Mai-Lu (Dazar'alor)
|
|
or npcID == "142977" -- Meredith Swane (Dazar'alor)
|
|
or npcID == "142981" -- Merill Redgrave (Dazar'alor)
|
|
or npcID == "142157" -- Paymaster Grintooth (Dazar'alor)
|
|
or npcID == "142158" -- Quartermaster Rauka (Dazar'alor)
|
|
or npcID == "142975" -- Seamstress Vessa (Dazar'alor)
|
|
or npcID == "142983" -- Swizzle Fizzcrank (Dazar'alor)
|
|
or npcID == "142992" -- Uma'wi (Dazar'alor)
|
|
or npcID == "142159" -- Zen'kin (Dazar'alor)
|
|
-- Dragonflight
|
|
or npcID == "193110" -- Khadin <Master Artisan> (Ohn'ahran Plains)
|
|
then
|
|
return true
|
|
end
|
|
-- Ignore specific NPCs for selecting quests only (only used for items that have no other purpose)
|
|
if actionType == "Select" then
|
|
if npcID == "87706" -- Gazmolf Futzwangler (Reputation quests, Nagrand, Draenor)
|
|
or npcID == "70022" -- Ku'ma (Isle of Giants, Pandaria)
|
|
or npcID == "12944" -- Lokhtos Darkbargainer (Thorium Brotherhood, Blackrock Depths)
|
|
or npcID == "87393" -- Sallee Silverclamp (Reputation quests, Nagrand, Draenor)
|
|
or npcID == "10307" -- Witch Doctor Mau'ari (E'Ko quests, Winterspring)
|
|
then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Function to check if quest ID is blocked
|
|
local function IsQuestIDBlocked(questID)
|
|
if questID then
|
|
if questID == 43923 -- Starlight Rose
|
|
or questID == 43924 -- Leyblood
|
|
or questID == 43925 -- Runescale Koi
|
|
or questID == 71162 -- Waygate: Algeth'era (Thaelin Darkanvil, Dragonflight)
|
|
or questID == 71165 -- Waygate: Eon's Fringe (Thaelin Darkanvil, Dragonflight)
|
|
or questID == 71138 -- Waygate: Rusza'thar Reach (Thaelin Darkanvil, Dragonflight)
|
|
or questID == 71178 -- Waygate: Shady Sanctuary (Thaelin Darkanvil, Dragonflight)
|
|
or questID == 71157 -- Waygate: Skytop Observatory (Thaelin Darkanvil, Dragonflight)
|
|
or questID == 71161 -- Waygate: Vakthros (Thaelin Darkanvil, Dragonflight)
|
|
|
|
-- Khuri (The Dragon Isles) (Catch and Release quests) (don't select and accept quest if requirements aren't met including bank storage)
|
|
or questID == 70199 and C_Item.GetItemCount(194730, true, true, true) < 20 -- Scalebelly Mackerel
|
|
or questID == 70200 and C_Item.GetItemCount(194966, true, true, true) < 20 -- Thousandbite Piranha
|
|
or questID == 70201 and C_Item.GetItemCount(194967, true, true, true) < 20 -- Aileron Seamoth
|
|
or questID == 70202 and C_Item.GetItemCount(194968, true, true, true) < 20 -- Cerulean Spinefish
|
|
or questID == 70203 and C_Item.GetItemCount(194969, true, true, true) < 20 -- Temporal Dragonhead
|
|
or questID == 70935 and C_Item.GetItemCount(194970, true, true, true) < 20 -- Islefin Dorado
|
|
|
|
then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Function to check if a required item is account-bound
|
|
local function IsItemAccountBound(itemID)
|
|
local tooltipData = C_TooltipInfo.GetItemByID(itemID)
|
|
for row, line in ipairs(tooltipData.lines) do
|
|
if tooltipData.lines[row] and tooltipData.lines[row].leftText and (tooltipData.lines[row].leftText == ITEM_BNETACCOUNTBOUND or tooltipData.lines[row].leftText == ITEM_BIND_TO_BNETACCOUNT or tooltipData.lines[row].leftText == ITEM_BIND_TO_ACCOUNT or tooltipData.lines[row].leftText == ITEM_ACCOUNTBOUND) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Function to check if quest requires currency or a crafting reagent or required item is account-bound
|
|
local function QuestRequiresCurrency()
|
|
for i = 1, 6 do
|
|
local progItem = _G["QuestProgressItem" ..i] or nil
|
|
if progItem and progItem:IsShown() and progItem.type == "required" then
|
|
if progItem.objectType == "currency" then
|
|
-- Quest requires currency so do nothing
|
|
return true
|
|
elseif progItem.objectType == "item" then
|
|
-- Quest requires an item
|
|
local name, texture, numItems, void, void, itemID = GetQuestItemInfo("required", i)
|
|
if name and itemID then
|
|
local void, void, void, void, void, void, void, void, void, void, void, void, void, void, void, void, isCraftingReagent = C_Item.GetItemInfo(itemID)
|
|
if isCraftingReagent or IsItemAccountBound(itemID) then
|
|
-- Item is a crafting reagent or account-bound so do nothing
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Function to check if quest requires gold
|
|
local function QuestRequiresGold()
|
|
local goldRequiredAmount = GetQuestMoneyToGet()
|
|
if goldRequiredAmount and goldRequiredAmount > 0 then
|
|
return true
|
|
end
|
|
end
|
|
|
|
-- Function to check if quest ID has requirements met
|
|
local function DoesQuestHaveRequirementsMet(qID)
|
|
if qID and qID ~= "" then
|
|
|
|
if not qID then
|
|
|
|
-- Scourgestones
|
|
elseif qID == 62293 then
|
|
-- Quest Darkened Scourgestones requires 25 Darkened Scourgestones
|
|
if C_Item.GetItemCount(180720) >= 25 then return true end
|
|
|
|
elseif qID == 62292 then
|
|
-- Quest Pitch Black Scourgestones requires 25 Pitch Black Scourgestones
|
|
if C_Item.GetItemCount(183200) >= 25 then return true end
|
|
|
|
elseif qID == 10325 or qID == 10326 then
|
|
-- Requires 10 More Marks of Kil'jaeden
|
|
if C_Item.GetItemCount(29425) >= 10 then return true end
|
|
|
|
elseif qID == 10655 or qID == 10828 then
|
|
-- Requires 1 Marks of Sargeras (if more than 10, leave for More Marks of Sargeras)
|
|
if C_Item.GetItemCount(30809) >= 1 and C_Item.GetItemCount(30809) < 10 then return true end
|
|
|
|
elseif qID == 10654 or qID == 10827 then
|
|
-- Requires 10 Marks of Sargeras
|
|
if C_Item.GetItemCount(30809) >= 10 then return true end
|
|
|
|
elseif qID == 10412 or qID == 10415 then
|
|
-- Requires 10 Firewing Signets
|
|
if C_Item.GetItemCount(29426) >= 10 then return true end
|
|
|
|
elseif qID == 10659 or qID == 10822 then
|
|
-- Requires 1 Sunfury Signet (if more than 10, leave for More Sunfury Signets)
|
|
if C_Item.GetItemCount(30810) >= 1 and C_Item.GetItemCount(30810) < 10 then return true end
|
|
|
|
elseif qID == 10658 or qID == 10823 then
|
|
-- Requires 10 Sunfury Signets
|
|
if C_Item.GetItemCount(30810) >= 10 then return true end
|
|
|
|
else return true
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Create event frame
|
|
local qFrame = CreateFrame("FRAME")
|
|
|
|
-- Function to setup events
|
|
local function SetupEvents()
|
|
if LeaPlusLC["AutomateQuests"] == "On" then
|
|
qFrame:RegisterEvent("QUEST_DETAIL")
|
|
qFrame:RegisterEvent("QUEST_ACCEPT_CONFIRM")
|
|
qFrame:RegisterEvent("QUEST_PROGRESS")
|
|
qFrame:RegisterEvent("QUEST_COMPLETE")
|
|
qFrame:RegisterEvent("QUEST_GREETING")
|
|
qFrame:RegisterEvent("QUEST_AUTOCOMPLETE")
|
|
qFrame:RegisterEvent("GOSSIP_SHOW")
|
|
qFrame:RegisterEvent("QUEST_FINISHED")
|
|
else
|
|
qFrame:UnregisterAllEvents()
|
|
end
|
|
end
|
|
|
|
-- Setup events when option is clicked and on startup (if option is enabled)
|
|
LeaPlusCB["AutomateQuests"]:HookScript("OnClick", SetupEvents)
|
|
if LeaPlusLC["AutomateQuests"] == "On" then SetupEvents() end
|
|
|
|
-- Store quest frequency values
|
|
local regularQuest = Enum.QuestFrequency.Default
|
|
local dailyQuest = Enum.QuestFrequency.Daily
|
|
local weeklyQuest = Enum.QuestFrequency.Weekly
|
|
|
|
-- Event handler
|
|
qFrame:SetScript("OnEvent", function(self, event, arg1)
|
|
|
|
-- Block shared quests if option is enabled
|
|
if event == "QUEST_DETAIL" then
|
|
LeaPlusLC:CheckIfQuestIsSharedAndShouldBeDeclined()
|
|
end
|
|
|
|
-- Clear progress items when quest interaction has ceased
|
|
if event == "QUEST_FINISHED" then
|
|
for i = 1, 6 do
|
|
local progItem = _G["QuestProgressItem" ..i] or nil
|
|
if progItem and progItem:IsShown() then
|
|
progItem:Hide()
|
|
end
|
|
end
|
|
return
|
|
end
|
|
|
|
-- Check for SHIFT key modifier
|
|
if LeaPlusLC["AutoQuestShift"] == "On" and not IsOverrideKeyDown() then return
|
|
elseif LeaPlusLC["AutoQuestShift"] == "Off" and IsOverrideKeyDown() then return
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Accept quests automatically
|
|
----------------------------------------------------------------------
|
|
|
|
-- Accept quests with a quest detail window
|
|
if event == "QUEST_DETAIL" then
|
|
if LeaPlusLC["AutoQuestRegular"] == "On" or LeaPlusLC["AutoQuestDaily"] == "On" or LeaPlusLC["AutoQuestWeekly"] == "On" then
|
|
-- Don't accept quests if option is not enabled
|
|
if LeaPlusLC["AutoQuestRegular"] == "Off" and not QuestIsDaily() and not QuestIsWeekly() then return end
|
|
-- Don't accept daily quests if option is not enabled
|
|
if LeaPlusLC["AutoQuestDaily"] == "Off" and QuestIsDaily() then return end
|
|
-- Don't accept weekly quests if option is not enabled
|
|
if LeaPlusLC["AutoQuestWeekly"] == "Off" and QuestIsWeekly() then return end
|
|
-- Don't accept blocked quests
|
|
if isNpcBlocked("Accept") then return end
|
|
-- Accept quest
|
|
if QuestGetAutoAccept() then
|
|
-- Quest has already been accepted by Wow so close the quest detail window
|
|
CloseQuest()
|
|
else
|
|
-- Quest has not been accepted by Wow so accept it
|
|
AcceptQuest()
|
|
--HideUIPanel(QuestFrame)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Accept quests which require confirmation (such as sharing escort quests)
|
|
if event == "QUEST_ACCEPT_CONFIRM" then
|
|
if LeaPlusLC["AutoQuestRegular"] == "On" then
|
|
ConfirmAcceptQuest()
|
|
StaticPopup_Hide("QUEST_ACCEPT")
|
|
end
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Turn-in quests automatically
|
|
----------------------------------------------------------------------
|
|
|
|
-- Turn-in progression quests
|
|
if event == "QUEST_PROGRESS" and IsQuestCompletable() then
|
|
if LeaPlusLC["AutoQuestCompleted"] == "On" then
|
|
-- Don't continue quests for blocked NPCs
|
|
if isNpcBlocked("Complete") then return end
|
|
-- Don't continue if quest requires currency
|
|
if QuestRequiresCurrency() then return end
|
|
-- Don't continue if quest requires gold
|
|
if QuestRequiresGold() then return end
|
|
-- Continue quest
|
|
CompleteQuest()
|
|
end
|
|
end
|
|
|
|
-- Turn in completed quests if only one reward item is being offered
|
|
if event == "QUEST_COMPLETE" then
|
|
if LeaPlusLC["AutoQuestCompleted"] == "On" then
|
|
-- Don't complete quests for blocked NPCs
|
|
if isNpcBlocked("Complete") then return end
|
|
-- Don't complete if quest requires currency
|
|
if QuestRequiresCurrency() then return end
|
|
-- Don't complete if quest requires gold
|
|
if QuestRequiresGold() then return end
|
|
-- Complete quest
|
|
if GetNumQuestChoices() <= 1 then
|
|
GetQuestReward(GetNumQuestChoices())
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Show quest dialog for quests that use the objective tracker (it will be completed automatically)
|
|
if event == "QUEST_AUTOCOMPLETE" then
|
|
if LeaPlusLC["AutoQuestCompleted"] == "On" then
|
|
local index = C_QuestLog.GetLogIndexForQuestID(arg1)
|
|
local info = C_QuestLog.GetInfo(index)
|
|
if info and info.isAutoComplete then
|
|
local questID = C_QuestLog.GetQuestIDForLogIndex(index)
|
|
C_QuestLog.SetSelectedQuest(questID)
|
|
ShowQuestComplete(C_QuestLog.GetSelectedQuest())
|
|
end
|
|
end
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Select quests automatically
|
|
----------------------------------------------------------------------
|
|
|
|
if event == "GOSSIP_SHOW" or event == "QUEST_GREETING" then
|
|
|
|
-- Select quests
|
|
if UnitExists("npc") or QuestFrameGreetingPanel:IsShown() then
|
|
|
|
-- Do nothing if there is a gossip option with a color code (such as skip ahead)
|
|
local gossipInfoTable = C_GossipInfo.GetOptions()
|
|
for i = 1, #gossipInfoTable do
|
|
local nameText = gossipInfoTable[i].name
|
|
if nameText then
|
|
if string.find(strupper(nameText), "|C") or string.find(strupper(nameText), "<")then
|
|
if not string.find(nameText, "FF0008E8") then -- Purple text such as Darkmoon Faire daily quests
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Don't select quests for blocked NPCs
|
|
if isNpcBlocked("Select") then return end
|
|
|
|
-- Select quests
|
|
if event == "QUEST_GREETING" then
|
|
-- Select quest greeting completed quests
|
|
if LeaPlusLC["AutoQuestCompleted"] == "On" then
|
|
for i = 1, GetNumActiveQuests() do
|
|
local title, isComplete = GetActiveTitle(i)
|
|
if title and isComplete then
|
|
return SelectActiveQuest(i)
|
|
end
|
|
end
|
|
end
|
|
-- Select quest greeting available quests
|
|
if LeaPlusLC["AutoQuestRegular"] == "On" or LeaPlusLC["AutoQuestDaily"] == "On" or LeaPlusLC["AutoQuestWeekly"] == "On" then
|
|
for i = 1, GetNumAvailableQuests() do
|
|
local title, isComplete = GetAvailableTitle(i)
|
|
if title and not isComplete then
|
|
local isTrivial, frequency, isRepeatable, isLegendary = GetAvailableQuestInfo(i)
|
|
if frequency ~= regularQuest or LeaPlusLC["AutoQuestRegular"] == "On" then
|
|
if frequency ~= dailyQuest or LeaPlusLC["AutoQuestDaily"] == "On" then
|
|
if frequency ~= weeklyQuest or LeaPlusLC["AutoQuestWeekly"] == "On" then
|
|
return SelectAvailableQuest(i)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
else
|
|
-- Select gossip completed quests
|
|
if LeaPlusLC["AutoQuestCompleted"] == "On" then
|
|
local gossipQuests = C_GossipInfo.GetActiveQuests()
|
|
for titleIndex, questInfo in ipairs(gossipQuests) do
|
|
if questInfo.title and questInfo.isComplete then
|
|
if questInfo.questID then
|
|
return C_GossipInfo.SelectActiveQuest(questInfo.questID)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-- Select gossip available quests
|
|
if LeaPlusLC["AutoQuestRegular"] == "On" or LeaPlusLC["AutoQuestDaily"] == "On" or LeaPlusLC["AutoQuestWeekly"] == "On" then
|
|
local GossipQuests = C_GossipInfo.GetAvailableQuests()
|
|
for titleIndex, questInfo in ipairs(GossipQuests) do
|
|
if questInfo.frequency ~= regularQuest or LeaPlusLC["AutoQuestRegular"] == "On" then
|
|
if questInfo.frequency ~= dailyQuest or LeaPlusLC["AutoQuestDaily"] == "On" then
|
|
if questInfo.frequency ~= weeklyQuest or LeaPlusLC["AutoQuestWeekly"] == "On" then
|
|
if questInfo.questID and not IsQuestIDBlocked(questInfo.questID) and DoesQuestHaveRequirementsMet(questInfo.questID) then
|
|
return C_GossipInfo.SelectAvailableQuest(questInfo.questID)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide bogyguard gossip
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideBodyguard"] == "On" then
|
|
local gFrame = CreateFrame("FRAME")
|
|
gFrame:RegisterEvent("GOSSIP_SHOW")
|
|
|
|
local bodyNames = {}
|
|
for i, v in pairs({--[[Delvar Ironfist]] 1733, --[[Tormmok]] 1736, --[[Talonpriest Ishaal]] 1737, --[[Defender Illona]] 1738, --[[Vivianne]] 1739, --[[Aeda Brightdawn]] 1740, --[[Leorajh]] 1741}) do
|
|
local reputationInfo = C_GossipInfo.GetFriendshipReputation(v)
|
|
bodyNames[reputationInfo.name] = true
|
|
end
|
|
|
|
gFrame:SetScript("OnEvent", function()
|
|
-- Do nothing if shift is being held
|
|
if IsShiftKeyDown() then return end
|
|
local name = UnitName("target") or nil
|
|
if bodyNames[name] then
|
|
-- Close gossip window if it's for a cooperating (active) bodyguard
|
|
-- If you open a gossip window prior to the bodyguard (or hold shift), it will not close
|
|
-- and will need to be closed manually.
|
|
if UnitCanCooperate("target", "player") then
|
|
C_GossipInfo.CloseGossip()
|
|
end
|
|
end
|
|
end)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Sell junk automatically
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["AutoSellJunk"] == "On" then
|
|
|
|
-- Hide the sell all junk items button
|
|
MerchantSellAllJunkButton:HookScript("OnShow", function() MerchantSellAllJunkButton:Hide() end)
|
|
|
|
-- Create sell junk banner
|
|
local StartMsg = CreateFrame("FRAME", nil, MerchantFrame)
|
|
StartMsg:ClearAllPoints()
|
|
StartMsg:SetPoint("BOTTOMLEFT", 4, 4)
|
|
StartMsg:SetSize(160, 22)
|
|
StartMsg:SetToplevel(true)
|
|
StartMsg:Hide()
|
|
|
|
StartMsg.s = StartMsg:CreateTexture(nil, "BACKGROUND")
|
|
StartMsg.s:SetAllPoints()
|
|
StartMsg.s:SetColorTexture(0.1, 0.1, 0.1, 1.0)
|
|
|
|
StartMsg.f = StartMsg:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
StartMsg.f:SetAllPoints();
|
|
StartMsg.f:SetText(L["SELLING JUNK"])
|
|
|
|
-- Declarations
|
|
local IterationCount, totalPrice = 500, 0
|
|
local SellJunkTicker
|
|
|
|
-- Create custom NewTicker function (from Wrath)
|
|
local function LeaPlusNewTicker(duration, callback, iterations)
|
|
local ticker = setmetatable({}, TickerMetatable)
|
|
ticker._remainingIterations = iterations
|
|
ticker._callback = function()
|
|
if (not ticker._cancelled) then
|
|
callback(ticker)
|
|
--Make sure we weren't cancelled during the callback
|
|
if (not ticker._cancelled) then
|
|
if (ticker._remainingIterations) then
|
|
ticker._remainingIterations = ticker._remainingIterations - 1
|
|
end
|
|
if (not ticker._remainingIterations or ticker._remainingIterations > 0) then
|
|
C_Timer.After(duration, ticker._callback)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
C_Timer.After(duration, ticker._callback)
|
|
return ticker
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local SellJunkFrame = LeaPlusLC:CreatePanel("Sell junk automatically", "SellJunkFrame")
|
|
LeaPlusLC:MakeTx(SellJunkFrame, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(SellJunkFrame, "AutoSellShowSummary", "Show vendor summary in chat", 16, -92, false, "If checked, a vendor summary will be shown in chat when junk is automatically sold.")
|
|
LeaPlusLC:MakeCB(SellJunkFrame, "AutoSellNoKeeperTahult", "Exclude Keeper Ta'hult's pet items", 16, -112, false, L["If checked, the following junk items required to purchase pets from Keeper Ta'hult in Oribos will not be sold automatically."] .. L["|cff889D9D|n"] .. L["|n- A Frayed Knot|n- Dark Iron Baby Booties|n- Ground Gear|n- Large Slimy Bone|n- Rabbits Foot|n- Robbles Wobbly Staff|n- Rotting Bear Carcass|n- The Stoppable Force|n- Very Unlucky Rock"] .. "|r")
|
|
LeaPlusLC:MakeCB(SellJunkFrame, "AutoSellNoGreyGear", "Exclude all unbound grey gear", 16, -132, false, L["If checked, grey gear that is not soulbound to your character will not be sold.|n|nUse this setting if you plan to sell grey gear in the auction house."])
|
|
|
|
-- Help button hidden
|
|
SellJunkFrame.h:Hide()
|
|
|
|
-- Back button handler
|
|
SellJunkFrame.b:SetScript("OnClick", function()
|
|
SellJunkFrame:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page1"]:Show();
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
SellJunkFrame.r.tiptext = SellJunkFrame.r.tiptext .. "|n|n" .. L["Note that this will not reset your exclusions list."]
|
|
SellJunkFrame.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
LeaPlusLC["AutoSellShowSummary"] = "On"
|
|
LeaPlusLC["AutoSellNoKeeperTahult"] = "On"
|
|
LeaPlusLC["AutoSellNoGreyGear"] = "Off"
|
|
|
|
-- Refresh panel
|
|
SellJunkFrame:Hide(); SellJunkFrame:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["AutoSellJunkBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["AutoSellShowSummary"] = "On"
|
|
LeaPlusLC["AutoSellNoKeeperTahult"] = "On"
|
|
LeaPlusLC["AutoSellNoGreyGear"] = "Off"
|
|
else
|
|
SellJunkFrame:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Function to stop selling
|
|
local function StopSelling()
|
|
if SellJunkTicker then SellJunkTicker._cancelled = true; end
|
|
StartMsg:Hide()
|
|
SellJunkFrame:UnregisterEvent("ITEM_LOCKED")
|
|
SellJunkFrame:UnregisterEvent("UI_ERROR_MESSAGE")
|
|
end
|
|
|
|
-- Create excluded box
|
|
local titleTX = LeaPlusLC:MakeTx(SellJunkFrame, "Exclusions", 356, -72)
|
|
titleTX:SetWidth(200)
|
|
titleTX:SetWordWrap(false)
|
|
titleTX:SetJustifyH("LEFT")
|
|
|
|
-- Show help button for exclusions
|
|
LeaPlusLC:CreateHelpButton("SellJunkExcludeHelpButton", SellJunkFrame, titleTX, "Enter item IDs separated by commas. Item IDs can be found in item tooltips while this panel is showing.|n|nJunk items entered here will not be sold automatically.|n|nWhite items entered here will be sold automatically.|n|nThe editbox tooltip will show you more information about the items you have entered.")
|
|
|
|
local eb = CreateFrame("Frame", nil, SellJunkFrame, "BackdropTemplate")
|
|
eb:SetSize(200, 180)
|
|
eb:SetPoint("TOPLEFT", 350, -92)
|
|
eb:SetBackdrop({
|
|
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
|
|
edgeFile = "Interface\\PVPFrame\\UI-Character-PVP-Highlight",
|
|
edgeSize = 16,
|
|
insets = {left = 8, right = 6, top = 8, bottom = 8},
|
|
})
|
|
eb:SetBackdropBorderColor(1.0, 0.85, 0.0, 0.5)
|
|
|
|
eb.scroll = CreateFrame("ScrollFrame", nil, eb, "LeaPlusSellJunkScrollFrameTemplate")
|
|
eb.scroll:SetPoint("TOPLEFT", eb, 12, -10)
|
|
eb.scroll:SetPoint("BOTTOMRIGHT", eb, -30, 10)
|
|
eb.scroll:SetPanExtent(16)
|
|
|
|
-- Create character count
|
|
eb.scroll.CharCount = eb.scroll:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
eb.scroll.CharCount:Hide()
|
|
|
|
eb.Text = eb.scroll.EditBox
|
|
eb.Text:SetWidth(150)
|
|
eb.Text:SetPoint("TOPLEFT", eb.scroll)
|
|
eb.Text:SetPoint("BOTTOMRIGHT", eb.scroll, -12, 0)
|
|
eb.Text:SetMaxLetters(2000)
|
|
eb.Text:SetFontObject(GameFontNormalLarge)
|
|
eb.Text:SetAutoFocus(false)
|
|
eb.scroll:SetScrollChild(eb.Text)
|
|
|
|
-- Set focus on the editbox text when clicking the editbox
|
|
eb:SetScript("OnMouseDown", function()
|
|
eb.Text:SetFocus()
|
|
eb.Text:SetCursorPosition(eb.Text:GetMaxLetters())
|
|
end)
|
|
|
|
-- Function to create whitelist
|
|
local whiteList = {}
|
|
local function UpdateWhiteList()
|
|
wipe(whiteList)
|
|
|
|
-- Keeper Ta'hult's pet items
|
|
if LeaPlusLC["AutoSellNoKeeperTahult"] == "On" then
|
|
|
|
-- Debug
|
|
-- whiteList[2219] = "Small White Shield"
|
|
-- whiteList[1820] = "Wooden Maul"
|
|
-- whiteList[1796] = "Rawhide Boots"
|
|
-- whiteList[2783] = "Shoddy Blunderbuss"
|
|
|
|
-- Ruby Baubleworm
|
|
whiteList[36812] = "Ground Gear"
|
|
whiteList[62072] = "Robbles Wobbly Staff"
|
|
whiteList[67410] = "Very Unlucky Rock"
|
|
|
|
-- Topaz Baubleworm
|
|
whiteList[11406] = "Rotting Bear Carcass"
|
|
whiteList[11944] = "Dark Iron Baby Booties"
|
|
whiteList[25402] = "The Stoppable Force"
|
|
|
|
-- Turquoise Baubleworm
|
|
whiteList[3300] = "Rabbits Foot"
|
|
whiteList[3670] = "Large Slimy Bone"
|
|
whiteList[6150] = "A Frayed Knot"
|
|
|
|
end
|
|
|
|
-- These items cannot be sold but the game thinks they can be
|
|
-- https://www.wowhead.com/items/quest/min-level:1/max-level:1/quality:0?filter=64;3;1
|
|
|
|
-- Continued Waygate Exploration
|
|
whiteList[200590] = "Carefully Rolled Message"
|
|
whiteList[200593] = "Sealed Expedition Note"
|
|
whiteList[200594] = "Thaelin's Second Favorite Comb"
|
|
whiteList[200595] = "Odorous Parchment"
|
|
whiteList[200596] = "Letter from Thaelin Darkanvil"
|
|
|
|
-- Dirty Old Satchel
|
|
whiteList[200592] = "Dirty Old Satchel"
|
|
whiteList[200606] = "Previously Owned Map"
|
|
|
|
-- Rock Buddy (item cannot be sold but sell price is reported as 1)
|
|
whiteList[228431] = "Rock Buddy"
|
|
|
|
-- End of whitelist
|
|
|
|
local whiteString = eb.Text:GetText()
|
|
if whiteString and whiteString ~= "" then
|
|
whiteString = whiteString:gsub("[^,%d]", "")
|
|
local tList = {strsplit(",", whiteString)}
|
|
for i = 1, #tList do
|
|
if tList[i] then
|
|
tList[i] = tonumber(tList[i])
|
|
if tList[i] then
|
|
whiteList[tList[i]] = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
LeaPlusLC["AutoSellExcludeList"] = whiteString
|
|
eb.Text:SetText(LeaPlusLC["AutoSellExcludeList"])
|
|
|
|
end
|
|
|
|
-- Save the excluded list when it changes and at startup
|
|
eb.Text:SetScript("OnTextChanged", UpdateWhiteList)
|
|
eb.Text:SetText(LeaPlusLC["AutoSellExcludeList"])
|
|
UpdateWhiteList()
|
|
|
|
-- Create whitelist on startup and option, reset or preset is clicked
|
|
UpdateWhiteList()
|
|
LeaPlusCB["AutoSellNoKeeperTahult"]:HookScript("OnClick", UpdateWhiteList)
|
|
SellJunkFrame.r:HookScript("OnClick", UpdateWhiteList)
|
|
LeaPlusCB["AutoSellJunkBtn"]:HookScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile (just the whitelist part)
|
|
UpdateWhiteList()
|
|
end
|
|
end)
|
|
|
|
-- Editbox tooltip
|
|
local tipPrefix = ""
|
|
|
|
-- Function to make tooltip string
|
|
local function MakeTooltipString()
|
|
|
|
local keepMsg = ""
|
|
local sellMsg = ""
|
|
local dupMsg = ""
|
|
local novalueMsg = ""
|
|
local incompatMsg = ""
|
|
|
|
local tipString = eb.Text:GetText()
|
|
if tipString and tipString ~= "" then
|
|
tipString = tipString:gsub("[^,%d]", "")
|
|
local tipList = {strsplit(",", tipString)}
|
|
for i = 1, #tipList do
|
|
if tipList[i] then
|
|
tipList[i] = tonumber(tipList[i])
|
|
if tipList[i] and tipList[i] > 0 and tipList[i] < 999999999 then
|
|
local void, tLink, Rarity, void, void, void, void, void, void, void, ItemPrice = C_Item.GetItemInfo(tipList[i])
|
|
if tLink and tLink ~= "" then
|
|
local linkCol = string.sub(tLink, 1, 10)
|
|
if linkCol then
|
|
local linkName = tLink:match("%[(.-)%]")
|
|
if linkName and ItemPrice then
|
|
if ItemPrice > 0 then
|
|
if Rarity == 0 then
|
|
-- Junk item
|
|
if string.find(keepMsg, "%(" .. tipList[i] .. "%)") then
|
|
-- Duplicate (ID appears more than once in list)
|
|
dupMsg = dupMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
else
|
|
-- Add junk item to keep list
|
|
keepMsg = keepMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
end
|
|
elseif Rarity == 1 then
|
|
-- White item
|
|
if string.find(sellMsg, "%(" .. tipList[i] .. "%)") then
|
|
-- Duplicate (ID appears more than once in list)
|
|
dupMsg = dupMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
else
|
|
-- Add non-junk item to sell list
|
|
sellMsg = sellMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
end
|
|
else
|
|
-- Incompatible item (not junk or white)
|
|
if string.find(incompatMsg, "%(" .. tipList[i] .. "%)") then
|
|
-- Duplicate (ID appears more than once in list)
|
|
dupMsg = dupMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
else
|
|
-- Add item to incompatible list
|
|
incompatMsg = incompatMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
end
|
|
end
|
|
else
|
|
-- Item has no sell price so cannot be sold
|
|
if string.find(novalueMsg, "%(" .. tipList[i] .. "%)") then
|
|
-- Duplicate (ID appears more than once in list)
|
|
dupMsg = dupMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
else
|
|
-- Add item to cannot be sold list
|
|
novalueMsg = novalueMsg .. linkCol .. linkName .. " (" .. tipList[i] .. ")" .. "|r|n"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if keepMsg ~= "" then keepMsg = "|n" .. L["Keep"] .. "|n" .. keepMsg end
|
|
if sellMsg ~= "" then sellMsg = "|n" .. L["Sell"] .. "|n" .. sellMsg end
|
|
if dupMsg ~= "" then dupMsg = "|n" .. L["Duplicates"] .. "|n" .. dupMsg end
|
|
if novalueMsg ~= "" then novalueMsg = "|n" .. L["Cannot be sold"] .. "|n" .. novalueMsg end
|
|
if incompatMsg ~= "" then incompatMsg = "|n" .. L["Incompatible"] .. "|n" .. incompatMsg end
|
|
|
|
eb.tiptext = L["Exclusions"] .. "|n" .. keepMsg .. sellMsg .. dupMsg .. novalueMsg .. incompatMsg
|
|
eb.Text.tiptext = L["Exclusions"] .. "|n" .. keepMsg .. sellMsg .. dupMsg .. novalueMsg .. incompatMsg
|
|
if eb.tiptext == L["Exclusions"] .. "|n" then eb.tiptext = eb.tiptext .. "|n" .. L["Nothing to see here."] end
|
|
if eb.Text.tiptext == L["Exclusions"] .. "|n" then eb.Text.tiptext = "-" end
|
|
|
|
if GameTooltip:IsShown() then
|
|
if MouseIsOver(eb) or MouseIsOver(eb.Text) then
|
|
GameTooltip:SetText(eb.tiptext, nil, nil, nil, nil, false)
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
eb.Text:HookScript("OnTextChanged", MakeTooltipString)
|
|
eb.Text:HookScript("OnTextChanged", function()
|
|
C_Timer.After(0.1, function()
|
|
MakeTooltipString()
|
|
end)
|
|
end)
|
|
|
|
-- Show the button tooltip for the editbox
|
|
eb:SetScript("OnEnter", MakeTooltipString)
|
|
eb:HookScript("OnEnter", LeaPlusLC.TipSee)
|
|
eb:HookScript("OnEnter", function() GameTooltip:SetText(eb.tiptext, nil, nil, nil, nil, false) end)
|
|
eb:SetScript("OnLeave", GameTooltip_Hide)
|
|
eb.Text:SetScript("OnEnter", MakeTooltipString)
|
|
eb.Text:HookScript("OnEnter", LeaPlusLC.ShowDropTip)
|
|
eb.Text:HookScript("OnEnter", function() GameTooltip:SetText(eb.tiptext, nil, nil, nil, nil, false) end)
|
|
eb.Text:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Show item ID in item tooltips while configuration panel is showing
|
|
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, function(self)
|
|
if self ~= GameTooltip then return end
|
|
if SellJunkFrame:IsShown() then
|
|
local void, itemLink = self:GetItem()
|
|
if itemLink then
|
|
local itemID = GetItemInfoFromHyperlink(itemLink)
|
|
if itemID then self:AddLine(L["Item ID"] .. ": " .. itemID) end
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Vendor function
|
|
local function SellJunkFunc()
|
|
|
|
-- Variables
|
|
local SoldCount, Rarity, ItemPrice = 0, 0, 0
|
|
local CurrentItemLink, classID, void
|
|
local itemTypeWeapon = Enum.ItemClass.Weapon
|
|
local itemTypeArmor = Enum.ItemClass.Armor
|
|
|
|
-- Traverse bags and sell grey items
|
|
for BagID = 0, 5 do
|
|
for BagSlot = 1, C_Container.GetContainerNumSlots(BagID) do
|
|
CurrentItemLink = C_Container.GetContainerItemLink(BagID, BagSlot)
|
|
if CurrentItemLink then
|
|
void, void, Rarity, void, void, void, void, void, void, void, ItemPrice, classID = C_Item.GetItemInfo(CurrentItemLink)
|
|
-- Don't sell whitelisted items
|
|
local itemID = GetItemInfoFromHyperlink(CurrentItemLink)
|
|
if itemID and whiteList[itemID] then
|
|
if Rarity == 0 then
|
|
-- Junk item to keep
|
|
Rarity = 20
|
|
ItemPrice = 0
|
|
elseif Rarity == 1 then
|
|
-- White item to sell
|
|
Rarity = 0
|
|
end
|
|
end
|
|
-- Exclude grey gear
|
|
if Rarity == 0 and classID and (classID == itemTypeWeapon or classID == itemTypeArmor) then -- Weapon or armor
|
|
local isSoulBound = C_Item.IsBound(ItemLocation:CreateFromBagAndSlot(BagID, BagSlot))
|
|
-- local isWarboundUntilEquipped = C_Item.IsBoundToAccountUntilEquip(ItemLocation:CreateFromBagAndSlot(BagID, BagSlot))
|
|
if not isSoulBound then
|
|
-- Item is not soulbound (soulbound gear cannot be sold to others)
|
|
if LeaPlusLC["AutoSellNoGreyGear"] == "On" then
|
|
-- Exclude all grey gear is checked so do not sell
|
|
Rarity = 20
|
|
ItemPrice = 0
|
|
end
|
|
end
|
|
end
|
|
-- Continue
|
|
local cInfo = C_Container.GetContainerItemInfo(BagID, BagSlot)
|
|
local itemCount = cInfo.stackCount
|
|
if Rarity == 0 and ItemPrice ~= 0 then
|
|
SoldCount = SoldCount + 1
|
|
if MerchantFrame:IsShown() then
|
|
-- If merchant frame is open, vendor the item
|
|
C_Container.UseContainerItem(BagID, BagSlot)
|
|
-- Perform actions on first iteration
|
|
if SellJunkTicker._remainingIterations == IterationCount then
|
|
-- Calculate total price
|
|
totalPrice = totalPrice + (ItemPrice * itemCount)
|
|
end
|
|
else
|
|
-- If merchant frame is not open, stop selling
|
|
StopSelling()
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Stop selling if no items were sold for this iteration or iteration limit was reached
|
|
if SoldCount == 0 or SellJunkTicker and SellJunkTicker._remainingIterations == 1 then
|
|
StopSelling()
|
|
if totalPrice > 0 and LeaPlusLC["AutoSellShowSummary"] == "On" then
|
|
LeaPlusLC:Print(L["Sold junk for"] .. " " .. C_CurrencyInfo.GetCoinText(totalPrice) .. ".")
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
-- Event handler
|
|
SellJunkFrame:RegisterEvent("MERCHANT_SHOW")
|
|
SellJunkFrame:RegisterEvent("MERCHANT_CLOSED")
|
|
SellJunkFrame:SetScript("OnEvent", function(self, event, arg1, arg2)
|
|
if event == "MERCHANT_SHOW" then
|
|
-- Check for vendors that refuse to buy items
|
|
SellJunkFrame:RegisterEvent("UI_ERROR_MESSAGE")
|
|
-- Reset variable
|
|
totalPrice = 0
|
|
-- Do nothing if shift key is held down
|
|
if IsShiftKeyDown() then return end
|
|
-- Cancel existing ticker if present
|
|
if SellJunkTicker then SellJunkTicker._cancelled = true; end
|
|
-- Sell grey items using ticker (ends when all grey items are sold or iteration count reached)
|
|
SellJunkTicker = LeaPlusNewTicker(0.2, SellJunkFunc, IterationCount)
|
|
SellJunkFrame:RegisterEvent("ITEM_LOCKED")
|
|
elseif event == "ITEM_LOCKED" then
|
|
StartMsg:Show()
|
|
SellJunkFrame:UnregisterEvent("ITEM_LOCKED")
|
|
elseif event == "MERCHANT_CLOSED" then
|
|
-- If merchant frame is closed, stop selling
|
|
StopSelling()
|
|
elseif event == "UI_ERROR_MESSAGE" then
|
|
if arg2 and (arg2 == ERR_VENDOR_DOESNT_BUY or arg2 == ERR_TOO_MUCH_GOLD) then
|
|
-- Vendor refuses to buy items or player at gold limit
|
|
StopSelling()
|
|
end
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Repair automatically (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Repair when suitable merchant frame is shown
|
|
local function RepairFunc()
|
|
if IsShiftKeyDown() then return end
|
|
if CanMerchantRepair() then -- If merchant is capable of repair
|
|
-- Process repair
|
|
local RepairCost, CanRepair = GetRepairAllCost()
|
|
if CanRepair then -- If merchant is offering repair
|
|
if LeaPlusLC["AutoRepairGuildFunds"] == "On" and IsInGuild() then
|
|
-- Guilded character and guild repair option is enabled
|
|
if CanGuildBankRepair() then
|
|
-- Character has permission to repair so try guild funds but fallback on character funds (if daily gold limit is reached)
|
|
RepairAllItems(1)
|
|
RepairAllItems()
|
|
else
|
|
-- Character does not have permission to repair so use character funds
|
|
RepairAllItems()
|
|
end
|
|
else
|
|
-- Unguilded character or guild repair option is disabled
|
|
RepairAllItems()
|
|
end
|
|
-- Show cost summary
|
|
if LeaPlusLC["AutoRepairShowSummary"] == "On" then
|
|
LeaPlusLC:Print(L["Repaired for"] .. " " .. C_CurrencyInfo.GetCoinText(RepairCost) .. ".")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Create event frame
|
|
local RepairFrame = CreateFrame("FRAME")
|
|
|
|
-- Function to setup event
|
|
local function SetupEvent()
|
|
if LeaPlusLC["AutoRepairGear"] == "On" then
|
|
RepairFrame:RegisterEvent("MERCHANT_SHOW")
|
|
else
|
|
RepairFrame:UnregisterEvent("MERCHANT_SHOW")
|
|
end
|
|
end
|
|
|
|
-- Setup event when option is clicked and on startup (if option is enabled)
|
|
LeaPlusCB["AutoRepairGear"]:HookScript("OnClick", SetupEvent)
|
|
if LeaPlusLC["AutoRepairGear"] == "On" then SetupEvent() end
|
|
|
|
-- Event handler
|
|
RepairFrame:SetScript("OnEvent", RepairFunc)
|
|
|
|
-- Create configuration panel
|
|
local RepairPanel = LeaPlusLC:CreatePanel("Repair automatically", "RepairPanel")
|
|
|
|
LeaPlusLC:MakeTx(RepairPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(RepairPanel, "AutoRepairGuildFunds", "Repair using guild funds if available", 16, -92, false, "If checked, repair costs will be taken from guild funds for characters that are guilded and have permission to repair.")
|
|
LeaPlusLC:MakeCB(RepairPanel, "AutoRepairShowSummary", "Show repair summary in chat", 16, -112, false, "If checked, a repair summary will be shown in chat when your gear is automatically repaired.")
|
|
|
|
-- Help button hidden
|
|
RepairPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
RepairPanel.b:SetScript("OnClick", function()
|
|
RepairPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page1"]:Show();
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
RepairPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
LeaPlusLC["AutoRepairGuildFunds"] = "On"
|
|
LeaPlusLC["AutoRepairShowSummary"] = "On"
|
|
|
|
-- Refresh panel
|
|
RepairPanel:Hide(); RepairPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["AutoRepairBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["AutoRepairGuildFunds"] = "On"
|
|
LeaPlusLC["AutoRepairShowSummary"] = "On"
|
|
else
|
|
RepairPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide the combat log
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoCombatLogTab"] == "On" and not LeaLockList["NoCombatLogTab"] then
|
|
|
|
-- Function to setup the combat log tab
|
|
local function SetupCombatLogTab()
|
|
ChatFrame2Tab:EnableMouse(false)
|
|
ChatFrame2Tab:SetText(" ") -- Needs to be something for chat settings to function
|
|
ChatFrame2Tab:SetScale(0.01)
|
|
ChatFrame2Tab:SetWidth(0.01)
|
|
ChatFrame2Tab:SetHeight(0.01)
|
|
end
|
|
|
|
local frame = CreateFrame("FRAME")
|
|
frame:SetScript("OnEvent", SetupCombatLogTab)
|
|
|
|
-- Ensure combat log is docked
|
|
if ChatFrame2.isDocked then
|
|
-- Set combat log attributes when chat windows are updated
|
|
frame:RegisterEvent("UPDATE_CHAT_WINDOWS")
|
|
-- Set combat log tab placement when tabs are assigned by the client
|
|
hooksecurefunc("FCF_SetTabPosition", function()
|
|
ChatFrame2Tab:SetPoint("BOTTOMLEFT", ChatFrame1Tab, "BOTTOMRIGHT", 0, 0)
|
|
end)
|
|
SetupCombatLogTab()
|
|
else
|
|
-- If combat log is undocked, do nothing but show warning
|
|
C_Timer.After(1, function()
|
|
LeaPlusLC:Print("Combat log cannot be hidden while undocked.")
|
|
end)
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show player chain
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowPlayerChain"] == "On" and not LeaLockList["ShowPlayerChain"] then
|
|
|
|
-- Ensure chain doesnt clip through pet portrait and rune frame
|
|
PetPortrait:GetParent():SetFrameLevel(4)
|
|
RuneFrame:SetFrameLevel(4)
|
|
|
|
-- Create chain texture
|
|
local playerChain = PlayerFrame.PlayerFrameContainer:CreateTexture(nil, "OVERLAY")
|
|
playerChain:SetTexCoord(1, 0, 0, 1)
|
|
|
|
-- Create configuration panel
|
|
local ChainPanel = LeaPlusLC:CreatePanel("Show player chain", "ChainPanel")
|
|
|
|
-- Add dropdown menu
|
|
LeaPlusLC:CreateDropdown("PlayerChainMenu", "Chain style", 146, "TOPLEFT", ChainPanel, "TOPLEFT", 16, -92, {{L["ELITE"], 1}, {L["BOSS"], 2}, {L["RARE"], 3}})
|
|
|
|
-- Set chain style
|
|
local function SetChainStyle()
|
|
-- Get dropdown menu value
|
|
local chain = LeaPlusLC["PlayerChainMenu"] -- Numeric value
|
|
-- Set chain style according to value
|
|
if chain == 1 then -- Elite (Gold)
|
|
playerChain:SetAtlas("UI-HUD-UnitFrame-Target-PortraitOn-Boss-Gold", true)
|
|
playerChain:ClearAllPoints()
|
|
playerChain:SetPoint("TOPLEFT", 8, -9)
|
|
playerChain:SetVertexColor(1, 1, 1, 1)
|
|
elseif chain == 2 then -- Boss (Gold Winged)
|
|
playerChain:SetAtlas("UI-HUD-UnitFrame-Target-PortraitOn-Boss-Gold-Winged", true)
|
|
playerChain:ClearAllPoints()
|
|
playerChain:SetPoint("TOPLEFT", -11, -8)
|
|
playerChain:SetVertexColor(1, 1, 1, 1)
|
|
elseif chain == 3 then -- Rare (Silver)
|
|
playerChain:SetAtlas("UI-HUD-UnitFrame-Target-PortraitOn-Boss-Rare-Silver", true)
|
|
playerChain:ClearAllPoints()
|
|
playerChain:SetPoint("TOPLEFT", 8, -9)
|
|
playerChain:SetVertexColor(1, 1, 1, 1)
|
|
end
|
|
end
|
|
|
|
-- Set style when dropdown menu is updated and on startup
|
|
LeaPlusCB["PlayerChainMenu"]:RegisterCallback("OnMenuClose", SetChainStyle)
|
|
SetChainStyle()
|
|
|
|
-- Help button hidden
|
|
ChainPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
ChainPanel.b:SetScript("OnClick", function()
|
|
ChainPanel:Hide();
|
|
LeaPlusLC["PageF"]:Show()
|
|
LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
ChainPanel.r:SetScript("OnClick", function()
|
|
LeaPlusLC["PlayerChainMenu"] = 1
|
|
ChainPanel:Hide(); ChainPanel:Show()
|
|
SetChainStyle()
|
|
end)
|
|
|
|
-- Show the panel when the configuration button is clicked
|
|
LeaPlusCB["ModPlayerChain"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
LeaPlusLC["PlayerChainMenu"] = 1
|
|
SetChainStyle()
|
|
else
|
|
LeaPlusLC:HideFrames()
|
|
ChainPanel:Show()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show raid frame toggle button
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowRaidToggle"] == "On" and not LeaLockList["ShowRaidToggle"] then
|
|
|
|
-- Check to make sure raid toggle button exists
|
|
if CompactRaidFrameManagerDisplayFrameHiddenModeToggle then
|
|
|
|
-- Move the button (function runs after PLAYER_ENTERING_WORLD and PARTY_LEADER_CHANGED)
|
|
hooksecurefunc("CompactRaidFrameManager_UpdateOptionsFlowContainer", function()
|
|
if CompactRaidFrameManager and CompactRaidFrameManagerDisplayFrameHiddenModeToggle then
|
|
local void, void, void, void, y = CompactRaidFrameManager:GetPoint()
|
|
CompactRaidFrameManagerDisplayFrameHiddenModeToggle:SetWidth(40)
|
|
CompactRaidFrameManagerDisplayFrameHiddenModeToggle:ClearAllPoints()
|
|
CompactRaidFrameManagerDisplayFrameHiddenModeToggle:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, y + 32)
|
|
CompactRaidFrameManagerDisplayFrameHiddenModeToggle:SetParent(UIParent)
|
|
CompactRaidFrameManagerDisplayFrameHiddenModeToggle:SetHitRectInsets(0, 0, 0, 0)
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide portrait numbers
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoHitIndicators"] == "On" and not LeaLockList["NoHitIndicators"] then
|
|
PlayerFrame.PlayerFrameContent.PlayerFrameContentMain.HitIndicator:Hide()
|
|
hooksecurefunc(PetHitIndicator, "Show", PetHitIndicator.Hide)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Class colored frames
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ClassColFrames"] == "On" and not LeaLockList["ClassColFrames"] then
|
|
|
|
-- Create background frame for player frame
|
|
local PlayFN = PlayerFrame.PlayerFrameContent.PlayerFrameContentMain:CreateTexture(nil, "BACKGROUND")
|
|
PlayFN:SetAtlas("UI-HUD-UnitFrame-Target-PortraitOn-Type", true)
|
|
PlayFN:SetTexCoord(1, 0, 0, 1)
|
|
PlayFN:ClearAllPoints()
|
|
PlayFN:SetPoint("TOPLEFT", 75, -25)
|
|
|
|
local c = LeaPlusLC["RaidColors"][select(2, UnitClass("player"))]
|
|
if c then PlayFN:SetVertexColor(c.r, c.g, c.b) end
|
|
|
|
-- Create color function for target and focus frames
|
|
local function TargetFrameCol()
|
|
if UnitIsPlayer("target") then
|
|
local c = LeaPlusLC["RaidColors"][select(2, UnitClass("target"))]
|
|
if c then TargetFrame.TargetFrameContent.TargetFrameContentMain.ReputationColor:SetVertexColor(c.r, c.g, c.b) end
|
|
end
|
|
if UnitIsPlayer("focus") then
|
|
local c = LeaPlusLC["RaidColors"][select(2, UnitClass("focus"))]
|
|
if c then FocusFrame.TargetFrameContent.TargetFrameContentMain.ReputationColor:SetVertexColor(c.r, c.g, c.b) end
|
|
end
|
|
end
|
|
|
|
local ColTar = CreateFrame("FRAME")
|
|
ColTar:SetScript("OnEvent", TargetFrameCol) -- Events are registered if target option is enabled
|
|
|
|
-- Refresh color if focus frame size changes
|
|
if FocusFrame_SetSmallSize then
|
|
hooksecurefunc(FocusFrame, "SetSmallSize", function()
|
|
if LeaPlusLC["ClassColTarget"] == "On" then
|
|
TargetFrameCol()
|
|
end
|
|
end)
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local ClassFrame = LeaPlusLC:CreatePanel("Class colored frames", "ClassFrame")
|
|
|
|
LeaPlusLC:MakeTx(ClassFrame, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(ClassFrame, "ClassColPlayer", "Show player frame in class color", 16, -92, false, "If checked, the player frame background will be shown in class color.")
|
|
LeaPlusLC:MakeCB(ClassFrame, "ClassColTarget", "Show target frame and focus frame in class color", 16, -112, false, "If checked, the target frame background and focus frame background will be shown in class color.")
|
|
|
|
-- Help button hidden
|
|
ClassFrame.h:Hide()
|
|
|
|
-- Back button handler
|
|
ClassFrame.b:SetScript("OnClick", function()
|
|
ClassFrame:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page6"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Function to set class colored frames
|
|
local function SetClassColFrames()
|
|
-- Player frame
|
|
if LeaPlusLC["ClassColPlayer"] == "On" then
|
|
PlayFN:Show()
|
|
else
|
|
PlayFN:Hide()
|
|
end
|
|
-- Target and focus frames
|
|
if LeaPlusLC["ClassColTarget"] == "On" then
|
|
ColTar:RegisterEvent("GROUP_ROSTER_UPDATE")
|
|
ColTar:RegisterEvent("PLAYER_TARGET_CHANGED")
|
|
ColTar:RegisterEvent("PLAYER_FOCUS_CHANGED")
|
|
ColTar:RegisterEvent("UNIT_FACTION")
|
|
TargetFrameCol()
|
|
else
|
|
ColTar:UnregisterAllEvents()
|
|
TargetFrame.CheckFaction(TargetFrame) -- Reset target frame colors
|
|
TargetFrame.CheckFaction(FocusFrame) -- Reset focus frame colors
|
|
end
|
|
end
|
|
|
|
-- Run function when options are clicked and on startup
|
|
LeaPlusCB["ClassColPlayer"]:HookScript("OnClick", SetClassColFrames)
|
|
LeaPlusCB["ClassColTarget"]:HookScript("OnClick", SetClassColFrames)
|
|
SetClassColFrames()
|
|
|
|
-- Reset button handler
|
|
ClassFrame.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
LeaPlusLC["ClassColPlayer"] = "On"
|
|
LeaPlusLC["ClassColTarget"] = "On"
|
|
|
|
-- Update colors and refresh configuration panel
|
|
SetClassColFrames()
|
|
ClassFrame:Hide(); ClassFrame:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["ClassColFramesBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["ClassColPlayer"] = "On"
|
|
LeaPlusLC["ClassColTarget"] = "On"
|
|
SetClassColFrames()
|
|
else
|
|
ClassFrame:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Quest text size
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["QuestFontChange"] == "On" then
|
|
|
|
-- Create configuration panel
|
|
local QuestTextPanel = LeaPlusLC:CreatePanel("Resize quest text", "QuestTextPanel")
|
|
|
|
LeaPlusLC:MakeTx(QuestTextPanel, "Text size", 16, -72)
|
|
LeaPlusLC:MakeSL(QuestTextPanel, "LeaPlusQuestFontSize", "Drag to set the font size of quest text.", 10, 30, 1, 16, -92, "%.0f")
|
|
|
|
-- Function to update the font size
|
|
local function QuestSizeUpdate()
|
|
local a, b, c = QuestFont:GetFont()
|
|
QuestTitleFont:SetFont(a, LeaPlusLC["LeaPlusQuestFontSize"] + 3, c)
|
|
QuestFont:SetFont(a, LeaPlusLC["LeaPlusQuestFontSize"] + 1, c)
|
|
local d, e, f = QuestFontNormalSmall:GetFont()
|
|
QuestFontNormalSmall:SetFont(d, LeaPlusLC["LeaPlusQuestFontSize"], f)
|
|
end
|
|
|
|
-- Set text size when slider changes and on startup
|
|
LeaPlusCB["LeaPlusQuestFontSize"]:HookScript("OnValueChanged", QuestSizeUpdate)
|
|
QuestSizeUpdate()
|
|
|
|
-- Help button hidden
|
|
QuestTextPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
QuestTextPanel.b:SetScript("OnClick", function()
|
|
QuestTextPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page4"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
QuestTextPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset slider
|
|
LeaPlusLC["LeaPlusQuestFontSize"] = 12
|
|
QuestSizeUpdate()
|
|
|
|
-- Refresh side panel
|
|
QuestTextPanel:Hide(); QuestTextPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["QuestTextBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["LeaPlusQuestFontSize"] = 18
|
|
QuestSizeUpdate()
|
|
else
|
|
QuestTextPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Resize mail text
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["MailFontChange"] == "On" then
|
|
|
|
-- Create configuration panel
|
|
local MailTextPanel = LeaPlusLC:CreatePanel("Resize mail text", "MailTextPanel")
|
|
|
|
LeaPlusLC:MakeTx(MailTextPanel, "Text size", 16, -72)
|
|
LeaPlusLC:MakeSL(MailTextPanel, "LeaPlusMailFontSize", "Drag to set the font size of mail text.", 10, 30, 1, 16, -92, "%.0f")
|
|
|
|
-- Function to set the text size
|
|
local function MailSizeUpdate()
|
|
local MailFont, void, flags = QuestFont:GetFont()
|
|
OpenMailBodyText:SetFont("h1", MailFont, LeaPlusLC["LeaPlusMailFontSize"], flags)
|
|
OpenMailBodyText:SetFont("h2", MailFont, LeaPlusLC["LeaPlusMailFontSize"], flags)
|
|
OpenMailBodyText:SetFont("h3", MailFont, LeaPlusLC["LeaPlusMailFontSize"], flags)
|
|
OpenMailBodyText:SetFont("p", MailFont, LeaPlusLC["LeaPlusMailFontSize"], flags)
|
|
SendMailBodyEditBox:SetFont(MailFont, LeaPlusLC["LeaPlusMailFontSize"], flags)
|
|
end
|
|
|
|
-- Set text size after changing slider and on startup
|
|
LeaPlusCB["LeaPlusMailFontSize"]:HookScript("OnValueChanged", MailSizeUpdate)
|
|
MailSizeUpdate()
|
|
|
|
-- Help button hidden
|
|
MailTextPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
MailTextPanel.b:SetScript("OnClick", function()
|
|
MailTextPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page4"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
MailTextPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset slider
|
|
LeaPlusLC["LeaPlusMailFontSize"] = 15
|
|
|
|
-- Refresh side panel
|
|
MailTextPanel:Hide(); MailTextPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["MailTextBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["LeaPlusMailFontSize"] = 22
|
|
MailSizeUpdate()
|
|
else
|
|
MailTextPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show durability status
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["DurabilityStatus"] == "On" then
|
|
|
|
-- Create durability button
|
|
local cButton = CreateFrame("BUTTON", nil, PaperDollFrame)
|
|
cButton:ClearAllPoints()
|
|
cButton:SetPoint("BOTTOMRIGHT", CharacterFrameInset, "BOTTOMRIGHT", -2, -1)
|
|
cButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up")
|
|
cButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
|
|
cButton:SetSize(32, 32)
|
|
|
|
-- Create durability tables
|
|
local Slots = {"HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot", "WaistSlot", "LegsSlot", "FeetSlot", "MainHandSlot", "SecondaryHandSlot"}
|
|
local SlotsFriendly = {INVTYPE_HEAD, INVTYPE_SHOULDER, INVTYPE_CHEST, INVTYPE_WRIST, INVTYPE_HAND, INVTYPE_WAIST, INVTYPE_LEGS, INVTYPE_FEET, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND}
|
|
|
|
-- Show durability status in tooltip or status line (tip or status)
|
|
local function ShowDuraStats(where)
|
|
|
|
local duravaltotal, duramaxtotal, durapercent = 0, 0, 0
|
|
local valcol, id, duraval, duramax
|
|
|
|
if where == "tip" then
|
|
-- Creare layout
|
|
GameTooltip:AddLine("|cffffffff")
|
|
GameTooltip:AddLine("|cffffffff")
|
|
GameTooltip:AddLine("|cffffffff")
|
|
_G["GameTooltipTextLeft1"]:SetText("|cffffffff"); _G["GameTooltipTextRight1"]:SetText("|cffffffff")
|
|
_G["GameTooltipTextLeft2"]:SetText("|cffffffff"); _G["GameTooltipTextRight2"]:SetText("|cffffffff")
|
|
_G["GameTooltipTextLeft3"]:SetText("|cffffffff"); _G["GameTooltipTextRight3"]:SetText("|cffffffff")
|
|
end
|
|
|
|
local validItems = false
|
|
|
|
-- Traverse equipment slots
|
|
for k, slotName in ipairs(Slots) do
|
|
if GetInventorySlotInfo(slotName) then
|
|
id = GetInventorySlotInfo(slotName)
|
|
duraval, duramax = GetInventoryItemDurability(id)
|
|
if duraval ~= nil then
|
|
|
|
-- At least one item has durability stat
|
|
validItems = true
|
|
|
|
-- Add to tooltip
|
|
if where == "tip" then
|
|
durapercent = tonumber(format("%.0f", duraval / duramax * 100))
|
|
valcol = (durapercent >= 80 and "|cff00FF00") or (durapercent >= 60 and "|cff99FF00") or (durapercent >= 40 and "|cffFFFF00") or (durapercent >= 20 and "|cffFF9900") or (durapercent >= 0 and "|cffFF2000") or ("|cffFFFFFF")
|
|
_G["GameTooltipTextLeft1"]:SetText(L["Durability"])
|
|
_G["GameTooltipTextLeft2"]:SetText(_G["GameTooltipTextLeft2"]:GetText() .. SlotsFriendly[k] .. "|n")
|
|
_G["GameTooltipTextRight2"]:SetText(_G["GameTooltipTextRight2"]:GetText() .. valcol .. durapercent .. "%" .. "|n")
|
|
end
|
|
|
|
duravaltotal = duravaltotal + duraval
|
|
duramaxtotal = duramaxtotal + duramax
|
|
end
|
|
end
|
|
end
|
|
if duravaltotal > 0 and duramaxtotal > 0 then
|
|
durapercent = duravaltotal / duramaxtotal * 100
|
|
else
|
|
durapercent = 0
|
|
end
|
|
|
|
if where == "tip" then
|
|
|
|
if validItems == true then
|
|
-- Show overall durability in the tooltip
|
|
if durapercent >= 80 then valcol = "|cff00FF00" elseif durapercent >= 60 then valcol = "|cff99FF00" elseif durapercent >= 40 then valcol = "|cffFFFF00" elseif durapercent >= 20 then valcol = "|cffFF9900" elseif durapercent >= 0 then valcol = "|cffFF2000" else return end
|
|
_G["GameTooltipTextLeft3"]:SetText(L["Overall"] .. " " .. valcol)
|
|
_G["GameTooltipTextRight3"]:SetText(valcol .. string.format("%.0f", durapercent) .. "%")
|
|
|
|
-- Show lines of the tooltip
|
|
GameTooltipTextLeft1:Show(); GameTooltipTextRight1:Show()
|
|
GameTooltipTextLeft2:Show(); GameTooltipTextRight2:Show()
|
|
GameTooltipTextLeft3:Show(); GameTooltipTextRight3:Show()
|
|
GameTooltipTextRight2:SetJustifyH"RIGHT";
|
|
GameTooltipTextRight3:SetJustifyH"RIGHT";
|
|
GameTooltip:Show()
|
|
else
|
|
-- No items have durability stat
|
|
GameTooltip:ClearLines()
|
|
GameTooltip:AddLine("" .. L["Durability"],1.0, 0.85, 0.0)
|
|
GameTooltip:AddLine("" .. L["No items with durability equipped."], 1, 1, 1)
|
|
GameTooltip:Show()
|
|
end
|
|
|
|
elseif where == "status" then
|
|
if validItems == true then
|
|
-- Show simple status line instead
|
|
if tonumber(durapercent) >= 0 then -- Ensure character has some durability items equipped
|
|
LeaPlusLC:Print(L["You have"] .. " " .. string.format("%.0f", durapercent) .. "%" .. " " .. L["durability"] .. ".")
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|
|
|
|
-- Hover over the durability button to show the durability tooltip
|
|
cButton:SetScript("OnEnter", function()
|
|
GameTooltip:SetOwner(cButton, "ANCHOR_RIGHT")
|
|
GameTooltip:SetMinimumWidth(0) -- Needed due to MoP mage reset specialisation and choose frost
|
|
ShowDuraStats("tip")
|
|
end)
|
|
cButton:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Create frame to watch events
|
|
local DeathDura = CreateFrame("FRAME")
|
|
DeathDura:RegisterEvent("PLAYER_DEAD")
|
|
DeathDura:SetScript("OnEvent", function(self, event)
|
|
ShowDuraStats("status")
|
|
DeathDura:UnregisterEvent("PLAYER_DEAD")
|
|
C_Timer.After(2, function()
|
|
DeathDura:RegisterEvent("PLAYER_DEAD")
|
|
end)
|
|
end)
|
|
|
|
hooksecurefunc("AcceptResurrect", function()
|
|
-- Player has ressed without releasing
|
|
ShowDuraStats("status")
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide zone text
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideZoneText"] == "On" then
|
|
ZoneTextFrame:SetScript("OnShow", ZoneTextFrame.Hide);
|
|
SubZoneTextFrame:SetScript("OnShow", SubZoneTextFrame.Hide);
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Disable sticky chat
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoStickyChat"] == "On" and not LeaLockList["NoStickyChat"] then
|
|
-- These taint if set to anything other than nil
|
|
ChatTypeInfo.WHISPER.sticky = nil
|
|
ChatTypeInfo.BN_WHISPER.sticky = nil
|
|
ChatTypeInfo.CHANNEL.sticky = nil
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide stance bar
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoClassBar"] == "On" and not LeaLockList["NoClassBar"] then
|
|
local stancebar = CreateFrame("FRAME", nil, UIParent)
|
|
stancebar:Hide()
|
|
StanceBar:UnregisterAllEvents()
|
|
StanceBar:SetParent(stancebar)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Disable chat fade
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoChatFade"] == "On" and not LeaLockList["NoChatFade"] then
|
|
-- Process normal and existing chat frames
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
_G["ChatFrame" .. i]:SetFading(false)
|
|
end
|
|
end
|
|
-- Process temporary frames
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function()
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
_G[cf]:SetFading(false)
|
|
end
|
|
end)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Use easy chat frame resizing
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["UseEasyChatResizing"] == "On" and not LeaLockList["UseEasyChatResizing"] then
|
|
ChatFrame1Tab:HookScript("OnMouseDown", function(self,arg1)
|
|
if arg1 == "LeftButton" then
|
|
if select(8, GetChatWindowInfo(1)) then
|
|
ChatFrame1:StartSizing("TOP")
|
|
end
|
|
end
|
|
end)
|
|
ChatFrame1Tab:SetScript("OnMouseUp", function(self,arg1)
|
|
if arg1 == "LeftButton" then
|
|
ChatFrame1:StopMovingOrSizing()
|
|
FCF_SavePositionAndDimensions(ChatFrame1)
|
|
end
|
|
end)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Increase chat history
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["MaxChatHstory"] == "On" and not LeaLockList["MaxChatHstory"] then
|
|
-- Process normal and existing chat frames
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] and _G["ChatFrame" .. i]:GetMaxLines() ~= 4096 then
|
|
_G["ChatFrame" .. i]:SetMaxLines(4096);
|
|
end
|
|
end
|
|
-- Process temporary chat frames
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function()
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
if (_G[cf]:GetMaxLines() ~= 4096) then
|
|
_G[cf]:SetMaxLines(4096);
|
|
end
|
|
end
|
|
end)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide error messages
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideErrorMessages"] == "On" then
|
|
|
|
-- Error message events
|
|
local OrigErrHandler = UIErrorsFrame:GetScript('OnEvent')
|
|
UIErrorsFrame:SetScript('OnEvent', function (self, event, id, err, ...)
|
|
if event == "UI_ERROR_MESSAGE" then
|
|
-- Hide error messages
|
|
if LeaPlusLC["ShowErrorsFlag"] == 1 then
|
|
if err == ERR_INV_FULL or
|
|
err == ERR_QUEST_LOG_FULL or
|
|
err == ERR_RAID_GROUP_ONLY or
|
|
err == ERR_PARTY_LFG_BOOT_LIMIT or
|
|
err == ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE or
|
|
err == ERR_PARTY_LFG_BOOT_IN_COMBAT or
|
|
err == ERR_PARTY_LFG_BOOT_IN_PROGRESS or
|
|
err == ERR_PARTY_LFG_BOOT_LOOT_ROLLS or
|
|
err == ERR_PARTY_LFG_TELEPORT_IN_COMBAT or
|
|
err == ERR_PET_SPELL_DEAD or
|
|
err == ERR_PLAYER_DEAD or
|
|
err == SPELL_FAILED_TARGET_NO_POCKETS or
|
|
err == ERR_ALREADY_PICKPOCKETED or
|
|
err:find(format(ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S, ".+")) then
|
|
return OrigErrHandler(self, event, id, err, ...)
|
|
end
|
|
else
|
|
return OrigErrHandler(self, event, id, err, ...)
|
|
end
|
|
elseif event == 'UI_INFO_MESSAGE' then
|
|
-- Show information messages
|
|
return OrigErrHandler(self, event, id, err, ...)
|
|
end
|
|
end)
|
|
|
|
-- Hide ping system errors
|
|
UIParent:UnregisterEvent("PING_SYSTEM_ERROR")
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Easy item destroy
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["EasyItemDestroy"] == "On" then
|
|
|
|
-- Get the type "DELETE" into the field to confirm text
|
|
local TypeDeleteLine = gsub(DELETE_GOOD_ITEM, "[\r\n]", "@")
|
|
local void, TypeDeleteLine = strsplit("@", TypeDeleteLine, 2)
|
|
|
|
-- Add hyperlinks to regular item destroy
|
|
StaticPopupDialogs["DELETE_ITEM"].OnHyperlinkEnter = StaticPopupDialogs["DELETE_GOOD_ITEM"].OnHyperlinkEnter
|
|
StaticPopupDialogs["DELETE_ITEM"].OnHyperlinkLeave = StaticPopupDialogs["DELETE_GOOD_ITEM"].OnHyperlinkLeave
|
|
StaticPopupDialogs["DELETE_QUEST_ITEM"].OnHyperlinkEnter = StaticPopupDialogs["DELETE_GOOD_ITEM"].OnHyperlinkEnter
|
|
StaticPopupDialogs["DELETE_QUEST_ITEM"].OnHyperlinkLeave = StaticPopupDialogs["DELETE_GOOD_ITEM"].OnHyperlinkLeave
|
|
StaticPopupDialogs["DELETE_GOOD_QUEST_ITEM"].OnHyperlinkEnter = StaticPopupDialogs["DELETE_GOOD_ITEM"].OnHyperlinkEnter
|
|
StaticPopupDialogs["DELETE_GOOD_QUEST_ITEM"].OnHyperlinkLeave = StaticPopupDialogs["DELETE_GOOD_ITEM"].OnHyperlinkLeave
|
|
|
|
-- Hide editbox and set item link
|
|
local easyDelFrame = CreateFrame("FRAME")
|
|
easyDelFrame:RegisterEvent("DELETE_ITEM_CONFIRM")
|
|
easyDelFrame:SetScript("OnEvent", function()
|
|
if StaticPopup1EditBox:IsShown() then
|
|
-- Item requires player to type delete so hide editbox and show link
|
|
StaticPopup1EditBox:Hide()
|
|
StaticPopup1Button1:Enable()
|
|
local link = select(3, GetCursorInfo())
|
|
if link then
|
|
-- Custom link for battle pets
|
|
local linkType, linkOptions, name = LinkUtil.ExtractLink(link)
|
|
if linkType == "battlepet" then
|
|
local speciesID, level, breedQuality = strsplit(":", linkOptions)
|
|
local qualityColor = BAG_ITEM_QUALITY_COLORS[tonumber(breedQuality)]
|
|
link = qualityColor:WrapTextInColorCode(name .. " |n" .. L["Level"] .. " " .. level .. L["Battle Pet"])
|
|
end
|
|
StaticPopup1Text:SetText(gsub(StaticPopup1Text:GetText(), gsub(TypeDeleteLine, "@", ""), "") .. "|n" .. link)
|
|
end
|
|
else
|
|
-- Item does not require player to type delete so just show item link
|
|
StaticPopup1:SetHeight(StaticPopup1:GetHeight() + 40)
|
|
StaticPopup1EditBox:Hide()
|
|
StaticPopup1Button1:Enable()
|
|
local link = select(3, GetCursorInfo())
|
|
if link then
|
|
-- Custom link for battle pets
|
|
local linkType, linkOptions, name = LinkUtil.ExtractLink(link)
|
|
if linkType == "battlepet" then
|
|
local speciesID, level, breedQuality = strsplit(":", linkOptions)
|
|
local qualityColor = BAG_ITEM_QUALITY_COLORS[tonumber(breedQuality)]
|
|
link = qualityColor:WrapTextInColorCode(name .. " |n" .. L["Level"] .. " " .. level .. L["Battle Pet"])
|
|
end
|
|
StaticPopup1Text:SetText(gsub(StaticPopup1Text:GetText(), gsub(TypeDeleteLine, "@", ""), "") .. "|n|n" .. link)
|
|
end
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Unclamp chat frame
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["UnclampChat"] == "On" and not LeaLockList["UnclampChat"] then
|
|
|
|
-- Process normal and existing chat frames on startup
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
_G["ChatFrame" .. i]:SetClampedToScreen(false)
|
|
_G["ChatFrame" .. i]:SetClampRectInsets(0, 0, 0, 0)
|
|
end
|
|
end
|
|
|
|
-- Process new chat frames and combat log
|
|
hooksecurefunc("FloatingChatFrame_UpdateBackgroundAnchors", function(self)
|
|
self:SetClampRectInsets(0, 0, 0, 0)
|
|
end)
|
|
|
|
-- Process temporary chat frames
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function()
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
_G[cf]:SetClampRectInsets(0, 0, 0, 0)
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Keep audio synced
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["KeepAudioSynced"] == "On" then
|
|
|
|
SetCVar("Sound_OutputDriverIndex", "0")
|
|
local event = CreateFrame("FRAME")
|
|
event:RegisterEvent("VOICE_CHAT_OUTPUT_DEVICES_UPDATED")
|
|
event:SetScript("OnEvent", function()
|
|
if not CinematicFrame:IsShown() and not MovieFrame:IsShown() then -- Dont restart sound system during cinematic
|
|
SetCVar("Sound_OutputDriverIndex", "0")
|
|
Sound_GameSystem_RestartSoundSystem()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Mute custom sounds (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create configuration panel
|
|
local MuteCustomPanel = LeaPlusLC:CreatePanel("Mute custom sounds", "MuteCustomPanel")
|
|
|
|
local titleTX = LeaPlusLC:MakeTx(MuteCustomPanel, "Editor", 16, -72)
|
|
titleTX:SetWidth(534)
|
|
titleTX:SetWordWrap(false)
|
|
titleTX:SetJustifyH("LEFT")
|
|
|
|
-- Show help button for title
|
|
LeaPlusLC:CreateHelpButton("MuteGameSoundsCustomHelpButton", MuteCustomPanel, titleTX, "Enter sound file IDs separated by comma then click the Mute button.|n|nIf you wish, you can enter a brief note for each file ID but do not include numbers in your notes.|n|nFor example, you can enter 'DevAura 569679, RetAura 568744' to mute the Devotion Aura and Retribution Aura spells.|n|nUse Leatrix Sounds to find, test and play sound file IDs.")
|
|
|
|
-- Add large editbox
|
|
local eb = CreateFrame("Frame", nil, MuteCustomPanel, "BackdropTemplate")
|
|
eb:SetSize(548, 180)
|
|
eb:SetPoint("TOPLEFT", 10, -92)
|
|
eb:SetBackdrop({
|
|
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
|
|
edgeFile = "Interface\\PVPFrame\\UI-Character-PVP-Highlight",
|
|
edgeSize = 16,
|
|
insets = { left = 8, right = 6, top = 8, bottom = 8 },
|
|
})
|
|
eb:SetBackdropBorderColor(1.0, 0.85, 0.0, 0.5)
|
|
|
|
eb.scroll = CreateFrame("ScrollFrame", nil, eb, "LeaPlusMuteCustomSoundsScrollFrameTemplate")
|
|
eb.scroll:SetPoint("TOPLEFT", eb, 12, -10)
|
|
eb.scroll:SetPoint("BOTTOMRIGHT", eb, -30, 10)
|
|
eb.scroll:SetPanExtent(16)
|
|
|
|
-- Create character count
|
|
eb.scroll.CharCount = eb.scroll:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
eb.scroll.CharCount:Hide()
|
|
|
|
eb.Text = eb.scroll.EditBox
|
|
eb.Text:SetWidth(494)
|
|
eb.Text:SetHeight(230)
|
|
eb.Text:SetPoint("TOPLEFT", eb.scroll)
|
|
eb.Text:SetPoint("BOTTOMRIGHT", eb.scroll, -12, 0)
|
|
eb.Text:SetMaxLetters(2000)
|
|
eb.Text:SetFontObject(GameFontNormalLarge)
|
|
eb.Text:SetAutoFocus(false)
|
|
eb.scroll:SetScrollChild(eb.Text)
|
|
|
|
-- Set focus on the editbox text when clicking the editbox
|
|
eb:SetScript("OnMouseDown", function()
|
|
eb.Text:SetFocus()
|
|
eb.Text:SetCursorPosition(eb.Text:GetMaxLetters())
|
|
end)
|
|
|
|
-- Function to save the custom sound list
|
|
local function SaveString(self, userInput)
|
|
local keytext = eb.Text:GetText()
|
|
if keytext and keytext ~= "" then
|
|
LeaPlusLC["MuteCustomList"] = strtrim(eb.Text:GetText())
|
|
else
|
|
LeaPlusLC["MuteCustomList"] = ""
|
|
end
|
|
end
|
|
|
|
-- Save the custom sound list when it changes and at startup
|
|
eb.Text:SetScript("OnTextChanged", SaveString)
|
|
eb.Text:SetText(LeaPlusLC["MuteCustomList"])
|
|
SaveString()
|
|
|
|
-- Help button hidden
|
|
MuteCustomPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
MuteCustomPanel.b:SetScript("OnClick", function()
|
|
MuteCustomPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page7"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button hidden
|
|
MuteCustomPanel.r:Hide()
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["MuteCustomSoundsBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["MuteCustomList"] = "Devotion Aura 569679, Retribution Aura 568744"
|
|
eb.Text:SetText(LeaPlusLC["MuteCustomList"])
|
|
else
|
|
MuteCustomPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Function to mute custom sound list
|
|
local function MuteCustomListFunc(unmute, userInput)
|
|
-- local mutedebug = true -- Debug
|
|
local counter = 0
|
|
local muteString = LeaPlusLC["MuteCustomList"]
|
|
if muteString and muteString ~= "" then
|
|
muteString = muteString:gsub("%s", ",")
|
|
muteString = muteString:gsub("[\n]", ",")
|
|
muteString = muteString:gsub("[^,%d]", "")
|
|
if mutedebug then print(muteString) end
|
|
local tList = {strsplit(",", muteString)}
|
|
if mutedebug then ChatFrame1:Clear() end
|
|
for i = 1, #tList do
|
|
if tList[i] then
|
|
tList[i] = tonumber(tList[i])
|
|
if tList[i] and tList[i] < 20000000 then
|
|
if mutedebug then print(tList[i]) end
|
|
if unmute then
|
|
UnmuteSoundFile(tList[i])
|
|
else
|
|
MuteSoundFile(tList[i])
|
|
end
|
|
counter = counter + 1
|
|
end
|
|
end
|
|
end
|
|
if userInput then
|
|
if unmute then
|
|
if counter == 1 then
|
|
LeaPlusLC:Print(L["Unmuted"] .. " " .. counter .. " " .. L["sound"] .. ".")
|
|
else
|
|
LeaPlusLC:Print(L["Unmuted"] .. " " .. counter .. " " .. L["sounds"] .. ".")
|
|
end
|
|
else
|
|
if counter == 1 then
|
|
LeaPlusLC:Print(L["Muted"] .. " " .. counter .. " " .. L["sound"] .. ".")
|
|
else
|
|
LeaPlusLC:Print(L["Muted"] .. " " .. counter .. " " .. L["sounds"] .. ".")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Mute custom list on startup if option is enabled
|
|
if LeaPlusLC["MuteCustomSounds"] == "On" then
|
|
MuteCustomListFunc()
|
|
end
|
|
|
|
-- Mute or unmute when option is clicked
|
|
LeaPlusCB["MuteCustomSounds"]:HookScript("OnClick", function()
|
|
if LeaPlusLC["MuteCustomSounds"] == "On" then
|
|
MuteCustomListFunc(false, false)
|
|
else
|
|
MuteCustomListFunc(true, false)
|
|
end
|
|
end)
|
|
|
|
-- Add mute button
|
|
local MuteCustomNowButton = LeaPlusLC:CreateButton("MuteCustomNowButton", MuteCustomPanel, "Mute", "TOPLEFT", 16, -292, 0, 25, true, "Click to mute sounds in the list.")
|
|
LeaPlusCB["MuteCustomNowButton"]:SetScript("OnClick", function() MuteCustomListFunc(false, true) end)
|
|
|
|
-- Add unmute button
|
|
local UnmuteCustomNowButton = LeaPlusLC:CreateButton("UnmuteCustomNowButton", MuteCustomPanel, "Unmute", "TOPLEFT", 16, -72, 0, 25, true, "Click to unmute sounds in the list.")
|
|
LeaPlusCB["UnmuteCustomNowButton"]:ClearAllPoints()
|
|
LeaPlusCB["UnmuteCustomNowButton"]:SetPoint("LEFT", MuteCustomNowButton, "RIGHT", 10, 0)
|
|
LeaPlusCB["UnmuteCustomNowButton"]:SetScript("OnClick", function() MuteCustomListFunc(true, true) end)
|
|
|
|
-- Add play sound file editbox
|
|
local willPlay, musicHandle
|
|
local MuteCustomSoundsStopButton = LeaPlusLC:CreateButton("MuteCustomSoundsStopButton", MuteCustomPanel, "Stop", "TOPRIGHT", -18, -66, 0, 25, true, "")
|
|
MuteCustomSoundsStopButton:SetScript("OnClick", function()
|
|
if musicHandle then StopSound(musicHandle) end
|
|
end)
|
|
|
|
local MuteCustomSoundsPlayButton = LeaPlusLC:CreateButton("MuteCustomSoundsPlayButton", MuteCustomPanel, "Play", "TOPRIGHT", -18, -66, 0, 25, true, "")
|
|
MuteCustomSoundsPlayButton:ClearAllPoints()
|
|
MuteCustomSoundsPlayButton:SetPoint("RIGHT", MuteCustomSoundsStopButton, "LEFT", -10, 0)
|
|
|
|
local MuteCustomSoundsSoundBox = LeaPlusLC:CreateEditBox("MuteCustomSoundsSoundBox", eb, 80, 8, "TOPRIGHT", -10, 20, "PlaySoundBox", "PlaySoundBox")
|
|
MuteCustomSoundsSoundBox:SetNumeric(true)
|
|
MuteCustomSoundsSoundBox:ClearAllPoints()
|
|
MuteCustomSoundsSoundBox:SetPoint("RIGHT", MuteCustomSoundsPlayButton, "LEFT", -10, 0)
|
|
MuteCustomSoundsPlayButton:SetScript("OnClick", function()
|
|
MuteCustomSoundsSoundBox:GetText()
|
|
if musicHandle then StopSound(musicHandle) end
|
|
willPlay, musicHandle = PlaySoundFile(MuteCustomSoundsSoundBox:GetText(), "Master")
|
|
end)
|
|
|
|
-- Add mousewheel support to the editbox
|
|
MuteCustomSoundsSoundBox:SetScript("OnMouseWheel", function(self, delta)
|
|
local endSound = tonumber(MuteCustomSoundsSoundBox:GetText())
|
|
if endSound then
|
|
if delta == 1 then endSound = endSound + 1 else endSound = endSound - 1 end
|
|
if endSound < 1 then endSound = 1 elseif endSound >= 10000000 then endSound = 10000000 end
|
|
MuteCustomSoundsSoundBox:SetText(endSound)
|
|
MuteCustomSoundsPlayButton:Click()
|
|
end
|
|
end)
|
|
|
|
local titlePlayer = LeaPlusLC:MakeTx(MuteCustomPanel, "Player", 16, -72)
|
|
titlePlayer:ClearAllPoints()
|
|
titlePlayer:SetPoint("TOPLEFT", MuteCustomSoundsSoundBox, "TOPLEFT", -4, 16)
|
|
LeaPlusLC:CreateHelpButton("MuteGameSoundsCustomPlayHelpButton", MuteCustomPanel, titlePlayer, "If you want to listen to a sound file, enter the sound file ID into the editbox and click the play button.|n|nYou can scroll the mousewheel over the editbox to play neighbouring sound files.")
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide rested sleep
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoRestedSleep"] == "On" and not LeaLockList["NoRestedSleep"] then
|
|
PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual.PlayerRestLoop.RestTexture:SetTexture("")
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Block shared quests (no reload needed)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local eFrame = CreateFrame("FRAME")
|
|
eFrame:SetScript("OnEvent", LeaPlusLC.CheckIfQuestIsSharedAndShouldBeDeclined)
|
|
|
|
-- Function to set event
|
|
local function SetSharedQuestsFunc()
|
|
if LeaPlusLC["NoSharedQuests"] == "On" then
|
|
eFrame:RegisterEvent("QUEST_DETAIL")
|
|
else
|
|
eFrame:UnregisterEvent("QUEST_DETAIL")
|
|
end
|
|
end
|
|
|
|
-- Set event when option is clicked and on startup
|
|
LeaPlusCB["NoSharedQuests"]:HookScript("OnClick", SetSharedQuestsFunc)
|
|
SetSharedQuestsFunc()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Restore chat messages
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["RestoreChatMessages"] == "On" and not LeaLockList["RestoreChatMessages"] then
|
|
|
|
local historyFrame = CreateFrame("FRAME")
|
|
historyFrame:RegisterEvent("PLAYER_LOGIN")
|
|
historyFrame:RegisterEvent("PLAYER_LOGOUT")
|
|
|
|
local FCF_IsChatWindowIndexActive = FCF_IsChatWindowIndexActive
|
|
local GetMessageInfo = GetMessageInfo
|
|
local GetNumMessages = GetNumMessages
|
|
|
|
-- Save chat messages on logout
|
|
historyFrame:SetScript("OnEvent", function(self, event)
|
|
if event == "PLAYER_LOGOUT" then
|
|
local name, realm = UnitFullName("player")
|
|
if not realm then realm = GetNormalizedRealmName() end
|
|
if name and realm then
|
|
LeaPlusDB["ChatHistoryName"] = name .. "-" .. realm
|
|
LeaPlusDB["ChatHistoryTime"] = GetServerTime()
|
|
for i = 1, 50 do
|
|
if i ~= 2 and _G["ChatFrame" .. i] then
|
|
if FCF_IsChatWindowIndexActive(i) then
|
|
LeaPlusDB["ChatHistory" .. i] = {}
|
|
local chtfrm = _G["ChatFrame" .. i]
|
|
local NumMsg = chtfrm:GetNumMessages()
|
|
local StartMsg = 1
|
|
if NumMsg > 256 then StartMsg = NumMsg - 255 end
|
|
for iMsg = StartMsg, NumMsg do
|
|
local chatMessage, r, g, b, chatTypeID = chtfrm:GetMessageInfo(iMsg)
|
|
if chatMessage then
|
|
if r and g and b then
|
|
local colorCode = RGBToColorCode(r, g, b)
|
|
chatMessage = colorCode .. chatMessage
|
|
end
|
|
tinsert(LeaPlusDB["ChatHistory" .. i], chatMessage)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Restore chat messages on login
|
|
local name, realm = UnitFullName("player")
|
|
if not realm then realm = GetNormalizedRealmName() end
|
|
if name and realm then
|
|
if LeaPlusDB["ChatHistoryName"] and LeaPlusDB["ChatHistoryTime"] then
|
|
local timeDiff = GetServerTime() - LeaPlusDB["ChatHistoryTime"]
|
|
if LeaPlusDB["ChatHistoryName"] == name .. "-" .. realm and timeDiff and timeDiff < 10 then -- reload must be done within 15 seconds
|
|
|
|
-- Store chat messages from current session and clear chat
|
|
for i = 1, 50 do
|
|
if i ~= 2 and _G["ChatFrame" .. i] and FCF_IsChatWindowIndexActive(i) then
|
|
LeaPlusDB["ChatTemp" .. i] = {}
|
|
local chtfrm = _G["ChatFrame" .. i]
|
|
local NumMsg = chtfrm:GetNumMessages()
|
|
for iMsg = 1, NumMsg do
|
|
local chatMessage, r, g, b, chatTypeID = chtfrm:GetMessageInfo(iMsg)
|
|
if chatMessage then
|
|
if r and g and b then
|
|
local colorCode = RGBToColorCode(r, g, b)
|
|
chatMessage = colorCode .. chatMessage
|
|
end
|
|
tinsert(LeaPlusDB["ChatTemp" .. i], chatMessage)
|
|
end
|
|
end
|
|
chtfrm:Clear()
|
|
end
|
|
end
|
|
|
|
-- Restore chat messages from previous session
|
|
for i = 1, 50 do
|
|
if i ~= 2 and _G["ChatFrame" .. i] and LeaPlusDB["ChatHistory" .. i] and FCF_IsChatWindowIndexActive(i) then
|
|
LeaPlusDB["ChatHistory" .. i .. "Count"] = 0
|
|
-- Add previous session messages to chat
|
|
for k = 1, #LeaPlusDB["ChatHistory" .. i] do
|
|
if LeaPlusDB["ChatHistory" .. i][k] ~= string.match(LeaPlusDB["ChatHistory" .. i][k], "|cffffd800" .. L["Restored"] .. " " .. ".*" .. " " .. L["message"] .. ".*.|r") then
|
|
_G["ChatFrame" .. i]:AddMessage(LeaPlusDB["ChatHistory" .. i][k])
|
|
LeaPlusDB["ChatHistory" .. i .. "Count"] = LeaPlusDB["ChatHistory" .. i .. "Count"] + 1
|
|
end
|
|
end
|
|
-- Show how many messages were restored
|
|
if LeaPlusDB["ChatHistory" .. i .. "Count"] == 1 then
|
|
_G["ChatFrame" .. i]:AddMessage("|cffffd800" .. L["Restored"] .. " " .. LeaPlusDB["ChatHistory" .. i .. "Count"] .. " " .. L["message from previous session"] .. ".|r")
|
|
else
|
|
_G["ChatFrame" .. i]:AddMessage("|cffffd800" .. L["Restored"] .. " " .. LeaPlusDB["ChatHistory" .. i .. "Count"] .. " " .. L["messages from previous session"] .. ".|r")
|
|
end
|
|
else
|
|
-- No messages to restore
|
|
LeaPlusDB["ChatHistory" .. i] = nil
|
|
end
|
|
end
|
|
|
|
-- Restore chat messages from this session
|
|
for i = 1, 50 do
|
|
if i ~= 2 and _G["ChatFrame" .. i] and LeaPlusDB["ChatTemp" .. i] and FCF_IsChatWindowIndexActive(i) then
|
|
for k = 1, #LeaPlusDB["ChatTemp" .. i] do
|
|
_G["ChatFrame" .. i]:AddMessage(LeaPlusDB["ChatTemp" .. i][k])
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
|
|
else
|
|
|
|
-- Option is disabled so clear any messages from saved variables
|
|
LeaPlusDB["ChatHistoryName"] = nil
|
|
LeaPlusDB["ChatHistoryTime"] = nil
|
|
for i = 1, 50 do
|
|
LeaPlusDB["ChatHistory" .. i] = nil
|
|
LeaPlusDB["ChatTemp" .. i] = nil
|
|
LeaPlusDB["ChatHistory" .. i .. "Count"] = nil
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Set chat font size
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["SetChatFontSize"] == "On" and not LeaLockList["SetChatFontSize"] then
|
|
|
|
-- Function to set chat font size of existing chat frames
|
|
local function SetFontSizeFunc()
|
|
-- Existing chat frames
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
local fontFile, unused, fontFlags = _G["ChatFrame" .. i]:GetFont()
|
|
_G["ChatFrame" .. i]:SetFont(fontFile, LeaPlusLC["LeaPlusChatFontSize"], fontFlags)
|
|
end
|
|
end
|
|
-- Special frames
|
|
local fontFile, unused, fontFlags = DEFAULT_CHAT_FRAME:GetFont()
|
|
if GMChatFrame then
|
|
GMChatFrame:SetFont(fontFile, LeaPlusLC["LeaPlusChatFontSize"], fontFlags)
|
|
end
|
|
if CommunitiesFrame then
|
|
CommunitiesFrame.Chat.MessageFrame:SetFont(fontFile, LeaPlusLC["LeaPlusChatFontSize"], fontFlags)
|
|
end
|
|
SetChatWindowSize(DEFAULT_CHAT_FRAME:GetID(), LeaPlusLC["LeaPlusChatFontSize"])
|
|
end
|
|
|
|
-- Set chat font size of temporary chat frames
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function()
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
-- Temporary frames
|
|
local fontFile, unused, fontFlags = _G[cf]:GetFont()
|
|
_G[cf]:SetFont(fontFile, LeaPlusLC["LeaPlusChatFontSize"], fontFlags)
|
|
end
|
|
end)
|
|
|
|
-- Set chat font size whenever the game sets it
|
|
hooksecurefunc("FCF_SetChatWindowFontSize", function(self, chatFrame, fontSize)
|
|
if not chatFrame then
|
|
chatFrame = FCF_GetCurrentChatFrame()
|
|
end
|
|
-- Temporary frames
|
|
local fontFile, unused, fontFlags = chatFrame:GetFont()
|
|
chatFrame:SetFont(fontFile, LeaPlusLC["LeaPlusChatFontSize"], fontFlags)
|
|
-- Special frames
|
|
if GMChatFrame then
|
|
GMChatFrame:SetFont(fontFile, LeaPlusLC["LeaPlusChatFontSize"], fontFlags)
|
|
end
|
|
if CommunitiesFrame then
|
|
CommunitiesFrame.Chat.MessageFrame:SetFont(fontFile, LeaPlusLC["LeaPlusChatFontSize"], fontFlags)
|
|
end
|
|
SetChatWindowSize(chatFrame:GetID(), LeaPlusLC["LeaPlusChatFontSize"])
|
|
end)
|
|
|
|
-- Create configuration panel
|
|
local ChatFontSizePanel = LeaPlusLC:CreatePanel("Set chat font size", "ChatFontSizePanel")
|
|
|
|
LeaPlusLC:MakeTx(ChatFontSizePanel, "Text size", 16, -72)
|
|
LeaPlusLC:MakeSL(ChatFontSizePanel, "LeaPlusChatFontSize", "Drag to set the chat font size.", 12, 48, 1, 16, -92, "%.0f")
|
|
|
|
-- Set text size when slider changes and on startup
|
|
LeaPlusCB["LeaPlusChatFontSize"]:HookScript("OnValueChanged", SetFontSizeFunc)
|
|
SetFontSizeFunc()
|
|
|
|
-- Help button hidden
|
|
ChatFontSizePanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
ChatFontSizePanel.b:SetScript("OnClick", function()
|
|
ChatFontSizePanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page3"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
ChatFontSizePanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset slider
|
|
LeaPlusLC["LeaPlusChatFontSize"] = 20
|
|
SetFontSizeFunc()
|
|
|
|
-- Refresh side panel
|
|
ChatFontSizePanel:Hide(); ChatFontSizePanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["SetChatFontSizeBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["LeaPlusChatFontSize"] = 20
|
|
SetFontSizeFunc()
|
|
else
|
|
ChatFontSizePanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Enhance minimap
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["MinimapModder"] == "On" and not LeaLockList["MinimapModder"] then
|
|
|
|
-- Set minimap shape (need to do this first)
|
|
if LeaPlusLC["SquareMinimap"] == "On" then
|
|
-- Square minimap is enabled so use square shape
|
|
_G.GetMinimapShape = function() return "SQUARE" end
|
|
else
|
|
-- Square minimap is disabled so use round shape
|
|
_G.GetMinimapShape = function() return "ROUND" end
|
|
end
|
|
|
|
local miniFrame = CreateFrame("FRAME")
|
|
local LibDBIconStub = LibStub("LibDBIcon-1.0")
|
|
if LeaPlusLC["SquareMinimap"] == "On" then
|
|
LibDBIconStub:SetButtonRadius(0.165)
|
|
else
|
|
LibDBIconStub:SetButtonRadius(1)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Configuration panel
|
|
----------------------------------------------------------------------
|
|
|
|
-- Create configuration panel
|
|
local SideMinimap = LeaPlusLC:CreatePanel("Enhance minimap", "SideMinimap")
|
|
|
|
-- Add checkboxes
|
|
LeaPlusLC:MakeTx(SideMinimap, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(SideMinimap, "HideMiniAddonButtons", "Hide addon buttons", 16, -92, false, "If checked, addon buttons will be hidden while the pointer is not over the minimap.")
|
|
LeaPlusLC:MakeCB(SideMinimap, "CombineAddonButtons", "Combine addon buttons", 16, -112, true, "If checked, addon buttons will be combined into a single button frame which you can toggle by right-clicking the minimap.|n|nNote that enabling this option will lock out the 'Hide addon buttons' setting.")
|
|
LeaPlusLC:MakeCB(SideMinimap, "SquareMinimap", "Square minimap", 16, -132, true, "If checked, the minimap shape will be square.")
|
|
LeaPlusLC:MakeCB(SideMinimap, "ShowWhoPinged", "Show who pinged", 16, -152, false, "If checked, when someone pings the minimap, their name will be shown. This does not apply to your pings.")
|
|
LeaPlusLC:MakeCB(SideMinimap, "HideMiniAddonMenu", "Hide addon menu", 16, -172, true, "If checked, the addon menu will be hidden.|n|nThe addon menu appears as a number in the corner of the minimap if you have any addons installed which make use of it.")
|
|
LeaPlusLC:MakeCB(SideMinimap, "UnclampMinimap", "Unclamp minimap cluster", 16, -192, true, "If checked, you will be able to drag the minimap cluster to the edge of the screen using Edit Mode.|n|nWhile positioning the minimap with Edit Mode, you may need to disable Snap to position the minimap precisely.")
|
|
|
|
-- Add excluded button
|
|
local MiniExcludedButton = LeaPlusLC:CreateButton("MiniExcludedButton", SideMinimap, "Buttons", "TOPLEFT", 16, -72, 0, 25, true, "Click to toggle the addon buttons editor.")
|
|
LeaPlusCB["MiniExcludedButton"]:ClearAllPoints()
|
|
LeaPlusCB["MiniExcludedButton"]:SetPoint("LEFT", SideMinimap.h, "RIGHT", 10, 0)
|
|
|
|
-- Set exclude button visibility
|
|
local function SetExcludeButtonsFunc()
|
|
if LeaPlusLC["HideMiniAddonButtons"] == "On" or LeaPlusLC["CombineAddonButtons"] == "On" then
|
|
LeaPlusLC:LockItem(LeaPlusCB["MiniExcludedButton"], false)
|
|
else
|
|
LeaPlusLC:LockItem(LeaPlusCB["MiniExcludedButton"], true)
|
|
end
|
|
end
|
|
LeaPlusCB["HideMiniAddonButtons"]:HookScript("OnClick", SetExcludeButtonsFunc)
|
|
SetExcludeButtonsFunc()
|
|
|
|
LeaPlusLC:MakeTx(SideMinimap, "Cluster scale", 356, -72)
|
|
LeaPlusLC:MakeSL(SideMinimap, "MiniClusterScale", "Drag to set the cluster scale.", 0.5, 2, 0.1, 356, -92, "%.2f")
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide addon menu
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideMiniAddonMenu"] == "On" then
|
|
|
|
-- Hide compartment menu when it is shown and on startup
|
|
AddonCompartmentFrame:HookScript("OnShow", AddonCompartmentFrame.Hide)
|
|
AddonCompartmentFrame:Hide()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Unclamp minimap cluster
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["UnclampMinimap"] == "On" then
|
|
MinimapCluster:SetClampedToScreen(false)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Addon buttons editor
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create configuration panel
|
|
local ExcludedButtonsPanel = LeaPlusLC:CreatePanel("Enhance minimap", "ExcludedButtonsPanel")
|
|
|
|
local titleTX = LeaPlusLC:MakeTx(ExcludedButtonsPanel, "Buttons for the addons listed below will remain visible.", 16, -72)
|
|
titleTX:SetWidth(534)
|
|
titleTX:SetWordWrap(false)
|
|
titleTX:SetJustifyH("LEFT")
|
|
|
|
-- Add second excluded button
|
|
local MiniExcludedButton2 = LeaPlusLC:CreateButton("MiniExcludedButton2", ExcludedButtonsPanel, "Buttons", "TOPLEFT", 16, -72, 0, 25, true, "Click to toggle the addon buttons editor.")
|
|
LeaPlusCB["MiniExcludedButton2"]:ClearAllPoints()
|
|
LeaPlusCB["MiniExcludedButton2"]:SetPoint("LEFT", ExcludedButtonsPanel.h, "RIGHT", 10, 0)
|
|
LeaPlusCB["MiniExcludedButton2"]:SetScript("OnClick", function()
|
|
ExcludedButtonsPanel:Hide(); SideMinimap:Show()
|
|
return
|
|
end)
|
|
|
|
-- Add large editbox
|
|
local eb = CreateFrame("Frame", nil, ExcludedButtonsPanel, "BackdropTemplate")
|
|
eb:SetSize(548, 180)
|
|
eb:SetPoint("TOPLEFT", 10, -92)
|
|
eb:SetBackdrop({
|
|
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
|
|
edgeFile = "Interface\\PVPFrame\\UI-Character-PVP-Highlight",
|
|
edgeSize = 16,
|
|
insets = { left = 8, right = 6, top = 8, bottom = 8 },
|
|
})
|
|
eb:SetBackdropBorderColor(1.0, 0.85, 0.0, 0.5)
|
|
|
|
eb.scroll = CreateFrame("ScrollFrame", nil, eb, "LeaPlusEnhanceMinimapExcludeButtonsScrollFrameTemplate")
|
|
eb.scroll:SetPoint("TOPLEFT", eb, 12, -10)
|
|
eb.scroll:SetPoint("BOTTOMRIGHT", eb, -30, 10)
|
|
eb.scroll:SetPanExtent(16)
|
|
|
|
-- Create character count
|
|
eb.scroll.CharCount = eb.scroll:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
eb.scroll.CharCount:Hide()
|
|
|
|
eb.Text = eb.scroll.EditBox
|
|
eb.Text:SetWidth(494)
|
|
eb.Text:SetHeight(230)
|
|
eb.Text:SetPoint("TOPLEFT", eb.scroll)
|
|
eb.Text:SetPoint("BOTTOMRIGHT", eb.scroll, -12, 0)
|
|
eb.Text:SetMaxLetters(1200)
|
|
eb.Text:SetFontObject(GameFontNormalLarge)
|
|
eb.Text:SetAutoFocus(false)
|
|
eb.scroll:SetScrollChild(eb.Text)
|
|
|
|
-- Set focus on the editbox text when clicking the editbox
|
|
eb:SetScript("OnMouseDown", function()
|
|
eb.Text:SetFocus()
|
|
eb.Text:SetCursorPosition(eb.Text:GetMaxLetters())
|
|
end)
|
|
|
|
-- Debug
|
|
-- eb.Text:SetText("Leatrix_Plus\nLeatrix_Maps\nBugSack\nLeatrix_Plus\nLeatrix_Maps\nBugSack\nLeatrix_Plus\nLeatrix_Maps\nBugSack\nLeatrix_Plus\nLeatrix_Maps\nBugSack\nLeatrix_Plus\nLeatrix_Maps\nBugSack")
|
|
|
|
-- Function to save the excluded list
|
|
local function SaveString(self, userInput)
|
|
local keytext = eb.Text:GetText()
|
|
if keytext and keytext ~= "" then
|
|
LeaPlusLC["MiniExcludeList"] = strtrim(eb.Text:GetText())
|
|
else
|
|
LeaPlusLC["MiniExcludeList"] = ""
|
|
end
|
|
if userInput then
|
|
LeaPlusLC:ReloadCheck()
|
|
end
|
|
end
|
|
|
|
-- Save the excluded list when it changes and at startup
|
|
eb.Text:SetScript("OnTextChanged", SaveString)
|
|
eb.Text:SetText(LeaPlusLC["MiniExcludeList"])
|
|
SaveString()
|
|
|
|
-- Help button tooltip
|
|
ExcludedButtonsPanel.h.tiptext = L["If you use the 'Hide addon buttons' or 'Combine addon buttons' settings but you want some addon buttons to remain visible around the minimap, enter the addon names into the editbox separated by a comma.|n|nThe editbox tooltip shows the addon names that you can enter. The names must match exactly with the names shown in the editbox tooltip though case does not matter.|n|nChanges to the list will require a UI reload to take effect."]
|
|
|
|
-- Back button handler
|
|
ExcludedButtonsPanel.b:SetScript("OnClick", function()
|
|
ExcludedButtonsPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
ExcludedButtonsPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset controls
|
|
LeaPlusLC["MiniExcludeList"] = ""
|
|
eb.Text:SetText(LeaPlusLC["MiniExcludeList"])
|
|
|
|
-- Refresh configuration panel
|
|
ExcludedButtonsPanel:Hide(); ExcludedButtonsPanel:Show()
|
|
LeaPlusLC:ReloadCheck()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["MiniExcludedButton"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["MiniExcludeList"] = "BugSack, Leatrix_Plus"
|
|
LeaPlusLC:ReloadCheck()
|
|
else
|
|
ExcludedButtonsPanel:Show()
|
|
LeaPlusGlobalPanel_SideMinimap:Hide()
|
|
end
|
|
end)
|
|
|
|
-- Function to make tooltip string with list of addons
|
|
local function MakeAddonString()
|
|
local msg = ""
|
|
local numAddons = C_AddOns.GetNumAddOns()
|
|
for i = 1, numAddons do
|
|
if C_AddOns.IsAddOnLoaded(i) then
|
|
local name = C_AddOns.GetAddOnInfo(i)
|
|
if name and _G["LibDBIcon10_" .. name] then -- Only list LibDBIcon buttons
|
|
msg = msg .. name .. ", "
|
|
end
|
|
end
|
|
end
|
|
if msg ~= "" then
|
|
msg = L["Supported Addons"] .. "|n|n" .. msg:sub(1, (strlen(msg) - 2)) .. "."
|
|
else
|
|
msg = L["No supported addons."]
|
|
end
|
|
eb.tiptext = msg
|
|
eb.Text.tiptext = msg
|
|
end
|
|
|
|
-- Show the help button tooltip for the editbox too
|
|
eb:SetScript("OnEnter", MakeAddonString)
|
|
eb:HookScript("OnEnter", LeaPlusLC.TipSee)
|
|
eb:SetScript("OnLeave", GameTooltip_Hide)
|
|
eb.Text:SetScript("OnEnter", MakeAddonString)
|
|
eb.Text:HookScript("OnEnter", LeaPlusLC.ShowDropTip)
|
|
eb.Text:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show who pinged
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create frame
|
|
local pFrame = CreateFrame("FRAME", nil, Minimap, "BackdropTemplate")
|
|
pFrame:SetSize(100, 20)
|
|
|
|
-- Set position
|
|
if LeaPlusLC["SquareMinimap"] == "On" then
|
|
pFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 0, -3)
|
|
else
|
|
pFrame:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, 2)
|
|
end
|
|
|
|
-- Set backdrop
|
|
pFrame.bg = {
|
|
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
|
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
|
insets = {left = 4, top = 4, right = 4, bottom = 4},
|
|
edgeSize = 16,
|
|
tile = true,
|
|
}
|
|
|
|
pFrame:SetBackdrop(pFrame.bg)
|
|
pFrame:SetBackdropColor(0, 0, 0, 0.7)
|
|
pFrame:SetBackdropBorderColor(0, 0, 0, 0)
|
|
|
|
-- Create fontstring
|
|
pFrame.f = pFrame:CreateFontString(nil, nil, "GameFontNormalSmall")
|
|
pFrame.f:SetAllPoints()
|
|
pFrame:Hide()
|
|
|
|
-- Set variables
|
|
local pingTime
|
|
local lastUnit, lastX, lastY = "player", 0, 0
|
|
|
|
-- Show who pinged
|
|
pFrame:SetScript("OnEvent", function(void, void, unit, x, y)
|
|
|
|
-- Do nothing if unit is you or unit has not changed
|
|
if UnitIsUnit(unit, "player") or UnitIsUnit(unit, lastUnit) and x == lastX and y == lastY then return end
|
|
lastUnit, lastX, lastY = unit, x, y
|
|
|
|
-- Show name in class color
|
|
local void, class = UnitClass(unit)
|
|
if class then
|
|
local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
|
|
if color then
|
|
|
|
-- Set frame details
|
|
pFrame.f:SetFormattedText("|cff%02x%02x%02x%s|r", color.r * 255, color.g * 255, color.b * 255, UnitName(unit))
|
|
pFrame:SetSize(pFrame.f:GetUnboundedStringWidth() + 12, 20)
|
|
|
|
-- Hide frame after 5 seconds
|
|
pFrame:Show()
|
|
pingTime = GetTime()
|
|
C_Timer.After(5, function()
|
|
if GetTime() - pingTime >= 5 then
|
|
pFrame:Hide()
|
|
end
|
|
end)
|
|
|
|
end
|
|
end
|
|
|
|
end)
|
|
|
|
-- Set event when option is clicked and on startup
|
|
local function SetPingFunc()
|
|
if LeaPlusLC["ShowWhoPinged"] == "On" then
|
|
pFrame:RegisterEvent("MINIMAP_PING")
|
|
else
|
|
pFrame:UnregisterEvent("MINIMAP_PING")
|
|
if pFrame:IsShown() then pFrame:Hide() end
|
|
end
|
|
end
|
|
|
|
LeaPlusLC.SetPingFunc = SetPingFunc
|
|
LeaPlusCB["ShowWhoPinged"]:HookScript("OnClick", SetPingFunc)
|
|
SetPingFunc()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Minimap cluster scale
|
|
----------------------------------------------------------------------
|
|
|
|
-- Function to set the minimap cluster scale
|
|
local function SetClusterScale()
|
|
MinimapCluster:SetScale(LeaPlusLC["MiniClusterScale"])
|
|
-- Set slider formatted text
|
|
LeaPlusCB["MiniClusterScale"].f:SetFormattedText("%.0f%%", LeaPlusLC["MiniClusterScale"] * 100)
|
|
end
|
|
|
|
-- Set minimap scale when slider is changed and on startup
|
|
LeaPlusCB["MiniClusterScale"]:HookScript("OnValueChanged", SetClusterScale)
|
|
SetClusterScale()
|
|
|
|
----------------------------------------------------------------------
|
|
-- Combine addon buttons
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["CombineAddonButtons"] == "On" then
|
|
|
|
-- Lock out hide minimap buttons
|
|
LeaPlusLC:LockItem(LeaPlusCB["HideMiniAddonButtons"], true)
|
|
LeaPlusCB["HideMiniAddonButtons"].tiptext = LeaPlusCB["HideMiniAddonButtons"].tiptext .. "|n|n|cff00AAFF" .. L["Cannot be used with Combine addon buttons."]
|
|
|
|
-- Create button frame
|
|
local bFrame = CreateFrame("FRAME", nil, UIParent)
|
|
bFrame:ClearAllPoints()
|
|
bFrame:SetPoint("TOPLEFT", Minimap, "TOPRIGHT", 4, 4)
|
|
bFrame:Hide()
|
|
|
|
-- Set top level to ensure button frame shows on top of frames such as the main action bar
|
|
bFrame:SetToplevel(true)
|
|
|
|
-- Set button frame scale to match minimap cluster scale
|
|
bFrame:SetScale(MinimapCluster:GetScale())
|
|
MinimapCluster:HookScript("OnSizeChanged", function()
|
|
bFrame:SetScale(MinimapCluster:GetScale())
|
|
end)
|
|
|
|
LeaPlusLC.bFrame = bFrame -- Used in LibDBIcon callback
|
|
_G["LeaPlusGlobalMinimapCombinedButtonFrame"] = bFrame -- For third party addons
|
|
|
|
-- Hide button frame automatically
|
|
local ButtonFrameTicker
|
|
bFrame:HookScript("OnShow", function()
|
|
if ButtonFrameTicker then ButtonFrameTicker:Cancel() end
|
|
ButtonFrameTicker = C_Timer.NewTicker(2, function()
|
|
if not bFrame:IsMouseOver() and not Minimap:IsMouseOver() then
|
|
bFrame:Hide()
|
|
if ButtonFrameTicker then ButtonFrameTicker:Cancel() end
|
|
end
|
|
end, 15)
|
|
end)
|
|
|
|
-- Position LibDBIcon tooltips when shown
|
|
LibDBIconTooltip:HookScript("OnShow", function()
|
|
GameTooltip:Hide()
|
|
LibDBIconTooltip:ClearAllPoints()
|
|
if bFrame:GetPoint() == "BOTTOMLEFT" then
|
|
LibDBIconTooltip:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -6)
|
|
else
|
|
LibDBIconTooltip:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -6)
|
|
end
|
|
end)
|
|
|
|
-- Function to position GameTooltip below the minimap
|
|
local function SetButtonTooltip()
|
|
GameTooltip:ClearAllPoints()
|
|
if bFrame:GetPoint() == "BOTTOMLEFT" then
|
|
GameTooltip:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -6)
|
|
else
|
|
GameTooltip:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -6)
|
|
end
|
|
end
|
|
|
|
LeaPlusLC.SetButtonTooltip = SetButtonTooltip -- Used in LibDBIcon callback
|
|
|
|
-- Hide existing LibDBIcon icons
|
|
local buttons = LibDBIconStub:GetButtonList()
|
|
for i = 1, #buttons do
|
|
local button = LibDBIconStub:GetMinimapButton(buttons[i])
|
|
local buttonName = strlower(buttons[i])
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
|
|
button:Hide()
|
|
button:SetScript("OnShow", function() if not bFrame:IsShown() then button:Hide() end end)
|
|
-- Create background texture
|
|
local bFrameBg = button:CreateTexture(nil, "BACKGROUND")
|
|
bFrameBg:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
|
bFrameBg:SetPoint("CENTER")
|
|
bFrameBg:SetSize(30, 30)
|
|
bFrameBg:SetVertexColor(0, 0, 0, 0.5)
|
|
end
|
|
-- Move GameTooltip to below the minimap in case the button uses it
|
|
button:HookScript("OnEnter", SetButtonTooltip)
|
|
-- Special case for MoveAny because it doesn't have button.db
|
|
if buttonName == "moveany" then
|
|
button.db = button.db or {}
|
|
if not button.db.hide then button.db.hide = false end
|
|
end
|
|
end
|
|
|
|
-- Hide new LibDBIcon icons
|
|
-- LibDBIcon_IconCreated: Done in LibDBIcon callback function
|
|
|
|
-- Toggle button frame
|
|
local MiniUpScript = Minimap:GetScript("OnMouseUp")
|
|
Minimap:SetScript("OnMouseUp", function(frame, button)
|
|
if button == "RightButton" then
|
|
if bFrame:IsShown() then
|
|
bFrame:Hide()
|
|
else bFrame:Show()
|
|
-- Position button frame
|
|
local side
|
|
local m = Minimap:GetCenter()
|
|
local b = Minimap:GetEffectiveScale()
|
|
local w = GetScreenWidth()
|
|
local s = UIParent:GetEffectiveScale()
|
|
bFrame:ClearAllPoints()
|
|
if m * b > (w * s / 2) then
|
|
side = "Right"
|
|
bFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMLEFT", -10, -0)
|
|
else
|
|
side = "Left"
|
|
bFrame:SetPoint("BOTTOMLEFT", Minimap, "BOTTOMRIGHT", 10, 0)
|
|
end
|
|
-- Show button frame
|
|
local x, y, row, col = 0, 0, 0, 0
|
|
local buttons = LibDBIconStub:GetButtonList()
|
|
-- Sort the button table
|
|
table.sort(buttons, function(a, b)
|
|
if string.find(a, "LeaPlusCustomIcon_") then
|
|
a = string.gsub(a, "LeaPlusCustomIcon_", "")
|
|
end
|
|
if string.find(b, "LeaPlusCustomIcon_") then
|
|
b = string.gsub(b, "LeaPlusCustomIcon_", "")
|
|
end
|
|
return a:lower() < b:lower()
|
|
end)
|
|
-- Calculate buttons per row
|
|
local buttonsPerRow
|
|
local totalButtons = #buttons
|
|
if totalButtons > 36 then buttonsPerRow = 10
|
|
elseif totalButtons > 32 then buttonsPerRow = 9
|
|
elseif totalButtons > 28 then buttonsPerRow = 8
|
|
elseif totalButtons > 24 then buttonsPerRow = 7
|
|
elseif totalButtons > 20 then buttonsPerRow = 6
|
|
elseif totalButtons > 16 then buttonsPerRow = 5
|
|
elseif totalButtons > 12 then buttonsPerRow = 4
|
|
elseif totalButtons > 8 then buttonsPerRow = 3
|
|
elseif totalButtons > 4 then buttonsPerRow = 2
|
|
else
|
|
buttonsPerRow = 1
|
|
end
|
|
-- Build button grid
|
|
for i = 1, totalButtons do
|
|
local buttonName = strlower(buttons[i])
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
|
|
local button = LibDBIconStub:GetMinimapButton(buttons[i])
|
|
if button.db then
|
|
if buttonName == "armory" then button.db.hide = false end -- Armory addon sets hidden to true
|
|
if not button.db.hide then
|
|
button:SetParent(bFrame)
|
|
button:ClearAllPoints()
|
|
if side == "Left" then
|
|
-- Minimap is on left side of screen
|
|
button:SetPoint("TOPLEFT", bFrame, "TOPLEFT", x, y)
|
|
col = col + 1; if col >= buttonsPerRow then col = 0; row = row + 1; x = 0; y = y - 30 else x = x + 30 end
|
|
else
|
|
-- Minimap is on right side of screen (changed from TOPRIGHT to TOPLEFT and x - 30 to x + 30 to make sorting work)
|
|
button:SetPoint("TOPLEFT", bFrame, "TOPLEFT", x, y)
|
|
col = col + 1; if col >= buttonsPerRow then col = 0; row = row + 1; x = 0; y = y - 30 else x = x + 30 end
|
|
end
|
|
if totalButtons <= buttonsPerRow then
|
|
bFrame:SetWidth(totalButtons * 30)
|
|
else
|
|
bFrame:SetWidth(buttonsPerRow * 30)
|
|
end
|
|
local void, void, void, void, e = button:GetPoint()
|
|
bFrame:SetHeight(0 - e + 30)
|
|
LibDBIconStub:Show(buttons[i])
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
else
|
|
MiniUpScript(frame, button)
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Square minimap
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["SquareMinimap"] == "On" then
|
|
|
|
-- Set button layout
|
|
AddonCompartmentFrame:SetFrameStrata("MEDIUM")
|
|
AddonCompartmentFrame:ClearAllPoints()
|
|
AddonCompartmentFrame:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", -2, -2)
|
|
|
|
-- Debug
|
|
-- AddonCompartmentFrame:SetText("56")
|
|
|
|
-- Create black border around map
|
|
local miniBorder = CreateFrame("Frame", nil, Minimap, "BackdropTemplate")
|
|
miniBorder:SetPoint("TOPLEFT", -3, 3)
|
|
miniBorder:SetPoint("BOTTOMRIGHT", 3, -3)
|
|
miniBorder:SetAlpha(1)
|
|
miniBorder:SetBackdrop({
|
|
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
|
|
edgeSize = 5,
|
|
})
|
|
|
|
-- Nudge calendar button to the left
|
|
GameTimeFrame:ClearAllPoints()
|
|
GameTimeFrame:SetPoint("TOPLEFT", TimeManagerClockButton, "TOPRIGHT", 0, 0)
|
|
|
|
-- Function to set minimap position
|
|
local function SetHeaderThing()
|
|
-- local setting = MinimapCluster:GetSettingValueBool(Enum.EditModeMinimapSetting.HeaderUnderneath)
|
|
Minimap:ClearAllPoints()
|
|
Minimap:SetPoint("CENTER", MinimapCluster, "TOP", 14, -124)
|
|
end
|
|
|
|
-- Set minimap position when header position is changed and on startup
|
|
hooksecurefunc(MinimapCluster, "SetHeaderUnderneath", SetHeaderThing)
|
|
SetHeaderThing()
|
|
|
|
-- Hide the default compass border
|
|
MinimapCompassTexture:Hide()
|
|
|
|
-- Mask texture
|
|
Minimap:SetMaskTexture('Interface\\ChatFrame\\ChatFrameBackground')
|
|
|
|
-- Fix textures
|
|
Minimap:SetArchBlobRingScalar(0)
|
|
Minimap:SetArchBlobRingAlpha(0)
|
|
Minimap:SetQuestBlobRingScalar(0)
|
|
Minimap:SetQuestBlobRingAlpha(0)
|
|
|
|
-- Zoom in button
|
|
miniFrame.ClearAllPoints(Minimap.ZoomIn)
|
|
Minimap.ZoomIn:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 0, 0)
|
|
|
|
miniFrame.ClearAllPoints(Minimap.ZoomOut)
|
|
Minimap.ZoomOut:SetPoint("RIGHT", Minimap.ZoomIn, "LEFT", -6, 0)
|
|
|
|
-- Expansion button
|
|
ExpansionLandingPageMinimapButton.border = ExpansionLandingPageMinimapButton:CreateTexture(nil, "OVERLAY")
|
|
ExpansionLandingPageMinimapButton.border:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
|
|
ExpansionLandingPageMinimapButton.border:SetSize(52, 52)
|
|
ExpansionLandingPageMinimapButton.border:SetPoint("TOPLEFT", 0, 0)
|
|
|
|
ExpansionLandingPageMinimapButton.background = ExpansionLandingPageMinimapButton:CreateTexture(nil, "BACKGROUND")
|
|
ExpansionLandingPageMinimapButton.background:SetTexture("Interface\\Minimap\\UI-Minimap-Background")
|
|
ExpansionLandingPageMinimapButton.background:SetAllPoints()
|
|
ExpansionLandingPageMinimapButton:SetHitRectInsets(-0.2, 0.2, 0, 0)
|
|
|
|
miniFrame.SetSize(ExpansionLandingPageMinimapButton, 30, 30)
|
|
hooksecurefunc(ExpansionLandingPageMinimapButton, "SetSize", function()
|
|
miniFrame.SetSize(ExpansionLandingPageMinimapButton, 30, 30)
|
|
end)
|
|
|
|
-- Set expansion button on startup (needed for Dragonflight button)
|
|
miniFrame.ClearAllPoints(ExpansionLandingPageMinimapButton)
|
|
ExpansionLandingPageMinimapButton:SetPoint("TOPLEFT", MinimapBackdrop, "TOPLEFT", -7, -150)
|
|
ExpansionLandingPageMinimapButton.LoopingGlow:SetAtlas("Mage-ArcaneCharge-CircleGlow", true)
|
|
|
|
-- Set expansion button when icon is updated (needed for Shadowlands button)
|
|
hooksecurefunc(ExpansionLandingPageMinimapButton, "UpdateIcon", function()
|
|
miniFrame.ClearAllPoints(ExpansionLandingPageMinimapButton)
|
|
ExpansionLandingPageMinimapButton:SetPoint("TOPLEFT", MinimapBackdrop, "TOPLEFT", -7, -150)
|
|
ExpansionLandingPageMinimapButton.LoopingGlow:SetAtlas("Mage-ArcaneCharge-CircleGlow", true)
|
|
end)
|
|
|
|
ExpansionLandingPageMinimapButton.AlertBG:ClearAllPoints()
|
|
ExpansionLandingPageMinimapButton.AlertBG:SetPoint("RIGHT", ExpansionLandingPageMinimapButton, "CENTER", -4, 0)
|
|
ExpansionLandingPageMinimapButton.AlertText:ClearAllPoints()
|
|
ExpansionLandingPageMinimapButton.AlertText:SetPoint("RIGHT", ExpansionLandingPageMinimapButton, "LEFT", -8, 0)
|
|
ExpansionLandingPageMinimapButton:SetHitRectInsets(0, 0, 0, 0)
|
|
|
|
-- Set instance difficulty layout
|
|
MinimapCluster.InstanceDifficulty:ClearAllPoints()
|
|
MinimapCluster.InstanceDifficulty:SetPoint("TOPRIGHT", MinimapCluster, "TOPRIGHT", -10, -22)
|
|
|
|
-- Setup hybrid minimap when available
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_HybridMinimap",function()
|
|
HybridMinimap.MapCanvas:SetUseMaskTexture(false)
|
|
HybridMinimap.CircleMask:SetTexture("Interface\\BUTTONS\\WHITE8X8")
|
|
HybridMinimap.MapCanvas:SetUseMaskTexture(true)
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Replace non-standard buttons
|
|
----------------------------------------------------------------------
|
|
|
|
-- Replace non-standard buttons for addons that don't use the standard LibDBIcon library
|
|
do
|
|
|
|
-- Make LibDBIcon buttons for addons that don't use LibDBIcon
|
|
local CustomAddonTable = {}
|
|
LeaPlusDB["CustomAddonButtons"] = LeaPlusDB["CustomAddonButtons"] or {}
|
|
|
|
-- Function to create a LibDBIcon button
|
|
local function CreateBadButton(name)
|
|
|
|
-- Get non-standard button texture
|
|
local finalTex = "Interface\\HELPFRAME\\HelpIcon-KnowledgeBase"
|
|
|
|
if _G[name .. "Icon"] then
|
|
if _G[name .. "Icon"]:GetObjectType() == "Texture" then
|
|
local gTex = _G[name .. "Icon"]:GetTexture()
|
|
if gTex then
|
|
finalTex = gTex
|
|
end
|
|
end
|
|
else
|
|
for i = 1, select('#', _G[name]:GetRegions()) do
|
|
local region = select(i, _G[name]:GetRegions())
|
|
if region.GetTexture then
|
|
local x, y = region:GetSize()
|
|
if x and x < 30 then
|
|
finalTex = region:GetTexture()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if not finalTex then finalTex = "Interface\\HELPFRAME\\HelpIcon-KnowledgeBase" end
|
|
|
|
-- Function to anchor the tooltip to the custom button or the minimap
|
|
local function ReanchorTooltip(tip, myButton)
|
|
tip:ClearAllPoints()
|
|
if LeaPlusLC["CombineAddonButtons"] == "On" then
|
|
if LeaPlusLC.bFrame and LeaPlusLC.bFrame:GetPoint() == "BOTTOMLEFT" then
|
|
tip:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -6)
|
|
else
|
|
tip:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -6)
|
|
end
|
|
else
|
|
if Minimap:GetCenter() * Minimap:GetEffectiveScale() > (GetScreenWidth() * UIParent:GetEffectiveScale() / 2) then
|
|
tip:SetPoint("TOPRIGHT", myButton, "BOTTOMRIGHT", 0, -6)
|
|
else
|
|
tip:SetPoint("TOPLEFT", myButton, "BOTTOMLEFT", 0, -6)
|
|
end
|
|
end
|
|
end
|
|
|
|
local zeroButton = LibStub("LibDataBroker-1.1"):NewDataObject("LeaPlusCustomIcon_" .. name, {
|
|
type = "data source",
|
|
text = name,
|
|
icon = finalTex,
|
|
OnClick = function(self, btn)
|
|
if _G[name] then
|
|
if string.find(name, "LibDBIcon") then
|
|
-- It's a fake LibDBIcon
|
|
local mouseUp = _G[name]:GetScript("OnMouseUp")
|
|
if mouseUp then
|
|
mouseUp(self, btn)
|
|
end
|
|
else
|
|
-- It's a genuine LibDBIcon
|
|
local clickUp = _G[name]:GetScript("OnClick")
|
|
if clickUp then
|
|
_G[name]:Click(btn)
|
|
end
|
|
end
|
|
end
|
|
end,
|
|
})
|
|
LeaPlusDB["CustomAddonButtons"][name] = LeaPlusDB["CustomAddonButtons"][name] or {}
|
|
LeaPlusDB["CustomAddonButtons"][name].hide = false
|
|
CustomAddonTable[name] = name
|
|
local icon = LibStub("LibDBIcon-1.0", true)
|
|
icon:Register("LeaPlusCustomIcon_" .. name, zeroButton, LeaPlusDB["CustomAddonButtons"][name])
|
|
-- Custom buttons
|
|
if name == "AllTheThings-Minimap" then
|
|
-- AllTheThings
|
|
local myButton = LibStub("LibDBIcon-1.0"):GetMinimapButton("LeaPlusCustomIcon_" .. name)
|
|
myButton.icon:SetTexture("Interface\\AddOns\\AllTheThings\\assets\\logo_tiny")
|
|
myButton:HookScript("OnEnter", function()
|
|
_G[name]:GetScript("OnEnter")(_G[name], true)
|
|
ReanchorTooltip(GameTooltip, myButton)
|
|
end)
|
|
myButton:HookScript("OnLeave", function()
|
|
_G[name]:GetScript("OnLeave")()
|
|
end)
|
|
elseif name == "AltoholicMinimapButton" then
|
|
-- Altoholic
|
|
local myButton = LibStub("LibDBIcon-1.0"):GetMinimapButton("LeaPlusCustomIcon_" .. name)
|
|
myButton.icon:SetTexture("Interface\\Icons\\INV_Drink_13")
|
|
myButton:HookScript("OnEnter", function()
|
|
_G[name]:GetScript("OnEnter")(_G[name], true)
|
|
ReanchorTooltip(AddonFactory_Tooltip, myButton)
|
|
end)
|
|
myButton:HookScript("OnLeave", function()
|
|
_G[name]:GetScript("OnLeave")()
|
|
end)
|
|
elseif name == "WIM3MinimapButton" then
|
|
-- WIM
|
|
local myButton = LibStub("LibDBIcon-1.0"):GetMinimapButton("LeaPlusCustomIcon_" .. name)
|
|
myButton:HookScript("OnEnter", function()
|
|
_G[name]:GetScript("OnEnter")(_G[name], true)
|
|
GameTooltip:SetOwner(myButton, "ANCHOR_TOP")
|
|
GameTooltip:AddLine(name)
|
|
GameTooltip:Show()
|
|
ReanchorTooltip(GameTooltip, myButton)
|
|
end)
|
|
myButton:HookScript("OnLeave", function()
|
|
_G["WIM3MinimapButton"]:GetScript("OnLeave")()
|
|
GameTooltip:Hide()
|
|
end)
|
|
elseif name == "ZygorGuidesViewerMapIcon" then
|
|
-- Zygor (uses LibDBIcon10_LeaPlusCustomIcon_ZygorGuidesViewerMapIcon)
|
|
local myButton = LibStub("LibDBIcon-1.0"):GetMinimapButton("LeaPlusCustomIcon_" .. name)
|
|
myButton.icon:SetTexture("Interface\\AddOns\\ZygorGuidesViewer\\Skins\\minimap-icon.tga")
|
|
hooksecurefunc(myButton.icon, "UpdateCoord", function()
|
|
myButton.icon:SetTexCoord(0, 0.5, 0, 0.25)
|
|
end)
|
|
myButton.icon:SetTexCoord(0, 0.5, 0, 0.25)
|
|
myButton:HookScript("OnEnter", function()
|
|
_G[name]:GetScript("OnEnter")(_G[name], true)
|
|
ReanchorTooltip(GameTooltip, myButton)
|
|
end)
|
|
myButton:HookScript("OnLeave", function()
|
|
GameTooltip:Hide()
|
|
end)
|
|
if ZGV_Notification_Entry_Template_Mixin then
|
|
-- Fix notification system entry height
|
|
hooksecurefunc(ZGV_Notification_Entry_Template_Mixin, "UpdateHeight", function(self)
|
|
self:Show()
|
|
local height = 46
|
|
if ZGV and ZGV.db and ZGV.db.profile and ZGV.db.profile.nc_size and ZGV.db.profile.nc_size == 1 then height = 36 end
|
|
height = height + (self.time:IsVisible() and self.time:GetStringHeight()+0 or 0)
|
|
height = height + (self.title:IsVisible() and self.title:GetStringHeight()+3 or 0)
|
|
height = height + (self.text:IsVisible() and self.text:GetStringHeight()+3 or 0)
|
|
height = height + (self.SpecialButton and self.SpecialButton:IsVisible() and self.SpecialButton:GetHeight()+8 or 0)
|
|
if (self.single or self.special) then height = max(height,25) end
|
|
self:SetHeight(height)
|
|
self:Hide()
|
|
end)
|
|
end
|
|
elseif name == "BtWQuestsMinimapButton" -- BtWQuests
|
|
or name == "TomCats-MinimapButton" -- TomCat's Tours
|
|
or name == "TomCats-LoveIsInTheAirMinimapButton2023"
|
|
or name == "TomCats-LunarFestivalMinimapButton2023"
|
|
or name == "LibDBIcon10_MethodRaidTools" -- Method Raid Tools
|
|
or name == "wlMinimapButton" -- Wowhead Looter (part of Wowhead client)
|
|
then
|
|
local myButton = LibStub("LibDBIcon-1.0"):GetMinimapButton("LeaPlusCustomIcon_" .. name)
|
|
myButton:HookScript("OnEnter", function()
|
|
_G[name]:GetScript("OnEnter")(_G[name], true)
|
|
ReanchorTooltip(GameTooltip, myButton)
|
|
end)
|
|
myButton:HookScript("OnLeave", function()
|
|
GameTooltip:Hide()
|
|
end)
|
|
else
|
|
-- Unknown custom buttons
|
|
local myButton = LibStub("LibDBIcon-1.0"):GetMinimapButton("LeaPlusCustomIcon_" .. name)
|
|
myButton:HookScript("OnEnter", function()
|
|
GameTooltip:SetOwner(myButton, "ANCHOR_TOP")
|
|
GameTooltip:AddLine(name)
|
|
GameTooltip:AddLine(L["This is a custom button. Please ask the addon author to use the standard LibDBIcon library instead."], 1, 1, 1, true)
|
|
GameTooltip:Show()
|
|
ReanchorTooltip(GameTooltip, myButton)
|
|
end)
|
|
myButton:HookScript("OnLeave", function()
|
|
GameTooltip:Hide()
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- Create LibDBIcon buttons for these addons that have LibDBIcon prefixes
|
|
local customButtonTable = {
|
|
"LibDBIcon10_MethodRaidTools", -- Method Raid Tools
|
|
}
|
|
|
|
-- Do not create LibDBIcon buttons for these special case buttons
|
|
local BypassButtonTable = {
|
|
"SexyMapZoneTextButton", -- SexyMap
|
|
"Narci_MinimapButton", -- Narcissus
|
|
}
|
|
|
|
-- Some buttons have less than 3 regions. These need to be manually defined below.
|
|
local LowRegionCountButtons = {
|
|
"AllTheThings-Minimap", -- AllTheThings
|
|
}
|
|
|
|
-- Function to loop through minimap children to find non-standard addon buttons
|
|
local function MakeButtons()
|
|
local temp = {Minimap:GetChildren()}
|
|
for i = 1, #temp do
|
|
if temp[i] then
|
|
local btn = temp[i]
|
|
local name = btn:GetName()
|
|
local btype = btn:GetObjectType()
|
|
if name and btype == "Button" and not CustomAddonTable[name] and (btn:GetNumRegions() >= 3 or tContains(LowRegionCountButtons, name)) and not issecurevariable(name) and btn:IsShown() then
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), strlower("##" .. name)) then
|
|
if not string.find(name, "LibDBIcon") and not tContains(BypassButtonTable, name) or tContains(customButtonTable, name) then
|
|
CreateBadButton(name)
|
|
btn:Hide()
|
|
btn:SetScript("OnShow", function() btn:Hide() end)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Run the function a few times on startup
|
|
C_Timer.NewTicker(2, MakeButtons, 8)
|
|
C_Timer.After(0.1, MakeButtons)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide addon buttons
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["CombineAddonButtons"] == "Off" then
|
|
|
|
-- Function to set button state
|
|
local function SetHideButtons()
|
|
if LeaPlusLC["HideMiniAddonButtons"] == "On" then
|
|
-- Hide existing buttons
|
|
local buttons = LibDBIconStub:GetButtonList()
|
|
for i = 1, #buttons do
|
|
local buttonName = strlower(buttons[i])
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
|
|
LibDBIconStub:ShowOnEnter(buttons[i], true)
|
|
end
|
|
end
|
|
-- Hide new buttons
|
|
-- LibDBIcon_IconCreated: Done in LibDBIcon callback function
|
|
else
|
|
-- Show existing buttons
|
|
local buttons = LibDBIconStub:GetButtonList()
|
|
for i = 1, #buttons do
|
|
local buttonName = strlower(buttons[i])
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
|
|
LibDBIconStub:ShowOnEnter(buttons[i], false)
|
|
end
|
|
end
|
|
-- Show new buttons
|
|
-- LibDBIcon_IconCreated: Done in LibDBIcon callback function
|
|
end
|
|
end
|
|
|
|
-- Assign file level scope (it's used in reset and preset)
|
|
LeaPlusLC.SetHideButtons = SetHideButtons
|
|
|
|
-- Set buttons when option is clicked and on startup
|
|
LeaPlusCB["HideMiniAddonButtons"]:HookScript("OnClick", SetHideButtons)
|
|
SetHideButtons()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Buttons
|
|
----------------------------------------------------------------------
|
|
|
|
-- Help button tooltip
|
|
SideMinimap.h.tiptext = L["If you toggle an addon minimap button, you may need to reload your UI for the change to take effect. This only affects a few addons that use custom buttons."]
|
|
|
|
-- Back button handler
|
|
SideMinimap.b:SetScript("OnClick", function()
|
|
SideMinimap:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
SideMinimap.r.tiptext = SideMinimap.r.tiptext .. "|n|n" .. L["Note that this will not reset settings that require a UI reload."]
|
|
SideMinimap.r:HookScript("OnClick", function()
|
|
LeaPlusLC["HideMiniAddonButtons"] = "On"; if LeaPlusLC.SetHideButtons then LeaPlusLC:SetHideButtons() end
|
|
LeaPlusLC["ShowWhoPinged"] = "On"; LeaPlusLC:SetPingFunc()
|
|
LeaPlusLC["MiniClusterScale"] = 1; LeaPlusLC["MinimapNoScale"] = "Off"; SetClusterScale()
|
|
-- Refresh panel
|
|
SideMinimap:Hide(); SideMinimap:Show()
|
|
end)
|
|
|
|
-- Configuration button handler
|
|
LeaPlusCB["ModMinimapBtn"]:HookScript("OnClick", function()
|
|
if LeaPlusLC:PlayerInCombat() then
|
|
return
|
|
else
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["HideMiniAddonButtons"] = "On"; if LeaPlusLC.SetHideButtons then LeaPlusLC:SetHideButtons() end
|
|
LeaPlusLC["ShowWhoPinged"] = "On"; LeaPlusLC:SetPingFunc()
|
|
LeaPlusLC["HideMiniAddonMenu"] = "On"
|
|
LeaPlusLC["MiniClusterScale"] = 1; LeaPlusLC["MinimapNoScale"] = "Off"; SetClusterScale()
|
|
LeaPlusLC["UnclampMinimap"] = "On"
|
|
LeaPlusLC:ReloadCheck() -- Special reload check
|
|
else
|
|
-- Show configuration panel
|
|
SideMinimap:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- LibDBIcon callback (search LibDBIcon_IconCreated to find calls to this)
|
|
LibDBIconStub.RegisterCallback(miniFrame, "LibDBIcon_IconCreated", function(self, button, name)
|
|
|
|
-- Combine addon buttons: Hide new LibDBIcon icons
|
|
if LeaPlusLC["CombineAddonButtons"] == "On" then
|
|
--C_Timer.After(0.1, function() -- Removed for now
|
|
local buttonName = strlower(name)
|
|
|
|
-- Special case for MoveAny because it doesn't have button.db
|
|
if buttonName == "moveany" then
|
|
button.db = button.db or {}
|
|
if not button.db.hide then button.db.hide = false end
|
|
end
|
|
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
|
|
if button.db and not button.db.hide then
|
|
button:Hide()
|
|
button:SetScript("OnShow", function() if not LeaPlusLC.bFrame:IsShown() then button:Hide() end end)
|
|
end
|
|
-- Create background texture
|
|
local bFrameBg = button:CreateTexture(nil, "BACKGROUND")
|
|
bFrameBg:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
|
|
bFrameBg:SetPoint("CENTER")
|
|
bFrameBg:SetSize(30, 30)
|
|
bFrameBg:SetVertexColor(0, 0, 0, 0.5)
|
|
end
|
|
-- Move GameTooltip to below the minimap in case the button uses it
|
|
button:HookScript("OnEnter", LeaPlusLC.SetButtonTooltip)
|
|
--end)
|
|
end
|
|
|
|
-- Hide addon buttons: Hide new LibDBIcon icons
|
|
if LeaPlusLC["CombineAddonButtons"] == "Off" then
|
|
local buttonName = strlower(name)
|
|
if LeaPlusLC["HideMiniAddonButtons"] == "On" then
|
|
-- Hide addon buttons is enabled
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
|
|
LibDBIconStub:ShowOnEnter(name, true)
|
|
end
|
|
else
|
|
-- Hide addon buttons is disabled
|
|
if not strfind(strlower(LeaPlusDB["MiniExcludeList"]), buttonName) then
|
|
LibDBIconStub:ShowOnEnter(name, false)
|
|
end
|
|
end
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show ready timer
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowReadyTimer"] == "On" then
|
|
|
|
|
|
-- Dungeons and Raids
|
|
do
|
|
|
|
-- Declare variables
|
|
local duration, barTime = 40, -1
|
|
local t = duration
|
|
|
|
-- Create status bar below dungeon ready popup
|
|
local bar = CreateFrame("StatusBar", nil, LFGDungeonReadyPopup)
|
|
bar:SetPoint("TOPLEFT", LFGDungeonReadyPopup, "BOTTOMLEFT", 0, -5)
|
|
bar:SetPoint("TOPRIGHT", LFGDungeonReadyPopup, "BOTTOMRIGHT", 0, -5)
|
|
bar:SetHeight(5)
|
|
bar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
|
|
bar:SetStatusBarColor(1.0, 0.85, 0.0)
|
|
bar:SetMinMaxValues(0, duration)
|
|
|
|
-- Create status bar text
|
|
local text = bar:CreateFontString(nil, "ARTWORK")
|
|
text:SetFontObject("GameFontNormalLarge")
|
|
text:SetTextColor(1.0, 0.85, 0.0)
|
|
text:SetPoint("TOP", 0, -10)
|
|
|
|
-- Update bar as timer counts down
|
|
bar:SetScript("OnUpdate", function(self, elapsed)
|
|
t = t - elapsed
|
|
if barTime >= 1 or barTime == -1 then
|
|
self:SetValue(t)
|
|
text:SetText(SecondsToTime(floor(t + 0.5)))
|
|
barTime = 0
|
|
end
|
|
barTime = barTime + elapsed
|
|
end)
|
|
|
|
-- Show frame when dungeon ready frame shows
|
|
local frame = CreateFrame("FRAME")
|
|
frame:RegisterEvent("LFG_PROPOSAL_SHOW")
|
|
frame:RegisterEvent("LFG_PROPOSAL_FAILED")
|
|
frame:RegisterEvent("LFG_PROPOSAL_SUCCEEDED")
|
|
frame:SetScript("OnEvent", function(self, event)
|
|
if event == "LFG_PROPOSAL_SHOW" then
|
|
t = duration
|
|
barTime = -1
|
|
bar:Show()
|
|
-- Hide existing timer bars (such as BigWigs)
|
|
local children = {LFGDungeonReadyPopup:GetChildren()}
|
|
if children then
|
|
for i, child in ipairs(children) do
|
|
if child ~= bar then
|
|
local objType = child:GetObjectType()
|
|
if objType and objType == "StatusBar" then
|
|
child:Hide()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
else
|
|
bar:Hide()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
-- Player vs Player
|
|
do
|
|
|
|
-- Declare variables
|
|
local t, barTime = -1, -1
|
|
|
|
-- Create status bar below dungeon ready popup
|
|
local bar = CreateFrame("StatusBar", nil, PVPReadyDialog)
|
|
bar:SetPoint("TOPLEFT", PVPReadyDialog, "BOTTOMLEFT", 0, -5)
|
|
bar:SetPoint("TOPRIGHT", PVPReadyDialog, "BOTTOMRIGHT", 0, -5)
|
|
bar:SetHeight(5)
|
|
bar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
|
|
bar:SetStatusBarColor(1.0, 0.85, 0.0)
|
|
|
|
-- Create status bar text
|
|
local text = bar:CreateFontString(nil, "ARTWORK")
|
|
text:SetFontObject("GameFontNormalLarge")
|
|
text:SetTextColor(1.0, 0.85, 0.0)
|
|
text:SetPoint("TOP", 0, -10)
|
|
|
|
-- Update bar as timer counts down
|
|
bar:SetScript("OnUpdate", function(self, elapsed)
|
|
t = t - elapsed
|
|
if barTime >= 1 or barTime == -1 then
|
|
self:SetValue(t)
|
|
text:SetText(SecondsToTime(floor(t + 0.5)))
|
|
barTime = 0
|
|
end
|
|
barTime = barTime + elapsed
|
|
end)
|
|
|
|
-- Show frame when PvP ready frame shows
|
|
hooksecurefunc("PVPReadyDialog_Display", function(self, id)
|
|
t = GetBattlefieldPortExpiration(id) + 1
|
|
-- t = 89; -- debug
|
|
if t and t > 1 then
|
|
bar:SetMinMaxValues(0, t)
|
|
barTime = -1
|
|
bar:Show()
|
|
else
|
|
bar:Hide()
|
|
end
|
|
end)
|
|
|
|
PVPReadyDialog:HookScript("OnHide", function()
|
|
bar:Hide()
|
|
end)
|
|
|
|
-- Debug
|
|
-- C_Timer.After(2, function() PVPReadyDialog_Display(PVPReadyDialog, 1, "Warsong Gulch", 0, "BATTLEGROUND", "", "DAMAGER"); bar:Show() end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Remove transforms (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- LeaPlusLC.NewPatch: Temporary UpdateVars for the old Transform professions to the new individual professions
|
|
local function UpdateVars(oldvar, newvar)
|
|
if LeaPlusDB[oldvar] and not LeaPlusDB[newvar] then LeaPlusDB[newvar] = LeaPlusDB[oldvar]; end
|
|
end
|
|
|
|
UpdateVars("TransProfessions", "TransBlacksmithing")
|
|
UpdateVars("TransProfessions", "TransJewelcrafting")
|
|
UpdateVars("TransProfessions", "TransTailoring")
|
|
UpdateVars("TransProfessions", "TransEngineering")
|
|
UpdateVars("TransProfessions", "TransEnchanting")
|
|
UpdateVars("TransProfessions", "TransAlchemy")
|
|
UpdateVars("TransProfessions", "TransInscription")
|
|
UpdateVars("TransProfessions", "TransLeatherworking")
|
|
UpdateVars("TransProfessions", "TransHerbalism")
|
|
UpdateVars("TransProfessions", "TransMining")
|
|
UpdateVars("TransProfessions", "TransSkinning")
|
|
UpdateVars("TransProfessions", "TransCooking")
|
|
UpdateVars("TransProfessions", "TransFishing")
|
|
LeaPlusDB["TransProfessions"] = nil
|
|
|
|
local transTable = {
|
|
|
|
-- Single spell IDs
|
|
["TransAqir"] = {318452}, -- Aqir Egg Cluster
|
|
["TransAtomic"] = {399502}, -- Atomically Recalibrator toy
|
|
["TransAtomGoblin"] = {1215363}, -- Atomically Regoblinator toy
|
|
["TransBlight"] = {290224}, -- Detoxified Blight Grenade
|
|
["TransLantern"] = {44212}, -- Weighted Jack-o'-Lantern
|
|
["TransWitch"] = {279509}, -- Lucille's Sewing Needle (witch)
|
|
["TransTurkey"] = {61781}, -- Turkey (Pilgrim's Bounty)
|
|
["TransCursedPickaxe"] = {454405}, -- Cursed Pickaxe (weapon)
|
|
|
|
-- Noblegarden: Noblegarden Bunny
|
|
["TransNobleBunny"] = {
|
|
--[[Noblegarden Bunny]] 61734,
|
|
--[[Rabbit Costume]] 61716,
|
|
},
|
|
|
|
-- Spraybots
|
|
["TransSpraybots"] = {
|
|
--[[Paintbot Orange]] 301892,
|
|
--[[Paintbot Blue]] 301893,
|
|
--[[Paintbot Green]] 301894,
|
|
},
|
|
|
|
-- Hallowed Wand costumes
|
|
["TransHallowed"] = {
|
|
--[[Abomination]] 172010,
|
|
--[[CancelBanshee]] 218132,
|
|
--[[Bat]] 191703, 24732,
|
|
--[[Gargoyle]] 191210,
|
|
--[[Geist]] 172015,
|
|
--[[Ghost]] 24735, 24736, 191698, 191700,
|
|
--[[Ghoul]] 172008,
|
|
--[[Leper Gnome]] 24712, 24713, 191701,
|
|
--[[Nerubian]] 191211,
|
|
--[[Ninja]] 24710, 24711, 191686, 191688,
|
|
--[[Pirate]] 24708, 24709, 173958, 173959, 191682, 191683,
|
|
--[[Skeleton]] 24723, 191702,
|
|
--[[Slime]] 172003,
|
|
--[[Spider]] 172020,
|
|
--[[Wight]] 191208,
|
|
--[[Wisp]] 24740,
|
|
},
|
|
|
|
-- Crafting professions
|
|
["TransBlacksmithing"] = {--[[Blacksmithing: Suited for Smithing]] 388658,},
|
|
["TransJewelcrafting"] = {--[[Jewelcrafting: An Eye For Shine]] 394015,},
|
|
["TransTailoring"] = {--[[Tailoring: Wrapped Up In Weaving]] 391312,},
|
|
["TransEngineering"] = {--[[Engineering: Ready To Build]] 394007,},
|
|
["TransEnchanting"] = {--[[Enchanting: A Looker's Charm]] 394008,},
|
|
["TransAlchemy"] = {--[[Alchemy: Spark of Madness]] 394003,},
|
|
["TransInscription"] = {--[[Inscription: Artist's Duds]] 394016,},
|
|
["TransLeatherworking"] = {--[[Leatherworking: Sculpting Leather Finery]] 394001,},
|
|
|
|
-- Gathering professions
|
|
["TransHerbalism"] = {--[[Herbalism: A Cultivator's Colors]] 394005,},
|
|
["TransMining"] = {--[[Mining: Rockin' Mining Gear]] 394006,},
|
|
["TransSkinning"] = {--[[Skinning: Dressed To Kill]] 394011,},
|
|
|
|
-- Secondary professions
|
|
["TransCooking"] = {--[[Cooking: What's Cookin', Good Lookin'?]] 391775,},
|
|
["TransFishing"] = {--[[Fishing: Fishing For Attention 394009 - Handled separately]]},
|
|
|
|
}
|
|
|
|
-- Give table file level scope (its used during logout and for admin command)
|
|
LeaPlusLC["transTable"] = transTable
|
|
|
|
-- Create local table for storing spell IDs that need to be removed
|
|
local cTable = {}
|
|
|
|
-- Load saved settings or set default values
|
|
for k, v in pairs(transTable) do
|
|
if LeaPlusDB[k] and type(LeaPlusDB[k]) == "string" and LeaPlusDB[k] == "On" or LeaPlusDB[k] == "Off" then
|
|
LeaPlusLC[k] = LeaPlusDB[k]
|
|
else
|
|
LeaPlusLC[k] = "Off"
|
|
LeaPlusDB[k] = "Off"
|
|
end
|
|
end
|
|
|
|
-- Create scrolling configuration panel
|
|
local transPanel = LeaPlusLC:CreatePanel("Remove transforms", "transPanel", true)
|
|
|
|
-- Initialise row count
|
|
local row = -1
|
|
|
|
-- Add checkboxes
|
|
row = row + 2; LeaPlusLC:MakeTx(transPanel.scrollChild, "Crafting professions", 16, -((row - 1) * 20) - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransBlacksmithing", "Blacksmithing", 16, -((row - 1) * 20) - 2, false, "If checked, the Suited for Smithing transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransJewelcrafting", "Jewelcrafting", 16, -((row - 1) * 20) - 2, false, "If checked, the An Eye For Shine transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransTailoring", "Tailoring", 16, -((row - 1) * 20) - 2, false, "If checked, the Wrapped Up In Weaving transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransEngineering", "Engineering", 16, -((row - 1) * 20) - 2, false, "If checked, the Ready To Build transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransEnchanting", "Enchanting", 16, -((row - 1) * 20) - 2, false, "If checked, the A Looker's Charm transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransAlchemy", "Alchemy", 16, -((row - 1) * 20) - 2, false, "If checked, the Spark of Madness transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransInscription", "Inscription", 16, -((row - 1) * 20) - 2, false, "If checked, the Artist's Duds transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransLeatherworking", "Leatherworking", 16, -((row - 1) * 20) - 2, false, "If checked, the Sculpting Leather Finery transform will be removed when applied.")
|
|
|
|
row = row + 2; LeaPlusLC:MakeTx(transPanel.scrollChild, "Gathering professions", 16, -((row - 1) * 20) - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransHerbalism", "Herbalism", 16, -((row - 1) * 20) - 2, false, "If checked, the A Cultivator's Colors transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransMining", "Mining", 16, -((row - 1) * 20) - 2, false, "If checked, the Rockin' Mining Gear transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransSkinning", "Skinning", 16, -((row - 1) * 20) - 2, false, "If checked, the Dressed To Kill transform will be removed when applied.")
|
|
|
|
row = row + 2; LeaPlusLC:MakeTx(transPanel.scrollChild, "Secondary professions", 16, -((row - 1) * 20) - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransCooking", "Cooking", 16, -((row - 1) * 20) - 2, false, "If checked, the What's Cookin', Good Lookin' transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransFishing", "Fishing", 16, -((row - 1) * 20) - 2, false, "If checked, the Fishing For Attention transform will be removed when applied.")
|
|
|
|
row = row + 2; LeaPlusLC:MakeTx(transPanel.scrollChild, "Toys", 16, -((row - 1) * 20) - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransAqir", "Aqir Egg Cluster", 16, -((row - 1) * 20) - 2, false, "If checked, the Aqir Egg Cluster transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransAtomic", "Atomic Recalibrator", 16, -((row - 1)* 20) -2, false, "If checked, the Atomic Recalibrator transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransAtomGoblin", "Atomic Regoblinator", 16, -((row - 1)* 20) -2, false, "If checked, the Atomic Regoblinator transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransBlight", "Detoxified Blight Grenade", 16, -((row - 1) * 20) - 2, false, "If checked, the Detoxified Blight Grenade transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransWitch", "Lucille's Sewing Needle", 16, -((row - 1) * 20) - 2, false, "If checked, the Lucille's Sewing Needle transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransSpraybots", "Spraybots", 16, -((row - 1) * 20) - 2, false, "If checked, the Spraybot transforms will be removed when applied.")
|
|
|
|
row = row + 2; LeaPlusLC:MakeTx(transPanel.scrollChild, "Events", 16, -(row - 1) * 20 - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransHallowed", "Hallow's End: Hallowed Wand", 16, -((row - 1) * 20) - 2, false, "If checked, the Hallowed Wand transforms will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransLantern", "Hallow's End: Weighted Jack-o'-Lantern", 16, -((row - 1) * 20) - 2, false, "If checked, the Weighted Jack-o'-Lantern transform will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransNobleBunny", "Noblegarden: Noblegarden Bunny", 16, -((row - 1) * 20) - 2, false, "If checked, the Noblegarden bunny transforms will be removed when applied.")
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransTurkey", "Pilgrim's Bounty: Turkey Shooter", 16, -((row - 1) * 20) - 2, false, "If checked, the Turkey Shooter transform will be removed when applied.")
|
|
|
|
row = row + 2; LeaPlusLC:MakeTx(transPanel.scrollChild, "Items", 16, -(row - 1) * 20 - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "TransCursedPickaxe", "Cursed Pickaxe", 16, -((row - 1) * 20) - 2, false, "If checked, the Cursed Pickaxe transform will be removed when applied.|n|nYou can mute the associated sounds with the mute game sounds combat shouts option.")
|
|
|
|
-- Debug
|
|
-- RemoveCommentToEnableDebug = true
|
|
if RemoveCommentToEnableDebug then
|
|
row = row + 2; LeaPlusLC:MakeTx(transPanel.scrollChild, "Debug", 16, -(row - 1) * 20 - 2)
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "CancelDevotion", "Devotion Aura", 16, -((row - 1) * 20) - 2, false, "")
|
|
transTable["CancelDevotion"] = {465}
|
|
LeaPlusLC["CancelDevotion"] = "On"
|
|
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "CancelStealth", "Stealth", 16, -((row - 1) * 20) - 2, false, "")
|
|
transTable["CancelStealth"] = {1784}
|
|
LeaPlusLC["CancelStealth"] = "On"
|
|
|
|
row = row + 1; LeaPlusLC:MakeCB(transPanel.scrollChild, "CancelIntel", "Intellect", 16, -((row - 1) * 20) - 2, false, "")
|
|
transTable["CancelIntel"] = {1459}
|
|
LeaPlusLC["CancelIntel"] = "On"
|
|
end
|
|
|
|
-- Function to populate cTable with spell IDs for settings that are enabled
|
|
local function UpdateList()
|
|
for k, v in pairs(transTable) do
|
|
for j, spellID in pairs(v) do
|
|
if LeaPlusLC[k] == "On" then
|
|
cTable[spellID] = true
|
|
else
|
|
cTable[spellID] = nil
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Populate cTable on startup
|
|
UpdateList()
|
|
|
|
-- Special exception for fishing (loot frame remains open after fishing channeling stops and buff is removed if combat starts)
|
|
local fishEvent = CreateFrame("FRAME")
|
|
fishEvent:RegisterUnitEvent("UNIT_SPELLCAST_CHANNEL_STOP", "player")
|
|
fishEvent:SetScript("OnEvent", function(self, event, unit, void, spellID)
|
|
if LeaPlusLC["NoTransforms"] == "On" and LeaPlusLC["TransFishing"] == "On" and spellID == 131476 then -- Fishing
|
|
for i = 1, 40 do
|
|
local BuffData = C_UnitAuras.GetBuffDataByIndex("player", i)
|
|
if BuffData then
|
|
local spellID = BuffData.spellId
|
|
if spellID and spellID == 394009 and not UnitAffectingCombat("player") then -- Fishing For Attention
|
|
CancelUnitBuff("player", i)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
LeaPlusCB["TransFishing"]:HookScript("OnClick", function() fishEvent:GetScript("OnEvent")("", "", "", "", 131476) end)
|
|
|
|
-- Create frame for events
|
|
local spellFrame = CreateFrame("FRAME")
|
|
local fisherTicker, castingSpellID
|
|
|
|
-- Function to cancel buffs
|
|
local function eventFunc()
|
|
for i = 1, 40 do
|
|
local BuffData = C_UnitAuras.GetBuffDataByIndex("player", i)
|
|
if BuffData then
|
|
local spellID = BuffData.spellId
|
|
if spellID and cTable[spellID] then
|
|
if UnitAffectingCombat("player") then
|
|
spellFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
|
|
else
|
|
CancelUnitBuff("player", i)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Check for buffs
|
|
spellFrame:SetScript("OnEvent", function(self, event, unit, updatedAuras)
|
|
if event == "UNIT_AURA" then
|
|
if updatedAuras then
|
|
if updatedAuras.isFullUpdate then
|
|
eventFunc()
|
|
elseif updatedAuras.addedAuras then
|
|
for void, aura in ipairs(updatedAuras.addedAuras) do
|
|
if aura.spellId and cTable[aura.spellId] then
|
|
eventFunc()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
elseif event == "PLAYER_REGEN_ENABLED" then
|
|
|
|
-- Traverse buffs (will only run spell was found in cTable previously)
|
|
for i = 1, 40 do
|
|
local BuffData = C_UnitAuras.GetBuffDataByIndex("player", i)
|
|
if BuffData then
|
|
local spellID = BuffData.spellId
|
|
if spellID and cTable[spellID] then
|
|
spellFrame:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
|
CancelUnitBuff("player", i)
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
end)
|
|
|
|
-- Function to set event
|
|
local function SetTransformFunc()
|
|
if LeaPlusLC["NoTransforms"] == "On" then
|
|
eventFunc()
|
|
spellFrame:RegisterUnitEvent("UNIT_AURA", "player")
|
|
else
|
|
spellFrame:UnregisterEvent("UNIT_AURA")
|
|
spellFrame:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
|
end
|
|
end
|
|
|
|
-- Run set event function when option is clicked and on startup
|
|
LeaPlusCB["NoTransforms"]:HookScript("OnClick", SetTransformFunc)
|
|
if LeaPlusLC["NoTransforms"] == "On" then SetTransformFunc() end
|
|
|
|
-- Set click width for checkboxes and run update when checkboxes are clicked
|
|
for k, v in pairs(transTable) do
|
|
--[[LeaPlusCB[k].f:SetWidth(80)
|
|
if LeaPlusCB[k].f:GetStringWidth() > 80 then
|
|
LeaPlusCB[k]:SetHitRectInsets(0, -70, 0, 0)
|
|
else
|
|
LeaPlusCB[k]:SetHitRectInsets(0, -LeaPlusCB[k].f:GetStringWidth() + 4, 0, 0)
|
|
end]]
|
|
LeaPlusCB[k]:HookScript("OnClick", function()
|
|
UpdateList()
|
|
eventFunc()
|
|
end)
|
|
end
|
|
|
|
-- Help button hidden
|
|
transPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
transPanel.b:SetScript("OnClick", function()
|
|
transPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page7"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
transPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
for k, v in pairs(transTable) do
|
|
LeaPlusLC[k] = "Off"
|
|
end
|
|
UpdateList()
|
|
eventFunc()
|
|
|
|
-- Refresh panel
|
|
transPanel:Hide(); transPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["NoTransformsBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
for k, v in pairs(transTable) do
|
|
LeaPlusLC[k] = "On"
|
|
end
|
|
UpdateList()
|
|
eventFunc()
|
|
else
|
|
transPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show train all button
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowTrainAllButton"] == "On" then
|
|
|
|
-- Function to create train all button
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_TrainerUI",function()
|
|
|
|
----------------------------------------------------------------------
|
|
-- Train All button
|
|
----------------------------------------------------------------------
|
|
|
|
-- Create train all button
|
|
LeaPlusLC:CreateButton("TrainAllButton", ClassTrainerFrame, "Train All", "BOTTOMLEFT", 344, 54, 0, 22, false, "")
|
|
LeaPlusCB["TrainAllButton"]:ClearAllPoints()
|
|
LeaPlusCB["TrainAllButton"]:SetPoint("RIGHT", ClassTrainerTrainButton, "LEFT", -1, 0)
|
|
|
|
local gap = ClassTrainerFrame:GetWidth() - ClassTrainerFrameMoneyBg:GetWidth() - ClassTrainerTrainButton:GetWidth() - 13
|
|
if LeaPlusCB["TrainAllButton"]:GetWidth() > gap then
|
|
LeaPlusCB["TrainAllButton"]:GetFontString():SetWordWrap(false)
|
|
LeaPlusCB["TrainAllButton"]:SetWidth(gap)
|
|
LeaPlusCB["TrainAllButton"]:GetFontString():SetWidth(gap - 8)
|
|
end
|
|
|
|
-- Give button global scope (useful for compatibility with other addons and essential for ElvUI)
|
|
_G.LeaPlusGlobalTrainAllButton = LeaPlusCB["TrainAllButton"]
|
|
|
|
-- Button tooltip
|
|
LeaPlusCB["TrainAllButton"]:SetScript("OnEnter", function(self)
|
|
-- Get number of available skills and total cost
|
|
local count, cost = 0, 0
|
|
for i = 1, GetNumTrainerServices() do
|
|
local void, isAvail = GetTrainerServiceInfo(i)
|
|
if isAvail and isAvail == "available" then
|
|
count = count + 1
|
|
cost = cost + GetTrainerServiceCost(i)
|
|
end
|
|
end
|
|
-- Show tooltip
|
|
if count > 0 then
|
|
GameTooltip:SetOwner(self, "ANCHOR_TOP", 0, 4)
|
|
GameTooltip:ClearLines()
|
|
if count > 1 then
|
|
GameTooltip:AddLine(L["Train"] .. " " .. count .. " " .. L["skills for"] .. " " .. C_CurrencyInfo.GetCoinTextureString(cost))
|
|
else
|
|
GameTooltip:AddLine(L["Train"] .. " " .. count .. " " .. L["skill for"] .. " " .. C_CurrencyInfo.GetCoinTextureString(cost))
|
|
end
|
|
GameTooltip:Show()
|
|
end
|
|
end)
|
|
|
|
-- Button click handler
|
|
LeaPlusCB["TrainAllButton"]:SetScript("OnClick",function(self)
|
|
for i = 1, GetNumTrainerServices() do
|
|
local void, isAvail = GetTrainerServiceInfo(i)
|
|
if isAvail and isAvail == "available" then
|
|
BuyTrainerService(i)
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Enable button only when skills are available
|
|
local skillsAvailable
|
|
hooksecurefunc("ClassTrainerFrame_Update", function()
|
|
skillsAvailable = false
|
|
for i = 1, GetNumTrainerServices() do
|
|
local void, isAvail = GetTrainerServiceInfo(i)
|
|
if isAvail and isAvail == "available" then
|
|
skillsAvailable = true
|
|
end
|
|
end
|
|
LeaPlusCB["TrainAllButton"]:SetEnabled(skillsAvailable)
|
|
-- Refresh tooltip
|
|
if LeaPlusCB["TrainAllButton"]:IsMouseOver() and skillsAvailable then
|
|
LeaPlusCB["TrainAllButton"]:GetScript("OnEnter")(LeaPlusCB["TrainAllButton"])
|
|
end
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- ElvUI fixes
|
|
----------------------------------------------------------------------
|
|
|
|
-- ElvUI fixes
|
|
if LeaPlusLC.ElvUI then
|
|
local E = LeaPlusLC.ElvUI
|
|
if E.private.skins.blizzard.enable and E.private.skins.blizzard.trainer then
|
|
LeaPlusCB["TrainAllButton"]:ClearAllPoints()
|
|
LeaPlusCB["TrainAllButton"]:SetPoint("RIGHT", ClassTrainerTrainButton, "LEFT", -6, 0)
|
|
E:GetModule("Skins"):HandleButton(_G.LeaPlusGlobalTrainAllButton)
|
|
if LeaPlusCB["TrainAllButton"]:GetWidth() > gap then
|
|
LeaPlusCB["TrainAllButton"]:GetFontString():SetWordWrap(false)
|
|
LeaPlusCB["TrainAllButton"]:SetWidth(gap - 5)
|
|
LeaPlusCB["TrainAllButton"]:GetFontString():SetWidth(gap - 8)
|
|
end
|
|
end
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Filter chat messages
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["FilterChatMessages"] == "On" then
|
|
|
|
-- Load LibChatAnims
|
|
Leatrix_Plus:LeaPlusLCA()
|
|
|
|
-- Create configuration panel
|
|
local ChatFilterPanel = LeaPlusLC:CreatePanel("Filter chat messages", "ChatFilterPanel")
|
|
|
|
LeaPlusLC:MakeTx(ChatFilterPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(ChatFilterPanel, "BlockSpellLinks", "Block spell links during combat", 16, -92, false, "If checked, messages containing spell links will be blocked while you are in combat.|n|nThis is useful for blocking spell interrupt spam.|n|nThis applies to the say, party, raid, instance, emote and yell channels.")
|
|
LeaPlusLC:MakeCB(ChatFilterPanel, "BlockDrunkenSpam", "Block drunken spam", 16, -112, false, "If checked, drunken messages will be blocked unless they apply to your character.|n|nThis applies to the system channel.")
|
|
LeaPlusLC:MakeCB(ChatFilterPanel, "BlockDuelSpam", "Block duel spam", 16, -132, false, "If checked, duel victory and retreat messages will be blocked unless your character took part in the duel.|n|nThis applies to the system channel.")
|
|
LeaPlusLC:MakeCB(ChatFilterPanel, "BlockAngelisSinny", "Block Angelis and Sinny spam", 16, -152, false, "If checked, messages from Angelis and Sinny (part of Bondable Val'kyr Diadem and Bondable Sinstone toys) will be blocked.|n|nThis applies to the monster whisper channel.")
|
|
|
|
-- Lock block drunken spam option for zhTW
|
|
if GameLocale == "zhTW" then
|
|
LeaPlusLC:LockItem(LeaPlusCB["BlockDrunkenSpam"], true)
|
|
LeaPlusLC["BlockDrunkenSpam"] = "Off"
|
|
LeaPlusDB["BlockDrunkenSpam"] = "Off"
|
|
LeaPlusCB["BlockDrunkenSpam"].tiptext = LeaPlusCB["BlockDrunkenSpam"].tiptext .. "|n|n|cff00AAFF" .. L["Cannot use this with your locale."]
|
|
end
|
|
|
|
-- Help button hidden
|
|
ChatFilterPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
ChatFilterPanel.b:SetScript("OnClick", function()
|
|
ChatFilterPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page3"]:Show()
|
|
return
|
|
end)
|
|
|
|
local charName = GetUnitName("player")
|
|
local charRealm = GetNormalizedRealmName()
|
|
local nameRealm = charName .. "%%-" .. charRealm
|
|
|
|
-- Localise Angelis and Sinny spam
|
|
if GameLocale == "frFR" then L["Sinny"] = "Stèlon" ; L["Angelis"] = "Angélis"
|
|
elseif GameLocale == "ptBR" then L["Sinny"] = "Pecadito" ; L["Angelis"] = "Ângelis"
|
|
elseif GameLocale == "ruRU" then L["Sinny"] = "Грешок" ; L["Angelis"] = "Ангелис"
|
|
elseif GameLocale == "koKR" then L["Sinny"] = "죄악이" ; L["Angelis"] = "안젤리스"
|
|
elseif GameLocale == "zhTW" then L["Sinny"] = "罪罪" ; L["Angelis"] = "安吉莉丝"
|
|
elseif GameLocale == "zhCN" then L["Sinny"] = "罪罪" ; L["Angelis"] = "安吉莉丝"
|
|
elseif GameLocale == "deDE" then L["Sinny"] = "Sündi"
|
|
elseif GameLocale == "esES" then L["Sinny"] = "Pecadín"
|
|
elseif GameLocale == "esMX" then L["Sinny"] = "Pecadín"
|
|
elseif GameLocale == "itIT" then L["Sinny"] = "Peccatello"
|
|
end
|
|
|
|
-- Chat filter
|
|
local function ChatFilterFunc(self, event, msg, sender)
|
|
-- Block duel spam
|
|
if LeaPlusLC["BlockDuelSpam"] == "On" then
|
|
-- Block duel messages unless you are part of the duel
|
|
if msg:match(DUEL_WINNER_KNOCKOUT:gsub("%%1$s", "%.+"):gsub("%%2$s", "%.+")) or msg:match(DUEL_WINNER_RETREAT:gsub("%%1$s", "%.+"):gsub("%%2$s", "%.+")) then
|
|
-- Player has defeated player in a duel.
|
|
if msg:match(DUEL_WINNER_KNOCKOUT:gsub("%%1$s", charName):gsub("%%2$s", "%.+")) then return false end
|
|
if msg:match(DUEL_WINNER_KNOCKOUT:gsub("%%1$s", nameRealm):gsub("%%2$s", "%.+")) then return false end
|
|
if msg:match(DUEL_WINNER_KNOCKOUT:gsub("%%1$s", "%.+"):gsub("%%2$s", charName)) then return false end
|
|
if msg:match(DUEL_WINNER_KNOCKOUT:gsub("%%1$s", "%.+"):gsub("%%2$s", nameRealm)) then return false end
|
|
-- Player has fled from player in a duel.
|
|
if msg:match(DUEL_WINNER_RETREAT:gsub("%%1$s", charName):gsub("%%2$s", "%.+")) then return false end
|
|
if msg:match(DUEL_WINNER_RETREAT:gsub("%%1$s", nameRealm):gsub("%%2$s", "%.+")) then return false end
|
|
if msg:match(DUEL_WINNER_RETREAT:gsub("%%1$s", "%.+"):gsub("%%2$s", charName)) then return false end
|
|
if msg:match(DUEL_WINNER_RETREAT:gsub("%%1$s", "%.+"):gsub("%%2$s", nameRealm)) then return false end
|
|
-- Block all duel messages not involving player
|
|
return true
|
|
end
|
|
end
|
|
-- Block spell links
|
|
if LeaPlusLC["BlockSpellLinks"] == "On" and UnitAffectingCombat("player") then
|
|
if msg:find("|Hspell") then return true end
|
|
end
|
|
-- Block drunken spam
|
|
if LeaPlusLC["BlockDrunkenSpam"] == "On" then
|
|
for i = 1, 4 do
|
|
local drunk1 = _G["DRUNK_MESSAGE_ITEM_OTHER"..i]:gsub("%%s", "%s-")
|
|
local drunk2 = _G["DRUNK_MESSAGE_OTHER"..i]:gsub("%%s", "%s-")
|
|
if msg:match(drunk1) or msg:match(drunk2) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
-- Block Angelis and Sinny spam
|
|
if LeaPlusLC["BlockAngelisSinny"] == "On" then
|
|
if sender then
|
|
if sender == L["Angelis"] or sender == L["Sinny"] then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Enable or disable chat filter settings
|
|
local function SetChatFilter()
|
|
if LeaPlusLC["BlockSpellLinks"] == "On" then
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_EMOTE", ChatFilterFunc)
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", ChatFilterFunc)
|
|
else
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SAY", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_PARTY", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_PARTY_LEADER", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_RAID", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_RAID_LEADER", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_EMOTE", ChatFilterFunc)
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_YELL", ChatFilterFunc)
|
|
end
|
|
if LeaPlusLC["BlockDrunkenSpam"] == "On" or LeaPlusLC["BlockDuelSpam"] == "On" then
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", ChatFilterFunc)
|
|
else
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", ChatFilterFunc)
|
|
end
|
|
if LeaPlusLC["BlockAngelisSinny"] == "On" then
|
|
ChatFrame_AddMessageEventFilter("CHAT_MSG_MONSTER_WHISPER", ChatFilterFunc)
|
|
else
|
|
ChatFrame_RemoveMessageEventFilter("CHAT_MSG_MONSTER_WHISPER", ChatFilterFunc)
|
|
end
|
|
end
|
|
|
|
-- Set chat filter when settings are clicked and on startup
|
|
LeaPlusCB["BlockSpellLinks"]:HookScript("OnClick", SetChatFilter)
|
|
LeaPlusCB["BlockDrunkenSpam"]:HookScript("OnClick", SetChatFilter)
|
|
LeaPlusCB["BlockDuelSpam"]:HookScript("OnClick", SetChatFilter)
|
|
LeaPlusCB["BlockAngelisSinny"]:HookScript("OnClick", SetChatFilter)
|
|
SetChatFilter()
|
|
|
|
-- Reset button handler
|
|
ChatFilterPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset controls
|
|
LeaPlusLC["BlockSpellLinks"] = "Off"
|
|
LeaPlusLC["BlockDrunkenSpam"] = "Off"
|
|
LeaPlusLC["BlockDuelSpam"] = "Off"
|
|
LeaPlusLC["BlockAngelisSinny"] = "Off"
|
|
SetChatFilter()
|
|
|
|
-- Refresh configuration panel
|
|
ChatFilterPanel:Hide(); ChatFilterPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["FilterChatMessagesBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["BlockSpellLinks"] = "On"
|
|
LeaPlusLC["BlockDrunkenSpam"] = "On"
|
|
LeaPlusLC["BlockDuelSpam"] = "On"
|
|
LeaPlusLC["BlockAngelisSinny"] = "On"
|
|
SetChatFilter()
|
|
else
|
|
ChatFilterPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Automatically accept resurrection requests (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create configuration panel
|
|
local AcceptResPanel = LeaPlusLC:CreatePanel("Accept resurrection", "AcceptResPanel")
|
|
|
|
LeaPlusLC:MakeTx(AcceptResPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(AcceptResPanel, "AutoResNoCombat", "Exclude combat resurrection", 16, -92, false, "If checked, resurrection requests will not be automatically accepted if the player resurrecting you is in combat.")
|
|
LeaPlusLC:MakeCB(AcceptResPanel, "AutoResNoAfterlife", "Exclude afterlife resurrection", 16, -112, false, "If checked, resurrection requests will not be automatically accepted if the player resurrecting you is dead and in the afterlife.")
|
|
|
|
-- Help button hidden
|
|
AcceptResPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
AcceptResPanel.b:SetScript("OnClick", function()
|
|
AcceptResPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page1"]:Show();
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
AcceptResPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
LeaPlusLC["AutoResNoCombat"] = "On"
|
|
LeaPlusLC["AutoResNoAfterlife"] = "Off"
|
|
|
|
-- Refresh panel
|
|
AcceptResPanel:Hide(); AcceptResPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["AutoAcceptResBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["AutoResNoCombat"] = "On"
|
|
LeaPlusLC["AutoResNoAfterlife"] = "Off"
|
|
else
|
|
AcceptResPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Function to set resurrect event
|
|
local function SetResEvent()
|
|
if LeaPlusLC["AutoAcceptRes"] == "On" then
|
|
AcceptResPanel:RegisterEvent("RESURRECT_REQUEST")
|
|
else
|
|
AcceptResPanel:UnregisterEvent("RESURRECT_REQUEST")
|
|
end
|
|
end
|
|
|
|
-- Run function when option is clicked and on startup if option is enabled
|
|
LeaPlusCB["AutoAcceptRes"]:HookScript("OnClick", SetResEvent)
|
|
if LeaPlusLC["AutoAcceptRes"] == "On" then SetResEvent() end
|
|
|
|
-- Handle event
|
|
AcceptResPanel:SetScript("OnEvent", function(self, event, arg1)
|
|
if event == "RESURRECT_REQUEST" then
|
|
|
|
-- Exclude afterlife resurrection (such as a holy priest with the Afterlife talent)
|
|
if LeaPlusLC["AutoResNoAfterlife"] == "On" and UnitIsDead(arg1) then return end
|
|
|
|
-- Exclude pylon and brazier requests
|
|
local pylonLoc
|
|
|
|
-- Exclude Failure Detection Pylon
|
|
pylonLoc = "Failure Detection Pylon"
|
|
if GameLocale == "zhCN" then pylonLoc = "故障检测晶塔"
|
|
elseif GameLocale == "zhTW" then pylonLoc = "滅團偵測水晶塔"
|
|
elseif GameLocale == "ruRU" then pylonLoc = "Пилон для обнаружения проблем"
|
|
elseif GameLocale == "koKR" then pylonLoc = "고장 감지 변환기"
|
|
elseif GameLocale == "esMX" then pylonLoc = "Pilón detector de errores"
|
|
elseif GameLocale == "ptBR" then pylonLoc = "Pilar Detector de Falhas"
|
|
elseif GameLocale == "deDE" then pylonLoc = "Fehlschlagdetektorpylon"
|
|
elseif GameLocale == "esES" then pylonLoc = "Pilón detector de errores"
|
|
elseif GameLocale == "frFR" then pylonLoc = "Pylône de détection des échecs"
|
|
elseif GameLocale == "itIT" then pylonLoc = "Pilone d'Individuazione Fallimenti"
|
|
end
|
|
if arg1 == pylonLoc then return end
|
|
|
|
-- Exclude Brazier of Awakening
|
|
pylonLoc = "Brazier of Awakening"
|
|
if GameLocale == "zhCN" then pylonLoc = "觉醒火盆"
|
|
elseif GameLocale == "zhTW" then pylonLoc = "覺醒火盆"
|
|
elseif GameLocale == "ruRU" then pylonLoc = "Жаровня пробуждения"
|
|
elseif GameLocale == "koKR" then pylonLoc = "각성의 화로"
|
|
elseif GameLocale == "esMX" then pylonLoc = "Blandón del Despertar"
|
|
elseif GameLocale == "ptBR" then pylonLoc = "Braseiro do Despertar"
|
|
elseif GameLocale == "deDE" then pylonLoc = "Kohlenbecken des Erwachens"
|
|
elseif GameLocale == "esES" then pylonLoc = "Blandón de Despertar"
|
|
elseif GameLocale == "frFR" then pylonLoc = "Brasero de l'Éveil"
|
|
elseif GameLocale == "itIT" then pylonLoc = "Braciere del Risveglio"
|
|
end
|
|
if arg1 == pylonLoc then return end
|
|
|
|
-- Manage other resurrection requests
|
|
if not UnitAffectingCombat(arg1) or LeaPlusLC["AutoResNoCombat"] == "Off" then
|
|
AcceptResurrect()
|
|
StaticPopup_Hide("RESURRECT_NO_TIMER")
|
|
end
|
|
return
|
|
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide keybind text
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideKeybindText"] == "On" and not LeaLockList["HideKeybindText"] then
|
|
|
|
-- Hide bind text
|
|
for i = 1, 12 do
|
|
_G["ActionButton"..i.."HotKey"]:SetAlpha(0) -- Main bar
|
|
_G["MultiBarBottomRightButton"..i.."HotKey"]:SetAlpha(0) -- Bottom right bar
|
|
_G["MultiBarBottomLeftButton"..i.."HotKey"]:SetAlpha(0) -- Bottom left bar
|
|
_G["MultiBarRightButton"..i.."HotKey"]:SetAlpha(0) -- Right bar
|
|
_G["MultiBarLeftButton"..i.."HotKey"]:SetAlpha(0) -- Left bar
|
|
_G["MultiBar5Button" .. i .. "HotKey"]:SetAlpha(0) -- Dragonflight new bars
|
|
_G["MultiBar6Button" .. i .. "HotKey"]:SetAlpha(0) -- Dragonflight new bars
|
|
_G["MultiBar7Button" .. i .. "HotKey"]:SetAlpha(0) -- Dragonflight new bars
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide macro text
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["HideMacroText"] == "On" and not LeaLockList["HideMacroText"] then
|
|
|
|
-- Hide marco text
|
|
for i = 1, 12 do
|
|
_G["ActionButton"..i.."Name"]:SetAlpha(0) -- Main bar
|
|
_G["MultiBarBottomRightButton"..i.."Name"]:SetAlpha(0) -- Bottom right bar
|
|
_G["MultiBarBottomLeftButton"..i.."Name"]:SetAlpha(0) -- Bottom left bar
|
|
_G["MultiBarRightButton"..i.."Name"]:SetAlpha(0) -- Right bar
|
|
_G["MultiBarLeftButton"..i.."Name"]:SetAlpha(0) -- Left bar
|
|
_G["MultiBar5Button" .. i .. "Name"]:SetAlpha(0) -- Dragonflight new bars
|
|
_G["MultiBar6Button" .. i .. "Name"]:SetAlpha(0) -- Dragonflight new bars
|
|
_G["MultiBar7Button" .. i .. "Name"]:SetAlpha(0) -- Dragonflight new bars
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Automatically release in battlegrounds
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create configuration panel
|
|
local ReleasePanel = LeaPlusLC:CreatePanel("Release in PvP", "ReleasePanel")
|
|
|
|
LeaPlusLC:MakeTx(ReleasePanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(ReleasePanel, "AutoReleaseNoAlterac", "Exclude Alterac Valley", 16, -92, false, "If checked, you will not release automatically in Alterac Valley.")
|
|
LeaPlusLC:MakeCB(ReleasePanel, "AutoReleaseNoWintergsp", "Exclude Wintergrasp", 16, -112, false, "If checked, you will not release automatically in Wintergrasp.")
|
|
LeaPlusLC:MakeCB(ReleasePanel, "AutoReleaseNoTolBarad", "Exclude Tol Barad (PvP)", 16, -132, false, "If checked, you will not release automatically in Tol Barad (PvP).")
|
|
LeaPlusLC:MakeCB(ReleasePanel, "AutoReleaseNoAshran", "Exclude Ashran", 16, -152, false, "If checked, you will not release automatically in Ashran.")
|
|
|
|
LeaPlusLC:MakeTx(ReleasePanel, "Delay", 356, -72)
|
|
LeaPlusLC:MakeSL(ReleasePanel, "AutoReleaseDelay", "Drag to set the number of milliseconds before you are automatically released.|n|nYou can hold down shift as the timer is ending to cancel the automatic release.", 0, 3000, 100, 356, -92, "%.0f")
|
|
|
|
-- Help button hidden
|
|
ReleasePanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
ReleasePanel.b:SetScript("OnClick", function()
|
|
ReleasePanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page1"]:Show();
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
ReleasePanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
LeaPlusLC["AutoReleaseNoAlterac"] = "Off"
|
|
LeaPlusLC["AutoReleaseNoWintergsp"] = "Off"
|
|
LeaPlusLC["AutoReleaseNoTolBarad"] = "Off"
|
|
LeaPlusLC["AutoReleaseNoAshran"] = "Off"
|
|
LeaPlusLC["AutoReleaseDelay"] = 0
|
|
|
|
-- Refresh panel
|
|
ReleasePanel:Hide(); ReleasePanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["AutoReleasePvPBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["AutoReleaseNoAlterac"] = "Off"
|
|
LeaPlusLC["AutoReleaseNoWintergsp"] = "Off"
|
|
LeaPlusLC["AutoReleaseNoTolBarad"] = "Off"
|
|
LeaPlusLC["AutoReleaseNoAshran"] = "Off"
|
|
LeaPlusLC["AutoReleaseDelay"] = 0
|
|
else
|
|
ReleasePanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Create event frame
|
|
local ReleaseEvent = CreateFrame("FRAME")
|
|
|
|
-- Function to set event
|
|
local function SetReleasePvP()
|
|
if LeaPlusLC["AutoReleasePvP"] == "On" then
|
|
ReleaseEvent:RegisterEvent("PLAYER_DEAD")
|
|
else
|
|
ReleaseEvent:UnregisterEvent("PLAYER_DEAD")
|
|
end
|
|
end
|
|
|
|
-- Set release event on startup and when option is clicked
|
|
LeaPlusCB["AutoReleasePvP"]:HookScript("OnClick", SetReleasePvP)
|
|
if LeaPlusLC["AutoReleasePvP"] == "On" then SetReleasePvP() end
|
|
|
|
-- Click the release button during OnUpdate when required
|
|
local ReleaseButtonReady = 0
|
|
hooksecurefunc(StaticPopupDialogs["DEATH"], "OnUpdate", function(self)
|
|
if ReleaseButtonReady == 1 and self.button1:IsEnabled() then
|
|
ReleaseButtonReady = 0
|
|
self.button1:Click()
|
|
end
|
|
end)
|
|
|
|
-- Release in PvP
|
|
ReleaseEvent:SetScript("OnEvent", function()
|
|
|
|
-- If player has ability to self-resurrect (soulstone, reincarnation, etc), do nothing and quit
|
|
if C_DeathInfo.GetSelfResurrectOptions() and #C_DeathInfo.GetSelfResurrectOptions() > 0 then return end
|
|
|
|
-- Resurrect if player is in a battleground
|
|
local InstStat, InstType = IsInInstance()
|
|
if InstStat and InstType == "pvp" then
|
|
-- Exclude specific instanced maps
|
|
local mapID = C_Map.GetBestMapForUnit("player") or nil
|
|
if mapID then
|
|
if mapID == 91 and LeaPlusLC["AutoReleaseNoAlterac"] == "On" then return end -- Alterac Valley
|
|
if mapID == 1537 and LeaPlusLC["AutoReleaseNoAlterac"] == "On" then return end -- Alterac Valley
|
|
if mapID == 1334 and LeaPlusLC["AutoReleaseNoWintergsp"] == "On" then return end -- Wintergrasp (instanced)
|
|
if mapID == 1478 and LeaPlusLC["AutoReleaseNoAshran"] == "On" then return end -- Ashran (instanced)
|
|
end
|
|
-- Release automatically
|
|
local delay = LeaPlusLC["AutoReleaseDelay"] / 1000
|
|
C_Timer.After(delay, function()
|
|
if IsShiftKeyDown() then
|
|
LeaPlusLC:DisplayMessage(L["Automatic Release Cancelled"], true)
|
|
else
|
|
ReleaseButtonReady = 1
|
|
end
|
|
return
|
|
end)
|
|
end
|
|
|
|
-- Resurrect if playuer is in a PvP location
|
|
local areaID = C_Map.GetBestMapForUnit("player") or 0
|
|
if areaID == 123 and LeaPlusLC["AutoReleaseNoWintergsp"] == "Off" -- Wintergrasp
|
|
or areaID == 244 and LeaPlusLC["AutoReleaseNoTolBarad"] == "Off" -- Tol Barad (PvP)
|
|
or areaID == 588 and LeaPlusLC["AutoReleaseNoAshran"] == "Off" -- Ashran
|
|
or areaID == 622 and LeaPlusLC["AutoReleaseNoAshran"] == "Off" -- Stormshield
|
|
or areaID == 624 and LeaPlusLC["AutoReleaseNoAshran"] == "Off" -- Warspear
|
|
then
|
|
local delay = LeaPlusLC["AutoReleaseDelay"] / 1000
|
|
C_Timer.After(delay, function()
|
|
if IsShiftKeyDown() then
|
|
LeaPlusLC:DisplayMessage(L["Automatic Release Cancelled"], true)
|
|
else
|
|
ReleaseButtonReady = 1
|
|
end
|
|
return
|
|
end)
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Sync from friends (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
hooksecurefunc(QuestSessionManager.StartDialog, "Show", function(self)
|
|
if LeaPlusLC["SyncFromFriends"] == "On" then
|
|
local details = C_QuestSession.GetSessionBeginDetails()
|
|
if details then
|
|
for index, unit in ipairs({"player", "party1", "party2", "party3", "party4",}) do
|
|
local guid = UnitGUID(unit)
|
|
if guid == details.guid then
|
|
local requesterName = UnitName(unit)
|
|
if requesterName and LeaPlusLC:FriendCheck(requesterName, guid) then
|
|
self.ButtonContainer.Confirm:Click()
|
|
end
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Set weather density (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create configuration panel
|
|
local weatherPanel = LeaPlusLC:CreatePanel("Set weather density", "weatherPanel")
|
|
LeaPlusLC:MakeTx(weatherPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeSL(weatherPanel, "WeatherLevel", "Drag to set the density of weather effects.", 0, 3, 1, 16, -92, "%.0f")
|
|
|
|
local weatherSliderTable = {L["Off"], L["Low"], L["Medium"], L["High"]}
|
|
|
|
-- Function to set the weather density
|
|
local function SetWeatherFunc()
|
|
LeaPlusCB["WeatherLevel"].f:SetText(LeaPlusLC["WeatherLevel"] .. " (" .. weatherSliderTable[LeaPlusLC["WeatherLevel"] + 1] .. ")")
|
|
if LeaPlusLC["SetWeatherDensity"] == "On" then
|
|
SetCVar("WeatherDensity", LeaPlusLC["WeatherLevel"])
|
|
SetCVar("RAIDweatherDensity", LeaPlusLC["WeatherLevel"])
|
|
else
|
|
SetCVar("WeatherDensity", "3")
|
|
SetCVar("RAIDweatherDensity", "3")
|
|
end
|
|
end
|
|
|
|
-- Set weather density when options are clicked and on startup if option is enabled
|
|
LeaPlusCB["SetWeatherDensity"]:HookScript("OnClick", SetWeatherFunc)
|
|
LeaPlusCB["WeatherLevel"]:HookScript("OnValueChanged", SetWeatherFunc)
|
|
if LeaPlusLC["SetWeatherDensity"] == "On" then SetWeatherFunc() end
|
|
|
|
-- Prevent weather density from being changed when particle density is changed
|
|
hooksecurefunc("SetCVar", function(setting, value)
|
|
if setting and LeaPlusLC["SetWeatherDensity"] == "On" then
|
|
if setting == "graphicsParticleDensity" then
|
|
if GetCVar("WeatherDensity") ~= LeaPlusLC["WeatherLevel"] then
|
|
C_Timer.After(0.1, function()
|
|
SetCVar("WeatherDensity", LeaPlusLC["WeatherLevel"])
|
|
end)
|
|
end
|
|
elseif setting == "raidGraphicsParticleDensity" then
|
|
if GetCVar("RAIDweatherDensity") ~= LeaPlusLC["WeatherLevel"] then
|
|
C_Timer.After(0.1, function()
|
|
SetCVar("RAIDweatherDensity", LeaPlusLC["WeatherLevel"])
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Help button hidden
|
|
weatherPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
weatherPanel.b:SetScript("OnClick", function()
|
|
weatherPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page7"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
weatherPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset slider
|
|
LeaPlusLC["WeatherLevel"] = 3
|
|
|
|
-- Refresh side panel
|
|
weatherPanel:Hide(); weatherPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panal when options panel button is clicked
|
|
LeaPlusCB["SetWeatherDensityBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["WeatherLevel"] = 0
|
|
SetWeatherFunc()
|
|
else
|
|
weatherPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Remove raid restrictions (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set raid restrictions
|
|
local function SetRaidFunc()
|
|
if LeaPlusLC["NoRaidRestrictions"] == "On" then
|
|
SetAllowLowLevelRaid(true)
|
|
else
|
|
SetAllowLowLevelRaid(false)
|
|
end
|
|
end
|
|
|
|
-- Run function when option is clicked and on startup (if enabled)
|
|
LeaPlusCB["NoRaidRestrictions"]:HookScript("OnClick", SetRaidFunc)
|
|
if LeaPlusLC["NoRaidRestrictions"] == "On" then SetRaidFunc() end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Disable screen glow (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set screen glow
|
|
local function SetGlow()
|
|
if LeaPlusLC["NoScreenGlow"] == "On" then
|
|
SetCVar("ffxGlow", "0")
|
|
else
|
|
SetCVar("ffxGlow", "1")
|
|
end
|
|
end
|
|
|
|
-- Set screen glow on startup and when option is clicked (if enabled)
|
|
LeaPlusCB["NoScreenGlow"]:HookScript("OnClick", SetGlow)
|
|
if LeaPlusLC["NoScreenGlow"] == "On" then SetGlow() end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Disable screen effects (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set screen effects
|
|
local function SetEffects()
|
|
if LeaPlusLC["NoScreenEffects"] == "On" then
|
|
SetCVar("ffxDeath", "0")
|
|
SetCVar("ffxNether", "0")
|
|
SetCVar("ffxVenari", "0")
|
|
SetCVar("ffxLingeringVenari", "0")
|
|
else
|
|
SetCVar("ffxDeath", "1")
|
|
SetCVar("ffxNether", "1")
|
|
SetCVar("ffxVenari", "1")
|
|
SetCVar("ffxLingeringVenari", "1")
|
|
end
|
|
end
|
|
|
|
-- Set screen effects when option is clicked and on startup (if enabled)
|
|
LeaPlusCB["NoScreenEffects"]:HookScript("OnClick", SetEffects)
|
|
if LeaPlusLC["NoScreenEffects"] == "On" then SetEffects() end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Max camera zoom (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set camera zoom
|
|
local function SetZoom()
|
|
if LeaPlusLC["MaxCameraZoom"] == "On" then
|
|
SetCVar("cameraDistanceMaxZoomFactor", 2.6)
|
|
else
|
|
SetCVar("cameraDistanceMaxZoomFactor", 1.9)
|
|
end
|
|
end
|
|
|
|
-- Set camera zoom when option is clicked and on startup (if enabled)
|
|
LeaPlusCB["MaxCameraZoom"]:HookScript("OnClick", SetZoom)
|
|
if LeaPlusLC["MaxCameraZoom"] == "On" then SetZoom() end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Universal group chat color (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set chat colors
|
|
local function SetCol()
|
|
if LeaPlusLC["UnivGroupColor"] == "On" then
|
|
ChangeChatColor("RAID", 0.67, 0.67, 1)
|
|
ChangeChatColor("RAID_LEADER", 0.46, 0.78, 1)
|
|
ChangeChatColor("INSTANCE_CHAT", 0.67, 0.67, 1)
|
|
ChangeChatColor("INSTANCE_CHAT_LEADER", 0.46, 0.78, 1)
|
|
else
|
|
ChangeChatColor("RAID", 1, 0.50, 0)
|
|
ChangeChatColor("RAID_LEADER", 1, 0.28, 0.04)
|
|
ChangeChatColor("INSTANCE_CHAT", 1, 0.50, 0)
|
|
ChangeChatColor("INSTANCE_CHAT_LEADER", 1, 0.28, 0.04)
|
|
end
|
|
end
|
|
|
|
-- Set chat colors when option is clicked and on startup (if enabled)
|
|
LeaPlusCB["UnivGroupColor"]:HookScript("OnClick", SetCol)
|
|
if LeaPlusLC["UnivGroupColor"] == "On" then SetCol() end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Minimap button (no reload required)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Minimap button click function
|
|
local function MiniBtnClickFunc(arg1, arg2)
|
|
|
|
if arg1 == "Leatrix_Plus" then arg1 = "LeftButton" end -- Needed for compartment menu clicks
|
|
|
|
-- Prevent options panel from showing if Blizzard Store is showing
|
|
if StoreFrame and StoreFrame:GetAttribute("isshown") then return end
|
|
-- Left button down
|
|
if arg1 == "LeftButton" or arg2 and arg2 == "LeftButton" then
|
|
|
|
-- Control key toggles target tracking
|
|
if IsControlKeyDown() and not IsShiftKeyDown() and not IsAltKeyDown() then
|
|
for i = 1, C_Minimap.GetNumTrackingTypes() do
|
|
local trackingInfo = C_Minimap.GetTrackingInfo(i)
|
|
if trackingInfo.name and trackingInfo.name == MINIMAP_TRACKING_TARGET then
|
|
if trackingInfo.active then
|
|
C_Minimap.SetTracking(i, false)
|
|
LeaPlusLC:DisplayMessage(L["Target Tracking Disabled"], true)
|
|
else
|
|
C_Minimap.SetTracking(i, true)
|
|
LeaPlusLC:DisplayMessage(L["Target Tracking Enabled"], true)
|
|
end
|
|
end
|
|
end
|
|
return
|
|
end
|
|
|
|
-- Shift key toggles music
|
|
if IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then
|
|
Sound_ToggleMusic()
|
|
return
|
|
end
|
|
|
|
-- Control key and alt key toggles Zygor addon
|
|
if IsControlKeyDown() and IsAltKeyDown() and not IsShiftKeyDown() then
|
|
LeaPlusLC:ZygorToggle()
|
|
return
|
|
end
|
|
|
|
-- Alt key toggles error messages
|
|
if IsAltKeyDown() and not IsControlKeyDown() and not IsShiftKeyDown() then
|
|
if LeaPlusDB["HideErrorMessages"] == "On" then -- Checks global
|
|
if LeaPlusLC["ShowErrorsFlag"] == 1 then
|
|
LeaPlusLC["ShowErrorsFlag"] = 0
|
|
LeaPlusLC:DisplayMessage(L["Error messages will be shown"], true)
|
|
else
|
|
LeaPlusLC["ShowErrorsFlag"] = 1
|
|
LeaPlusLC:DisplayMessage(L["Error messages will be hidden"], true)
|
|
end
|
|
return
|
|
end
|
|
return
|
|
end
|
|
|
|
-- Control key and shift key toggles maximised window mode
|
|
if IsControlKeyDown() and IsShiftKeyDown() and not IsAltKeyDown() then
|
|
if LeaPlusLC:PlayerInCombat() then
|
|
return
|
|
else
|
|
SetCVar("gxMaximize", tostring(1 - GetCVar("gxMaximize")))
|
|
UpdateWindow()
|
|
end
|
|
return
|
|
end
|
|
|
|
-- No modifier key toggles the options panel
|
|
if LeaPlusLC:IsPlusShowing() then
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC:HideConfigPanels()
|
|
else
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC["PageF"]:Show()
|
|
end
|
|
LeaPlusLC["Page"..LeaPlusLC["LeaStartPage"]]:Show()
|
|
end
|
|
|
|
-- Right button down
|
|
if arg1 == "RightButton" or arg2 and arg2 == "RightButton" then
|
|
|
|
-- No modifier key toggles the options panel
|
|
if LeaPlusLC:IsPlusShowing() then
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC:HideConfigPanels()
|
|
else
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC["PageF"]:Show()
|
|
end
|
|
LeaPlusLC["Page" .. LeaPlusLC["LeaStartPage"]]:Show()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- Assign global scope for function (it's used in TOC)
|
|
_G.LeaPlusGlobalMiniBtnClickFunc = MiniBtnClickFunc
|
|
|
|
-- Create minimap button using LibDBIcon
|
|
local miniButton = LibStub("LibDataBroker-1.1"):NewDataObject("Leatrix_Plus", {
|
|
type = "data source",
|
|
text = "Leatrix Plus",
|
|
icon = "Interface\\HELPFRAME\\ReportLagIcon-Movement",
|
|
OnClick = function(self, btn)
|
|
MiniBtnClickFunc(btn)
|
|
end,
|
|
OnTooltipShow = function(tooltip)
|
|
if not tooltip or not tooltip.AddLine then return end
|
|
tooltip:AddLine("Leatrix Plus")
|
|
end,
|
|
})
|
|
|
|
local icon = LibStub("LibDBIcon-1.0", true)
|
|
icon:Register("Leatrix_Plus", miniButton, LeaPlusDB)
|
|
|
|
-- Function to toggle LibDBIcon
|
|
local function SetLibDBIconFunc()
|
|
if LeaPlusLC["ShowMinimapIcon"] == "On" then
|
|
LeaPlusDB["hide"] = false
|
|
icon:Show("Leatrix_Plus")
|
|
else
|
|
LeaPlusDB["hide"] = true
|
|
icon:Hide("Leatrix_Plus")
|
|
end
|
|
end
|
|
|
|
-- Set LibDBIcon when option is clicked and on startup
|
|
LeaPlusCB["ShowMinimapIcon"]:HookScript("OnClick", SetLibDBIconFunc)
|
|
SetLibDBIconFunc()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show volume control on character frame
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowVolume"] == "On" then
|
|
|
|
-- Function to update master volume
|
|
local function MasterVolUpdate()
|
|
if LeaPlusLC["ShowVolume"] == "On" then
|
|
-- Set the volume
|
|
SetCVar("Sound_MasterVolume", LeaPlusLC["LeaPlusMaxVol"]);
|
|
-- Format the slider text
|
|
LeaPlusCB["LeaPlusMaxVol"].f:SetFormattedText("%.0f", LeaPlusLC["LeaPlusMaxVol"] * 20)
|
|
end
|
|
end
|
|
|
|
-- Create slider control
|
|
LeaPlusLC["LeaPlusMaxVol"] = tonumber(GetCVar("Sound_MasterVolume"))
|
|
LeaPlusLC:MakeSL(CharacterModelScene, "LeaPlusMaxVol", "", 0, 1, 0.05, -34, -328, "%.2f")
|
|
LeaPlusCB["LeaPlusMaxVol"]:SetWidth(64)
|
|
|
|
-- Set slider control value when shown
|
|
LeaPlusCB["LeaPlusMaxVol"]:SetScript("OnShow", function()
|
|
LeaPlusCB["LeaPlusMaxVol"]:SetValue(GetCVar("Sound_MasterVolume"))
|
|
end)
|
|
|
|
-- Update volume when slider control is changed
|
|
LeaPlusCB["LeaPlusMaxVol"]:HookScript("OnValueChanged", function()
|
|
if IsMouseButtonDown("RightButton") and IsShiftKeyDown() then
|
|
-- Dual layout is active so don't adjust slider
|
|
LeaPlusCB["LeaPlusMaxVol"].f:SetFormattedText("%.0f", LeaPlusLC["LeaPlusMaxVol"] * 20)
|
|
LeaPlusCB["LeaPlusMaxVol"]:Hide()
|
|
LeaPlusCB["LeaPlusMaxVol"]:Show()
|
|
return
|
|
else
|
|
-- Set sound level and refresh slider
|
|
MasterVolUpdate()
|
|
end
|
|
end)
|
|
|
|
-- Dual layout
|
|
local function SetVolumePlacement()
|
|
if LeaPlusLC["ShowVolumeInFrame"] == "On" then
|
|
LeaPlusCB["LeaPlusMaxVol"]:ClearAllPoints();
|
|
LeaPlusCB["LeaPlusMaxVol"]:SetPoint("TOPLEFT", 72, -276)
|
|
else
|
|
LeaPlusCB["LeaPlusMaxVol"]:ClearAllPoints();
|
|
LeaPlusCB["LeaPlusMaxVol"]:SetPoint("TOPLEFT", -34, -328)
|
|
end
|
|
end
|
|
|
|
LeaPlusCB["LeaPlusMaxVol"]:SetScript('OnMouseDown', function(self, btn)
|
|
if btn == "RightButton" and IsShiftKeyDown() then
|
|
if LeaPlusLC["ShowVolumeInFrame"] == "On" then LeaPlusLC["ShowVolumeInFrame"] = "Off" else LeaPlusLC["ShowVolumeInFrame"] = "On" end
|
|
SetVolumePlacement();
|
|
end
|
|
end)
|
|
|
|
CharacterModelScene:HookScript("OnShow",function()
|
|
SetVolumePlacement()
|
|
end)
|
|
|
|
-- ElvUI skin for slider control
|
|
if LeaPlusLC.ElvUI then
|
|
_G.LeaPlusGlobalVolumeButton = LeaPlusCB["LeaPlusMaxVol"]
|
|
LeaPlusLC.ElvUI:GetModule("Skins"):HandleSliderFrame(_G.LeaPlusGlobalVolumeButton, false)
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Use arrow keys in chat
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["UseArrowKeysInChat"] == "On" and not LeaLockList["UseArrowKeysInChat"] then
|
|
-- Enable arrow keys for normal and existing chat frames
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
_G["ChatFrame" .. i .. "EditBox"]:SetAltArrowKeyMode(false)
|
|
end
|
|
end
|
|
-- Enable arrow keys for temporary chat frames
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function()
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
_G[cf .. "EditBox"]:SetAltArrowKeyMode(false)
|
|
end
|
|
end)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide social button
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoSocialButton"] == "On" and not LeaLockList["NoSocialButton"] then
|
|
-- Create hidden frame to store social button
|
|
local tframe = CreateFrame("FRAME")
|
|
tframe:Hide()
|
|
QuickJoinToastButton:SetParent(tframe)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L43: Manage widget top
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ManageWidgetTop"] == "On" and not LeaLockList["ManageWidgetTop"] then
|
|
|
|
-- Create and manage container for UIWidgetTopCenterContainerFrame
|
|
local topCenterHolder = CreateFrame("Frame", nil, UIParent)
|
|
topCenterHolder:SetPoint("TOP", UIParent, "TOP", 0, -15)
|
|
topCenterHolder:SetSize(10, 58)
|
|
|
|
local topCenterContainer = _G.UIWidgetTopCenterContainerFrame
|
|
topCenterContainer:ClearAllPoints()
|
|
topCenterContainer:SetPoint('CENTER', topCenterHolder)
|
|
|
|
hooksecurefunc(topCenterContainer, 'SetPoint', function(self, void, b)
|
|
if b and (b ~= topCenterHolder) then
|
|
-- Reset parent if it changes from topCenterHolder
|
|
self:ClearAllPoints()
|
|
self:SetPoint('CENTER', topCenterHolder)
|
|
self:SetParent(topCenterHolder)
|
|
end
|
|
end)
|
|
|
|
-- Allow widget frame to be moved
|
|
topCenterHolder:SetMovable(true)
|
|
topCenterHolder:SetUserPlaced(true)
|
|
topCenterHolder:SetDontSavePosition(true)
|
|
topCenterHolder:SetClampedToScreen(false)
|
|
|
|
-- Set widget frame position at startup
|
|
topCenterHolder:ClearAllPoints()
|
|
topCenterHolder:SetPoint(LeaPlusLC["WidgetTopA"], UIParent, LeaPlusLC["WidgetTopR"], LeaPlusLC["WidgetTopX"], LeaPlusLC["WidgetTopY"])
|
|
topCenterHolder:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
UIWidgetTopCenterContainerFrame:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
|
|
-- Create drag frame
|
|
local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate")
|
|
dragframe:SetPoint("CENTER", topCenterHolder, "CENTER", 0, 1)
|
|
dragframe:SetBackdropColor(0.0, 0.5, 1.0)
|
|
dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0}})
|
|
dragframe:SetToplevel(true)
|
|
dragframe:Hide()
|
|
dragframe:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
|
|
dragframe.t = dragframe:CreateTexture()
|
|
dragframe.t:SetAllPoints()
|
|
dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5)
|
|
dragframe.t:SetAlpha(0.5)
|
|
|
|
dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
dragframe.f:SetPoint('CENTER', 0, 0)
|
|
dragframe.f:SetText(L["Widget Top"])
|
|
|
|
-- Click handler
|
|
dragframe:SetScript("OnMouseDown", function(self, btn)
|
|
-- Start dragging if left clicked
|
|
if btn == "LeftButton" then
|
|
topCenterHolder:StartMoving()
|
|
end
|
|
end)
|
|
|
|
dragframe:SetScript("OnMouseUp", function()
|
|
-- Save frame position
|
|
topCenterHolder:StopMovingOrSizing()
|
|
LeaPlusLC["WidgetTopA"], void, LeaPlusLC["WidgetTopR"], LeaPlusLC["WidgetTopX"], LeaPlusLC["WidgetTopY"] = topCenterHolder:GetPoint()
|
|
topCenterHolder:SetMovable(true)
|
|
topCenterHolder:ClearAllPoints()
|
|
topCenterHolder:SetPoint(LeaPlusLC["WidgetTopA"], UIParent, LeaPlusLC["WidgetTopR"], LeaPlusLC["WidgetTopX"], LeaPlusLC["WidgetTopY"])
|
|
end)
|
|
|
|
-- Snap-to-grid
|
|
do
|
|
local frame, grid = dragframe, 10
|
|
local w, h = 0, 60
|
|
local xpos, ypos, scale, uiscale
|
|
frame:RegisterForDrag("RightButton")
|
|
frame:HookScript("OnDragStart", function()
|
|
frame:SetScript("OnUpdate", function()
|
|
scale, uiscale = frame:GetScale(), UIParent:GetScale()
|
|
xpos, ypos = GetCursorPosition()
|
|
xpos = floor((xpos / scale / uiscale) / grid) * grid - w / 2
|
|
ypos = ceil((ypos / scale / uiscale) / grid) * grid + h / 2
|
|
topCenterHolder:ClearAllPoints()
|
|
topCenterHolder:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", xpos, ypos)
|
|
end)
|
|
end)
|
|
frame:HookScript("OnDragStop", function()
|
|
frame:SetScript("OnUpdate", nil)
|
|
frame:GetScript("OnMouseUp")()
|
|
end)
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local WidgetTopPanel = LeaPlusLC:CreatePanel("Manage widget top", "WidgetTopPanel")
|
|
|
|
-- Create Titan Panel screen adjust warning
|
|
local titanFrame = CreateFrame("FRAME", nil, WidgetTopPanel)
|
|
titanFrame:SetAllPoints()
|
|
titanFrame:Hide()
|
|
LeaPlusLC:MakeTx(titanFrame, "Warning", 16, -172)
|
|
titanFrame.txt = LeaPlusLC:MakeWD(titanFrame, "Titan Panel frame adjustment needs to be disabled.", 16, -192, 500)
|
|
titanFrame.txt:SetWordWrap(false)
|
|
titanFrame.txt:SetWidth(520)
|
|
titanFrame.btn = LeaPlusLC:CreateButton("fixTitanBtn", titanFrame, "Okay, disable frame adjustment for me", "TOPLEFT", 16, -212, 0, 25, true, "Click to disable Titan Panel frame adjustment. Your UI will be reloaded.")
|
|
titanFrame.btn:SetScript("OnClick", function()
|
|
if C_AddOns.IsAddOnLoaded("Titan") and TitanPlayerSettings and TitanPlayerSettings.Adjust and TitanPlayerSettings.Adjust.UIWidgetTopCenterContainerFrame and TitanPlayerSettings.Adjust.UIWidgetTopCenterContainerFrame.adjust then
|
|
TitanPlayerSettings.Adjust.UIWidgetTopCenterContainerFrame.adjust = false
|
|
ReloadUI()
|
|
end
|
|
end)
|
|
|
|
LeaPlusLC:MakeTx(WidgetTopPanel, "Scale", 16, -72)
|
|
LeaPlusLC:MakeSL(WidgetTopPanel, "WidgetTopScale", "Drag to set the widget top scale.", 0.5, 2, 0.05, 16, -92, "%.2f")
|
|
|
|
-- Set scale when slider is changed
|
|
LeaPlusCB["WidgetTopScale"]:HookScript("OnValueChanged", function()
|
|
topCenterHolder:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
UIWidgetTopCenterContainerFrame:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
dragframe:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
-- Show formatted slider value
|
|
LeaPlusCB["WidgetTopScale"].f:SetFormattedText("%.0f%%", LeaPlusLC["WidgetTopScale"] * 100)
|
|
end)
|
|
|
|
-- Hide frame alignment grid with panel
|
|
WidgetTopPanel:HookScript("OnHide", function()
|
|
LeaPlusLC.grid:Hide()
|
|
end)
|
|
|
|
-- Toggle grid button
|
|
local WidgetTopToggleGridButton = LeaPlusLC:CreateButton("WidgetTopToggleGridButton", WidgetTopPanel, "Toggle Grid", "TOPLEFT", 16, -72, 0, 25, true, "Click to toggle the frame alignment grid.")
|
|
LeaPlusCB["WidgetTopToggleGridButton"]:ClearAllPoints()
|
|
LeaPlusCB["WidgetTopToggleGridButton"]:SetPoint("LEFT", WidgetTopPanel.h, "RIGHT", 10, 0)
|
|
LeaPlusCB["WidgetTopToggleGridButton"]:SetScript("OnClick", function()
|
|
if LeaPlusLC.grid:IsShown() then LeaPlusLC.grid:Hide() else LeaPlusLC.grid:Show() end
|
|
end)
|
|
WidgetTopPanel:HookScript("OnHide", function()
|
|
if LeaPlusLC.grid then LeaPlusLC.grid:Hide() end
|
|
end)
|
|
|
|
-- Help button tooltip
|
|
WidgetTopPanel.h.tiptext = L["Drag the frame overlay with the left button to position it freely or with the right button to position it using snap-to-grid."]
|
|
|
|
-- Back button handler
|
|
WidgetTopPanel.b:SetScript("OnClick", function()
|
|
WidgetTopPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page6"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
WidgetTopPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset position and scale
|
|
LeaPlusLC["WidgetTopA"] = "TOP"
|
|
LeaPlusLC["WidgetTopR"] = "TOP"
|
|
LeaPlusLC["WidgetTopX"] = 0
|
|
LeaPlusLC["WidgetTopY"] = -15
|
|
LeaPlusLC["WidgetTopScale"] = 1
|
|
topCenterHolder:ClearAllPoints()
|
|
topCenterHolder:SetPoint(LeaPlusLC["WidgetTopA"], UIParent, LeaPlusLC["WidgetTopR"], LeaPlusLC["WidgetTopX"], LeaPlusLC["WidgetTopY"])
|
|
|
|
-- Refresh configuration panel
|
|
WidgetTopPanel:Hide(); WidgetTopPanel:Show()
|
|
dragframe:Show()
|
|
|
|
-- Show frame alignment grid
|
|
LeaPlusLC.grid:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panel when options panel button is clicked
|
|
LeaPlusCB["ManageWidgetTopButton"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["WidgetTopA"] = "CENTER"
|
|
LeaPlusLC["WidgetTopR"] = "CENTER"
|
|
LeaPlusLC["WidgetTopX"] = 0
|
|
LeaPlusLC["WidgetTopY"] = -160
|
|
LeaPlusLC["WidgetTopScale"] = 1.25
|
|
topCenterHolder:ClearAllPoints()
|
|
topCenterHolder:SetPoint(LeaPlusLC["WidgetTopA"], UIParent, LeaPlusLC["WidgetTopR"], LeaPlusLC["WidgetTopX"], LeaPlusLC["WidgetTopY"])
|
|
topCenterHolder:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
UIWidgetTopCenterContainerFrame:SetScale(LeaPlusLC["WidgetTopScale"])
|
|
else
|
|
-- Show Titan Panel frame adjustment warning if Titan Panel is installed with frame adjustment widget enabled
|
|
if C_AddOns.IsAddOnLoaded("Titan") and TitanPlayerSettings and TitanPlayerSettings.Adjust and TitanPlayerSettings.Adjust.UIWidgetTopCenterContainerFrame and TitanPlayerSettings.Adjust.UIWidgetTopCenterContainerFrame.adjust then
|
|
titanFrame:Show()
|
|
end
|
|
|
|
-- Find out if the UI has a non-standard scale
|
|
if GetCVar("useuiscale") == "1" then
|
|
LeaPlusLC["gscale"] = GetCVar("uiscale")
|
|
else
|
|
LeaPlusLC["gscale"] = 1
|
|
end
|
|
|
|
-- Set drag frame size according to UI scale
|
|
dragframe:SetWidth(160 * LeaPlusLC["gscale"])
|
|
dragframe:SetHeight(79 * LeaPlusLC["gscale"])
|
|
|
|
-- Show configuration panel
|
|
WidgetTopPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
dragframe:Show()
|
|
|
|
-- Show frame alignment grid
|
|
LeaPlusLC.grid:Show()
|
|
end
|
|
end)
|
|
|
|
-- Hide drag frame when configuration panel is closed
|
|
WidgetTopPanel:HookScript("OnHide", function() dragframe:Hide() end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L45: Manage control
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ManageControl"] == "On" and not LeaLockList["ManageControl"] then
|
|
|
|
-- Allow control frame to be moved
|
|
LossOfControlFrame:SetMovable(true)
|
|
LossOfControlFrame:SetUserPlaced(true)
|
|
LossOfControlFrame:SetDontSavePosition(true)
|
|
LossOfControlFrame:SetClampedToScreen(true)
|
|
|
|
-- Set control frame position at startup
|
|
LossOfControlFrame:ClearAllPoints()
|
|
LossOfControlFrame:SetPoint(LeaPlusLC["ControlA"], UIParent, LeaPlusLC["ControlR"], LeaPlusLC["ControlX"], LeaPlusLC["ControlY"])
|
|
LossOfControlFrame:SetScale(LeaPlusLC["ControlScale"])
|
|
|
|
-- Create drag frame
|
|
local dragframe = CreateFrame("FRAME", nil, nil, "BackdropTemplate")
|
|
dragframe:SetBackdropColor(0.0, 0.5, 1.0)
|
|
dragframe:SetBackdrop({edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = false, tileSize = 0, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0}})
|
|
dragframe:SetToplevel(true)
|
|
dragframe:Hide()
|
|
dragframe:SetScale(LeaPlusLC["ControlScale"])
|
|
dragframe:SetFrameStrata("HIGH") -- Exception for LossOfControlFrame
|
|
|
|
dragframe.t = dragframe:CreateTexture()
|
|
dragframe.t:SetAllPoints()
|
|
dragframe.t:SetColorTexture(0.0, 1.0, 0.0, 0.5)
|
|
dragframe.t:SetAlpha(0.5)
|
|
|
|
dragframe.f = dragframe:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
dragframe.f:SetPoint('CENTER', 0, 0)
|
|
dragframe.f:SetText(L["Control"])
|
|
|
|
-- Click handler
|
|
dragframe:SetScript("OnMouseDown", function(self, btn)
|
|
-- Start dragging if left clicked
|
|
if btn == "LeftButton" then
|
|
LossOfControlFrame:StartMoving()
|
|
end
|
|
end)
|
|
|
|
dragframe:SetScript("OnMouseUp", function()
|
|
-- Save frame positions
|
|
LossOfControlFrame:StopMovingOrSizing()
|
|
LeaPlusLC["ControlA"], void, LeaPlusLC["ControlR"], LeaPlusLC["ControlX"], LeaPlusLC["ControlY"] = LossOfControlFrame:GetPoint()
|
|
LossOfControlFrame:SetMovable(true)
|
|
LossOfControlFrame:ClearAllPoints()
|
|
LossOfControlFrame:SetPoint(LeaPlusLC["ControlA"], UIParent, LeaPlusLC["ControlR"], LeaPlusLC["ControlX"], LeaPlusLC["ControlY"])
|
|
end)
|
|
|
|
-- Snap-to-grid
|
|
do
|
|
local frame, grid = dragframe, 10
|
|
local w, h = 230, 56
|
|
local xpos, ypos, scale, uiscale
|
|
frame:RegisterForDrag("RightButton")
|
|
frame:HookScript("OnDragStart", function()
|
|
frame:SetScript("OnUpdate", function()
|
|
scale, uiscale = frame:GetScale(), UIParent:GetScale()
|
|
xpos, ypos = GetCursorPosition()
|
|
xpos = floor((xpos / scale / uiscale) / grid) * grid - w / 2
|
|
ypos = ceil((ypos / scale / uiscale) / grid) * grid + h / 2
|
|
LossOfControlFrame:ClearAllPoints()
|
|
LossOfControlFrame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", xpos, ypos)
|
|
end)
|
|
end)
|
|
frame:HookScript("OnDragStop", function()
|
|
frame:SetScript("OnUpdate", nil)
|
|
frame:GetScript("OnMouseUp")()
|
|
end)
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local ControlPanel = LeaPlusLC:CreatePanel("Manage control", "ControlPanel")
|
|
LeaPlusLC:MakeTx(ControlPanel, "Scale", 16, -72)
|
|
LeaPlusLC:MakeSL(ControlPanel, "ControlScale", "Drag to set the control frame scale.", 0.5, 2, 0.05, 16, -92, "%.2f")
|
|
|
|
-- Set scale when slider is changed
|
|
LeaPlusCB["ControlScale"]:HookScript("OnValueChanged", function()
|
|
LossOfControlFrame:SetScale(LeaPlusLC["ControlScale"])
|
|
dragframe:SetScale(LeaPlusLC["ControlScale"])
|
|
-- Show formatted slider value
|
|
LeaPlusCB["ControlScale"].f:SetFormattedText("%.0f%%", LeaPlusLC["ControlScale"] * 100)
|
|
end)
|
|
|
|
-- Hide frame alignment grid with panel
|
|
ControlPanel:HookScript("OnHide", function()
|
|
LeaPlusLC.grid:Hide()
|
|
end)
|
|
|
|
-- Toggle grid button
|
|
local ControlToggleGridButton = LeaPlusLC:CreateButton("ControlToggleGridButton", ControlPanel, "Toggle Grid", "TOPLEFT", 16, -72, 0, 25, true, "Click to toggle the frame alignment grid.")
|
|
LeaPlusCB["ControlToggleGridButton"]:ClearAllPoints()
|
|
LeaPlusCB["ControlToggleGridButton"]:SetPoint("LEFT", ControlPanel.h, "RIGHT", 10, 0)
|
|
LeaPlusCB["ControlToggleGridButton"]:SetScript("OnClick", function()
|
|
if LeaPlusLC.grid:IsShown() then LeaPlusLC.grid:Hide() else LeaPlusLC.grid:Show() end
|
|
end)
|
|
ControlPanel:HookScript("OnHide", function()
|
|
if LeaPlusLC.grid then LeaPlusLC.grid:Hide() end
|
|
end)
|
|
|
|
-- Help button tooltip
|
|
ControlPanel.h.tiptext = L["Drag the frame overlay with the left button to position it freely or with the right button to position it using snap-to-grid."]
|
|
|
|
-- Back button handler
|
|
ControlPanel.b:SetScript("OnClick", function()
|
|
ControlPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page6"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
ControlPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset position and scale
|
|
LeaPlusLC["ControlA"] = "CENTER"
|
|
LeaPlusLC["ControlR"] = "CENTER"
|
|
LeaPlusLC["ControlX"] = 0
|
|
LeaPlusLC["ControlY"] = 0
|
|
LeaPlusLC["ControlScale"] = 1
|
|
LossOfControlFrame:ClearAllPoints()
|
|
LossOfControlFrame:SetPoint(LeaPlusLC["ControlA"], UIParent, LeaPlusLC["ControlR"], LeaPlusLC["ControlX"], LeaPlusLC["ControlY"])
|
|
|
|
-- Refresh configuration panel
|
|
ControlPanel:Hide(); ControlPanel:Show()
|
|
dragframe:Show()
|
|
|
|
-- Show frame alignment grid
|
|
LeaPlusLC.grid:Show()
|
|
|
|
end)
|
|
|
|
-- Show configuration panel when options panel button is clicked
|
|
LeaPlusCB["ManageControlButton"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["ControlA"] = "CENTER"
|
|
LeaPlusLC["ControlR"] = "CENTER"
|
|
LeaPlusLC["ControlX"] = 0
|
|
LeaPlusLC["ControlY"] = 0
|
|
LeaPlusLC["ControlScale"] = 1
|
|
LossOfControlFrame:ClearAllPoints()
|
|
LossOfControlFrame:SetPoint(LeaPlusLC["ControlA"], UIParent, LeaPlusLC["ControlR"], LeaPlusLC["ControlX"], LeaPlusLC["ControlY"])
|
|
LossOfControlFrame:SetScale(LeaPlusLC["ControlScale"])
|
|
else
|
|
-- Find out if the UI has a non-standard scale
|
|
if GetCVar("useuiscale") == "1" then
|
|
LeaPlusLC["gscale"] = GetCVar("uiscale")
|
|
else
|
|
LeaPlusLC["gscale"] = 1
|
|
end
|
|
|
|
-- Set drag frame size and position according to UI scale
|
|
dragframe:SetWidth(196 * LeaPlusLC["gscale"])
|
|
dragframe:SetHeight(76 * LeaPlusLC["gscale"])
|
|
dragframe:ClearAllPoints()
|
|
dragframe:SetPoint("CENTER", LossOfControlFrame, "CENTER", -2 * LeaPlusLC["gscale"], 0 * LeaPlusLC["gscale"])
|
|
|
|
-- Show configuration panel
|
|
ControlPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
dragframe:Show()
|
|
|
|
-- Show frame alignment grid
|
|
LeaPlusLC.grid:Show()
|
|
end
|
|
end)
|
|
|
|
-- Hide drag frame when configuration panel is closed
|
|
ControlPanel:HookScript("OnHide", function() dragframe:Hide() end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide chat buttons
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoChatButtons"] == "On" and not LeaLockList["NoChatButtons"] then
|
|
|
|
-- Create hidden frame to store unwanted frames (more efficient than creating functions)
|
|
local tframe = CreateFrame("FRAME")
|
|
tframe:Hide()
|
|
|
|
-- Function to enable mouse scrolling with CTRL and SHIFT key modifiers
|
|
local function AddMouseScroll(chtfrm)
|
|
if _G[chtfrm] then
|
|
_G[chtfrm]:SetScript("OnMouseWheel", function(self, direction)
|
|
if direction == 1 then
|
|
if IsControlKeyDown() then
|
|
self:ScrollToTop()
|
|
elseif IsShiftKeyDown() then
|
|
self:PageUp()
|
|
else
|
|
self:ScrollUp()
|
|
end
|
|
else
|
|
if IsControlKeyDown() then
|
|
self:ScrollToBottom()
|
|
elseif IsShiftKeyDown() then
|
|
self:PageDown()
|
|
else
|
|
self:ScrollDown()
|
|
end
|
|
end
|
|
end)
|
|
_G[chtfrm]:EnableMouseWheel(true)
|
|
end
|
|
end
|
|
|
|
-- Function to hide chat buttons
|
|
local function HideButtons(chtfrm)
|
|
_G[chtfrm .. "ButtonFrameMinimizeButton"]:SetParent(tframe)
|
|
_G[chtfrm .. "ButtonFrameMinimizeButton"]:Hide();
|
|
_G[chtfrm .. "ButtonFrame"]:SetSize(0.1,0.1)
|
|
_G[chtfrm].ScrollBar:SetParent(tframe)
|
|
_G[chtfrm].ScrollBar:Hide()
|
|
end
|
|
|
|
-- Function to highlight chat tabs and click to scroll to bottom
|
|
local function HighlightTabs(chtfrm)
|
|
|
|
-- Hide bottom button
|
|
_G[chtfrm].ScrollToBottomButton:SetSize(0.1, 0.1) -- Positions it away
|
|
|
|
-- Remove click from the bottom button
|
|
_G[chtfrm].ScrollToBottomButton:SetScript("OnClick", nil)
|
|
|
|
-- Remove textures
|
|
_G[chtfrm].ScrollToBottomButton:SetNormalTexture("")
|
|
_G[chtfrm].ScrollToBottomButton:SetHighlightTexture("")
|
|
_G[chtfrm].ScrollToBottomButton:SetPushedTexture("")
|
|
_G[chtfrm].ScrollToBottomButton:SetDisabledTexture("")
|
|
|
|
-- Always scroll to bottom when clicking a tab
|
|
_G[chtfrm .. "Tab"]:HookScript("OnClick", function(self,arg1)
|
|
if arg1 == "LeftButton" then
|
|
_G[chtfrm]:ScrollToBottom()
|
|
end
|
|
end)
|
|
|
|
-- Create new bottom button under tab
|
|
_G[chtfrm .. "Tab"].newglow = _G[chtfrm .. "Tab"]:CreateTexture(nil, "BACKGROUND")
|
|
_G[chtfrm .. "Tab"].newglow:ClearAllPoints()
|
|
_G[chtfrm .. "Tab"].newglow:SetPoint("BOTTOMLEFT", _G[chtfrm .. "Tab"], "BOTTOMLEFT", 0, 0)
|
|
_G[chtfrm .. "Tab"].newglow:SetTexture("Interface\\ChatFrame\\ChatFrameTab-NewMessage")
|
|
_G[chtfrm .. "Tab"].newglow:SetWidth(_G[chtfrm .. "Tab"]:GetWidth())
|
|
_G[chtfrm .. "Tab"].newglow:SetVertexColor(0.6, 0.6, 1, 0.7)
|
|
_G[chtfrm .. "Tab"].newglow:SetBlendMode("ADD")
|
|
_G[chtfrm .. "Tab"].newglow:Hide()
|
|
|
|
-- Show new bottom button when old one glows
|
|
_G[chtfrm].ScrollToBottomButton.Flash:HookScript("OnShow", function(self,arg1)
|
|
_G[chtfrm .. "Tab"].newglow:Show()
|
|
end)
|
|
|
|
_G[chtfrm].ScrollToBottomButton.Flash:HookScript("OnHide", function(self,arg1)
|
|
_G[chtfrm .. "Tab"].newglow:Hide()
|
|
end)
|
|
|
|
-- Match new bottom button size to tab
|
|
_G[chtfrm .. "Tab"]:HookScript("OnSizeChanged", function()
|
|
_G[chtfrm .. "Tab"].newglow:SetWidth(_G[chtfrm .. "Tab"]:GetWidth())
|
|
end)
|
|
|
|
end
|
|
|
|
-- Set options for normal and existing chat frames
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
AddMouseScroll("ChatFrame" .. i);
|
|
HideButtons("ChatFrame" .. i);
|
|
HighlightTabs("ChatFrame" .. i)
|
|
end
|
|
end
|
|
|
|
-- Do the functions above for temporary chat frames
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function(chatType)
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
|
|
-- Set options for temporary frame
|
|
AddMouseScroll(cf)
|
|
HideButtons(cf)
|
|
HighlightTabs(cf)
|
|
|
|
-- Create new bottom button under tab
|
|
_G[cf .. "Tab"].newglow = _G[cf .. "Tab"]:CreateTexture(nil, "BACKGROUND")
|
|
_G[cf .. "Tab"].newglow:ClearAllPoints()
|
|
_G[cf .. "Tab"].newglow:SetPoint("BOTTOMLEFT", _G[cf .. "Tab"], "BOTTOMLEFT", 0, 0)
|
|
_G[cf .. "Tab"].newglow:SetTexture("Interface\\ChatFrame\\ChatFrameTab-NewMessage")
|
|
_G[cf .. "Tab"].newglow:SetWidth(_G[cf .. "Tab"]:GetWidth())
|
|
_G[cf .. "Tab"].newglow:SetVertexColor(0.6, 0.6, 1, 1)
|
|
_G[cf .. "Tab"].newglow:Hide()
|
|
|
|
-- Show new bottom button when old one glows
|
|
_G[cf].ScrollToBottomButton.Flash:HookScript("OnShow", function(self,arg1)
|
|
_G[cf .. "Tab"].newglow:Show()
|
|
end)
|
|
|
|
_G[cf].ScrollToBottomButton.Flash:HookScript("OnHide", function(self,arg1)
|
|
_G[cf .. "Tab"].newglow:Hide()
|
|
end)
|
|
|
|
-- Match new bottom button size to tab
|
|
_G[cf .. "Tab"]:HookScript("OnSizeChanged", function()
|
|
_G[cf .. "Tab"].newglow:SetWidth(_G[cf .. "Tab"]:GetWidth())
|
|
end)
|
|
|
|
end
|
|
end)
|
|
|
|
-- Hide text to speech button
|
|
TextToSpeechButton:SetParent(tframe)
|
|
|
|
-- Move voice chat and chat menu buttons inside the chat frame
|
|
ChatFrameChannelButton:ClearAllPoints()
|
|
ChatFrameChannelButton:SetPoint("TOPRIGHT", ChatFrame1Background, "TOPRIGHT", 1, -3)
|
|
ChatFrameChannelButton:SetSize(26,25)
|
|
|
|
ChatFrameToggleVoiceDeafenButton:ClearAllPoints()
|
|
ChatFrameToggleVoiceDeafenButton:SetPoint("TOP", ChatFrameChannelButton, "BOTTOM", 0, -2)
|
|
ChatFrameToggleVoiceDeafenButton:SetSize(26,25)
|
|
|
|
ChatFrameToggleVoiceMuteButton:ClearAllPoints()
|
|
ChatFrameToggleVoiceMuteButton:SetPoint("TOP", ChatFrameToggleVoiceDeafenButton, "BOTTOM", 0, -2)
|
|
ChatFrameToggleVoiceMuteButton:SetSize(26,25)
|
|
|
|
ChatFrameMenuButton:ClearAllPoints()
|
|
ChatFrameMenuButton:SetPoint("BOTTOMRIGHT", ChatFrame1Background, "BOTTOMRIGHT", 3, 18)
|
|
ChatFrameMenuButton:SetSize(29,29)
|
|
|
|
-- Function to set voice chat and chat menu buttons
|
|
local function SetChatButtonFrameButtons()
|
|
if LeaPlusLC["ShowVoiceButtons"] == "On" then
|
|
-- Show voice chat buttons
|
|
ChatFrameChannelButton:SetParent(UIParent)
|
|
ChatFrameToggleVoiceDeafenButton:SetParent(UIParent)
|
|
ChatFrameToggleVoiceMuteButton:SetParent(UIParent)
|
|
else
|
|
-- Hide voice chat buttons
|
|
ChatFrameChannelButton:SetParent(tframe)
|
|
ChatFrameToggleVoiceDeafenButton:SetParent(tframe)
|
|
ChatFrameToggleVoiceMuteButton:SetParent(tframe)
|
|
end
|
|
if LeaPlusLC["ShowChatMenuButton"] == "On" then
|
|
-- Show chat menu button
|
|
ChatFrameMenuButton:SetParent(UIParent)
|
|
else
|
|
-- Hide chat menu button
|
|
ChatFrameMenuButton:SetParent(tframe)
|
|
end
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local HideChatButtonsPanel = LeaPlusLC:CreatePanel("Hide chat buttons", "HideChatButtonsPanel")
|
|
|
|
-- Add checkboxes
|
|
LeaPlusLC:MakeTx(HideChatButtonsPanel, "General", 16, -72)
|
|
LeaPlusLC:MakeCB(HideChatButtonsPanel, "ShowVoiceButtons", "Show voice chat buttons", 16, -92, false, "If checked, voice chat buttons will be shown.")
|
|
LeaPlusLC:MakeCB(HideChatButtonsPanel, "ShowChatMenuButton", "Show chat menu button", 16, -112, false, "If checked, the chat menu button will be shown.")
|
|
|
|
-- Help button hidden
|
|
HideChatButtonsPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
HideChatButtonsPanel.b:SetScript("OnClick", function()
|
|
HideChatButtonsPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page3"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
HideChatButtonsPanel.r:SetScript("OnClick", function()
|
|
|
|
-- Reset checkboxes
|
|
LeaPlusLC["ShowVoiceButtons"] = "Off"
|
|
LeaPlusLC["ShowChatMenuButton"] = "Off"
|
|
|
|
-- Refresh panel
|
|
SetChatButtonFrameButtons()
|
|
HideChatButtonsPanel:Hide(); HideChatButtonsPanel:Show()
|
|
|
|
end)
|
|
|
|
-- Show panal when options panel button is clicked
|
|
LeaPlusCB["NoChatButtonsBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["ShowVoiceButtons"] = "On"
|
|
LeaPlusLC["ShowChatMenuButton"] = "Off"
|
|
SetChatButtonFrameButtons()
|
|
else
|
|
HideChatButtonsPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Run function when options are clicked and on startup
|
|
LeaPlusCB["ShowVoiceButtons"]:HookScript("OnClick", SetChatButtonFrameButtons)
|
|
LeaPlusCB["ShowChatMenuButton"]:HookScript("OnClick", SetChatButtonFrameButtons)
|
|
SetChatButtonFrameButtons()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Recent chat window
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["RecentChatWindow"] == "On" and not LeaLockList["RecentChatWindow"] then
|
|
|
|
-- Create recent chat frame
|
|
local editFrame = CreateFrame("ScrollFrame", nil, UIParent, "LeaPlusRecentChatScrollFrameTemplate")
|
|
|
|
-- Set frame parameters
|
|
editFrame:ClearAllPoints()
|
|
editFrame:SetPoint("BOTTOM", 0, 130)
|
|
editFrame:SetSize(600, LeaPlusLC["RecentChatSize"])
|
|
editFrame:SetFrameStrata("MEDIUM")
|
|
editFrame:SetToplevel(true)
|
|
editFrame:Hide()
|
|
|
|
-- Add background color
|
|
editFrame.t = editFrame:CreateTexture(nil, "BACKGROUND")
|
|
editFrame.t:SetAllPoints()
|
|
editFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.6)
|
|
|
|
-- Create title bar
|
|
local titleFrame = CreateFrame("Frame", nil, editFrame)
|
|
titleFrame:ClearAllPoints()
|
|
titleFrame:SetPoint("TOP", 0, 24)
|
|
titleFrame:SetSize(600, 24)
|
|
titleFrame:SetFrameStrata("MEDIUM")
|
|
titleFrame:SetToplevel(true)
|
|
titleFrame:SetHitRectInsets(-6, -6, -6, -6)
|
|
titleFrame.t = titleFrame:CreateTexture(nil, "BACKGROUND")
|
|
titleFrame.t:SetAllPoints()
|
|
titleFrame.t:SetColorTexture(0.00, 0.00, 0.0, 0.8)
|
|
|
|
-- Add message count
|
|
titleFrame.m = titleFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
titleFrame.m:SetPoint("LEFT", 4, 0)
|
|
titleFrame.m:SetText(L["Messages"] .. ": 0")
|
|
titleFrame.m:SetFont(titleFrame.m:GetFont(), 16, nil)
|
|
|
|
-- Add right-click to close message
|
|
titleFrame.x = titleFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
titleFrame.x:SetPoint("RIGHT", -4, 0)
|
|
titleFrame.x:SetText(L["Drag to size"] .. " | " .. L["Right-click to close"])
|
|
titleFrame.x:SetFont(titleFrame.x:GetFont(), 16, nil)
|
|
titleFrame.x:SetWidth(600 - titleFrame.m:GetStringWidth() - 30)
|
|
titleFrame.x:SetWordWrap(false)
|
|
titleFrame.x:SetJustifyH("RIGHT")
|
|
|
|
-- Drag to resize
|
|
editFrame:SetResizable(true)
|
|
editFrame:SetResizeBounds(600, 170, 600, 560)
|
|
|
|
titleFrame:HookScript("OnMouseDown", function(self, btn)
|
|
if btn == "LeftButton" then
|
|
editFrame:StartSizing("TOP")
|
|
end
|
|
end)
|
|
titleFrame:HookScript("OnMouseUp", function(self, btn)
|
|
if btn == "LeftButton" then
|
|
editFrame:StopMovingOrSizing()
|
|
LeaPlusLC["RecentChatSize"] = editFrame:GetHeight()
|
|
elseif btn == "MiddleButton" then
|
|
-- Reset frame size
|
|
LeaPlusLC["RecentChatSize"] = 170
|
|
editFrame:SetSize(600, LeaPlusLC["RecentChatSize"])
|
|
editFrame:ClearAllPoints()
|
|
editFrame:SetPoint("BOTTOM", 0, 130)
|
|
end
|
|
end)
|
|
|
|
-- Create character count
|
|
editFrame.CharCount = editFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
editFrame.CharCount:Hide()
|
|
|
|
-- Create editbox
|
|
local editBox = editFrame.EditBox
|
|
editBox:SetAltArrowKeyMode(false)
|
|
editBox:SetTextInsets(4, 4, 4, 4)
|
|
editBox:SetWidth(editFrame:GetWidth() - 30)
|
|
editBox:SetSecurityDisablePaste()
|
|
editBox:SetMaxLetters(0)
|
|
|
|
editFrame:SetScrollChild(editBox)
|
|
|
|
-- Manage focus
|
|
editBox:HookScript("OnEditFocusLost", function()
|
|
if MouseIsOver(titleFrame) and IsMouseButtonDown("LeftButton") then
|
|
editBox:SetFocus()
|
|
end
|
|
end)
|
|
|
|
-- Close frame with right-click of editframe or editbox
|
|
local function CloseRecentChatWindow()
|
|
editBox:SetText("")
|
|
editBox:ClearFocus()
|
|
editFrame:Hide()
|
|
end
|
|
|
|
editFrame:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then CloseRecentChatWindow() end
|
|
end)
|
|
|
|
editBox:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then CloseRecentChatWindow() end
|
|
end)
|
|
|
|
titleFrame:HookScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then CloseRecentChatWindow() end
|
|
end)
|
|
|
|
-- Disable text changes while still allowing editing controls to work
|
|
editBox:EnableKeyboard(false)
|
|
editBox:SetScript("OnKeyDown", function() end)
|
|
|
|
-- Populate recent chat frame with chat messages
|
|
local function ShowChatbox(chtfrm)
|
|
editBox:SetText("")
|
|
local NumMsg = chtfrm:GetNumMessages()
|
|
local StartMsg = 1
|
|
if NumMsg > 256 then StartMsg = NumMsg - 255 end
|
|
local totalMsgCount = 0
|
|
for iMsg = StartMsg, NumMsg do
|
|
local chatMessage, r, g, b, chatTypeID = chtfrm:GetMessageInfo(iMsg)
|
|
if chatMessage then
|
|
|
|
-- Handle Battle.net messages
|
|
if string.match(chatMessage, "k:(%d+):(%d+):BN_WHISPER:")
|
|
or string.match(chatMessage, "k:(%d+):(%d+):BN_INLINE_TOAST_ALERT:")
|
|
or string.match(chatMessage, "k:(%d+):(%d+):BN_INLINE_TOAST_BROADCAST:")
|
|
then
|
|
local ctype
|
|
if string.match(chatMessage, "k:(%d+):(%d+):BN_WHISPER:") then
|
|
ctype = "BN_WHISPER"
|
|
elseif string.match(chatMessage, "k:(%d+):(%d+):BN_INLINE_TOAST_ALERT:") then
|
|
ctype = "BN_INLINE_TOAST_ALERT"
|
|
elseif string.match(chatMessage, "k:(%d+):(%d+):BN_INLINE_TOAST_BROADCAST:") then
|
|
ctype = "BN_INLINE_TOAST_BROADCAST"
|
|
end
|
|
local id = tonumber(string.match(chatMessage, "k:(%d+):%d+:" .. ctype .. ":"))
|
|
local totalBNFriends = BNGetNumFriends()
|
|
for friendIndex = 1, totalBNFriends do
|
|
local accountInfo = C_BattleNet.GetFriendAccountInfo(friendIndex)
|
|
local bnetAccountID = accountInfo.bnetAccountID
|
|
local battleTag = accountInfo.battleTag
|
|
if id == bnetAccountID then
|
|
battleTag = strsplit("#", battleTag)
|
|
chatMessage = chatMessage:gsub("(|HBNplayer%S-|k)(%d-)(:%S-" .. ctype .. "%S-|h)%[(%S-)%](|?h?)(:?)", "[" .. battleTag .. "]:")
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Handle colors
|
|
if r and g and b then
|
|
local colorCode = RGBToColorCode(r, g, b)
|
|
chatMessage = colorCode .. chatMessage
|
|
end
|
|
|
|
chatMessage = gsub(chatMessage, "|T.-|t", "") -- Remove textures
|
|
chatMessage = gsub(chatMessage, "|A.-|a", "") -- Remove atlases
|
|
editBox:Insert(chatMessage .. "|r|n")
|
|
|
|
end
|
|
totalMsgCount = totalMsgCount + 1
|
|
end
|
|
titleFrame.m:SetText(L["Messages"] .. ": " .. totalMsgCount)
|
|
editFrame:SetVerticalScroll(0)
|
|
editFrame.ScrollBar:ScrollToEnd()
|
|
editFrame:Show()
|
|
editBox:ClearFocus()
|
|
end
|
|
|
|
-- Hook normal chat frame tab clicks
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
_G["ChatFrame" .. i .. "Tab"]:HookScript("OnClick", function()
|
|
if IsControlKeyDown() then
|
|
editBox:SetFont(_G["ChatFrame" .. i]:GetFont())
|
|
editFrame:SetPanExtent(select(2, _G["ChatFrame" .. i]:GetFont()))
|
|
ShowChatbox(_G["ChatFrame" .. i])
|
|
end
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- Hook temporary chat frame tab clicks
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function()
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
_G[cf .. "Tab"]:HookScript("OnClick", function()
|
|
if IsControlKeyDown() then
|
|
editBox:SetFont(_G[cf]:GetFont())
|
|
editFrame:SetPanExtent(select(2, _G[cf]:GetFont()))
|
|
ShowChatbox(_G[cf])
|
|
end
|
|
end)
|
|
end
|
|
end)
|
|
|
|
-- Add entry to chat menu to show recent chat window
|
|
Menu.ModifyMenu("MENU_FCF_TAB", function(self, rootDescription, contextData)
|
|
rootDescription:CreateDivider()
|
|
rootDescription:CreateTitle(L["Leatrix Plus"])
|
|
local recentChatButton = rootDescription:CreateButton(L["Recent chat window"], function()
|
|
local currentChatFrame = FCF_GetCurrentChatFrame()
|
|
editBox:SetFont(currentChatFrame:GetFont())
|
|
editFrame:SetPanExtent(select(2, currentChatFrame:GetFont()))
|
|
ShowChatbox(currentChatFrame)
|
|
end)
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Hide alerts
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["NoAlerts"] == "On" then
|
|
hooksecurefunc(AlertFrame, "RegisterEvent", function(self, event)
|
|
AlertFrame:UnregisterEvent(event)
|
|
end)
|
|
AlertFrame:UnregisterAllEvents()
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show cooldowns
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowCooldowns"] == "On" then
|
|
|
|
-- Create main table structure in saved variables if it doesn't exist
|
|
if LeaPlusDB["Cooldowns"] == nil then
|
|
LeaPlusDB["Cooldowns"] = {}
|
|
end
|
|
|
|
-- Create class tables if they don't exist
|
|
for index = 1, GetNumClasses() do
|
|
local classDisplayName, classTag, classID = GetClassInfo(index)
|
|
if LeaPlusDB["Cooldowns"][classTag] == nil then
|
|
LeaPlusDB["Cooldowns"][classTag] = {}
|
|
end
|
|
end
|
|
|
|
-- Get current class and spec
|
|
local PlayerClass = select(2, UnitClass("player"))
|
|
local activeSpec = GetSpecialization() or 1
|
|
|
|
-- Create local tables to store cooldown frames and editboxes
|
|
local icon = {} -- Used to store cooldown frames
|
|
local SpellEB = {} -- Used to store editbox values
|
|
local iCount = 5 -- Number of cooldowns
|
|
|
|
-- Create cooldown frames
|
|
for i = 1, iCount do
|
|
|
|
-- Create cooldown frame
|
|
icon[i] = CreateFrame("Frame", nil, UIParent)
|
|
icon[i]:SetFrameStrata("MEDIUM")
|
|
icon[i]:SetWidth(21)
|
|
icon[i]:SetHeight(21)
|
|
|
|
-- Create cooldown icon
|
|
icon[i].c = CreateFrame("Cooldown", nil, icon[i], "CooldownFrameTemplate")
|
|
icon[i].c:SetAllPoints()
|
|
icon[i].c:SetReverse(true)
|
|
|
|
-- Create blank texture (will be assigned a cooldown texture later)
|
|
icon[i].t = icon[i]:CreateTexture(nil,"BACKGROUND")
|
|
icon[i].t:SetAllPoints()
|
|
|
|
-- Show icon above target frame and set initial scale
|
|
icon[i]:ClearAllPoints()
|
|
icon[i]:SetPoint("TOPLEFT", TargetFrame, "TOPLEFT", 6 + (22 * (i - 1)), 5)
|
|
icon[i]:SetScale(TargetFrame:GetScale())
|
|
|
|
-- Show tooltip
|
|
icon[i]:SetScript("OnEnter", function(self)
|
|
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT", 15, -25)
|
|
local spellInfo = C_Spell.GetSpellInfo(LeaPlusCB["Spell" .. i]:GetText())
|
|
if spellInfo then
|
|
GameTooltip:SetText(C_Spell.GetSpellInfo(LeaPlusCB["Spell" .. i]:GetText()).name)
|
|
end
|
|
end)
|
|
|
|
-- Hide tooltip
|
|
icon[i]:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
end
|
|
|
|
-- Change cooldown icon scale when player frame scale changes
|
|
PlayerFrame:HookScript("OnSizeChanged", function()
|
|
if LeaPlusLC["CooldownsOnPlayer"] == "On" then
|
|
for i = 1, iCount do
|
|
icon[i]:SetScale(PlayerFrame:GetScale())
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Change cooldown icon scale when target frame scale changes
|
|
TargetFrame:HookScript("OnSizeChanged", function()
|
|
if LeaPlusLC["CooldownsOnPlayer"] == "Off" then
|
|
for i = 1, iCount do
|
|
icon[i]:SetScale(TargetFrame:GetScale())
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Function to show cooldown textures in the cooldown frames (run when icons are loaded or changed)
|
|
local function ShowIcon(i, id, owner)
|
|
|
|
local void
|
|
|
|
-- Get spell information
|
|
if not id then return end
|
|
local spellInfo = C_Spell.GetSpellInfo(id)
|
|
if not spellInfo then
|
|
-- Spell does not exist so stop watching it
|
|
icon[i]:SetScript("OnEvent", nil)
|
|
icon[i]:Hide()
|
|
return
|
|
end
|
|
local spell = spellInfo.spellID
|
|
local path = spellInfo.iconID
|
|
if spell and path then
|
|
|
|
-- Set icon texture to the spell texture
|
|
icon[i].t:SetTexture(path)
|
|
|
|
-- Handle events
|
|
icon[i]:RegisterUnitEvent("UNIT_AURA", owner)
|
|
icon[i]:RegisterUnitEvent("UNIT_PET", "player")
|
|
icon[i]:SetScript("OnEvent", function(self, event, arg1, updatedAuras)
|
|
|
|
-- If pet was dismissed (or otherwise disappears such as when flying), hide pet cooldowns
|
|
if event == "UNIT_PET" then
|
|
if not UnitExists("pet") then
|
|
if LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Pet"] then
|
|
icon[i]:Hide()
|
|
end
|
|
end
|
|
|
|
-- Ensure cooldown belongs to the owner we are watching (player or pet)
|
|
elseif arg1 == owner then
|
|
|
|
-- Hide the cooldown frame (required for cooldowns to disappear after the duration)
|
|
icon[i]:Hide()
|
|
|
|
-- If buff matches cooldown we want, start the cooldown
|
|
AuraUtil.ForEachAura(owner, "HELPFUL", nil, function(aura)
|
|
if aura.spellId and aura.spellId == id and aura.expirationTime and aura.duration then
|
|
icon[i]:Show()
|
|
CooldownFrame_Set(icon[i].c, aura.expirationTime - aura.duration, aura.duration, 1)
|
|
end
|
|
end, true)
|
|
|
|
end
|
|
end)
|
|
|
|
else
|
|
|
|
-- Spell does not exist so stop watching it
|
|
icon[i]:SetScript("OnEvent", nil)
|
|
icon[i]:Hide()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- Create configuration panel
|
|
local CooldownPanel = LeaPlusLC:CreatePanel("Show cooldowns", "CooldownPanel")
|
|
|
|
-- Function to refresh the editbox tooltip with the spell name
|
|
local function RefSpellTip(self,elapsed)
|
|
local spellInfo = C_Spell.GetSpellInfo(self:GetText())
|
|
if not spellInfo then GameTooltip:Hide(); return end
|
|
local spellinfo = spellInfo.name
|
|
local icon = spellInfo.iconID
|
|
if spellinfo and spellinfo ~= "" and icon and icon ~= "" then
|
|
GameTooltip:SetOwner(self, "ANCHOR_NONE")
|
|
GameTooltip:ClearAllPoints()
|
|
GameTooltip:SetPoint("RIGHT", self, "LEFT", -10, 0)
|
|
GameTooltip:SetText("|T" .. icon .. ":0|t " .. spellinfo, nil, nil, nil, nil, true)
|
|
else
|
|
GameTooltip:Hide()
|
|
end
|
|
end
|
|
|
|
-- Function to create spell ID editboxes and pet checkboxes
|
|
local function MakeSpellEB(num, x, y, tab, shifttab)
|
|
|
|
-- Create editbox for spell ID
|
|
SpellEB[num] = LeaPlusLC:CreateEditBox("Spell" .. num, CooldownPanel, 70, 6, "TOPLEFT", x, y - 20, "Spell" .. tab, "Spell" .. shifttab)
|
|
SpellEB[num]:SetNumeric(true)
|
|
|
|
-- Set initial value (for current spec)
|
|
SpellEB[num]:SetText(LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. num .. "Idn"] or "")
|
|
|
|
-- Refresh tooltip when mouse is hovering over the editbox
|
|
SpellEB[num]:SetScript("OnEnter", function()
|
|
SpellEB[num]:SetScript("OnUpdate", RefSpellTip)
|
|
end)
|
|
SpellEB[num]:SetScript("OnLeave", function()
|
|
SpellEB[num]:SetScript("OnUpdate", nil)
|
|
GameTooltip:Hide()
|
|
end)
|
|
|
|
-- Create checkbox for pet cooldown
|
|
LeaPlusLC:MakeCB(CooldownPanel, "Spell" .. num .."Pet", "", 462, y - 20, false, "")
|
|
LeaPlusCB["Spell" .. num .."Pet"]:SetHitRectInsets(0, 0, 0, 0)
|
|
|
|
end
|
|
|
|
-- Add titles
|
|
LeaPlusLC:MakeTx(CooldownPanel, "Spell ID", 384, -92)
|
|
LeaPlusLC:MakeTx(CooldownPanel, "Pet", 462, -92)
|
|
|
|
-- Add editboxes and checkboxes
|
|
MakeSpellEB(1, 386, -92, "2", "5")
|
|
MakeSpellEB(2, 386, -122, "3", "1")
|
|
MakeSpellEB(3, 386, -152, "4", "2")
|
|
MakeSpellEB(4, 386, -182, "5", "3")
|
|
MakeSpellEB(5, 386, -212, "1", "4")
|
|
|
|
-- Add checkboxes
|
|
LeaPlusLC:MakeTx(CooldownPanel, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(CooldownPanel, "ShowCooldownID", "Show the spell ID in buff icon tooltips", 16, -92, false, "If checked, spell IDs will be shown in buff icon tooltips located in the buff frame and under the target frame.");
|
|
LeaPlusLC:MakeCB(CooldownPanel, "NoCooldownDuration", "Hide cooldown duration numbers (if enabled)", 16, -112, false, "If checked, cooldown duration numbers will not be shown over the cooldowns.|n|nIf unchecked, cooldown duration numbers will be shown over the cooldowns if they are enabled in the game options panel ('ActionBars' menu).")
|
|
LeaPlusLC:MakeCB(CooldownPanel, "CooldownsOnPlayer", "Show cooldowns above the player frame", 16, -132, false, "If checked, cooldown icons will be shown above the player frame.|n|nIf unchecked, cooldown icons will be shown above the target frame.")
|
|
|
|
-- Function to save the panel control settings and refresh the cooldown icons
|
|
local function SavePanelControls()
|
|
for i = 1, iCount do
|
|
|
|
-- Refresh the cooldown texture
|
|
icon[i].c:SetCooldown(0,0)
|
|
|
|
-- Show icons above target or player frame
|
|
icon[i]:ClearAllPoints()
|
|
if LeaPlusLC["CooldownsOnPlayer"] == "On" then
|
|
icon[i]:SetPoint("TOPLEFT", PlayerFrame, "TOPLEFT", 90 + (24 * (i - 1)), -2)
|
|
icon[i]:SetScale(PlayerFrame:GetScale())
|
|
else
|
|
icon[i]:SetPoint("TOPLEFT", TargetFrame, "TOPLEFT", 25 + (24 * (i - 1)), -2)
|
|
icon[i]:SetScale(TargetFrame:GetScale())
|
|
end
|
|
|
|
-- Save control states to globals
|
|
LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Idn"] = SpellEB[i]:GetText()
|
|
LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Pet"] = LeaPlusCB["Spell" .. i .."Pet"]:GetChecked()
|
|
|
|
-- Set cooldowns
|
|
if LeaPlusCB["Spell" .. i .."Pet"]:GetChecked() then
|
|
ShowIcon(i, tonumber(SpellEB[i]:GetText()), "pet")
|
|
else
|
|
ShowIcon(i, tonumber(SpellEB[i]:GetText()), "player")
|
|
end
|
|
|
|
-- Show or hide cooldown duration
|
|
if LeaPlusLC["NoCooldownDuration"] == "On" then
|
|
icon[i].c:SetHideCountdownNumbers(true)
|
|
else
|
|
icon[i].c:SetHideCountdownNumbers(false)
|
|
end
|
|
|
|
-- Show or hide cooldown icons depending on current buffs
|
|
local newowner
|
|
local newspell = tonumber(SpellEB[i]:GetText())
|
|
|
|
if newspell then
|
|
if LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Pet"] then
|
|
newowner = "pet"
|
|
else
|
|
newowner = "player"
|
|
end
|
|
-- Hide cooldown icon
|
|
icon[i]:Hide()
|
|
|
|
-- If buff matches spell we want, show cooldown icon
|
|
AuraUtil.ForEachAura(newowner, "HELPFUL", nil, function(aura)
|
|
if aura.spellId and aura.spellId == newspell and aura.expirationTime and aura.duration then
|
|
icon[i]:Show()
|
|
CooldownFrame_Set(icon[i].c, aura.expirationTime - aura.duration, aura.duration, 1)
|
|
end
|
|
end, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- Update cooldown icons when checkboxes are clicked
|
|
LeaPlusCB["NoCooldownDuration"]:HookScript("OnClick", SavePanelControls)
|
|
LeaPlusCB["CooldownsOnPlayer"]:HookScript("OnClick", SavePanelControls)
|
|
|
|
-- Help button hidden
|
|
CooldownPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
CooldownPanel.b:SetScript("OnClick", function()
|
|
CooldownPanel:Hide(); LeaPlusLC["PageF"]:Show(); LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
CooldownPanel.r:SetScript("OnClick", function()
|
|
-- Reset the checkboxes
|
|
LeaPlusLC["ShowCooldownID"] = "On"
|
|
LeaPlusLC["NoCooldownDuration"] = "On"
|
|
LeaPlusLC["CooldownsOnPlayer"] = "Off"
|
|
for i = 1, iCount do
|
|
-- Reset the panel controls
|
|
SpellEB[i]:SetText("");
|
|
LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Pet"] = false
|
|
-- Hide cooldowns and clear scripts
|
|
icon[i]:Hide()
|
|
icon[i]:SetScript("OnEvent", nil)
|
|
end
|
|
CooldownPanel:Hide(); CooldownPanel:Show()
|
|
end)
|
|
|
|
-- Save settings when changed
|
|
for i = 1, iCount do
|
|
-- Set initial checkbox states
|
|
LeaPlusCB["Spell" .. i .."Pet"]:SetChecked(LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Pet"])
|
|
-- Set checkbox states when shown
|
|
LeaPlusCB["Spell" .. i .."Pet"]:SetScript("OnShow", function()
|
|
LeaPlusCB["Spell" .. i .."Pet"]:SetChecked(LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Pet"])
|
|
end)
|
|
-- Set states when changed
|
|
SpellEB[i]:SetScript("OnTextChanged", SavePanelControls)
|
|
LeaPlusCB["Spell" .. i .."Pet"]:SetScript("OnClick", SavePanelControls)
|
|
end
|
|
|
|
-- Show cooldowns on startup
|
|
SavePanelControls()
|
|
|
|
-- Show panel when configuration button is clicked
|
|
LeaPlusCB["CooldownsButton"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- No preset profile
|
|
else
|
|
-- Show panel
|
|
CooldownPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Create spec tag banner fontstring
|
|
local specTagSpecID = GetSpecialization()
|
|
local specTagSpecInfoID, specTagName = GetSpecializationInfo(specTagSpecID)
|
|
local specTagBanner = CooldownPanel:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
specTagBanner:SetPoint("TOPLEFT", 384, -72)
|
|
specTagBanner:SetText(specTagName)
|
|
|
|
-- Add help button
|
|
LeaPlusLC:CreateHelpButton("ShowCooldownsHelpButton", CooldownPanel, specTagBanner, "Enter the spell IDs for the cooldown icons that you want to see.|n|nIf a cooldown icon normally appears under the pet frame, check the pet checkbox.|n|nCooldown icons are saved to your class and specialisation.")
|
|
|
|
-- Set controls when spec changes
|
|
local swapFrame = CreateFrame("FRAME")
|
|
swapFrame:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
|
|
swapFrame:SetScript("OnEvent", function()
|
|
-- Store new spec
|
|
activeSpec = GetSpecialization()
|
|
-- Update controls for new spec
|
|
for i = 1, iCount do
|
|
SpellEB[i]:SetText(LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Idn"] or "")
|
|
LeaPlusCB["Spell" .. i .. "Pet"]:SetChecked(LeaPlusDB["Cooldowns"][PlayerClass]["S" .. activeSpec .. "R" .. i .. "Pet"] or false)
|
|
end
|
|
-- Update spec tag banner with new spec
|
|
local specTagSpecInfoID, specTagName = GetSpecializationInfo(activeSpec)
|
|
specTagBanner:SetText(specTagName)
|
|
-- Refresh configuration panel
|
|
if CooldownPanel:IsShown() then
|
|
CooldownPanel:Hide(); CooldownPanel:Show()
|
|
end
|
|
-- Save settings
|
|
SavePanelControls()
|
|
end)
|
|
|
|
-- Function to show spell ID in tooltips
|
|
local function CooldownIDFunc(unit, target, index, auratype)
|
|
if LeaPlusLC["ShowCooldownID"] == "On" and auratype ~= "HARMFUL" then
|
|
local AuraData = C_UnitAuras.GetAuraDataByIndex(target, index)
|
|
if AuraData then
|
|
local spellid = AuraData.spellId
|
|
if spellid then
|
|
GameTooltip:AddLine(L["Spell ID"] .. ": " .. spellid)
|
|
GameTooltip:Show()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Add spell ID to tooltip when buff frame buffs are hovered
|
|
hooksecurefunc(GameTooltip, 'SetUnitAura', CooldownIDFunc)
|
|
|
|
-- Add spell ID to tooltip when target frame buffs are hovered
|
|
hooksecurefunc(GameTooltip, 'SetUnitBuff', CooldownIDFunc)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Combat plates
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["CombatPlates"] == "On" then
|
|
|
|
-- Toggle nameplates with combat
|
|
local f = CreateFrame("Frame")
|
|
f:RegisterEvent("PLAYER_REGEN_DISABLED")
|
|
f:RegisterEvent("PLAYER_REGEN_ENABLED")
|
|
f:SetScript("OnEvent", function(self, event)
|
|
SetCVar("nameplateShowEnemies", event == "PLAYER_REGEN_DISABLED" and 1 or 0)
|
|
end)
|
|
|
|
-- Run combat check on startup
|
|
SetCVar("nameplateShowEnemies", UnitAffectingCombat("player") and 1 or 0)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Enhance tooltip
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["TipModEnable"] == "On" and not LeaLockList["TipModEnable"] then
|
|
|
|
-- Enable mouse hover events for world frame (required for hide tooltips, cursor anchor and maybe other addons)
|
|
WorldFrame:EnableMouseMotion(true)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Position the tooltip
|
|
----------------------------------------------------------------------
|
|
|
|
-- Position general tooltip
|
|
hooksecurefunc("GameTooltip_SetDefaultAnchor", function(tooltip, parent)
|
|
if LeaPlusLC["TooltipAnchorMenu"] ~= 1 then
|
|
if (not tooltip or not parent) then
|
|
return
|
|
end
|
|
if WorldFrame:IsMouseMotionFocus() then
|
|
if LeaPlusLC["TooltipAnchorMenu"] == 2 then
|
|
tooltip:SetOwner(parent, "ANCHOR_CURSOR")
|
|
return
|
|
elseif LeaPlusLC["TooltipAnchorMenu"] == 3 then
|
|
tooltip:SetOwner(parent, "ANCHOR_CURSOR_LEFT", LeaPlusLC["TipCursorX"], LeaPlusLC["TipCursorY"])
|
|
return
|
|
elseif LeaPlusLC["TooltipAnchorMenu"] == 4 then
|
|
tooltip:SetOwner(parent, "ANCHOR_CURSOR_RIGHT", LeaPlusLC["TipCursorX"], LeaPlusLC["TipCursorY"])
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Tooltip Configuration
|
|
----------------------------------------------------------------------
|
|
|
|
local LT = {}
|
|
|
|
-- Create locale specific level string
|
|
LT["LevelLocale"] = strtrim(strtrim(string.gsub(TOOLTIP_UNIT_LEVEL, "%%s", "")))
|
|
if GameLocale == "ruRU" then
|
|
LT["LevelLocale"] = "-ro уровня"
|
|
end
|
|
|
|
-- Tooltip
|
|
LT["ColorBlind"] = GetCVar("colorblindMode")
|
|
|
|
---------------------------------------------------------------------------------------------------------
|
|
-- Tooltip movement settings
|
|
---------------------------------------------------------------------------------------------------------
|
|
|
|
-- Create tooltip customisation side panel
|
|
local SideTip = LeaPlusLC:CreatePanel("Enhance tooltip", "SideTip")
|
|
|
|
-- Add controls
|
|
LeaPlusLC:MakeTx(SideTip, "Settings", 16, -72)
|
|
LeaPlusLC:MakeCB(SideTip, "TipShowRank", "Show guild ranks for your guild", 16, -92, false, "If checked, guild ranks will be shown for players in your guild.")
|
|
LeaPlusLC:MakeCB(SideTip, "TipShowOtherRank", "Show guild ranks for other guilds", 16, -112, false, "If checked, guild ranks will be shown for players who are not in your guild.")
|
|
LeaPlusLC:MakeCB(SideTip, "TipShowTarget", "Show the unit's target", 16, -132, false, "If checked, unit targets will be shown.")
|
|
-- LeaPlusLC:MakeCB(SideTip, "TipShowMythic", "Show mythic score", 16, -152, false, "If checked, the unit's mythic score will be shown if it is above zero.")
|
|
LeaPlusLC:MakeCB(SideTip, "TipBackSimple", "Color the backdrops based on faction", 16, -152, false, "If checked, backdrops will be tinted blue (friendly) or red (hostile).")
|
|
LeaPlusLC:MakeCB(SideTip, "TipNoHealthBar", "Hide the health bar", 16, -172, true, "If checked, the health bar will not be shown.")
|
|
|
|
LeaPlusLC:MakeTx(SideTip, "Hide tooltips", 16, -212)
|
|
LeaPlusLC:MakeCB(SideTip, "TipHideInCombat", "Hide tooltips for world units during combat", 16, -232, false, "If checked, tooltips for world units will be hidden during combat.")
|
|
LeaPlusLC:MakeCB(SideTip, "TipHideShiftOverride", "Show tooltips with shift key", 16, -252, false, "If checked, you can hold shift while tooltips are hidden to show them temporarily.")
|
|
|
|
-- Handle show tooltips with shift key lock
|
|
local function SetTipHideShiftOverrideFunc()
|
|
if LeaPlusLC["TipHideInCombat"] == "On" then
|
|
LeaPlusLC:LockItem(LeaPlusCB["TipHideShiftOverride"], false)
|
|
else
|
|
LeaPlusLC:LockItem(LeaPlusCB["TipHideShiftOverride"], true)
|
|
end
|
|
end
|
|
|
|
LeaPlusCB["TipHideInCombat"]:HookScript("OnClick", SetTipHideShiftOverrideFunc)
|
|
SetTipHideShiftOverrideFunc()
|
|
|
|
LeaPlusLC:CreateDropdown("TooltipAnchorMenu", "Anchor", 146, "TOPLEFT", SideTip, "TOPLEFT", 356, -92, {{L["None"], 1}, {L["Cursor"], 2}, {L["Cursor Left"], 3}, {L["Cursor Right"], 4}})
|
|
|
|
local XOffsetHeading = LeaPlusLC:MakeTx(SideTip, "X Offset", 356, -132)
|
|
LeaPlusLC:MakeSL(SideTip, "TipCursorX", "Drag to set the cursor X offset.", -128, 128, 1, 356, -152, "%.0f")
|
|
|
|
local YOffsetHeading = LeaPlusLC:MakeTx(SideTip, "Y Offset", 356, -182)
|
|
LeaPlusLC:MakeSL(SideTip, "TipCursorY", "Drag to set the cursor Y offset.", -128, 128, 1, 356, -202, "%.0f")
|
|
|
|
LeaPlusLC:MakeTx(SideTip, "Scale", 356, -232)
|
|
LeaPlusLC:MakeSL(SideTip, "LeaPlusTipSize", "Drag to set the tooltip scale.", 0.50, 2.00, 0.05, 356, -252, "%.2f")
|
|
|
|
-- Function to enable or disable anchor controls
|
|
local function SetAnchorControls()
|
|
-- Set the X and Y sliders
|
|
if LeaPlusLC["TooltipAnchorMenu"] == 1 or LeaPlusLC["TooltipAnchorMenu"] == 2 then
|
|
-- Dropdown is set to none or cursor so disable X and Y offset sliders
|
|
LeaPlusLC:LockItem(LeaPlusCB["TipCursorX"], true)
|
|
LeaPlusLC:LockItem(LeaPlusCB["TipCursorY"], true)
|
|
XOffsetHeading:SetAlpha(0.3)
|
|
YOffsetHeading:SetAlpha(0.3)
|
|
LeaPlusCB["TipCursorX"]:SetScript("OnEnter", nil)
|
|
LeaPlusCB["TipCursorY"]:SetScript("OnEnter", nil)
|
|
else
|
|
-- Dropdown is set to cursor left or cursor right so enable X and Y offset sliders
|
|
LeaPlusLC:LockItem(LeaPlusCB["TipCursorX"], false)
|
|
LeaPlusLC:LockItem(LeaPlusCB["TipCursorY"], false)
|
|
XOffsetHeading:SetAlpha(1.0)
|
|
YOffsetHeading:SetAlpha(1.0)
|
|
LeaPlusCB["TipCursorX"]:SetScript("OnEnter", LeaPlusLC.TipSee)
|
|
LeaPlusCB["TipCursorY"]:SetScript("OnEnter", LeaPlusLC.TipSee)
|
|
end
|
|
end
|
|
|
|
-- Set controls when dropdown menu is changed and on startup
|
|
LeaPlusCB["TooltipAnchorMenu"]:RegisterCallback("OnMenuClose", function()
|
|
if not UnitAffectingCombat("player") then
|
|
SetAnchorControls()
|
|
end
|
|
end)
|
|
SetAnchorControls()
|
|
|
|
-- Help button hidden
|
|
SideTip.h:Hide()
|
|
|
|
-- Back button handler
|
|
SideTip.b:SetScript("OnClick", function()
|
|
SideTip:Hide()
|
|
LeaPlusLC["PageF"]:Show()
|
|
LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
SideTip.r.tiptext = SideTip.r.tiptext .. "|n|n" .. L["Note that this will not reset settings that require a UI reload."]
|
|
SideTip.r:SetScript("OnClick", function()
|
|
LeaPlusLC["TipShowRank"] = "On"
|
|
LeaPlusLC["TipShowOtherRank"] = "Off"
|
|
LeaPlusLC["TipShowTarget"] = "On"
|
|
--LeaPlusLC["TipShowMythic"] = "Off"
|
|
LeaPlusLC["TipBackSimple"] = "Off"
|
|
LeaPlusLC["TipHideInCombat"] = "Off"; SetTipHideShiftOverrideFunc()
|
|
LeaPlusLC["TipHideShiftOverride"] = "On"
|
|
LeaPlusLC["LeaPlusTipSize"] = 1.00
|
|
LeaPlusLC["TooltipAnchorMenu"] = 1
|
|
LeaPlusLC["TipCursorX"] = 0
|
|
LeaPlusLC["TipCursorY"] = 0
|
|
SetAnchorControls()
|
|
LeaPlusLC:SetTipScale()
|
|
SideTip:Hide(); SideTip:Show()
|
|
end)
|
|
|
|
-- Move the tooltip
|
|
LeaPlusCB["MoveTooltipButton"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["TipShowRank"] = "On"
|
|
LeaPlusLC["TipShowOtherRank"] = "Off"
|
|
LeaPlusLC["TipShowTarget"] = "On"
|
|
--LeaPlusLC["TipShowMythic"] = "On"
|
|
LeaPlusLC["TipBackSimple"] = "On"
|
|
LeaPlusLC["TipHideInCombat"] = "Off"; SetTipHideShiftOverrideFunc()
|
|
LeaPlusLC["TipHideShiftOverride"] = "On"
|
|
LeaPlusLC["LeaPlusTipSize"] = 1.25
|
|
LeaPlusLC["TooltipAnchorMenu"] = 1
|
|
LeaPlusLC["TipCursorX"] = 0
|
|
LeaPlusLC["TipCursorY"] = 0
|
|
SetAnchorControls()
|
|
LeaPlusLC:SetTipScale()
|
|
LeaPlusLC:SetDim()
|
|
LeaPlusLC:ReloadCheck()
|
|
SideTip:Show(); SideTip:Hide() -- Needed to update tooltip scale
|
|
LeaPlusLC["PageF"]:Hide(); LeaPlusLC["PageF"]:Show()
|
|
else
|
|
-- Show tooltip configuration panel
|
|
LeaPlusLC:HideFrames()
|
|
SideTip:Show()
|
|
end
|
|
end)
|
|
|
|
-- Hide health bar
|
|
if LeaPlusLC["TipNoHealthBar"] == "On" then
|
|
GameTooltipStatusBarTexture:SetTexture("")
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------
|
|
-- Tooltip scale settings
|
|
---------------------------------------------------------------------------------------------------------
|
|
|
|
-- Function to set the tooltip scale
|
|
local function SetTipScale()
|
|
|
|
-- General tooltip
|
|
if GameTooltip then GameTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Friends
|
|
if FriendsTooltip then FriendsTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- AutoCompleteBox
|
|
if AutoCompleteBox then AutoCompleteBox:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Reputation
|
|
if ReputationParagonTooltip then ReputationParagonTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Pet battles and battle pets
|
|
if PetBattlePrimaryAbilityTooltip then PetBattlePrimaryAbilityTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if PetBattlePrimaryUnitTooltip then PetBattlePrimaryUnitTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if BattlePetTooltip then BattlePetTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if FloatingBattlePetTooltip then FloatingBattlePetTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if FloatingPetBattleAbilityTooltip then FloatingPetBattleAbilityTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Garrison
|
|
if FloatingGarrisonFollowerTooltip then FloatingGarrisonFollowerTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if FloatingGarrisonFollowerAbilityTooltip then FloatingGarrisonFollowerAbilityTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if FloatingGarrisonMissionTooltip then FloatingGarrisonMissionTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if FloatingGarrisonShipyardFollowerTooltip then FloatingGarrisonShipyardFollowerTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Order Hall
|
|
if GarrisonFollowerMissionAbilityWithoutCountersTooltip then GarrisonFollowerMissionAbilityWithoutCountersTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if GarrisonFollowerAbilityWithoutCountersTooltip then GarrisonFollowerAbilityWithoutCountersTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Items (links, comparisons)
|
|
if ItemRefTooltip then ItemRefTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if ItemRefShoppingTooltip1 then ItemRefShoppingTooltip1:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if ItemRefShoppingTooltip2 then ItemRefShoppingTooltip2:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if ShoppingTooltip1 then ShoppingTooltip1:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if ShoppingTooltip2 then ShoppingTooltip2:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- World map (story)
|
|
if QuestScrollFrame.WarCampaignTooltip then QuestScrollFrame.WarCampaignTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
if QuestScrollFrame.StoryTooltip then
|
|
QuestScrollFrame.StoryTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
QuestScrollFrame.StoryTooltip:SetFrameStrata("TOOLTIP")
|
|
end
|
|
|
|
-- Minimap (PVP queue status)
|
|
if QueueStatusFrame then QueueStatusFrame:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Embedded item tooltip (as used in PVP UI)
|
|
if EmbeddedItemTooltip then EmbeddedItemTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Nameplate tooltip
|
|
if NamePlateTooltip then NamePlateTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Game settings panel tooltip
|
|
if SettingsTooltip then SettingsTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- LibDBIcon
|
|
if LibDBIconTooltip then LibDBIconTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"]) end
|
|
|
|
-- Total RP 3
|
|
if C_AddOns.IsAddOnLoaded("totalRP3") and TRP3_MainTooltip and TRP3_CharacterTooltip then
|
|
TRP3_MainTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
TRP3_CharacterTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
end
|
|
|
|
-- Altoholic
|
|
if AddonFactory_Tooltip then
|
|
AddonFactory_Tooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
end
|
|
|
|
-- Set slider formatted text
|
|
LeaPlusCB["LeaPlusTipSize"].f:SetFormattedText("%.0f%%", LeaPlusLC["LeaPlusTipSize"] * 100)
|
|
|
|
end
|
|
|
|
-- Give function a file level scope
|
|
LeaPlusLC.SetTipScale = SetTipScale
|
|
|
|
-- Set tooltip scale when slider or checkbox changes and on startup
|
|
LeaPlusCB["LeaPlusTipSize"]:HookScript("OnValueChanged", SetTipScale)
|
|
SetTipScale()
|
|
|
|
----------------------------------------------------------------------
|
|
-- Character customisation (dragonriding customisation, barbershop)
|
|
----------------------------------------------------------------------
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_CharacterCustomize",function()
|
|
|
|
-- Function to set tooltip scale
|
|
local function SetCharCustomiseScale()
|
|
if CharCustomizeNoHeaderTooltip then
|
|
CharCustomizeNoHeaderTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
end
|
|
end
|
|
|
|
-- Set tooltip scale when slider changes and on startup
|
|
LeaPlusCB["LeaPlusTipSize"]:HookScript("OnValueChanged", SetCharCustomiseScale)
|
|
SetCharCustomiseScale()
|
|
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Contribution frame
|
|
----------------------------------------------------------------------
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_Contribution",function()
|
|
|
|
-- Function to set tooltip scale
|
|
local function SetContributionTipScale()
|
|
ContributionBuffTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
end
|
|
|
|
-- Set tooltip scale when slider changes and on startup
|
|
LeaPlusCB["LeaPlusTipSize"]:HookScript("OnValueChanged", SetContributionTipScale)
|
|
SetContributionTipScale()
|
|
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Pet Journal tooltips
|
|
----------------------------------------------------------------------
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_Collections",function()
|
|
|
|
-- Function to set tooltip scale
|
|
local function SetPetJournalTipScale()
|
|
PetJournalPrimaryAbilityTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
end
|
|
|
|
-- Set tooltip scale when slider changes and on startup
|
|
LeaPlusCB["LeaPlusTipSize"]:HookScript("OnValueChanged", SetPetJournalTipScale)
|
|
SetPetJournalTipScale()
|
|
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Encounter Journal tooltips
|
|
----------------------------------------------------------------------
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_EncounterJournal",function()
|
|
|
|
-- Function to set tooltip scale
|
|
local function SetEncounterJournalTipScale()
|
|
EncounterJournalTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
end
|
|
|
|
-- Set tooltip scale when slider changes and on startup
|
|
LeaPlusCB["LeaPlusTipSize"]:HookScript("OnValueChanged", SetEncounterJournalTipScale)
|
|
SetEncounterJournalTipScale()
|
|
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Perks program tooltip (trading post)
|
|
----------------------------------------------------------------------
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_PerksProgram",function()
|
|
|
|
-- Set tooltip scale
|
|
PerksProgramTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Death Recap frame tooltips
|
|
----------------------------------------------------------------------
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_DeathRecap",function()
|
|
|
|
-- Simple fix to prevent mousing over units behind the frame
|
|
DeathRecapFrame:EnableMouse(true)
|
|
|
|
end)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Garrison tooltips
|
|
----------------------------------------------------------------------
|
|
|
|
EventUtil.ContinueOnAddOnLoaded("Blizzard_GarrisonUI",function()
|
|
|
|
-- Function to set tooltip scale
|
|
local function SetGarrisonTipScale()
|
|
GarrisonFollowerTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
GarrisonFollowerAbilityTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
GarrisonMissionMechanicTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
GarrisonMissionMechanicFollowerCounterTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
GarrisonBuildingFrame.BuildingLevelTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
GarrisonBonusAreaTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
GarrisonShipyardMapMissionTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
GarrisonShipyardFollowerTooltip:SetScale(LeaPlusLC["LeaPlusTipSize"])
|
|
end
|
|
|
|
-- Set tooltip scale when slider changes and on startup
|
|
LeaPlusCB["LeaPlusTipSize"]:HookScript("OnValueChanged", SetGarrisonTipScale)
|
|
SetGarrisonTipScale()
|
|
|
|
end)
|
|
|
|
---------------------------------------------------------------------------------------------------------
|
|
-- Other tooltip code
|
|
---------------------------------------------------------------------------------------------------------
|
|
|
|
-- Remove the right-click for frame settings instruction (UNIT_POPUP_RIGHT_CLICK)
|
|
hooksecurefunc("UnitFrame_UpdateTooltip", function(self)
|
|
GameTooltip_SetDefaultAnchor(GameTooltip, self)
|
|
GameTooltip:SetUnit(self.unit, true)
|
|
GameTooltip:Show()
|
|
end)
|
|
|
|
-- Colorblind setting change
|
|
SideTip:RegisterEvent("CVAR_UPDATE");
|
|
SideTip:SetScript("OnEvent", function(self, event, arg1, arg2)
|
|
if (arg1 == "colorblindMode") then
|
|
LT["ColorBlind"] = arg2
|
|
end
|
|
end)
|
|
|
|
-- Store locals
|
|
local TipMClass = LOCALIZED_CLASS_NAMES_MALE
|
|
local TipFClass = LOCALIZED_CLASS_NAMES_FEMALE
|
|
|
|
local GetPlayerMythicPlusRatingSummary = C_PlayerInfo.GetPlayerMythicPlusRatingSummary
|
|
local GetDungeonScoreRarityColor = C_ChallengeMode.GetDungeonScoreRarityColor
|
|
local GetRGBAsBytes = GetRGBAsBytes
|
|
|
|
-- Level string
|
|
local LevelString, LevelString2
|
|
if GameLocale == "ruRU" then
|
|
-- Level string for ruRU
|
|
LevelString = "уровня"
|
|
LevelString2 = "уровень"
|
|
else
|
|
-- Level string for all other locales
|
|
LevelString = string.lower(TOOLTIP_UNIT_LEVEL:gsub("%%s",".+"))
|
|
LevelString2 = ""
|
|
end
|
|
|
|
-- Tag locale (code construction from tiplang)
|
|
local ttYou, ttLevel, ttBoss, ttElite, ttRare, ttRareElite, ttRareBoss, ttTarget
|
|
if GameLocale == "zhCN" then ttYou = "您" ; ttLevel = "等级" ; ttBoss = "首领" ; ttElite = "精英" ; ttRare = "精良" ; ttRareElite = "精良 精英" ; ttRareBoss = "精良 首领" ; ttTarget = "目标"
|
|
elseif GameLocale == "zhTW" then ttYou = "您" ; ttLevel = "等級" ; ttBoss = "首領" ; ttElite = "精英" ; ttRare = "精良" ; ttRareElite = "精良 精英" ; ttRareBoss = "精良 首領" ; ttTarget = "目標"
|
|
elseif GameLocale == "ruRU" then ttYou = "ВЫ" ; ttLevel = "Уровень" ; ttBoss = "босс" ; ttElite = "элита" ; ttRare = "Редкое" ; ttRareElite = "Редкое элита" ; ttRareBoss = "Редкое босс" ; ttTarget = "Цель"
|
|
elseif GameLocale == "koKR" then ttYou = "당신" ; ttLevel = "레벨" ; ttBoss = "우두머리" ; ttElite = "정예" ; ttRare = "희귀" ; ttRareElite = "희귀 정예" ; ttRareBoss = "희귀 우두머리" ; ttTarget = "대상"
|
|
elseif GameLocale == "esMX" then ttYou = "TÚ" ; ttLevel = "Nivel" ; ttBoss = "Jefe" ; ttElite = "Élite" ; ttRare = "Raro" ; ttRareElite = "Raro Élite" ; ttRareBoss = "Raro Jefe" ; ttTarget = "Objetivo"
|
|
elseif GameLocale == "ptBR" then ttYou = "VOCÊ" ; ttLevel = "Nível" ; ttBoss = "Chefe" ; ttElite = "Elite" ; ttRare = "Raro" ; ttRareElite = "Raro Elite" ; ttRareBoss = "Raro Chefe" ; ttTarget = "Alvo"
|
|
elseif GameLocale == "deDE" then ttYou = "SIE" ; ttLevel = "Stufe" ; ttBoss = "Boss" ; ttElite = "Elite" ; ttRare = "Selten" ; ttRareElite = "Selten Elite" ; ttRareBoss = "Selten Boss" ; ttTarget = "Ziel"
|
|
elseif GameLocale == "esES" then ttYou = "TÚ" ; ttLevel = "Nivel" ; ttBoss = "Jefe" ; ttElite = "Élite" ; ttRare = "Raro" ; ttRareElite = "Raro Élite" ; ttRareBoss = "Raro Jefe" ; ttTarget = "Objetivo"
|
|
elseif GameLocale == "frFR" then ttYou = "TOI" ; ttLevel = "Niveau" ; ttBoss = "Boss" ; ttElite = "Élite" ; ttRare = "Rare" ; ttRareElite = "Rare Élite" ; ttRareBoss = "Rare Boss" ; ttTarget = "Cible"
|
|
elseif GameLocale == "itIT" then ttYou = "TU" ; ttLevel = "Livello" ; ttBoss = "Boss" ; ttElite = "Élite" ; ttRare = "Raro" ; ttRareElite = "Raro Élite" ; ttRareBoss = "Raro Boss" ; ttTarget = "Bersaglio"
|
|
else ttYou = "YOU" ; ttLevel = "Level" ; ttBoss = "Boss" ; ttElite = "Elite" ; ttRare = "Rare" ; ttRareElite = "Rare Elite" ; ttRareBoss = "Rare Boss" ; ttTarget = "Target"
|
|
end
|
|
|
|
-- Show tooltip
|
|
local function ShowTip(self)
|
|
|
|
-- Required for Dragonflight (or not self:IsTooltipType(Enum.TooltipDataType.Unit))
|
|
if self ~= GameTooltip then return end
|
|
|
|
-- Do nothing if CTRL, SHIFT and ALT are being held
|
|
if IsControlKeyDown() and IsAltKeyDown() and IsShiftKeyDown() then
|
|
return
|
|
end
|
|
|
|
-- Get unit information
|
|
if WorldFrame:IsMouseMotionFocus() then
|
|
LT["Unit"] = "mouseover"
|
|
-- Hide and quit if tips should be hidden during combat
|
|
if LeaPlusLC["TipHideInCombat"] == "On" and UnitAffectingCombat("player") then
|
|
if not IsShiftKeyDown() or LeaPlusLC["TipHideShiftOverride"] == "Off" then
|
|
GameTooltip:Hide()
|
|
return
|
|
end
|
|
end
|
|
else
|
|
LT["Unit"] = select(2, GameTooltip:GetUnit())
|
|
if not (LT["Unit"]) then return end
|
|
end
|
|
|
|
-- Quit if unit has no reaction to player
|
|
LT["Reaction"] = UnitReaction(LT["Unit"], "player") or nil
|
|
if not LT["Reaction"] then
|
|
return
|
|
end
|
|
|
|
-- Quit if unit is a wild pet
|
|
if UnitIsWildBattlePet(LT["Unit"]) then return end
|
|
|
|
-- Setup variables
|
|
LT["TipUnitName"], LT["TipUnitRealm"] = UnitName(LT["Unit"])
|
|
LT["TipIsPlayer"] = UnitIsPlayer(LT["Unit"])
|
|
LT["UnitLevel"] = UnitEffectiveLevel(LT["Unit"])
|
|
LT["RealLevel"] = UnitLevel(LT["Unit"])
|
|
LT["UnitClass"] = UnitClassBase(LT["Unit"])
|
|
LT["PlayerControl"] = UnitPlayerControlled(LT["Unit"])
|
|
LT["PlayerRace"] = UnitRace(LT["Unit"])
|
|
|
|
-- Get guild information
|
|
if LT["TipIsPlayer"] then
|
|
local unitGuild, unitRank = GetGuildInfo(LT["Unit"])
|
|
if unitGuild and unitRank then
|
|
-- Unit is guilded
|
|
if LT["ColorBlind"] == "1" then
|
|
LT["GuildLine"], LT["InfoLine"], LT["SpecLine"] = 2, 4, 5
|
|
else
|
|
LT["GuildLine"], LT["InfoLine"], LT["SpecLine"] = 2, 3, 4
|
|
end
|
|
LT["GuildName"], LT["GuildRank"] = unitGuild, unitRank
|
|
else
|
|
-- Unit is not guilded
|
|
LT["GuildName"] = nil
|
|
if LT["ColorBlind"] == "1" then
|
|
LT["GuildLine"], LT["InfoLine"], LT["SpecLine"] = 0, 3, 4
|
|
else
|
|
LT["GuildLine"], LT["InfoLine"], LT["SpecLine"] = 0, 2, 3
|
|
end
|
|
end
|
|
-- Lower information and specialisation lines if unit is charmed
|
|
if UnitIsCharmed(LT["Unit"]) then
|
|
LT["InfoLine"] = LT["InfoLine"] + 1
|
|
LT["SpecLine"] = LT["SpecLine"] + 1
|
|
end
|
|
-- Quit if gametooltip spec line doesn't exist or has no text (such as Akunda the Nimble in Vol'dun)
|
|
if not _G["GameTooltipTextLeft" .. LT["SpecLine"]] or not _G["GameTooltipTextLeft" .. LT["SpecLine"]]:GetText() then return end
|
|
end
|
|
|
|
-- Determine class color
|
|
if LT["UnitClass"] then
|
|
-- Define male or female (for certain locales)
|
|
LT["Sex"] = UnitSex(LT["Unit"])
|
|
if LT["Sex"] == 2 then
|
|
LT["Class"] = TipMClass[LT["UnitClass"]]
|
|
else
|
|
LT["Class"] = TipFClass[LT["UnitClass"]]
|
|
end
|
|
-- Define class color
|
|
LT["ClassCol"] = LeaPlusLC["RaidColors"][LT["UnitClass"]]
|
|
LT["LpTipClassColor"] = "|cff" .. string.format("%02x%02x%02x", LT["ClassCol"].r * 255, LT["ClassCol"].g * 255, LT["ClassCol"].b * 255)
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Name line
|
|
----------------------------------------------------------------------
|
|
|
|
if ((LT["TipIsPlayer"]) or (LT["PlayerControl"])) or LT["Reaction"] > 4 then
|
|
|
|
-- If it's a player show name in class color
|
|
if LT["TipIsPlayer"] then
|
|
LT["NameColor"] = LT["LpTipClassColor"]
|
|
else
|
|
-- If not, set to green or blue depending on PvP status
|
|
if UnitIsPVP(LT["Unit"]) then
|
|
LT["NameColor"] = "|cff00ff00"
|
|
else
|
|
LT["NameColor"] = "|cff00aaff"
|
|
end
|
|
end
|
|
|
|
-- Show name
|
|
LT["NameText"] = UnitPVPName(LT["Unit"]) or LT["TipUnitName"]
|
|
if LT["NameText"] == "" then LT["NameText"] = LT["TipUnitName"] end -- Needed because some units (Demolition Fan, 237523) return empty strings for UnitPVPName
|
|
|
|
-- Show realm
|
|
if LT["TipUnitRealm"] and LT["TipUnitRealm"] ~= "" then
|
|
LT["NameText"] = LT["NameText"] .. " - " .. LT["TipUnitRealm"]
|
|
end
|
|
|
|
-- Show dead units in grey
|
|
if UnitIsDeadOrGhost(LT["Unit"]) then
|
|
LT["NameColor"] = "|c88888888"
|
|
end
|
|
|
|
-- Show mythic score
|
|
--if LT["TipIsPlayer"] and LeaPlusLC["TipShowMythic"] == "On" then
|
|
-- LT["MythicScore"] = GetPlayerMythicPlusRatingSummary(LT["Unit"]).currentSeasonScore
|
|
-- if LT["MythicScore"] > 0 then
|
|
-- LT["MythicColor"] = string.format('%02x%02x%02x', GetDungeonScoreRarityColor(GetPlayerMythicPlusRatingSummary(LT["Unit"]).currentSeasonScore):GetRGBAsBytes())
|
|
-- LT["NameText"] = LT["NameText"] .. " |cff" .. LT["MythicColor"] .. "(" .. LT["MythicScore"] .. ")|r"
|
|
-- end
|
|
--end
|
|
|
|
-- Show name line
|
|
_G["GameTooltipTextLeft1"]:SetText(LT["NameColor"] .. LT["NameText"] .. "|cffffffff|r")
|
|
|
|
elseif UnitIsDeadOrGhost(LT["Unit"]) then
|
|
|
|
-- Show grey name for other dead units
|
|
_G["GameTooltipTextLeft1"]:SetText("|c88888888" .. (_G["GameTooltipTextLeft1"]:GetText() or "") .. "|cffffffff|r")
|
|
return
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Guild line
|
|
----------------------------------------------------------------------
|
|
|
|
if LT["TipIsPlayer"] and LT["GuildName"] then
|
|
|
|
-- Show guild line
|
|
if UnitIsInMyGuild(LT["Unit"]) then
|
|
if LeaPlusLC["TipShowRank"] == "On" then
|
|
_G["GameTooltipTextLeft" .. LT["GuildLine"]]:SetText("|c00aaaaff" .. LT["GuildName"] .. " - " .. LT["GuildRank"] .. "|r")
|
|
else
|
|
_G["GameTooltipTextLeft" .. LT["GuildLine"]]:SetText("|c00aaaaff" .. LT["GuildName"] .. "|cffffffff|r")
|
|
end
|
|
else
|
|
if LeaPlusLC["TipShowOtherRank"] == "On" then
|
|
_G["GameTooltipTextLeft" .. LT["GuildLine"]]:SetText("|c00aaaaff" .. LT["GuildName"] .. " - " .. LT["GuildRank"] .. "|r")
|
|
else
|
|
_G["GameTooltipTextLeft" .. LT["GuildLine"]]:SetText("|c00aaaaff" .. LT["GuildName"] .. "|cffffffff|r")
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Information line (level, class, race)
|
|
----------------------------------------------------------------------
|
|
|
|
if LT["TipIsPlayer"] then
|
|
|
|
if GameLocale == "ruRU" then
|
|
|
|
LT["InfoText"], LT["SpecText"] = "", ""
|
|
|
|
-- Show race
|
|
if LT["PlayerRace"] then
|
|
LT["InfoText"] = LT["InfoText"] .. LT["PlayerRace"] .. ","
|
|
end
|
|
|
|
-- Show specialisation
|
|
-- LT["InfoText"] = LT["InfoText"] .. " " .. LT["LpTipClassColor"] .. LT["Class"] .. "|r " or LT["InfoText"] .. "|r "
|
|
LT["SpecText"] = _G["GameTooltipTextLeft" .. LT["SpecLine"]]:GetText()
|
|
_G["GameTooltipTextLeft" .. LT["SpecLine"]]:SetText(LT["LpTipClassColor"] .. LT["SpecText"] .. "|r")
|
|
|
|
-- Show level
|
|
if LT["Reaction"] < 5 then
|
|
if LT["UnitLevel"] == -1 then
|
|
LT["InfoText"] = LT["InfoText"] .. ("|cffff3333" .. "??-ro" .. " " .. ttLevel .. "|cffffffff")
|
|
else
|
|
LT["LevelDifficulty"] = C_PlayerInfo.GetContentDifficultyCreatureForPlayer(LT["Unit"])
|
|
LT["LevelColor"] = GetDifficultyColor(LT["LevelDifficulty"])
|
|
LT["LevelColor"] = string.format('%02x%02x%02x', LT["LevelColor"].r * 255, LT["LevelColor"].g * 255, LT["LevelColor"].b * 255)
|
|
LT["InfoText"] = LT["InfoText"] .. ("|cff" .. LT["LevelColor"] .. LT["UnitLevel"] .. LT["LevelLocale"] .. "|cffffffff")
|
|
end
|
|
else
|
|
if LT["UnitLevel"] ~= LT["RealLevel"] then
|
|
LT["InfoText"] = LT["InfoText"] .. LT["UnitLevel"] .. " (" .. LT["RealLevel"] .. ") " .. LT["LevelLocale"]
|
|
else
|
|
LT["InfoText"] = LT["InfoText"] .. LT["UnitLevel"] .. LT["LevelLocale"]
|
|
end
|
|
end
|
|
|
|
-- Show information line
|
|
_G["GameTooltipTextLeft" .. LT["InfoLine"]]:SetText(LT["InfoText"] .. "|cffffffff|r")
|
|
|
|
else
|
|
|
|
-- Show level
|
|
if LT["Reaction"] < 5 then
|
|
if LT["UnitLevel"] == -1 then
|
|
LT["InfoText"] = ("|cffff3333" .. ttLevel .. " ??|cffffffff")
|
|
else
|
|
LT["LevelDifficulty"] = C_PlayerInfo.GetContentDifficultyCreatureForPlayer(LT["Unit"])
|
|
LT["LevelColor"] = GetDifficultyColor(LT["LevelDifficulty"])
|
|
LT["LevelColor"] = string.format('%02x%02x%02x', LT["LevelColor"].r * 255, LT["LevelColor"].g * 255, LT["LevelColor"].b * 255)
|
|
LT["InfoText"] = ("|cff" .. LT["LevelColor"] .. LT["LevelLocale"] .. " " .. LT["UnitLevel"] .. "|cffffffff")
|
|
end
|
|
else
|
|
if LT["UnitLevel"] ~= LT["RealLevel"] then
|
|
LT["InfoText"] = LT["LevelLocale"] .. " " .. LT["UnitLevel"] .. " (" .. LT["RealLevel"] .. ")"
|
|
else
|
|
LT["InfoText"] = LT["LevelLocale"] .. " " .. LT["UnitLevel"]
|
|
end
|
|
end
|
|
|
|
-- Show race
|
|
if LT["PlayerRace"] then
|
|
LT["InfoText"] = LT["InfoText"] .. " " .. LT["PlayerRace"]
|
|
end
|
|
|
|
-- Show specialisation
|
|
-- LT["InfoText"] = LT["InfoText"] .. " " .. LT["LpTipClassColor"] .. LT["Class"] or LT["InfoText"]
|
|
LT["SpecText"] = _G["GameTooltipTextLeft" .. LT["SpecLine"]]:GetText()
|
|
_G["GameTooltipTextLeft" .. LT["SpecLine"]]:SetText(LT["LpTipClassColor"] .. LT["SpecText"] .. "|r")
|
|
|
|
-- Show information line
|
|
_G["GameTooltipTextLeft" .. LT["InfoLine"]]:SetText(LT["InfoText"] .. "|cffffffff|r")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Mob name in brighter red (alive) and steel blue (tap denied)
|
|
----------------------------------------------------------------------
|
|
|
|
if not (LT["TipIsPlayer"]) and LT["Reaction"] < 4 and not (LT["PlayerControl"]) then
|
|
if UnitIsTapDenied(LT["Unit"]) then
|
|
LT["NameText"] = "|c8888bbbb" .. LT["TipUnitName"] .. "|r"
|
|
else
|
|
LT["NameText"] = "|cffff3333" .. LT["TipUnitName"] .. "|r"
|
|
end
|
|
_G["GameTooltipTextLeft1"]:SetText(LT["NameText"])
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Mob level in color (neutral or lower)
|
|
----------------------------------------------------------------------
|
|
|
|
if UnitCanAttack(LT["Unit"], "player") and not (LT["TipIsPlayer"]) and LT["Reaction"] < 5 and not (LT["PlayerControl"]) then
|
|
|
|
-- Find the level line
|
|
LT["MobInfoLine"] = 0
|
|
local line2, line3, line4
|
|
if _G["GameTooltipTextLeft2"] then line2 = _G["GameTooltipTextLeft2"]:GetText() end
|
|
if _G["GameTooltipTextLeft3"] then line3 = _G["GameTooltipTextLeft3"]:GetText() end
|
|
if _G["GameTooltipTextLeft4"] then line4 = _G["GameTooltipTextLeft4"]:GetText() end
|
|
if GameLocale == "ruRU" then -- Additional check for ruRU
|
|
if line2 and string.lower(line2):find(LevelString2) then LT["MobInfoLine"] = 2 end
|
|
if line3 and string.lower(line3):find(LevelString2) then LT["MobInfoLine"] = 3 end
|
|
if line4 and string.lower(line4):find(LevelString2) then LT["MobInfoLine"] = 4 end
|
|
end
|
|
if line2 and string.lower(line2):find(LevelString) then LT["MobInfoLine"] = 2 end
|
|
if line3 and string.lower(line3):find(LevelString) then LT["MobInfoLine"] = 3 end
|
|
if line4 and string.lower(line4):find(LevelString) then LT["MobInfoLine"] = 4 end
|
|
|
|
-- Show level line
|
|
if LT["MobInfoLine"] > 1 then
|
|
|
|
if GameLocale == "ruRU" then
|
|
|
|
LT["InfoText"] = ""
|
|
|
|
-- Show creature type and classification
|
|
LT["CreatureType"] = UnitCreatureType(LT["Unit"])
|
|
if (LT["CreatureType"]) and not (LT["CreatureType"] == "Not specified") then
|
|
LT["InfoText"] = LT["InfoText"] .. "|cffffffff" .. LT["CreatureType"] .. "|cffffffff "
|
|
end
|
|
|
|
-- Level ?? mob
|
|
if LT["UnitLevel"] == -1 then
|
|
LT["InfoText"] = LT["InfoText"] .. "|cffff3333" .. "??-ro " .. ttLevel .. "|cffffffff "
|
|
|
|
-- Mobs within level range
|
|
else
|
|
LT["MobDifficulty"] = C_PlayerInfo.GetContentDifficultyCreatureForPlayer(LT["Unit"])
|
|
LT["MobColor"] = GetDifficultyColor(LT["MobDifficulty"])
|
|
LT["MobColor"] = string.format('%02x%02x%02x', LT["MobColor"].r * 255, LT["MobColor"].g * 255, LT["MobColor"].b * 255)
|
|
LT["InfoText"] = LT["InfoText"] .. "|cff" .. LT["MobColor"] .. LT["UnitLevel"] .. LT["LevelLocale"] .. "|cffffffff "
|
|
end
|
|
|
|
else
|
|
|
|
-- Level ?? mob
|
|
if LT["UnitLevel"] == -1 then
|
|
LT["InfoText"] = "|cffff3333" .. ttLevel .. " ??|cffffffff "
|
|
|
|
-- Mobs within level range
|
|
else
|
|
LT["MobDifficulty"] = C_PlayerInfo.GetContentDifficultyCreatureForPlayer(LT["Unit"])
|
|
LT["MobColor"] = GetDifficultyColor(LT["MobDifficulty"])
|
|
LT["MobColor"] = string.format('%02x%02x%02x', LT["MobColor"].r * 255, LT["MobColor"].g * 255, LT["MobColor"].b * 255)
|
|
LT["InfoText"] = "|cff" .. LT["MobColor"] .. LT["LevelLocale"] .. " " .. LT["UnitLevel"] .. "|cffffffff "
|
|
end
|
|
|
|
-- Show creature type and classification
|
|
LT["CreatureType"] = UnitCreatureType(LT["Unit"])
|
|
if (LT["CreatureType"]) and not (LT["CreatureType"] == "Not specified") then
|
|
LT["InfoText"] = LT["InfoText"] .. "|cffffffff" .. LT["CreatureType"] .. "|cffffffff "
|
|
end
|
|
|
|
end
|
|
|
|
-- Rare, elite and boss mobs
|
|
LT["Special"] = UnitClassification(LT["Unit"])
|
|
if LT["Special"] then
|
|
if LT["Special"] == "elite" then
|
|
if strfind(_G["GameTooltipTextLeft" .. LT["MobInfoLine"]]:GetText(), "(" .. ttBoss .. ")") then
|
|
LT["Special"] = "(" .. ttBoss .. ")"
|
|
else
|
|
LT["Special"] = "(" .. ttElite .. ")"
|
|
end
|
|
elseif LT["Special"] == "rare" then
|
|
LT["Special"] = "|c00e066ff(" .. ttRare .. ")"
|
|
elseif LT["Special"] == "rareelite" then
|
|
if strfind(_G["GameTooltipTextLeft" .. LT["MobInfoLine"]]:GetText(), "(" .. ttBoss .. ")") then
|
|
LT["Special"] = "|c00e066ff(" .. ttRareBoss .. ")"
|
|
else
|
|
LT["Special"] = "|c00e066ff(" .. ttRareElite .. ")"
|
|
end
|
|
elseif LT["Special"] == "worldboss" then
|
|
LT["Special"] = "(" .. ttBoss .. ")"
|
|
elseif LT["UnitLevel"] == -1 and LT["Special"] == "normal" and strfind(_G["GameTooltipTextLeft" .. LT["MobInfoLine"]]:GetText(), "(" .. ttBoss .. ")") then
|
|
LT["Special"] = "(" .. ttBoss .. ")"
|
|
else
|
|
LT["Special"] = nil
|
|
end
|
|
|
|
if (LT["Special"]) then
|
|
LT["InfoText"] = LT["InfoText"] .. LT["Special"]
|
|
end
|
|
end
|
|
|
|
-- Show mob info line
|
|
_G["GameTooltipTextLeft" .. LT["MobInfoLine"]]:SetText(LT["InfoText"])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Backdrop color
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["TipBackSimple"] == "On" then
|
|
LT["TipFaction"] = UnitFactionGroup(LT["Unit"])
|
|
if UnitCanAttack("player", LT["Unit"]) and not (UnitIsDeadOrGhost(LT["Unit"])) and not (LT["TipFaction"] == nil) and not (LT["TipFaction"] == UnitFactionGroup("player")) then
|
|
-- Hostile faction
|
|
GameTooltip.NineSlice:SetCenterColor(0.5, 0.0, 0.0)
|
|
else
|
|
-- Friendly faction
|
|
GameTooltip.NineSlice:SetCenterColor(0.0, 0.0, 0.5)
|
|
end
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show target
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["TipShowTarget"] == "On" then
|
|
|
|
-- Get target
|
|
LT["Target"] = UnitName(LT["Unit"] .. "target");
|
|
|
|
-- If target doesn't exist, quit
|
|
if LT["Target"] == nil or LT["Target"] == "" then return end
|
|
|
|
-- If target is you, set target to YOU
|
|
if (UnitIsUnit(LT["Target"], "player")) then
|
|
LT["Target"] = ("|c12ff4400" .. ttYou)
|
|
|
|
-- If it's not you, but it's a player, show target in class color
|
|
elseif UnitIsPlayer(LT["Unit"] .. "target") then
|
|
LT["TargetBase"] = UnitClassBase(LT["Unit"] .. "target")
|
|
LT["TargetCol"] = LeaPlusLC["RaidColors"][LT["TargetBase"]]
|
|
LT["TargetCol"] = "|cff" .. string.format('%02x%02x%02x', LT["TargetCol"].r * 255, LT["TargetCol"].g * 255, LT["TargetCol"].b * 255)
|
|
LT["Target"] = (LT["TargetCol"] .. LT["Target"])
|
|
|
|
end
|
|
|
|
-- Add target line
|
|
GameTooltip:AddLine(ttTarget .. ": " .. LT["Target"])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, ShowTip)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Move chat editbox to top
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["MoveChatEditBoxToTop"] == "On" and not LeaLockList["MoveChatEditBoxToTop"] then
|
|
|
|
-- Set options for normal chat frames
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
-- Position the editbox
|
|
_G["ChatFrame" .. i .. "EditBox"]:ClearAllPoints();
|
|
_G["ChatFrame" .. i .. "EditBox"]:SetPoint("TOPLEFT", _G["ChatFrame" .. i], 0, 0);
|
|
_G["ChatFrame" .. i .. "EditBox"]:SetWidth(_G["ChatFrame" .. i]:GetWidth());
|
|
-- Ensure editbox width matches chatframe width
|
|
_G["ChatFrame" .. i]:HookScript("OnSizeChanged", function()
|
|
_G["ChatFrame" .. i .. "EditBox"]:SetWidth(_G["ChatFrame" .. i]:GetWidth())
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- Do the functions above for other chat frames (pet battles, whispers, etc)
|
|
hooksecurefunc("FCF_OpenTemporaryWindow", function()
|
|
|
|
local cf = FCF_GetCurrentChatFrame():GetName() or nil
|
|
if cf then
|
|
|
|
-- Position the editbox
|
|
_G[cf .. "EditBox"]:ClearAllPoints();
|
|
_G[cf .. "EditBox"]:SetPoint("TOPLEFT", cf, "TOPLEFT", 0, 0);
|
|
_G[cf .. "EditBox"]:SetWidth(_G[cf]:GetWidth());
|
|
|
|
-- Ensure editbox width matches chatframe width
|
|
_G[cf]:HookScript("OnSizeChanged", function()
|
|
_G[cf .. "EditBox"]:SetWidth(_G[cf]:GetWidth())
|
|
end)
|
|
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Show borders
|
|
----------------------------------------------------------------------
|
|
|
|
if LeaPlusLC["ShowBorders"] == "On" then
|
|
|
|
-- Create border textures
|
|
local BordTop = WorldFrame:CreateTexture(nil, "ARTWORK"); BordTop:SetColorTexture(0, 0, 0, 1); BordTop:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0); BordTop:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0)
|
|
local BordBot = WorldFrame:CreateTexture(nil, "ARTWORK"); BordBot:SetColorTexture(0, 0, 0, 1); BordBot:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0); BordBot:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0)
|
|
local BordLeft = WorldFrame:CreateTexture(nil, "ARTWORK"); BordLeft:SetColorTexture(0, 0, 0, 1); BordLeft:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0); BordLeft:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0)
|
|
local BordRight = WorldFrame:CreateTexture(nil, "ARTWORK"); BordRight:SetColorTexture(0, 0, 0, 1); BordRight:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0); BordRight:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0)
|
|
|
|
-- Create border configuration panel
|
|
local bordersPanel = LeaPlusLC:CreatePanel("Show borders", "bordersPanel")
|
|
|
|
-- Function to set border parameters
|
|
local function RefreshBorders()
|
|
|
|
-- Set border size and transparency
|
|
BordTop:SetHeight(LeaPlusLC["BordersTop"]); BordTop:SetAlpha(1 - LeaPlusLC["BordersAlpha"])
|
|
BordBot:SetHeight(LeaPlusLC["BordersBottom"]); BordBot:SetAlpha(1 - LeaPlusLC["BordersAlpha"])
|
|
BordLeft:SetWidth(LeaPlusLC["BordersLeft"]); BordLeft:SetAlpha(1 - LeaPlusLC["BordersAlpha"])
|
|
BordRight:SetWidth(LeaPlusLC["BordersRight"]); BordRight:SetAlpha(1 - LeaPlusLC["BordersAlpha"])
|
|
|
|
-- Show formatted slider value
|
|
LeaPlusCB["BordersAlpha"].f:SetFormattedText("%.0f%%", LeaPlusLC["BordersAlpha"] * 100)
|
|
|
|
end
|
|
|
|
-- Create slider controls
|
|
LeaPlusLC:MakeTx(bordersPanel, "Top", 16, -72)
|
|
LeaPlusLC:MakeSL(bordersPanel, "BordersTop", "Drag to set the size of the top border.", 0, 300, 5, 16, -92, "%.0f")
|
|
LeaPlusCB["BordersTop"]:HookScript("OnValueChanged", RefreshBorders)
|
|
|
|
LeaPlusLC:MakeTx(bordersPanel, "Bottom", 16, -132)
|
|
LeaPlusLC:MakeSL(bordersPanel, "BordersBottom", "Drag to set the size of the bottom border.", 0, 300, 5, 16, -152, "%.0f")
|
|
LeaPlusCB["BordersBottom"]:HookScript("OnValueChanged", RefreshBorders)
|
|
|
|
LeaPlusLC:MakeTx(bordersPanel, "Left", 186, -72)
|
|
LeaPlusLC:MakeSL(bordersPanel, "BordersLeft", "Drag to set the size of the left border.", 0, 300, 5, 186, -92, "%.0f")
|
|
LeaPlusCB["BordersLeft"]:HookScript("OnValueChanged", RefreshBorders)
|
|
|
|
LeaPlusLC:MakeTx(bordersPanel, "Right", 186, -132)
|
|
LeaPlusLC:MakeSL(bordersPanel, "BordersRight", "Drag to set the size of the right border.", 0, 300, 5, 186, -152, "%.0f")
|
|
LeaPlusCB["BordersRight"]:HookScript("OnValueChanged", RefreshBorders)
|
|
|
|
LeaPlusLC:MakeTx(bordersPanel, "Transparency", 356, -132)
|
|
LeaPlusLC:MakeSL(bordersPanel, "BordersAlpha", "Drag to set the transparency of the borders.", 0, 0.9, 0.1, 356, -152, "%.1f")
|
|
LeaPlusCB["BordersAlpha"]:HookScript("OnValueChanged", RefreshBorders)
|
|
|
|
-- Help button hidden
|
|
bordersPanel.h:Hide()
|
|
|
|
-- Back button handler
|
|
bordersPanel.b:SetScript("OnClick", function()
|
|
bordersPanel:Hide()
|
|
LeaPlusLC["PageF"]:Show()
|
|
LeaPlusLC["Page5"]:Show()
|
|
return
|
|
end)
|
|
|
|
-- Reset button handler
|
|
bordersPanel.r:SetScript("OnClick", function()
|
|
LeaPlusLC["BordersTop"] = 0
|
|
LeaPlusLC["BordersBottom"] = 0
|
|
LeaPlusLC["BordersLeft"] = 0
|
|
LeaPlusLC["BordersRight"] = 0
|
|
LeaPlusLC["BordersAlpha"] = 0
|
|
bordersPanel:Hide(); bordersPanel:Show()
|
|
RefreshBorders()
|
|
end)
|
|
|
|
-- Configuration button handler
|
|
LeaPlusCB["ModBordersBtn"]:SetScript("OnClick", function()
|
|
if IsShiftKeyDown() and IsControlKeyDown() then
|
|
-- Preset profile
|
|
LeaPlusLC["BordersTop"] = 0
|
|
LeaPlusLC["BordersBottom"] = 0
|
|
LeaPlusLC["BordersLeft"] = 0
|
|
LeaPlusLC["BordersRight"] = 0
|
|
LeaPlusLC["BordersAlpha"] = 0.7
|
|
RefreshBorders()
|
|
else
|
|
bordersPanel:Show()
|
|
LeaPlusLC:HideFrames()
|
|
end
|
|
end)
|
|
|
|
-- Set borders on startup
|
|
RefreshBorders()
|
|
|
|
-- Hide borders when cinematic is shown
|
|
hooksecurefunc(CinematicFrame, "Hide", function()
|
|
BordTop:Show(); BordBot:Show(); BordLeft:Show(); BordRight:Show()
|
|
end)
|
|
hooksecurefunc(CinematicFrame, "Show", function()
|
|
BordTop:Hide(); BordBot:Hide(); BordLeft:Hide(); BordRight:Hide()
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Silence rested emotes
|
|
----------------------------------------------------------------------
|
|
|
|
-- Manage emotes
|
|
if LeaPlusLC["NoRestedEmotes"] == "On" then
|
|
|
|
-- Zone table English , French , German , Italian , Russian , S Chinese , Spanish , T Chinese ,
|
|
local zonetable = { "The Halfhill Market" , "Marché de Micolline" , "Der Halbhügelmarkt" , "Il Mercato di Mezzocolle" , "Рынок Полугорья" , "半山市集" , "El Mercado del Alcor" , "半丘市集" ,
|
|
"The Grim Guzzler" , "Le Sinistre écluseur" , "Zum Grimmigen Säufer" , "Torvo Beone" , "Трактир Угрюмый обжора" , "黑铁酒吧" , "Tragapenas" , "黑鐵酒吧" ,
|
|
"The Summer Terrace" , "La terrasse Estivale" , "Die Sommerterrasse" , "Terrazza Estiva" , "Летняя терраса" , "夏之台" , "El Bancal del Verano" , "夏日露臺" ,
|
|
}
|
|
|
|
-- Function to set rested state
|
|
local function UpdateEmoteSound()
|
|
|
|
-- Find character's current zone
|
|
local szone = GetSubZoneText() or "None"
|
|
|
|
-- Find out if emote sounds are disabled or enabled
|
|
local emoset = GetCVar("Sound_EnableEmoteSounds")
|
|
|
|
if IsResting() then
|
|
-- Character is resting so silence emotes
|
|
if emoset ~= "0" then
|
|
SetCVar("Sound_EnableEmoteSounds", "0")
|
|
end
|
|
return
|
|
end
|
|
|
|
-- Traverse zone table and silence emotes if character is in a designated zone
|
|
for k, v in next, zonetable do
|
|
if szone == zonetable[k] then
|
|
if emoset ~= "0" then
|
|
SetCVar("Sound_EnableEmoteSounds", "0")
|
|
end
|
|
return
|
|
end
|
|
end
|
|
|
|
-- Silence emotes if character is in a pet battle
|
|
if C_PetBattles.IsInBattle() then
|
|
if emoset ~= "0" then
|
|
SetCVar("Sound_EnableEmoteSounds", "0")
|
|
end
|
|
return
|
|
end
|
|
|
|
-- If the above didn't return, emote sounds should be enabled
|
|
if emoset ~= "1" then
|
|
SetCVar("Sound_EnableEmoteSounds", "1")
|
|
end
|
|
return
|
|
|
|
end
|
|
|
|
-- Set emote sound when pet battles start and end
|
|
hooksecurefunc("PetBattleFrame_Display", UpdateEmoteSound)
|
|
hooksecurefunc("PetBattleFrame_Remove", UpdateEmoteSound)
|
|
|
|
-- Set emote sound when rest state or zone changes
|
|
local RestEvent = CreateFrame("FRAME")
|
|
RestEvent:RegisterEvent("PLAYER_UPDATE_RESTING")
|
|
RestEvent:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
|
RestEvent:RegisterEvent("ZONE_CHANGED")
|
|
RestEvent:RegisterEvent("ZONE_CHANGED_INDOORS")
|
|
RestEvent:SetScript("OnEvent", UpdateEmoteSound)
|
|
|
|
-- Set sound setting at startup
|
|
UpdateEmoteSound()
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Flares (world markers)
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
local raidTable = {L["Flare: Square"], L["Flare: Triangle"], L["Flare: Diamond"], L["Flare: Cross"], L["Flare: Star"], L["Flare: Circle"], L["Flare: Moon"], L["Flare: Skull"], L["Flare: Clear all"]}
|
|
for i = 1, 9 do
|
|
_G["BINDING_NAME_CLICK " .. "LeaPlusGlobalFlare" .. i ..":LeftButton"] = raidTable[i]
|
|
local btn = CreateFrame("Button", "LeaPlusGlobalFlare" .. i, nil, "SecureActionButtonTemplate")
|
|
btn:SetAttribute("type", "macro")
|
|
if i == 9 then
|
|
btn:SetAttribute("macrotext", "/clearworldmarker 0")
|
|
else
|
|
btn:SetAttribute("macrotext", "/clearworldmarker " .. i .. "\n/worldmarker " .. i)
|
|
end
|
|
-- btn:RegisterForClicks("AnyDown") -- Shadowlands
|
|
btn:RegisterForClicks("AnyUp", "AnyDown") -- Currently needed in Dragonflight
|
|
end
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Frame alignment grid
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Create frame alignment grid
|
|
local grid = CreateFrame('FRAME')
|
|
LeaPlusLC.grid = grid
|
|
grid:Hide()
|
|
grid:SetAllPoints(UIParent)
|
|
local w, h = GetScreenWidth() * UIParent:GetEffectiveScale(), GetScreenHeight() * UIParent:GetEffectiveScale()
|
|
local ratio = w / h
|
|
local sqsize = w / 20
|
|
local wline = floor(sqsize - (sqsize % 2))
|
|
local hline = floor(sqsize / ratio - ((sqsize / ratio) % 2))
|
|
-- Plot vertical lines
|
|
for i = 0, wline do
|
|
local t = LeaPlusLC.grid:CreateTexture(nil, 'BACKGROUND')
|
|
if i == wline / 2 then t:SetColorTexture(1, 0, 0, 0.5) else t:SetColorTexture(0, 0, 0, 0.5) end
|
|
t:SetPoint('TOPLEFT', grid, 'TOPLEFT', i * w / wline - 1, 0)
|
|
t:SetPoint('BOTTOMRIGHT', grid, 'BOTTOMLEFT', i * w / wline + 1, 0)
|
|
end
|
|
-- Plot horizontal lines
|
|
for i = 0, hline do
|
|
local t = LeaPlusLC.grid:CreateTexture(nil, 'BACKGROUND')
|
|
if i == hline / 2 then t:SetColorTexture(1, 0, 0, 0.5) else t:SetColorTexture(0, 0, 0, 0.5) end
|
|
t:SetPoint('TOPLEFT', grid, 'TOPLEFT', 0, -i * h / hline + 1)
|
|
t:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -i * h / hline - 1)
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Media player
|
|
----------------------------------------------------------------------
|
|
|
|
function LeaPlusLC:MediaFunc()
|
|
|
|
-- Create tables for list data
|
|
local ListData, playlist = {}, {}
|
|
local scrollFrame, willPlay, musicHandle, ZonePage, LastPlayed, LastFolder, TempFolder, HeadingOfClickedTrack, LastMusicHandle
|
|
local numButtons = 15
|
|
local uframe = CreateFrame("FRAME")
|
|
|
|
-- These categories will not appear in random track selections
|
|
local randomBannedList = {L["Narration"], L["Cinematics"], "MUS_51_DarkmoonFaire_MerryGoRound_01#34440"}
|
|
|
|
-- Get media table
|
|
local ZoneList = Leatrix_Plus["ZoneList"]
|
|
|
|
-- Show relevant list items
|
|
local function UpdateList()
|
|
local offset = max(0, floor(scrollFrame:GetVerticalScroll() + 0.5))
|
|
for i, button in ipairs(scrollFrame.buttons) do
|
|
local index = offset + i
|
|
if index <= #ListData then
|
|
-- Show zone listing or track listing
|
|
button:SetText(ListData[index].zone or ListData[index])
|
|
-- Set width of highlight texture
|
|
if button:GetTextWidth() > 290 then
|
|
button.t:SetSize(290, 16)
|
|
else
|
|
button.t:SetSize(button:GetTextWidth(), 16)
|
|
end
|
|
-- Show the button
|
|
button:Show()
|
|
-- Hide highlight bar texture by default
|
|
button.s:Hide()
|
|
-- Hide highlight bar if the button is a heading
|
|
if strfind(button:GetText(), "|c") then button.t:Hide() end
|
|
-- Show last played track highlight bar texture
|
|
if LastPlayed == button:GetText() then
|
|
local HeadingOfCurrentFolder = ListData[1]
|
|
if HeadingOfCurrentFolder == HeadingOfClickedTrack then
|
|
button.s:Show()
|
|
end
|
|
end
|
|
-- Show last played folder highlight bar texture
|
|
if LastFolder == button:GetText() then
|
|
button.s:Show()
|
|
end
|
|
-- Set width of highlight bar
|
|
if button:GetTextWidth() > 290 then
|
|
button.s:SetSize(290, 16)
|
|
else
|
|
button.s:SetSize(button:GetTextWidth(), 16)
|
|
end
|
|
-- Limit click to label width
|
|
local bWidth = button:GetFontString():GetStringWidth() or 0
|
|
if bWidth > 290 then bWidth = 290 end
|
|
button:SetHitRectInsets(0, 454 - bWidth, 0, 0)
|
|
-- Disable label click movement
|
|
button:SetPushedTextOffset(0, 0)
|
|
-- Disable word wrap and set width
|
|
button:GetFontString():SetWidth(290)
|
|
button:GetFontString():SetWordWrap(false)
|
|
else
|
|
button:Hide()
|
|
end
|
|
end
|
|
scrollFrame.child:SetSize(200, #ListData + (14*19.6) - 1) --++ LeaSoundsLC.NewPatch
|
|
end
|
|
|
|
-- Give function file level scope (it's used in SetPlusScale to set the highlight bar scale)
|
|
LeaPlusLC.UpdateList = UpdateList
|
|
|
|
-- Right-button click to go back
|
|
local function BackClick()
|
|
-- Return to the current zone list (back button)
|
|
if type(ListData[1]) == "string" then
|
|
-- Strip the color code from the list data
|
|
local nocol = string.gsub(ListData[1], "|cffffd800", "")
|
|
-- Strip the zone
|
|
local backzone = strsplit(":", nocol, 2)
|
|
-- Don't go back if random or search category is being shown
|
|
if backzone == L["Random"] or backzone == L["Search"] then return end
|
|
-- Show the tracklist continent
|
|
if ZoneList[backzone] then ListData = ZoneList[backzone] end
|
|
UpdateList()
|
|
scrollFrame:SetVerticalScroll(ZonePage or 0)
|
|
end
|
|
end
|
|
|
|
-- Function to make navigation menu buttons
|
|
local function MakeButton(where, y)
|
|
local mbtn = CreateFrame("Button", nil, LeaPlusLC["Page9"])
|
|
mbtn:Show()
|
|
mbtn:SetAlpha(1.0)
|
|
mbtn:SetPoint("TOPLEFT", 146, y)
|
|
|
|
-- Create hover texture
|
|
mbtn.t = mbtn:CreateTexture(nil, "BACKGROUND")
|
|
mbtn.t:SetColorTexture(0.3, 0.3, 0.00, 0.8)
|
|
mbtn.t:SetAlpha(0.7)
|
|
mbtn.t:SetAllPoints()
|
|
mbtn.t:Hide()
|
|
|
|
-- Create highlight texture
|
|
mbtn.s = mbtn:CreateTexture(nil, "BACKGROUND")
|
|
mbtn.s:SetColorTexture(0.3, 0.3, 0.00, 0.8)
|
|
mbtn.s:SetAlpha(1.0)
|
|
mbtn.s:SetAllPoints()
|
|
mbtn.s:Hide()
|
|
|
|
-- Create fontstring
|
|
mbtn.f = mbtn:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
mbtn.f:SetPoint('LEFT', 1, 0)
|
|
mbtn.f:SetText(L[where])
|
|
|
|
mbtn:SetScript("OnEnter", function()
|
|
mbtn.t:Show()
|
|
end)
|
|
|
|
mbtn:SetScript("OnLeave", function()
|
|
mbtn.t:Hide()
|
|
end)
|
|
|
|
-- Set button size when shown
|
|
mbtn:SetScript("OnShow", function()
|
|
mbtn:SetSize(mbtn.f:GetStringWidth() + 1, 16)
|
|
end)
|
|
|
|
mbtn:SetScript("OnClick", function()
|
|
-- Show zone listing for clicked item
|
|
ListData = ZoneList[where]
|
|
UpdateList()
|
|
end)
|
|
|
|
return mbtn, mbtn.s
|
|
|
|
end
|
|
|
|
-- Create a table for each button
|
|
local conbtn = {}
|
|
for q, w in pairs(ZoneList) do
|
|
conbtn[q] = {}
|
|
end
|
|
|
|
-- Create buttons
|
|
local function MakeButtonNow(title, anchor)
|
|
conbtn[title], conbtn[title].s = MakeButton(title, height)
|
|
conbtn[title]:ClearAllPoints()
|
|
if title == L["Zones"] then
|
|
-- Set first button position
|
|
conbtn[title]:SetPoint("TOPLEFT", LeaPlusLC["Page9"], "TOPLEFT", 145, -70)
|
|
elseif anchor then
|
|
-- Set subsequent button positions
|
|
conbtn[title]:SetPoint("TOPLEFT", conbtn[anchor], "BOTTOMLEFT", 0, 0)
|
|
conbtn[title].f:SetText(L[title])
|
|
end
|
|
end
|
|
|
|
MakeButtonNow(L["Zones"])
|
|
MakeButtonNow(L["Dungeons"], L["Zones"])
|
|
MakeButtonNow(L["Various"], L["Dungeons"])
|
|
MakeButtonNow(L["Movies"], L["Various"])
|
|
MakeButtonNow(L["Random"], L["Movies"])
|
|
MakeButtonNow(L["Search"]) -- Positioned when search editbox is created
|
|
|
|
-- Show button highlight for clicked button
|
|
for q, w in pairs(ZoneList) do
|
|
if type(w) == "string" and conbtn[w] then
|
|
conbtn[w]:HookScript("OnClick", function()
|
|
-- Hide all button highlights
|
|
for k, v in pairs(ZoneList) do
|
|
if type(v) == "string" and conbtn[v] then
|
|
conbtn[v].s:Hide()
|
|
end
|
|
end
|
|
-- Show clicked button highlight
|
|
conbtn[w].s:Show()
|
|
LeaPlusDB["MusicContinent"] = w
|
|
scrollFrame:SetVerticalScroll(0)
|
|
-- Set TempFolder for listings without folders
|
|
if w == L["Random"] then TempFolder = L["Random"] end
|
|
if w == L["Search"] then TempFolder = L["Search"] end
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- Create scroll bar
|
|
scrollFrame = CreateFrame("ScrollFrame", nil, LeaPlusLC["Page9"], "ScrollFrameTemplate")
|
|
scrollFrame:SetPoint("TOPLEFT", 0, -32)
|
|
scrollFrame:SetPoint("BOTTOMRIGHT", -30, 50)
|
|
scrollFrame:SetPanExtent(1)
|
|
scrollFrame:SetScript("OnVerticalScroll", UpdateList)
|
|
|
|
-- Create the scroll child
|
|
scrollFrame.child = CreateFrame("Frame", nil, scrollFrame)
|
|
scrollFrame:SetScrollChild(scrollFrame.child)
|
|
|
|
-- Add stop button
|
|
local stopBtn = LeaPlusLC:CreateButton("StopMusicBtn", LeaPlusLC["Page9"], "Stop", "TOPLEFT", 146, -292, 0, 25, true, "")
|
|
stopBtn:Hide(); stopBtn:Show()
|
|
LeaPlusLC:LockItem(stopBtn, true)
|
|
stopBtn:SetScript("OnClick", function()
|
|
if musicHandle then
|
|
StopSound(musicHandle)
|
|
musicHandle = nil
|
|
-- Hide highlight bars
|
|
LastPlayed = ""
|
|
LastFolder = ""
|
|
UpdateList()
|
|
end
|
|
-- Cancel sound file music timer
|
|
if LeaPlusLC.TrackTimer then LeaPlusLC.TrackTimer:Cancel() end
|
|
-- Lock button and unregister next track events
|
|
LeaPlusLC:LockItem(stopBtn, true)
|
|
uframe:UnregisterEvent("SOUNDKIT_FINISHED")
|
|
uframe:UnregisterEvent("LOADING_SCREEN_DISABLED")
|
|
end)
|
|
|
|
-- Store currently playing track number
|
|
local tracknumber = 1
|
|
|
|
-- Function to play a track and show the static highlight bar
|
|
local function PlayTrack()
|
|
-- Play tracks
|
|
if musicHandle then StopSound(musicHandle) end
|
|
local file, soundID, trackTime
|
|
if playlist[tracknumber]:match("([^,]+)%#([^,]+)%#([^,]+)") then
|
|
-- Music file with track time
|
|
file, soundID, trackTime = playlist[tracknumber]:match("([^,]+)%#([^,]+)%#([^,]+)")
|
|
willPlay, musicHandle = PlaySoundFile(soundID, "Master", false, true)
|
|
else
|
|
-- Sound kit without track time
|
|
file, soundID = playlist[tracknumber]:match("([^,]+)%#([^,]+)")
|
|
willPlay, musicHandle = PlaySound(soundID, "Master", false, true)
|
|
end
|
|
-- Cancel existing music timer for a sound file
|
|
if LeaPlusLC.TrackTimer then LeaPlusLC.TrackTimer:Cancel() end
|
|
if playlist[tracknumber]:match("([^,]+)%#([^,]+)%#([^,]+)") then
|
|
-- Track is a sound file with track time so create track timer
|
|
LeaPlusLC.TrackTimer = C_Timer.NewTimer(trackTime + 1, function()
|
|
if musicHandle then StopSound(musicHandle) end
|
|
if tracknumber == #playlist then
|
|
-- Playlist is at the end, restart from first track
|
|
tracknumber = 1
|
|
end
|
|
PlayTrack()
|
|
end)
|
|
end
|
|
-- Store its handle for later use
|
|
LastMusicHandle = musicHandle
|
|
LastPlayed = playlist[tracknumber]
|
|
tracknumber = tracknumber + 1
|
|
-- Show static highlight bar
|
|
for index = 1, numButtons do
|
|
local button = scrollFrame.buttons[index]
|
|
local item = button:GetText()
|
|
if item then
|
|
if item:match("([^,]+)%#([^,]+)%#([^,]+)") then
|
|
-- Music file with track time
|
|
local item, void, void = item:match("([^,]+)%#([^,]+)%#([^,]+)")
|
|
if item then
|
|
if item == file and LastFolder == TempFolder then
|
|
button.s:Show()
|
|
else
|
|
button.s:Hide()
|
|
end
|
|
end
|
|
else
|
|
-- Sound kit without track time
|
|
local item, void = item:match("([^,]+)%#([^,]+)")
|
|
if item then
|
|
if item == file and LastFolder == TempFolder then
|
|
button.s:Show()
|
|
else
|
|
button.s:Hide()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Create editbox for search
|
|
local sBox = LeaPlusLC:CreateEditBox("MusicSearchBox", LeaPlusLC["Page9"], 78, 10, "TOPLEFT", 150, -260, "MusicSearchBox", "MusicSearchBox")
|
|
sBox:SetMaxLetters(50)
|
|
|
|
-- Position search button above editbox
|
|
conbtn[L["Search"]]:ClearAllPoints()
|
|
conbtn[L["Search"]]:SetPoint("BOTTOMLEFT", sBox, "TOPLEFT", -4, 0)
|
|
|
|
-- Set initial search data
|
|
for q, w in pairs(ZoneList) do
|
|
if conbtn[w] then
|
|
conbtn[w]:HookScript("OnClick", function()
|
|
if w == L["Search"] then
|
|
ListData[1] = "|cffffd800" .. L["Search"]
|
|
if #ListData == 1 then
|
|
ListData[2] = "|cffffffaa{" .. L["enter zone or track name"] .. "}"
|
|
end
|
|
UpdateList()
|
|
else
|
|
sBox:ClearFocus()
|
|
end
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- Function to show search results
|
|
local function ShowSearchResults()
|
|
-- Get unescaped editbox text
|
|
local searchText = gsub(strlower(sBox:GetText()), '(['..("%^$().[]*+-?"):gsub("(.)", "%%%1")..'])', "%%%1")
|
|
-- Wipe the track listing
|
|
wipe(ListData)
|
|
-- Set the track list heading
|
|
ListData[1] = "|cffffd800" .. L["Search"]
|
|
-- Show the subheading only if no search results are being shown
|
|
if searchText == "" then
|
|
ListData[2] = "|cffffffaa{" .. L["enter zone or track name"] .. "}"
|
|
else
|
|
ListData[2] = ""
|
|
end
|
|
-- Traverse music listing and populate ListData
|
|
if searchText ~= "" then
|
|
local word1, word2, word3, word4, word5 = strsplit(" ", (strtrim(searchText):gsub("%s+", " ")))
|
|
local hash = {}
|
|
local trackCount = 0
|
|
for i, e in pairs(ZoneList) do
|
|
if ZoneList[e] then
|
|
for a, b in pairs(ZoneList[e]) do
|
|
if b.tracks then
|
|
for k, v in pairs(b.tracks) do
|
|
if (strfind(v, "#") or strfind(v, "|r")) and (strfind(strlower(v), word1) or strfind(strlower(b.zone), word1) or strfind(strlower(b.category), word1)) then
|
|
if not word2 or word2 ~= "" and (strfind(strlower(v), word2) or strfind(strlower(b.zone), word2) or strfind(strlower(b.category), word2)) then
|
|
if not word3 or word3 ~= "" and (strfind(strlower(v), word3) or strfind(strlower(b.zone), word3) or strfind(strlower(b.category), word3)) then
|
|
if not word4 or word4 ~= "" and (strfind(strlower(v), word4) or strfind(strlower(b.zone), word4) or strfind(strlower(b.category), word4)) then
|
|
if not word5 or word5 ~= "" and (strfind(strlower(v), word5) or strfind(strlower(b.zone), word5) or strfind(strlower(b.category), word5)) then
|
|
-- Show category
|
|
if not hash[b.category] then
|
|
tinsert(ListData, "|cffffffff")
|
|
if b.category == e then
|
|
-- No category so just show ZoneList entry (such as Various)
|
|
tinsert(ListData, "|cffffd800" .. e)
|
|
else
|
|
-- Category exists so show that
|
|
tinsert(ListData, "|cffffd800" .. e .. ": " .. b.category)
|
|
end
|
|
hash[b.category] = true
|
|
end
|
|
-- Show track
|
|
tinsert(ListData, "|Cffffffaa" .. b.zone .. " |r" .. v)
|
|
trackCount = trackCount + 1
|
|
hash[v] = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Set results tag
|
|
if trackCount == 1 then
|
|
ListData[2] = "|cffffffaa{" .. trackCount .. " " .. L["result"] .. "}"
|
|
else
|
|
ListData[2] = "|cffffffaa{" .. trackCount .. " " .. L["results"] .. "}"
|
|
end
|
|
end
|
|
-- Refresh the track listing
|
|
UpdateList()
|
|
-- Set track listing to top
|
|
scrollFrame:SetVerticalScroll(0)
|
|
end
|
|
|
|
-- Populate ListData when editbox is changed by user
|
|
sBox:HookScript("OnTextChanged", function(self, userInput)
|
|
if userInput then
|
|
-- Show search page
|
|
conbtn[L["Search"]]:Click()
|
|
-- If search results are currently playing, stop playback since search results will be changed
|
|
if LastFolder == L["Search"] then stopBtn:Click() end
|
|
-- Show search results
|
|
ShowSearchResults()
|
|
end
|
|
end)
|
|
|
|
-- Populate ListData when editbox enter key is pressed
|
|
sBox:HookScript("OnEnterPressed", function()
|
|
-- Show search page
|
|
conbtn[L["Search"]]:Click()
|
|
-- If search results are currently playing, stop playback since search results will be changed
|
|
if LastFolder == L["Search"] then stopBtn:Click() end
|
|
-- Show search results
|
|
ShowSearchResults()
|
|
end)
|
|
|
|
-- Function to get random argument for random track listing
|
|
local function GetRandomArgument(...)
|
|
return (select(random(select("#", ...)), ...))
|
|
end
|
|
|
|
-- Function to show random track listing
|
|
local function ShowRandomList()
|
|
-- If random track is currently playing, stop playback since random track list will be changed
|
|
if LastFolder == L["Random"] then
|
|
stopBtn:Click()
|
|
end
|
|
-- Wipe the track listing for random
|
|
wipe(ListData)
|
|
-- Set the track list heading
|
|
ListData[1] = "|cffffd800" .. L["Random"]
|
|
ListData[2] = "|Cffffffaa{" .. L["click here for new selection"] .. "}" -- Must be capital |C
|
|
ListData[3] = "|cffffd800"
|
|
ListData[4] = "|cffffd800" .. L["Selection of music tracks"] -- Must be lower case |c
|
|
-- Populate list data until it contains desired number of tracks
|
|
while #ListData < 50 do
|
|
-- Get random category
|
|
local rCategory = GetRandomArgument(L["Zones"], L["Dungeons"], L["Various"])
|
|
-- Get random zone within category
|
|
local rZone = random(1, #ZoneList[rCategory])
|
|
-- Get random track within zone
|
|
local rTrack = ZoneList[rCategory][rZone].tracks[random(1, #ZoneList[rCategory][rZone].tracks)]
|
|
-- Insert track into ListData if it's not a duplicate or on the banned list
|
|
if rTrack and rTrack ~= "" and strfind(rTrack, "#") and not tContains(ListData, "|Cffffffaa" .. ZoneList[rCategory][rZone].zone .. " |r" .. rTrack) then
|
|
if not tContains(randomBannedList, L[ZoneList[rCategory][rZone].zone]) and not tContains(randomBannedList, rTrack) then
|
|
tinsert(ListData, "|Cffffffaa" .. ZoneList[rCategory][rZone].zone .. " |r" .. rTrack)
|
|
end
|
|
end
|
|
end
|
|
-- Refresh the track listing
|
|
UpdateList()
|
|
-- Set track listing to top
|
|
scrollFrame:SetVerticalScroll(0)
|
|
end
|
|
|
|
-- Show random track listing on startup when random button is clicked
|
|
for q, w in pairs(ZoneList) do
|
|
if conbtn[w] then
|
|
conbtn[w]:HookScript("OnClick", function()
|
|
if w == L["Random"] then
|
|
-- Generate initial playlist for first run
|
|
if #ListData == 0 then
|
|
ShowRandomList()
|
|
end
|
|
end
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- Create list items
|
|
scrollFrame.buttons = {}
|
|
for i = 1, numButtons do
|
|
scrollFrame.buttons[i] = CreateFrame("Button", nil, LeaPlusLC["Page9"])
|
|
local button = scrollFrame.buttons[i]
|
|
|
|
button:SetSize(470 - 14, 16)
|
|
button:SetNormalFontObject("GameFontHighlightLeft")
|
|
button:SetPoint("TOPLEFT", 246, -62+ -(i - 1) * 16 - 8)
|
|
|
|
-- Create highlight bar texture
|
|
button.t = button:CreateTexture(nil, "BACKGROUND")
|
|
button.t:SetPoint("TOPLEFT", button, 0, 0)
|
|
button.t:SetSize(516, 16)
|
|
|
|
button.t:SetColorTexture(0.3, 0.3, 0.0, 0.8)
|
|
button.t:SetAlpha(0.7)
|
|
button.t:Hide()
|
|
|
|
-- Create last playing highlight bar texture
|
|
button.s = button:CreateTexture(nil, "BACKGROUND")
|
|
button.s:SetPoint("TOPLEFT", button, 0, 0)
|
|
button.s:SetSize(516, 16)
|
|
|
|
button.s:SetColorTexture(0.3, 0.4, 0.00, 0.6)
|
|
button.s:Hide()
|
|
|
|
button:SetScript("OnEnter", function()
|
|
-- Highlight links only
|
|
if not string.match(button:GetText() or "", "|c") then
|
|
button.t:Show()
|
|
end
|
|
end)
|
|
|
|
button:SetScript("OnLeave", function()
|
|
button.t:Hide()
|
|
end)
|
|
|
|
button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
|
|
|
|
-- Handler for playing next SoundKit track in playlist
|
|
uframe:SetScript("OnEvent", function(self, event, stoppedHandle)
|
|
if event == "SOUNDKIT_FINISHED" then
|
|
-- Do nothing if stopped sound kit handle doesnt match last played track handle
|
|
if LastMusicHandle and LastMusicHandle ~= stoppedHandle then return end
|
|
-- Reset track number if playlist has reached the end
|
|
if tracknumber == #playlist then tracknumber = 1 end
|
|
-- Play next track
|
|
PlayTrack()
|
|
elseif event == "LOADING_SCREEN_DISABLED" then
|
|
-- Restart player if it stopped between tracks during loading screen
|
|
if playlist and tracknumber and playlist[tracknumber] and not willPlay and not musicHandle then
|
|
tracknumber = tracknumber - 1
|
|
C_Timer.After(0.1, PlayTrack)
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Click handler for track, zone and back button
|
|
button:SetScript("OnClick", function(self, btn)
|
|
if btn == "LeftButton" then
|
|
-- Remove focus from search box
|
|
sBox:ClearFocus()
|
|
-- Get clicked track text
|
|
local item = self:GetText()
|
|
-- Do nothing if its a blank line or informational heading
|
|
if not item or strfind(item, "|c") then return end
|
|
if item == "|Cffffffaa{" .. L["click here for new selection"] .. "}" then -- must be capital |C
|
|
-- Create new random track listing
|
|
ShowRandomList()
|
|
return
|
|
elseif strfind(item, "#") then
|
|
-- Enable sound if required
|
|
if GetCVar("Sound_EnableAllSound") == "0" then SetCVar("Sound_EnableAllSound", "1") end
|
|
-- Disable music if it's currently enabled
|
|
if GetCVar("Sound_EnableMusic") == "1" then SetCVar("Sound_EnableMusic", "0") end
|
|
-- Add all tracks to playlist
|
|
wipe(playlist)
|
|
local StartItem = 0
|
|
-- Get item clicked row number
|
|
for index = 1, #ListData do
|
|
local item = ListData[index]
|
|
if self:GetText() == item then StartItem = index end
|
|
end
|
|
-- Add all items from clicked item onwards to playlist
|
|
for index = StartItem, #ListData do
|
|
local item = ListData[index]
|
|
if item then
|
|
if strfind(item, "#") then
|
|
tinsert(playlist, item)
|
|
end
|
|
end
|
|
end
|
|
-- Add all items up to clicked item to playlist
|
|
for index = 1, StartItem do
|
|
local item = ListData[index]
|
|
if item then
|
|
if strfind(item, "#") then
|
|
tinsert(playlist, item)
|
|
end
|
|
end
|
|
end
|
|
-- Enable the stop button
|
|
LeaPlusLC:LockItem(stopBtn, false)
|
|
-- Set Temp Folder to Random if track is in Random
|
|
if ListData[1] == "|cffffd800" .. L["Random"] then TempFolder = L["Random"] end
|
|
-- Set Temp Folder to Search if track is in Search
|
|
if ListData[1] == "|cffffd800" .. L["Search"] then TempFolder = L["Search"] end
|
|
-- Store information about the track we are about to play
|
|
tracknumber = 1
|
|
LastPlayed = item
|
|
LastFolder = TempFolder
|
|
HeadingOfClickedTrack = ListData[1]
|
|
-- Play first track
|
|
PlayTrack()
|
|
-- Play subsequent tracks
|
|
uframe:RegisterEvent("SOUNDKIT_FINISHED")
|
|
uframe:RegisterEvent("LOADING_SCREEN_DISABLED")
|
|
return
|
|
elseif strfind(item, "|r") then
|
|
-- A movie was clicked
|
|
local movieName, movieID = item:match("([^,]+)%|r([^,]+)")
|
|
movieID = strtrim(movieID, "()")
|
|
if IsMoviePlayable(movieID) then
|
|
stopBtn:Click()
|
|
LeaPlusLC.MoviePlaying = true
|
|
MovieFrame_PlayMovie(MovieFrame, movieID)
|
|
LeaPlusLC.MoviePlaying = false
|
|
else
|
|
LeaPlusLC:Print("Movie not playable.")
|
|
end
|
|
return
|
|
else
|
|
-- A zone was clicked so show track listing
|
|
ZonePage = scrollFrame:GetVerticalScroll()
|
|
-- Find the track listing for the clicked zone
|
|
for q, w in pairs(ZoneList) do
|
|
for k, v in pairs(ZoneList[w]) do
|
|
if item == v.zone then
|
|
-- Show track listing
|
|
TempFolder = item
|
|
LeaPlusDB["MusicZone"] = item
|
|
ListData = v.tracks
|
|
UpdateList()
|
|
-- Hide hover highlight if track under pointer is a heading
|
|
if strfind(scrollFrame.buttons[i]:GetText(), "|c") then
|
|
scrollFrame.buttons[i].t:Hide()
|
|
end
|
|
-- Show top of track list
|
|
scrollFrame:SetVerticalScroll(0)
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
elseif btn == "RightButton" then
|
|
-- Back button was clicked
|
|
BackClick()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
-- Right-click to go back (from anywhere on the main content area of the panel)
|
|
LeaPlusLC["PageF"]:HookScript("OnMouseUp", function(self, btn)
|
|
if LeaPlusLC["Page9"]:IsShown() and LeaPlusLC["Page9"]:IsMouseOver(0, 0, 0, -440) == false and LeaPlusLC["Page9"]:IsMouseOver(-330, 0, 0, 0) == false then
|
|
if btn == "RightButton" then
|
|
BackClick()
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Set zone listing on startup
|
|
if LeaPlusDB["MusicContinent"] and LeaPlusDB["MusicContinent"] ~= "" then
|
|
-- Saved music continent exists
|
|
if conbtn[LeaPlusDB["MusicContinent"]] then
|
|
-- Saved continent is valid button so click it
|
|
conbtn[LeaPlusDB["MusicContinent"]]:Click()
|
|
else
|
|
-- Saved continent is not valid button so click default button
|
|
conbtn[L["Zones"]]:Click()
|
|
end
|
|
else
|
|
-- Saved music continent does not exist so click default button
|
|
conbtn[L["Zones"]]:Click()
|
|
end
|
|
UpdateList()
|
|
|
|
-- Manage events
|
|
LeaPlusLC["Page9"]:RegisterEvent("PLAYER_LOGOUT")
|
|
LeaPlusLC["Page9"]:RegisterEvent("UI_SCALE_CHANGED")
|
|
LeaPlusLC["Page9"]:SetScript("OnEvent", function(self, event)
|
|
if event == "PLAYER_LOGOUT" then
|
|
-- Stop playing at reload or logout
|
|
if musicHandle then
|
|
StopSound(musicHandle)
|
|
end
|
|
elseif event == "UI_SCALE_CHANGED" then
|
|
-- Refresh list
|
|
UpdateList()
|
|
end
|
|
end)
|
|
|
|
end
|
|
|
|
-- Run on startup
|
|
LeaPlusLC:MediaFunc()
|
|
|
|
-- Release memory
|
|
LeaPlusLC.MediaFunc = nil
|
|
|
|
----------------------------------------------------------------------
|
|
-- Panel alpha
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set panel alpha
|
|
local function SetPlusAlpha()
|
|
-- Set panel alpha
|
|
LeaPlusLC["PageF"].t:SetAlpha(1 - LeaPlusLC["PlusPanelAlpha"])
|
|
-- Show formatted value
|
|
LeaPlusCB["PlusPanelAlpha"].f:SetFormattedText("%.0f%%", LeaPlusLC["PlusPanelAlpha"] * 100)
|
|
end
|
|
|
|
-- Set alpha on startup
|
|
SetPlusAlpha()
|
|
|
|
-- Set alpha after changing slider
|
|
LeaPlusCB["PlusPanelAlpha"]:HookScript("OnValueChanged", SetPlusAlpha)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Panel scale
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
-- Function to set panel scale
|
|
local function SetPlusScale()
|
|
-- Reset panel position
|
|
LeaPlusLC["MainPanelA"], LeaPlusLC["MainPanelR"], LeaPlusLC["MainPanelX"], LeaPlusLC["MainPanelY"] = "CENTER", "CENTER", 0, 0
|
|
if LeaPlusLC["PageF"]:IsShown() then
|
|
LeaPlusLC["PageF"]:Hide()
|
|
LeaPlusLC["PageF"]:Show()
|
|
end
|
|
-- Set panel scale
|
|
LeaPlusLC["PageF"]:SetScale(LeaPlusLC["PlusPanelScale"])
|
|
-- Update music player highlight bar scale
|
|
LeaPlusLC:UpdateList()
|
|
end
|
|
|
|
-- Set scale on startup
|
|
LeaPlusLC["PageF"]:SetScale(LeaPlusLC["PlusPanelScale"])
|
|
|
|
-- Set scale and reset panel position after changing slider
|
|
LeaPlusCB["PlusPanelScale"]:HookScript("OnMouseUp", SetPlusScale)
|
|
LeaPlusCB["PlusPanelScale"]:HookScript("OnMouseWheel", SetPlusScale)
|
|
|
|
-- Show formatted slider value
|
|
LeaPlusCB["PlusPanelScale"]:HookScript("OnValueChanged", function()
|
|
LeaPlusCB["PlusPanelScale"].f:SetFormattedText("%.0f%%", LeaPlusLC["PlusPanelScale"] * 100)
|
|
end)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Create panel in game options panel
|
|
----------------------------------------------------------------------
|
|
|
|
do
|
|
|
|
local interPanel = CreateFrame("FRAME")
|
|
interPanel.name = "Leatrix Plus"
|
|
|
|
local maintitle = LeaPlusLC:MakeTx(interPanel, "Leatrix Plus", 0, 0)
|
|
maintitle:SetFont(maintitle:GetFont(), 72)
|
|
maintitle:ClearAllPoints()
|
|
maintitle:SetPoint("TOP", 0, -72)
|
|
|
|
local expTitle = LeaPlusLC:MakeTx(interPanel, "Shadowlands", 0, 0)
|
|
expTitle:SetFont(expTitle:GetFont(), 32)
|
|
expTitle:ClearAllPoints()
|
|
expTitle:SetPoint("TOP", 0, -152)
|
|
|
|
local subTitle = LeaPlusLC:MakeTx(interPanel, "www.leatrix.com", 0, 0)
|
|
subTitle:SetFont(subTitle:GetFont(), 20)
|
|
subTitle:ClearAllPoints()
|
|
subTitle:SetPoint("BOTTOM", 0, 72)
|
|
|
|
local slashTitle = LeaPlusLC:MakeTx(interPanel, "/ltp", 0, 0)
|
|
slashTitle:SetFont(slashTitle:GetFont(), 72)
|
|
slashTitle:ClearAllPoints()
|
|
slashTitle:SetPoint("BOTTOM", subTitle, "TOP", 0, 40)
|
|
slashTitle:SetScript("OnMouseUp", function(self, button)
|
|
if button == "LeftButton" then
|
|
SlashCmdList["Leatrix_Plus"]("")
|
|
end
|
|
end)
|
|
slashTitle:SetScript("OnEnter", function()
|
|
slashTitle.r, slashTitle.g, slashTitle.b = slashTitle:GetTextColor()
|
|
slashTitle:SetTextColor(1, 1, 0)
|
|
end)
|
|
slashTitle:SetScript("OnLeave", function()
|
|
slashTitle:SetTextColor(slashTitle.r, slashTitle.g, slashTitle.b)
|
|
end)
|
|
|
|
local pTex = interPanel:CreateTexture(nil, "BACKGROUND")
|
|
pTex:SetAllPoints()
|
|
pTex:SetTexture("Interface\\GLUES\\Models\\UI_MainMenu\\swordgradient2")
|
|
pTex:SetAlpha(0.2)
|
|
pTex:SetTexCoord(0, 1, 1, 0)
|
|
|
|
expTitle:SetText(L["The War Within"])
|
|
local category = Settings.RegisterCanvasLayoutCategory(interPanel, L["Leatrix Plus"])
|
|
Settings.RegisterAddOnCategory(category)
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Final code for Player
|
|
----------------------------------------------------------------------
|
|
|
|
-- Show first run message
|
|
if not LeaPlusDB["FirstRunMessageSeen"] then
|
|
C_Timer.After(1, function()
|
|
LeaPlusLC:Print(L["Enter"] .. " |cff00ff00" .. "/ltp" .. "|r " .. L["or click the minimap button to open Leatrix Plus."])
|
|
LeaPlusDB["FirstRunMessageSeen"] = true
|
|
end)
|
|
end
|
|
|
|
-- Register logout event to save settings
|
|
LpEvt:RegisterEvent("PLAYER_LOGOUT")
|
|
|
|
-- Update addon memory usage (speeds up initial value)
|
|
UpdateAddOnMemoryUsage()
|
|
|
|
-- Release memory
|
|
LeaPlusLC.Player = nil
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L60: Default events
|
|
----------------------------------------------------------------------
|
|
|
|
local function eventHandler(self, event, arg1, arg2, ...)
|
|
|
|
----------------------------------------------------------------------
|
|
-- L62: Profile events
|
|
----------------------------------------------------------------------
|
|
|
|
if event == "ADDON_LOADED" then
|
|
if arg1 == "Leatrix_Plus" then
|
|
|
|
-- Replace old var names with new ones
|
|
local function UpdateVars(oldvar, newvar)
|
|
if LeaPlusDB[oldvar] and not LeaPlusDB[newvar] then LeaPlusDB[newvar] = LeaPlusDB[oldvar]; LeaPlusDB[oldvar] = nil end
|
|
end
|
|
|
|
UpdateVars("MinimapMod", "MinimapModder") -- 9.2.26 (24th August 2022)
|
|
UpdateVars("RestorechatMessages", "RestoreChatMessages") -- 9.2.36 (20th September 2022)
|
|
|
|
-- Minimum faster auto loot delay changed from 0.0 to 0.1 in 10.0.20
|
|
if LeaPlusDB["LeaPlusFasterLootDelay"] and LeaPlusDB["LeaPlusFasterLootDelay"] == 0 then
|
|
LeaPlusDB["LeaPlusFasterLootDelay"] = 0.1
|
|
end
|
|
|
|
if LeaPlusDB["AutoQuestNoDaily"] and not LeaPlusDB["AutoQuestDaily"] then
|
|
if LeaPlusDB["AutoQuestNoDaily"] == "On" then
|
|
LeaPlusDB["AutoQuestDaily"] = "Off"
|
|
else
|
|
LeaPlusDB["AutoQuestDaily"] = "On"
|
|
end
|
|
LeaPlusDB["AutoQuestNoDaily"] = nil
|
|
end
|
|
|
|
-- Mute game sounds split with Mute mount sounds
|
|
if LeaPlusDB["MuteGameSounds"] == "On" and not LeaPlusDB["MuteMountSounds"] then
|
|
if LeaPlusDB["MuteAerials"] == "On"
|
|
or LeaPlusDB["MuteAirships"] == "On"
|
|
or LeaPlusDB["MuteBanLu"] == "On"
|
|
or LeaPlusDB["MuteBikes"] == "On"
|
|
or LeaPlusDB["MuteBrooms"] == "On"
|
|
or LeaPlusDB["MuteDragonriding"] == "On"
|
|
or LeaPlusDB["MuteFurlines"] == "On"
|
|
or LeaPlusDB["MuteGyrocopters"] == "On"
|
|
or LeaPlusDB["MuteHovercraft"] == "On"
|
|
or LeaPlusDB["MuteMechSteps"] == "On"
|
|
or LeaPlusDB["MuteMechsuits"] == "On"
|
|
or LeaPlusDB["MuteOttuks"] == "On"
|
|
or LeaPlusDB["MuteRazorwings"] == "On"
|
|
or LeaPlusDB["MuteRockets"] == "On"
|
|
or LeaPlusDB["MuteSoulEaters"] == "On"
|
|
or LeaPlusDB["MuteSoulseekers"] == "On"
|
|
or LeaPlusDB["MuteStriders"] == "On"
|
|
or LeaPlusDB["MuteTravelers"] == "On"
|
|
or LeaPlusDB["MuteUnicorns"] == "On"
|
|
or LeaPlusDB["MuteZeppelins"] == "On"
|
|
then
|
|
LeaPlusLC["MuteMountSounds"] = "On"
|
|
LeaPlusDB["MuteMountSounds"] = "On"
|
|
end
|
|
end
|
|
|
|
-- Automation
|
|
LeaPlusLC:LoadVarChk("AutomateQuests", "Off") -- Automate quests
|
|
LeaPlusLC:LoadVarChk("AutoQuestShift", "Off") -- Automate quests requires shift
|
|
LeaPlusLC:LoadVarChk("AutoQuestRegular", "On") -- Accept regular quests
|
|
LeaPlusLC:LoadVarChk("AutoQuestDaily", "On") -- Accept daily quests
|
|
LeaPlusLC:LoadVarChk("AutoQuestWeekly", "On") -- Accept weekly quests
|
|
LeaPlusLC:LoadVarChk("AutoQuestCompleted", "On") -- Turn-in completed quests
|
|
LeaPlusLC:LoadVarNum("AutoQuestKeyMenu", 1, 1, 4) -- Automate quests override key
|
|
LeaPlusLC:LoadVarChk("AutomateGossip", "Off") -- Automate gossip
|
|
LeaPlusLC:LoadVarChk("AutoAcceptSummon", "Off") -- Accept summon
|
|
LeaPlusLC:LoadVarChk("AutoAcceptRes", "Off") -- Accept resurrection
|
|
LeaPlusLC:LoadVarChk("AutoResNoCombat", "On") -- Accept resurrection exclude combat
|
|
LeaPlusLC:LoadVarChk("AutoResNoAfterlife", "Off") -- Accept resurrection exclude afterlife
|
|
LeaPlusLC:LoadVarChk("AutoReleasePvP", "Off") -- Release in PvP
|
|
LeaPlusLC:LoadVarChk("AutoReleaseNoAlterac", "Off") -- Release in PvP Exclude Alterac Valley
|
|
LeaPlusLC:LoadVarChk("AutoReleaseNoWintergsp", "Off") -- Release in PvP Exclude Wintergrasp
|
|
LeaPlusLC:LoadVarChk("AutoReleaseNoTolBarad", "Off") -- Release in PvP Exclude Tol Barad (PvP)
|
|
LeaPlusLC:LoadVarChk("AutoReleaseNoAshran", "Off") -- Release in PvP Exclude Ashran
|
|
LeaPlusLC:LoadVarNum("AutoReleaseDelay", 0, 0, 3000) -- Release in PvP Delay
|
|
|
|
LeaPlusLC:LoadVarChk("AutoSellJunk", "Off") -- Sell junk automatically
|
|
LeaPlusLC:LoadVarChk("AutoSellShowSummary", "On") -- Sell junk summary in chat
|
|
LeaPlusLC:LoadVarChk("AutoSellNoKeeperTahult", "On") -- Sell junk exclude Keeper Ta'hult
|
|
LeaPlusLC:LoadVarChk("AutoSellNoGreyGear", "Off") -- Sell junk exclude all grey gear
|
|
LeaPlusLC:LoadVarStr("AutoSellExcludeList", "") -- Sell junk exclude list
|
|
LeaPlusLC:LoadVarChk("AutoRepairGear", "Off") -- Repair automatically
|
|
LeaPlusLC:LoadVarChk("AutoRepairGuildFunds", "On") -- Repair using guild funds
|
|
LeaPlusLC:LoadVarChk("AutoRepairShowSummary", "On") -- Repair show summary in chat
|
|
|
|
-- Social
|
|
LeaPlusLC:LoadVarChk("NoDuelRequests", "Off") -- Block duels
|
|
LeaPlusLC:LoadVarChk("NoPetDuels", "Off") -- Block pet battle duels
|
|
LeaPlusLC:LoadVarChk("NoPartyInvites", "Off") -- Block party invites
|
|
LeaPlusLC:LoadVarChk("NoRequestedInvites", "Off") -- Block requested invites
|
|
LeaPlusLC:LoadVarChk("NoFriendRequests", "Off") -- Block friend requests
|
|
LeaPlusLC:LoadVarChk("NoSharedQuests", "Off") -- Block shared quests
|
|
|
|
LeaPlusLC:LoadVarChk("AcceptPartyFriends", "Off") -- Party from friends
|
|
LeaPlusLC:LoadVarChk("SyncFromFriends", "Off") -- Sync from friends
|
|
LeaPlusLC:LoadVarChk("AutoConfirmRole", "Off") -- Queue from friends
|
|
LeaPlusLC:LoadVarChk("InviteFromWhisper", "Off") -- Invite from whispers
|
|
LeaPlusLC:LoadVarChk("InviteFriendsOnly", "Off") -- Restrict invites to friends
|
|
LeaPlusLC["InvKey"] = LeaPlusDB["InvKey"] or "inv" -- Invite from whisper keyword
|
|
LeaPlusLC:LoadVarChk("FriendlyCommunities", "Off") -- Friendly communities
|
|
LeaPlusLC:LoadVarChk("FriendlyGuild", "On") -- Friendly guild
|
|
|
|
-- Chat
|
|
LeaPlusLC:LoadVarChk("UseEasyChatResizing", "Off") -- Use easy resizing
|
|
LeaPlusLC:LoadVarChk("NoCombatLogTab", "Off") -- Hide the combat log
|
|
LeaPlusLC:LoadVarChk("NoChatButtons", "Off") -- Hide chat buttons
|
|
LeaPlusLC:LoadVarChk("ShowVoiceButtons", "Off") -- Show voice buttons
|
|
LeaPlusLC:LoadVarChk("ShowChatMenuButton", "Off") -- Show chat menu button
|
|
LeaPlusLC:LoadVarChk("NoSocialButton", "Off") -- Hide social button
|
|
LeaPlusLC:LoadVarChk("UnclampChat", "Off") -- Unclamp chat frame
|
|
LeaPlusLC:LoadVarChk("MoveChatEditBoxToTop", "Off") -- Move editbox to top
|
|
LeaPlusLC:LoadVarChk("SetChatFontSize", "Off") -- Set chat font size
|
|
LeaPlusLC:LoadVarNum("LeaPlusChatFontSize", 20, 12, 48) -- Chat font size value
|
|
|
|
LeaPlusLC:LoadVarChk("NoStickyChat", "Off") -- Disable sticky chat
|
|
LeaPlusLC:LoadVarChk("UseArrowKeysInChat", "Off") -- Use arrow keys in chat
|
|
LeaPlusLC:LoadVarChk("NoChatFade", "Off") -- Disable chat fade
|
|
LeaPlusLC:LoadVarChk("UnivGroupColor", "Off") -- Universal group color
|
|
LeaPlusLC:LoadVarChk("RecentChatWindow", "Off") -- Recent chat window
|
|
LeaPlusLC:LoadVarNum("RecentChatSize", 170, 170, 600) -- Recent chat size
|
|
LeaPlusLC:LoadVarChk("MaxChatHstory", "Off") -- Increase chat history
|
|
LeaPlusLC:LoadVarChk("FilterChatMessages", "Off") -- Filter chat messages
|
|
LeaPlusLC:LoadVarChk("BlockSpellLinks", "Off") -- Block spell links
|
|
LeaPlusLC:LoadVarChk("BlockDrunkenSpam", "Off") -- Block drunken spam
|
|
LeaPlusLC:LoadVarChk("BlockDuelSpam", "Off") -- Block duel spam
|
|
LeaPlusLC:LoadVarChk("BlockAngelisSinny", "Off") -- Block Angelis and Sinny spam
|
|
LeaPlusLC:LoadVarChk("RestoreChatMessages", "Off") -- Restore chat messages
|
|
|
|
-- Text
|
|
LeaPlusLC:LoadVarChk("HideErrorMessages", "Off") -- Hide error messages
|
|
LeaPlusLC:LoadVarChk("NoHitIndicators", "Off") -- Hide portrait numbers
|
|
LeaPlusLC:LoadVarChk("HideZoneText", "Off") -- Hide zone text
|
|
LeaPlusLC:LoadVarChk("HideKeybindText", "Off") -- Hide keybind text
|
|
LeaPlusLC:LoadVarChk("HideMacroText", "Off") -- Hide macro text
|
|
|
|
LeaPlusLC:LoadVarChk("MailFontChange", "Off") -- Resize mail text
|
|
LeaPlusLC:LoadVarNum("LeaPlusMailFontSize", 15, 10, 30) -- Mail text slider
|
|
|
|
LeaPlusLC:LoadVarChk("QuestFontChange", "Off") -- Resize quest text
|
|
LeaPlusLC:LoadVarNum("LeaPlusQuestFontSize", 12, 10, 30) -- Quest text slider
|
|
|
|
-- Interface
|
|
LeaPlusLC:LoadVarChk("MinimapModder", "Off") -- Enhance minimap
|
|
LeaPlusLC:LoadVarChk("SquareMinimap", "On") -- Square minimap
|
|
LeaPlusLC:LoadVarChk("ShowWhoPinged", "On") -- Show who pinged
|
|
LeaPlusLC:LoadVarChk("HideMiniAddonMenu", "On") -- Hide addon menu
|
|
LeaPlusLC:LoadVarChk("UnclampMinimap", "Off") -- Unclamp minimap cluster
|
|
LeaPlusLC:LoadVarChk("CombineAddonButtons", "Off") -- Combine addon buttons
|
|
LeaPlusLC:LoadVarStr("MiniExcludeList", "") -- Minimap exclude list
|
|
LeaPlusLC:LoadVarChk("HideMiniAddonButtons", "On") -- Hide addon buttons
|
|
LeaPlusLC:LoadVarNum("MiniClusterScale", 1, 0.5, 2) -- Minimap cluster scale
|
|
LeaPlusLC:LoadVarChk("MinimapNoScale", "Off") -- Minimap not minimap
|
|
LeaPlusLC:LoadVarAnc("MinimapA", "TOPRIGHT") -- Minimap anchor
|
|
LeaPlusLC:LoadVarAnc("MinimapR", "TOPRIGHT") -- Minimap relative
|
|
LeaPlusLC:LoadVarNum("MinimapX", -17, -5000, 5000) -- Minimap X
|
|
LeaPlusLC:LoadVarNum("MinimapY", -22, -5000, 5000) -- Minimap Y
|
|
LeaPlusLC:LoadVarChk("TipModEnable", "Off") -- Enhance tooltip
|
|
LeaPlusLC:LoadVarChk("TipShowRank", "On") -- Show rank for your guild
|
|
LeaPlusLC:LoadVarChk("TipShowOtherRank", "Off") -- Show rank for other guilds
|
|
LeaPlusLC:LoadVarChk("TipShowTarget", "On") -- Show target
|
|
--LeaPlusLC:LoadVarChk("TipShowMythic", "Off") -- Show mythic score
|
|
LeaPlusLC:LoadVarChk("TipBackSimple", "Off") -- Color backdrops
|
|
LeaPlusLC:LoadVarChk("TipHideInCombat", "Off") -- Hide tooltips during combat
|
|
LeaPlusLC:LoadVarChk("TipHideShiftOverride", "On") -- Hide tooltips shift override
|
|
LeaPlusLC:LoadVarChk("TipNoHealthBar", "Off") -- Hide health bar
|
|
LeaPlusLC:LoadVarNum("LeaPlusTipSize", 1.00, 0.50, 2.00) -- Tooltip scale slider
|
|
LeaPlusLC:LoadVarNum("TooltipAnchorMenu", 1, 1, 4) -- Tooltip anchor menu
|
|
LeaPlusLC:LoadVarNum("TipCursorX", 0, -128, 128) -- Tooltip cursor X offset
|
|
LeaPlusLC:LoadVarNum("TipCursorY", 0, -128, 128) -- Tooltip cursor Y offset
|
|
|
|
LeaPlusLC:LoadVarChk("EnhanceDressup", "Off") -- Enhance dressup
|
|
LeaPlusLC:LoadVarChk("DressupItemButtons", "On") -- Dressup item buttons
|
|
LeaPlusLC:LoadVarChk("DressupAnimControl", "On") -- Dressup animation control
|
|
LeaPlusLC:LoadVarChk("DressupWiderPreview", "On") -- Dressup wider character preview
|
|
LeaPlusLC:LoadVarChk("DressupMoreZoomOut", "Off") -- Dressup increase zoom out distance
|
|
LeaPlusLC:LoadVarChk("DressupTransmogAnim", "Off") -- Dressup show transmogrify animation control
|
|
LeaPlusLC:LoadVarNum("DressupFasterZoom", 3, 1, 10) -- Dressup zoom speed
|
|
LeaPlusLC:LoadVarChk("ShowVolume", "Off") -- Show volume slider
|
|
LeaPlusLC:LoadVarChk("ShowVolumeInFrame", "Off") -- Volume slider dual layout
|
|
|
|
LeaPlusLC:LoadVarChk("ShowCooldowns", "Off") -- Show cooldowns
|
|
LeaPlusLC:LoadVarChk("ShowCooldownID", "On") -- Show cooldown ID in tips
|
|
LeaPlusLC:LoadVarChk("NoCooldownDuration", "On") -- Hide cooldown duration
|
|
LeaPlusLC:LoadVarChk("CooldownsOnPlayer", "Off") -- Anchor to player
|
|
LeaPlusLC:LoadVarChk("DurabilityStatus", "Off") -- Show durability status
|
|
LeaPlusLC:LoadVarChk("ShowPetSaveBtn", "Off") -- Show pet save button
|
|
LeaPlusLC:LoadVarChk("ShowRaidToggle", "Off") -- Show raid button
|
|
LeaPlusLC:LoadVarChk("ShowTrainAllButton", "Off") -- Show train all button
|
|
LeaPlusLC:LoadVarChk("ShowBorders", "Off") -- Show borders
|
|
LeaPlusLC:LoadVarNum("BordersTop", 0, 0, 300) -- Top border
|
|
LeaPlusLC:LoadVarNum("BordersBottom", 0, 0, 300) -- Bottom border
|
|
LeaPlusLC:LoadVarNum("BordersLeft", 0, 0, 300) -- Left border
|
|
LeaPlusLC:LoadVarNum("BordersRight", 0, 0, 300) -- Right border
|
|
LeaPlusLC:LoadVarNum("BordersAlpha", 0, 0, 0.9) -- Border alpha
|
|
LeaPlusLC:LoadVarChk("ShowPlayerChain", "Off") -- Show player chain
|
|
LeaPlusLC:LoadVarNum("PlayerChainMenu", 1, 1, 3) -- Player chain dropdown value
|
|
LeaPlusLC:LoadVarChk("ShowReadyTimer", "Off") -- Show ready timer
|
|
LeaPlusLC:LoadVarChk("ShowWowheadLinks", "Off") -- Show Wowhead links
|
|
LeaPlusLC:LoadVarChk("WowheadLinkComments", "Off") -- Show Wowhead links to comments
|
|
|
|
-- Frames
|
|
LeaPlusLC:LoadVarChk("ManageWidgetTop", "Off") -- Manage widget top
|
|
LeaPlusLC:LoadVarAnc("WidgetTopA", "TOP") -- Manage widget top anchor
|
|
LeaPlusLC:LoadVarAnc("WidgetTopR", "TOP") -- Manage widget top relative
|
|
LeaPlusLC:LoadVarNum("WidgetTopX", 0, -5000, 5000) -- Manage widget top position X
|
|
LeaPlusLC:LoadVarNum("WidgetTopY", -15, -5000, 5000) -- Manage widget top position Y
|
|
LeaPlusLC:LoadVarNum("WidgetTopScale", 1, 0.5, 2) -- Manage widget top scale
|
|
|
|
LeaPlusLC:LoadVarChk("ManageControl", "Off") -- Manage control
|
|
LeaPlusLC:LoadVarAnc("ControlA", "CENTER") -- Manage control anchor
|
|
LeaPlusLC:LoadVarAnc("ControlR", "CENTER") -- Manage control relative
|
|
LeaPlusLC:LoadVarNum("ControlX", 0, -5000, 5000) -- Manage control position X
|
|
LeaPlusLC:LoadVarNum("ControlY", 0, -5000, 5000) -- Manage control position Y
|
|
LeaPlusLC:LoadVarNum("ControlScale", 1, 0.5, 2) -- Manage control scale
|
|
|
|
LeaPlusLC:LoadVarChk("ClassColFrames", "Off") -- Class colored frames
|
|
LeaPlusLC:LoadVarChk("ClassColPlayer", "On") -- Class colored player frame
|
|
LeaPlusLC:LoadVarChk("ClassColTarget", "On") -- Class colored target frame
|
|
|
|
LeaPlusLC:LoadVarChk("NoAlerts", "Off") -- Hide alerts
|
|
LeaPlusLC:LoadVarChk("HideBodyguard", "Off") -- Hide bodyguard window
|
|
LeaPlusLC:LoadVarChk("HideTalkingFrame", "Off") -- Hide talking frame
|
|
LeaPlusLC:LoadVarChk("HideCleanupBtns", "Off") -- Hide clean-up buttons
|
|
LeaPlusLC:LoadVarChk("HideBossBanner", "Off") -- Hide boss banner
|
|
LeaPlusLC:LoadVarChk("HideEventToasts", "Off") -- Hide event toasts
|
|
LeaPlusLC:LoadVarChk("NoClassBar", "Off") -- Hide stance bar
|
|
LeaPlusLC:LoadVarChk("NoCommandBar", "Off") -- Hide order hall bar
|
|
LeaPlusLC:LoadVarChk("NoRestedSleep", "Off") -- Hide rested sleep
|
|
|
|
-- System
|
|
LeaPlusLC:LoadVarChk("NoScreenGlow", "Off") -- Disable screen glow
|
|
LeaPlusLC:LoadVarChk("NoScreenEffects", "Off") -- Disable screen effects
|
|
LeaPlusLC:LoadVarChk("SetWeatherDensity", "Off") -- Set weather density
|
|
LeaPlusLC:LoadVarNum("WeatherLevel", 3, 0, 3) -- Weather density level
|
|
LeaPlusLC:LoadVarChk("MaxCameraZoom", "Off") -- Max camera zoom
|
|
|
|
LeaPlusLC:LoadVarChk("NoRestedEmotes", "Off") -- Silence rested emotes
|
|
LeaPlusLC:LoadVarChk("KeepAudioSynced", "Off") -- Keep audio synced
|
|
LeaPlusLC:LoadVarChk("MuteGameSounds", "Off") -- Mute game sounds
|
|
LeaPlusLC:LoadVarChk("MuteMountSounds", "Off") -- Mute mount sounds
|
|
LeaPlusLC:LoadVarChk("MuteCustomSounds", "Off") -- Mute custom sounds
|
|
LeaPlusLC:LoadVarStr("MuteCustomList", "") -- Mute custom sounds list
|
|
|
|
LeaPlusLC:LoadVarChk("NoBagAutomation", "Off") -- Disable bag automation
|
|
LeaPlusLC:LoadVarChk("NoPetAutomation", "Off") -- Disable pet automation
|
|
LeaPlusLC:LoadVarChk("NoRaidRestrictions", "Off") -- Remove raid restrictions
|
|
LeaPlusLC:LoadVarChk("NoConfirmLoot", "Off") -- Disable loot warnings
|
|
LeaPlusLC:LoadVarChk("FasterLooting", "Off") -- Faster auto loot
|
|
LeaPlusLC:LoadVarNum("LeaPlusFasterLootDelay", 0.3, 0.1, 0.3) -- Faster auto loot delay
|
|
|
|
LeaPlusLC:LoadVarChk("FasterMovieSkip", "Off") -- Faster movie skip
|
|
LeaPlusLC:LoadVarChk("CombatPlates", "Off") -- Combat plates
|
|
LeaPlusLC:LoadVarChk("EasyItemDestroy", "Off") -- Easy item destroy
|
|
LeaPlusLC:LoadVarChk("NoTransforms", "Off") -- Remove transforms
|
|
LeaPlusLC:LoadVarChk("SetAddtonOptions", "Off") -- Set additional options
|
|
LeaPlusLC:LoadVarChk("AddOptNoCombatBox", "Off") -- Uncheck combat animation checkbox
|
|
LeaPlusLC:LoadVarChk("AddOptNoMountBox", "Off") -- Uncheck mount special animation checkbox
|
|
|
|
-- Settings
|
|
LeaPlusLC:LoadVarChk("ShowMinimapIcon", "On") -- Show minimap button
|
|
LeaPlusLC:LoadVarNum("PlusPanelScale", 1, 1, 2) -- Panel scale
|
|
LeaPlusLC:LoadVarNum("PlusPanelAlpha", 0, 0, 1) -- Panel alpha
|
|
|
|
-- Panel position
|
|
LeaPlusLC:LoadVarAnc("MainPanelA", "CENTER") -- Panel anchor
|
|
LeaPlusLC:LoadVarAnc("MainPanelR", "CENTER") -- Panel relative
|
|
LeaPlusLC:LoadVarNum("MainPanelX", 0, -5000, 5000) -- Panel X axis
|
|
LeaPlusLC:LoadVarNum("MainPanelY", 0, -5000, 5000) -- Panel Y axis
|
|
|
|
-- Start page
|
|
LeaPlusLC:LoadVarNum("LeaStartPage", 0, 0, LeaPlusLC["NumberOfPages"])
|
|
|
|
-- Lock conflicting options
|
|
do
|
|
|
|
-- Function to disable and lock an option and add a note to the tooltip
|
|
local function Lock(option, reason, optmodule)
|
|
LeaLockList[option] = LeaPlusLC[option]
|
|
LeaPlusLC:LockItem(LeaPlusCB[option], true)
|
|
LeaPlusCB[option].tiptext = LeaPlusCB[option].tiptext .. "|n|n|cff00AAFF" .. reason
|
|
if optmodule then
|
|
LeaPlusCB[option].tiptext = LeaPlusCB[option].tiptext .. " " .. optmodule .. " " .. L["module"]
|
|
end
|
|
LeaPlusCB[option].tiptext = LeaPlusCB[option].tiptext .. "."
|
|
-- Remove hover from configuration button if there is one
|
|
local temp = {LeaPlusCB[option]:GetChildren()}
|
|
if temp and temp[1] and temp[1].t and temp[1].t:GetTexture() == 311225 then
|
|
temp[1]:SetHighlightTexture(0)
|
|
temp[1]:SetScript("OnEnter", nil)
|
|
end
|
|
end
|
|
|
|
-- Disable items that conflict with Easy Frames
|
|
if C_AddOns.IsAddOnLoaded("EasyFrames") then
|
|
Lock("ClassColFrames", L["Cannot be used with Easy Frames"]) -- Class colored frames
|
|
end
|
|
|
|
-- Disable items that conflict with Glass
|
|
if C_AddOns.IsAddOnLoaded("Glass") then
|
|
local reason = L["Cannot be used with Glass"]
|
|
Lock("UseEasyChatResizing", reason) -- Use easy resizing
|
|
Lock("NoCombatLogTab", reason) -- Hide the combat log
|
|
Lock("NoChatButtons", reason) -- Hide chat buttons
|
|
Lock("NoSocialButton", reason) -- Hide social button
|
|
Lock("UnclampChat", reason) -- Unclamp chat frame
|
|
Lock("MoveChatEditBoxToTop", reason) -- Move editbox to top
|
|
Lock("SetChatFontSize", reason) -- Set chat font size
|
|
Lock("NoChatFade", reason) -- Disable chat fade
|
|
Lock("RecentChatWindow", reason) -- Recent chat window
|
|
end
|
|
|
|
-- Disable items that conflict with ElvUI
|
|
if LeaPlusLC.ElvUI then
|
|
local E = LeaPlusLC.ElvUI
|
|
if E and E.private then
|
|
|
|
local reason = L["Cannot be used with ElvUI"]
|
|
|
|
-- Chat
|
|
if E.private.chat.enable then
|
|
Lock("UseEasyChatResizing", reason, "Chat") -- Use easy resizing
|
|
Lock("NoCombatLogTab", reason, "Chat") -- Hide the combat log
|
|
Lock("NoChatButtons", reason, "Chat") -- Hide chat buttons
|
|
Lock("NoSocialButton", reason, "Chat") -- Hide social button
|
|
Lock("UnclampChat", reason, "Chat") -- Unclamp chat frame
|
|
Lock("SetChatFontSize", reason, "Chat") -- Set chat font size
|
|
Lock("NoStickyChat", reason, "Chat") -- Disable sticky chat
|
|
Lock("UseArrowKeysInChat", reason, "Chat") -- Use arrow keys in chat
|
|
Lock("NoChatFade", reason, "Chat") -- Disable chat fade
|
|
Lock("MaxChatHstory", reason, "Chat") -- Increase chat history
|
|
Lock("RestoreChatMessages", reason, "Chat") -- Restore chat messages (E.db.chat.chatHistory)
|
|
end
|
|
|
|
-- Minimap
|
|
if E.private.general.minimap.enable then
|
|
Lock("MinimapModder", reason, "Minimap") -- Enhance minimap
|
|
end
|
|
|
|
-- UnitFrames
|
|
if E.private.unitframe.enable then
|
|
Lock("ShowRaidToggle", reason, "UnitFrames") -- Show raid button
|
|
end
|
|
|
|
-- ActionBars
|
|
if E.private.actionbar.enable then
|
|
Lock("NoClassBar", reason, "ActionBars") -- Hide stance bar
|
|
Lock("HideKeybindText", reason, "ActionBars") -- Hide keybind text
|
|
Lock("HideMacroText", reason, "ActionBars") -- Hide macro text
|
|
end
|
|
|
|
-- Bags
|
|
if E.private.bags.enable then
|
|
Lock("NoBagAutomation", reason, "Bags") -- Disable bag automation
|
|
Lock("HideCleanupBtns", reason, "Bags") -- Hide clean-up buttons
|
|
end
|
|
|
|
-- Tooltip
|
|
if E.private.tooltip.enable then
|
|
Lock("TipModEnable", reason, "Tooltip") -- Enhance tooltip
|
|
end
|
|
|
|
-- UnitFrames: Disabled Blizzard: Player
|
|
if E.private.unitframe.disabledBlizzardFrames.player then
|
|
Lock("ShowPlayerChain", reason, "UnitFrames (Disabled Blizzard Frames Player)") -- Show player chain
|
|
Lock("NoHitIndicators", reason, "UnitFrames (Disabled Blizzard Frames Player)") -- Hide portrait numbers
|
|
Lock("NoRestedSleep", reason, "UnitFrames (Disabled Blizzard Frames Player)") -- Hide rested sleep
|
|
end
|
|
|
|
-- UnitFrames: Disabled Blizzard: Player, Target or Focus
|
|
if E.private.unitframe.disabledBlizzardFrames.player or E.private.unitframe.disabledBlizzardFrames.target or E.private.unitframe.disabledBlizzardFrames.focus then
|
|
Lock("ClassColFrames", reason, "UnitFrames (Disabled Blizzard Frames Player, Target and Focus)") -- Class-colored frames
|
|
end
|
|
|
|
-- Base
|
|
do
|
|
Lock("ManageWidgetTop", reason) -- Manage widget top
|
|
Lock("ManageControl", reason) -- Manage control
|
|
end
|
|
|
|
end
|
|
|
|
C_AddOns.EnableAddOn("Leatrix_Plus")
|
|
end
|
|
|
|
end
|
|
|
|
-- Lock options currently not compatible with the next expansion (LeaPlusLC.DF)
|
|
local function LockDF(option, reason)
|
|
LeaPlusLC[option] = "Off"
|
|
LeaPlusDB[option] = "Off"
|
|
LeaPlusLC:LockItem(LeaPlusCB[option], true)
|
|
if reason then
|
|
LeaPlusCB[option].tiptext = LeaPlusCB[option].tiptext .. "|n|n|cff00AAFF" .. L[reason]
|
|
end
|
|
end
|
|
|
|
if LeaPlusLC.NewPatch then
|
|
-- LockDF("LockoutSharing", "This option is no longer available in the game. The achievements window now always shows warband achievement points.")
|
|
end
|
|
|
|
-- Run other startup items
|
|
LeaPlusLC:SetDim()
|
|
|
|
end
|
|
return
|
|
end
|
|
|
|
if event == "PLAYER_LOGIN" then
|
|
LeaPlusLC:Player()
|
|
collectgarbage()
|
|
return
|
|
end
|
|
|
|
-- Save locals back to globals on logout
|
|
if event == "PLAYER_LOGOUT" then
|
|
|
|
-- Run the logout function without wipe flag
|
|
LeaPlusLC:PlayerLogout(false)
|
|
|
|
-- Automation
|
|
LeaPlusDB["AutomateQuests"] = LeaPlusLC["AutomateQuests"]
|
|
LeaPlusDB["AutoQuestShift"] = LeaPlusLC["AutoQuestShift"]
|
|
LeaPlusDB["AutoQuestRegular"] = LeaPlusLC["AutoQuestRegular"]
|
|
LeaPlusDB["AutoQuestDaily"] = LeaPlusLC["AutoQuestDaily"]
|
|
LeaPlusDB["AutoQuestWeekly"] = LeaPlusLC["AutoQuestWeekly"]
|
|
LeaPlusDB["AutoQuestCompleted"] = LeaPlusLC["AutoQuestCompleted"]
|
|
LeaPlusDB["AutoQuestKeyMenu"] = LeaPlusLC["AutoQuestKeyMenu"]
|
|
LeaPlusDB["AutomateGossip"] = LeaPlusLC["AutomateGossip"]
|
|
LeaPlusDB["AutoAcceptSummon"] = LeaPlusLC["AutoAcceptSummon"]
|
|
LeaPlusDB["AutoAcceptRes"] = LeaPlusLC["AutoAcceptRes"]
|
|
LeaPlusDB["AutoResNoCombat"] = LeaPlusLC["AutoResNoCombat"]
|
|
LeaPlusDB["AutoResNoAfterlife"] = LeaPlusLC["AutoResNoAfterlife"]
|
|
LeaPlusDB["AutoReleasePvP"] = LeaPlusLC["AutoReleasePvP"]
|
|
LeaPlusDB["AutoReleaseNoAlterac"] = LeaPlusLC["AutoReleaseNoAlterac"]
|
|
LeaPlusDB["AutoReleaseNoWintergsp"] = LeaPlusLC["AutoReleaseNoWintergsp"]
|
|
LeaPlusDB["AutoReleaseNoTolBarad"] = LeaPlusLC["AutoReleaseNoTolBarad"]
|
|
LeaPlusDB["AutoReleaseNoAshran"] = LeaPlusLC["AutoReleaseNoAshran"]
|
|
LeaPlusDB["AutoReleaseDelay"] = LeaPlusLC["AutoReleaseDelay"]
|
|
|
|
LeaPlusDB["AutoSellJunk"] = LeaPlusLC["AutoSellJunk"]
|
|
LeaPlusDB["AutoSellShowSummary"] = LeaPlusLC["AutoSellShowSummary"]
|
|
LeaPlusDB["AutoSellNoKeeperTahult"] = LeaPlusLC["AutoSellNoKeeperTahult"]
|
|
LeaPlusDB["AutoSellNoGreyGear"] = LeaPlusLC["AutoSellNoGreyGear"]
|
|
LeaPlusDB["AutoSellExcludeList"] = LeaPlusLC["AutoSellExcludeList"]
|
|
LeaPlusDB["AutoRepairGear"] = LeaPlusLC["AutoRepairGear"]
|
|
LeaPlusDB["AutoRepairGuildFunds"] = LeaPlusLC["AutoRepairGuildFunds"]
|
|
LeaPlusDB["AutoRepairShowSummary"] = LeaPlusLC["AutoRepairShowSummary"]
|
|
|
|
-- Social
|
|
LeaPlusDB["NoDuelRequests"] = LeaPlusLC["NoDuelRequests"]
|
|
LeaPlusDB["NoPetDuels"] = LeaPlusLC["NoPetDuels"]
|
|
LeaPlusDB["NoPartyInvites"] = LeaPlusLC["NoPartyInvites"]
|
|
LeaPlusDB["NoRequestedInvites"] = LeaPlusLC["NoRequestedInvites"]
|
|
LeaPlusDB["NoFriendRequests"] = LeaPlusLC["NoFriendRequests"]
|
|
LeaPlusDB["NoSharedQuests"] = LeaPlusLC["NoSharedQuests"]
|
|
|
|
LeaPlusDB["AcceptPartyFriends"] = LeaPlusLC["AcceptPartyFriends"]
|
|
LeaPlusDB["SyncFromFriends"] = LeaPlusLC["SyncFromFriends"]
|
|
LeaPlusDB["AutoConfirmRole"] = LeaPlusLC["AutoConfirmRole"]
|
|
LeaPlusDB["InviteFromWhisper"] = LeaPlusLC["InviteFromWhisper"]
|
|
LeaPlusDB["InviteFriendsOnly"] = LeaPlusLC["InviteFriendsOnly"]
|
|
LeaPlusDB["InvKey"] = LeaPlusLC["InvKey"]
|
|
LeaPlusDB["FriendlyCommunities"] = LeaPlusLC["FriendlyCommunities"]
|
|
LeaPlusDB["FriendlyGuild"] = LeaPlusLC["FriendlyGuild"]
|
|
|
|
-- Chat
|
|
LeaPlusDB["UseEasyChatResizing"] = LeaPlusLC["UseEasyChatResizing"]
|
|
LeaPlusDB["NoCombatLogTab"] = LeaPlusLC["NoCombatLogTab"]
|
|
LeaPlusDB["NoChatButtons"] = LeaPlusLC["NoChatButtons"]
|
|
LeaPlusDB["ShowVoiceButtons"] = LeaPlusLC["ShowVoiceButtons"]
|
|
LeaPlusDB["ShowChatMenuButton"] = LeaPlusLC["ShowChatMenuButton"]
|
|
LeaPlusDB["NoSocialButton"] = LeaPlusLC["NoSocialButton"]
|
|
LeaPlusDB["UnclampChat"] = LeaPlusLC["UnclampChat"]
|
|
LeaPlusDB["MoveChatEditBoxToTop"] = LeaPlusLC["MoveChatEditBoxToTop"]
|
|
LeaPlusDB["SetChatFontSize"] = LeaPlusLC["SetChatFontSize"]
|
|
LeaPlusDB["LeaPlusChatFontSize"] = LeaPlusLC["LeaPlusChatFontSize"]
|
|
|
|
LeaPlusDB["NoStickyChat"] = LeaPlusLC["NoStickyChat"]
|
|
LeaPlusDB["UseArrowKeysInChat"] = LeaPlusLC["UseArrowKeysInChat"]
|
|
LeaPlusDB["NoChatFade"] = LeaPlusLC["NoChatFade"]
|
|
LeaPlusDB["UnivGroupColor"] = LeaPlusLC["UnivGroupColor"]
|
|
LeaPlusDB["RecentChatWindow"] = LeaPlusLC["RecentChatWindow"]
|
|
LeaPlusDB["RecentChatSize"] = LeaPlusLC["RecentChatSize"]
|
|
LeaPlusDB["MaxChatHstory"] = LeaPlusLC["MaxChatHstory"]
|
|
LeaPlusDB["FilterChatMessages"] = LeaPlusLC["FilterChatMessages"]
|
|
LeaPlusDB["BlockSpellLinks"] = LeaPlusLC["BlockSpellLinks"]
|
|
LeaPlusDB["BlockDrunkenSpam"] = LeaPlusLC["BlockDrunkenSpam"]
|
|
LeaPlusDB["BlockDuelSpam"] = LeaPlusLC["BlockDuelSpam"]
|
|
LeaPlusDB["BlockAngelisSinny"] = LeaPlusLC["BlockAngelisSinny"]
|
|
LeaPlusDB["RestoreChatMessages"] = LeaPlusLC["RestoreChatMessages"]
|
|
|
|
-- Text
|
|
LeaPlusDB["HideErrorMessages"] = LeaPlusLC["HideErrorMessages"]
|
|
LeaPlusDB["NoHitIndicators"] = LeaPlusLC["NoHitIndicators"]
|
|
LeaPlusDB["HideZoneText"] = LeaPlusLC["HideZoneText"]
|
|
LeaPlusDB["HideKeybindText"] = LeaPlusLC["HideKeybindText"]
|
|
LeaPlusDB["HideMacroText"] = LeaPlusLC["HideMacroText"]
|
|
|
|
LeaPlusDB["MailFontChange"] = LeaPlusLC["MailFontChange"]
|
|
LeaPlusDB["LeaPlusMailFontSize"] = LeaPlusLC["LeaPlusMailFontSize"]
|
|
|
|
LeaPlusDB["QuestFontChange"] = LeaPlusLC["QuestFontChange"]
|
|
LeaPlusDB["LeaPlusQuestFontSize"] = LeaPlusLC["LeaPlusQuestFontSize"]
|
|
|
|
-- Interface
|
|
LeaPlusDB["MinimapModder"] = LeaPlusLC["MinimapModder"]
|
|
LeaPlusDB["SquareMinimap"] = LeaPlusLC["SquareMinimap"]
|
|
LeaPlusDB["ShowWhoPinged"] = LeaPlusLC["ShowWhoPinged"]
|
|
LeaPlusDB["HideMiniAddonMenu"] = LeaPlusLC["HideMiniAddonMenu"]
|
|
LeaPlusDB["UnclampMinimap"] = LeaPlusLC["UnclampMinimap"]
|
|
LeaPlusDB["CombineAddonButtons"] = LeaPlusLC["CombineAddonButtons"]
|
|
LeaPlusDB["MiniExcludeList"] = LeaPlusLC["MiniExcludeList"]
|
|
LeaPlusDB["HideMiniAddonButtons"] = LeaPlusLC["HideMiniAddonButtons"]
|
|
LeaPlusDB["MiniClusterScale"] = LeaPlusLC["MiniClusterScale"]
|
|
LeaPlusDB["MinimapNoScale"] = LeaPlusLC["MinimapNoScale"]
|
|
LeaPlusDB["MinimapA"] = LeaPlusLC["MinimapA"]
|
|
LeaPlusDB["MinimapR"] = LeaPlusLC["MinimapR"]
|
|
LeaPlusDB["MinimapX"] = LeaPlusLC["MinimapX"]
|
|
LeaPlusDB["MinimapY"] = LeaPlusLC["MinimapY"]
|
|
|
|
LeaPlusDB["TipModEnable"] = LeaPlusLC["TipModEnable"]
|
|
LeaPlusDB["TipShowRank"] = LeaPlusLC["TipShowRank"]
|
|
LeaPlusDB["TipShowOtherRank"] = LeaPlusLC["TipShowOtherRank"]
|
|
LeaPlusDB["TipShowTarget"] = LeaPlusLC["TipShowTarget"]
|
|
--LeaPlusDB["TipShowMythic"] = LeaPlusLC["TipShowMythic"]
|
|
LeaPlusDB["TipBackSimple"] = LeaPlusLC["TipBackSimple"]
|
|
LeaPlusDB["TipHideInCombat"] = LeaPlusLC["TipHideInCombat"]
|
|
LeaPlusDB["TipHideShiftOverride"] = LeaPlusLC["TipHideShiftOverride"]
|
|
LeaPlusDB["TipNoHealthBar"] = LeaPlusLC["TipNoHealthBar"]
|
|
LeaPlusDB["LeaPlusTipSize"] = LeaPlusLC["LeaPlusTipSize"]
|
|
LeaPlusDB["TooltipAnchorMenu"] = LeaPlusLC["TooltipAnchorMenu"]
|
|
LeaPlusDB["TipCursorX"] = LeaPlusLC["TipCursorX"]
|
|
LeaPlusDB["TipCursorY"] = LeaPlusLC["TipCursorY"]
|
|
|
|
LeaPlusDB["EnhanceDressup"] = LeaPlusLC["EnhanceDressup"]
|
|
LeaPlusDB["DressupItemButtons"] = LeaPlusLC["DressupItemButtons"]
|
|
LeaPlusDB["DressupAnimControl"] = LeaPlusLC["DressupAnimControl"]
|
|
LeaPlusDB["DressupWiderPreview"] = LeaPlusLC["DressupWiderPreview"]
|
|
LeaPlusDB["DressupMoreZoomOut"] = LeaPlusLC["DressupMoreZoomOut"]
|
|
LeaPlusDB["DressupTransmogAnim"] = LeaPlusLC["DressupTransmogAnim"]
|
|
LeaPlusDB["DressupFasterZoom"] = LeaPlusLC["DressupFasterZoom"]
|
|
LeaPlusDB["ShowVolume"] = LeaPlusLC["ShowVolume"]
|
|
LeaPlusDB["ShowVolumeInFrame"] = LeaPlusLC["ShowVolumeInFrame"]
|
|
|
|
LeaPlusDB["ShowCooldowns"] = LeaPlusLC["ShowCooldowns"]
|
|
LeaPlusDB["ShowCooldownID"] = LeaPlusLC["ShowCooldownID"]
|
|
LeaPlusDB["NoCooldownDuration"] = LeaPlusLC["NoCooldownDuration"]
|
|
LeaPlusDB["CooldownsOnPlayer"] = LeaPlusLC["CooldownsOnPlayer"]
|
|
LeaPlusDB["DurabilityStatus"] = LeaPlusLC["DurabilityStatus"]
|
|
LeaPlusDB["ShowPetSaveBtn"] = LeaPlusLC["ShowPetSaveBtn"]
|
|
LeaPlusDB["ShowRaidToggle"] = LeaPlusLC["ShowRaidToggle"]
|
|
LeaPlusDB["ShowTrainAllButton"] = LeaPlusLC["ShowTrainAllButton"]
|
|
LeaPlusDB["ShowBorders"] = LeaPlusLC["ShowBorders"]
|
|
LeaPlusDB["BordersTop"] = LeaPlusLC["BordersTop"]
|
|
LeaPlusDB["BordersBottom"] = LeaPlusLC["BordersBottom"]
|
|
LeaPlusDB["BordersLeft"] = LeaPlusLC["BordersLeft"]
|
|
LeaPlusDB["BordersRight"] = LeaPlusLC["BordersRight"]
|
|
LeaPlusDB["BordersAlpha"] = LeaPlusLC["BordersAlpha"]
|
|
LeaPlusDB["ShowPlayerChain"] = LeaPlusLC["ShowPlayerChain"]
|
|
LeaPlusDB["PlayerChainMenu"] = LeaPlusLC["PlayerChainMenu"]
|
|
LeaPlusDB["ShowReadyTimer"] = LeaPlusLC["ShowReadyTimer"]
|
|
LeaPlusDB["ShowWowheadLinks"] = LeaPlusLC["ShowWowheadLinks"]
|
|
LeaPlusDB["WowheadLinkComments"] = LeaPlusLC["WowheadLinkComments"]
|
|
|
|
-- Frames
|
|
LeaPlusDB["ManageWidgetTop"] = LeaPlusLC["ManageWidgetTop"]
|
|
LeaPlusDB["WidgetTopA"] = LeaPlusLC["WidgetTopA"]
|
|
LeaPlusDB["WidgetTopR"] = LeaPlusLC["WidgetTopR"]
|
|
LeaPlusDB["WidgetTopX"] = LeaPlusLC["WidgetTopX"]
|
|
LeaPlusDB["WidgetTopY"] = LeaPlusLC["WidgetTopY"]
|
|
LeaPlusDB["WidgetTopScale"] = LeaPlusLC["WidgetTopScale"]
|
|
|
|
LeaPlusDB["ManageControl"] = LeaPlusLC["ManageControl"]
|
|
LeaPlusDB["ControlA"] = LeaPlusLC["ControlA"]
|
|
LeaPlusDB["ControlR"] = LeaPlusLC["ControlR"]
|
|
LeaPlusDB["ControlX"] = LeaPlusLC["ControlX"]
|
|
LeaPlusDB["ControlY"] = LeaPlusLC["ControlY"]
|
|
LeaPlusDB["ControlScale"] = LeaPlusLC["ControlScale"]
|
|
|
|
LeaPlusDB["ClassColFrames"] = LeaPlusLC["ClassColFrames"]
|
|
LeaPlusDB["ClassColPlayer"] = LeaPlusLC["ClassColPlayer"]
|
|
LeaPlusDB["ClassColTarget"] = LeaPlusLC["ClassColTarget"]
|
|
|
|
LeaPlusDB["NoAlerts"] = LeaPlusLC["NoAlerts"]
|
|
LeaPlusDB["HideBodyguard"] = LeaPlusLC["HideBodyguard"]
|
|
LeaPlusDB["HideTalkingFrame"] = LeaPlusLC["HideTalkingFrame"]
|
|
LeaPlusDB["HideCleanupBtns"] = LeaPlusLC["HideCleanupBtns"]
|
|
LeaPlusDB["HideBossBanner"] = LeaPlusLC["HideBossBanner"]
|
|
LeaPlusDB["HideEventToasts"] = LeaPlusLC["HideEventToasts"]
|
|
LeaPlusDB["NoClassBar"] = LeaPlusLC["NoClassBar"]
|
|
LeaPlusDB["NoCommandBar"] = LeaPlusLC["NoCommandBar"]
|
|
LeaPlusDB["NoRestedSleep"] = LeaPlusLC["NoRestedSleep"]
|
|
|
|
-- System
|
|
LeaPlusDB["NoScreenGlow"] = LeaPlusLC["NoScreenGlow"]
|
|
LeaPlusDB["NoScreenEffects"] = LeaPlusLC["NoScreenEffects"]
|
|
LeaPlusDB["SetWeatherDensity"] = LeaPlusLC["SetWeatherDensity"]
|
|
LeaPlusDB["WeatherLevel"] = LeaPlusLC["WeatherLevel"]
|
|
LeaPlusDB["MaxCameraZoom"] = LeaPlusLC["MaxCameraZoom"]
|
|
|
|
LeaPlusDB["NoRestedEmotes"] = LeaPlusLC["NoRestedEmotes"]
|
|
LeaPlusDB["KeepAudioSynced"] = LeaPlusLC["KeepAudioSynced"]
|
|
LeaPlusDB["MuteGameSounds"] = LeaPlusLC["MuteGameSounds"]
|
|
LeaPlusDB["MuteMountSounds"] = LeaPlusLC["MuteMountSounds"]
|
|
LeaPlusDB["MuteCustomSounds"] = LeaPlusLC["MuteCustomSounds"]
|
|
LeaPlusDB["MuteCustomList"] = LeaPlusLC["MuteCustomList"]
|
|
|
|
LeaPlusDB["NoBagAutomation"] = LeaPlusLC["NoBagAutomation"]
|
|
LeaPlusDB["NoPetAutomation"] = LeaPlusLC["NoPetAutomation"]
|
|
LeaPlusDB["NoRaidRestrictions"] = LeaPlusLC["NoRaidRestrictions"]
|
|
LeaPlusDB["NoConfirmLoot"] = LeaPlusLC["NoConfirmLoot"]
|
|
LeaPlusDB["FasterLooting"] = LeaPlusLC["FasterLooting"]
|
|
LeaPlusDB["LeaPlusFasterLootDelay"] = LeaPlusLC["LeaPlusFasterLootDelay"]
|
|
|
|
LeaPlusDB["FasterMovieSkip"] = LeaPlusLC["FasterMovieSkip"]
|
|
LeaPlusDB["CombatPlates"] = LeaPlusLC["CombatPlates"]
|
|
LeaPlusDB["EasyItemDestroy"] = LeaPlusLC["EasyItemDestroy"]
|
|
LeaPlusDB["NoTransforms"] = LeaPlusLC["NoTransforms"]
|
|
LeaPlusDB["SetAddtonOptions"] = LeaPlusLC["SetAddtonOptions"]
|
|
LeaPlusDB["AddOptNoCombatBox"] = LeaPlusLC["AddOptNoCombatBox"]
|
|
LeaPlusDB["AddOptNoMountBox"] = LeaPlusLC["AddOptNoMountBox"]
|
|
|
|
-- Settings
|
|
LeaPlusDB["ShowMinimapIcon"] = LeaPlusLC["ShowMinimapIcon"]
|
|
LeaPlusDB["PlusPanelScale"] = LeaPlusLC["PlusPanelScale"]
|
|
LeaPlusDB["PlusPanelAlpha"] = LeaPlusLC["PlusPanelAlpha"]
|
|
|
|
-- Panel position
|
|
LeaPlusDB["MainPanelA"] = LeaPlusLC["MainPanelA"]
|
|
LeaPlusDB["MainPanelR"] = LeaPlusLC["MainPanelR"]
|
|
LeaPlusDB["MainPanelX"] = LeaPlusLC["MainPanelX"]
|
|
LeaPlusDB["MainPanelY"] = LeaPlusLC["MainPanelY"]
|
|
|
|
-- Start page
|
|
LeaPlusDB["LeaStartPage"] = LeaPlusLC["LeaStartPage"]
|
|
|
|
-- Mute game sounds (LeaPlusLC["MuteGameSounds"])
|
|
for k, v in pairs(LeaPlusLC["muteTable"]) do
|
|
LeaPlusDB[k] = LeaPlusLC[k]
|
|
end
|
|
|
|
-- Mute mount sounds (LeaPlusLC["MuteMountSounds"])
|
|
for k, v in pairs(LeaPlusLC["mountTable"]) do
|
|
LeaPlusDB[k] = LeaPlusLC[k]
|
|
end
|
|
|
|
-- Remove transforms (LeaPlusLC["NoTransforms"])
|
|
for k, v in pairs(LeaPlusLC["transTable"]) do
|
|
LeaPlusDB[k] = LeaPlusLC[k]
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- Register event handler
|
|
LpEvt:SetScript("OnEvent", eventHandler)
|
|
|
|
----------------------------------------------------------------------
|
|
-- L70: Player logout
|
|
----------------------------------------------------------------------
|
|
|
|
-- Player Logout
|
|
function LeaPlusLC:PlayerLogout(wipe)
|
|
|
|
----------------------------------------------------------------------
|
|
-- Restore default values for options that do not require reloads
|
|
----------------------------------------------------------------------
|
|
|
|
-- Disable screen glow (LeaPlusLC["NoScreenGlow"])
|
|
if wipe then
|
|
|
|
-- Disable screen glow (LeaPlusLC["NoScreenGlow"])
|
|
SetCVar("ffxGlow", "1")
|
|
|
|
-- Disable screen effects (LeaPlusLC["NoScreenEffects"])
|
|
SetCVar("ffxDeath", "1")
|
|
SetCVar("ffxNether", "1")
|
|
SetCVar("ffxVenari", "1")
|
|
SetCVar("ffxLingeringVenari", "1")
|
|
|
|
-- Set weather density (LeaPlusLC["SetWeatherDensity"])
|
|
SetCVar("WeatherDensity", "3")
|
|
SetCVar("RAIDweatherDensity", "3")
|
|
|
|
-- Remove raid restrictions (LeaPlusLC["NoRaidRestrictions"])
|
|
SetAllowLowLevelRaid(false)
|
|
|
|
-- Max camera zoom (LeaPlusLC["MaxCameraZoom"])
|
|
SetCVar("cameraDistanceMaxZoomFactor", 1.9)
|
|
|
|
-- Universal group color (LeaPlusLC["UnivGroupColor"])
|
|
ChangeChatColor("RAID", 1, 0.50, 0)
|
|
ChangeChatColor("RAID_LEADER", 1, 0.28, 0.04)
|
|
ChangeChatColor("INSTANCE_CHAT", 1, 0.50, 0)
|
|
ChangeChatColor("INSTANCE_CHAT_LEADER", 1, 0.28, 0.04)
|
|
|
|
-- Mute game sounds (LeaPlusLC["MuteGameSounds"])
|
|
for k, v in pairs(LeaPlusLC["muteTable"]) do
|
|
for i, e in pairs(v) do
|
|
local file, soundID = e:match("([^,]+)%#([^,]+)")
|
|
UnmuteSoundFile(soundID)
|
|
end
|
|
end
|
|
|
|
-- Mute mount sounds (LeaPlusLC["MuteMountSounds"])
|
|
for k, v in pairs(LeaPlusLC["mountTable"]) do
|
|
for i, e in pairs(v) do
|
|
local file, soundID = e:match("([^,]+)%#([^,]+)")
|
|
UnmuteSoundFile(soundID)
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Restore default values for options that require reloads
|
|
----------------------------------------------------------------------
|
|
|
|
-- Silence rested emotes
|
|
if LeaPlusDB["NoRestedEmotes"] == "On" then
|
|
if wipe or (not wipe and LeaPlusLC["NoRestedEmotes"] == "Off") then
|
|
SetCVar("Sound_EnableEmoteSounds", "1")
|
|
end
|
|
end
|
|
|
|
-- Set chat font size
|
|
if LeaPlusDB["SetChatFontSize"] == "On" and not LeaLockList["SetChatFontSize"] then
|
|
if wipe or (not wipe and LeaPlusLC["SetChatFontSize"] == "Off") then
|
|
for i = 1, 50 do
|
|
if _G["ChatFrame" .. i] then
|
|
LeaPlusLC["LeaPlusChatFontSize"] = CHAT_FRAME_DEFAULT_FONT_SIZE
|
|
FCF_SetChatWindowFontSize(self, _G["ChatFrame" .. i], CHAT_FRAME_DEFAULT_FONT_SIZE)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Options panel functions
|
|
----------------------------------------------------------------------
|
|
|
|
-- Function to add textures to panels
|
|
function LeaPlusLC:CreateBar(name, parent, width, height, anchor, r, g, b, alp, tex)
|
|
local ft = parent:CreateTexture(nil, "BORDER")
|
|
ft:SetTexture(tex)
|
|
ft:SetSize(width, height)
|
|
ft:SetPoint(anchor)
|
|
ft:SetVertexColor(r ,g, b, alp)
|
|
if name == "MainTexture" then
|
|
ft:SetTexCoord(0.09, 1, 0, 1);
|
|
end
|
|
end
|
|
|
|
-- Create a configuration panel
|
|
function LeaPlusLC:CreatePanel(title, globref, scrolling)
|
|
|
|
-- Create the panel
|
|
local Side = CreateFrame("Frame", nil, UIParent)
|
|
|
|
-- Make it a system frame
|
|
_G["LeaPlusGlobalPanel_" .. globref] = Side
|
|
table.insert(UISpecialFrames, "LeaPlusGlobalPanel_" .. globref)
|
|
|
|
-- Store it in the configuration panel table
|
|
tinsert(LeaConfigList, Side)
|
|
|
|
-- Set frame parameters
|
|
Side:Hide();
|
|
Side:SetSize(570, 370);
|
|
Side:SetClampedToScreen(true)
|
|
Side:SetClampRectInsets(500, -500, -300, 300)
|
|
Side:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
|
|
-- Set the background color
|
|
Side.t = Side:CreateTexture(nil, "BACKGROUND")
|
|
Side.t:SetAllPoints()
|
|
Side.t:SetColorTexture(0.05, 0.05, 0.05, 0.9)
|
|
|
|
-- Add a close Button
|
|
Side.c = LeaPlusLC:CreateCloseButton(Side, 30, 30, "TOPRIGHT", 0, 0)
|
|
Side.c:SetScript("OnClick", function() Side:Hide() end)
|
|
|
|
-- Add reset, help and back buttons
|
|
Side.r = LeaPlusLC:CreateButton("ResetButton", Side, "Reset", "TOPLEFT", 16, -292, 0, 25, true, "Click to reset the settings on this page.")
|
|
Side.h = LeaPlusLC:CreateButton("HelpButton", Side, "Help", "TOPLEFT", 76, -292, 0, 25, true, "No help is available for this page.")
|
|
Side.b = LeaPlusLC:CreateButton("BackButton", Side, "Back to Main Menu", "TOPRIGHT", -16, -292, 0, 25, true, "Click to return to the main menu.")
|
|
|
|
-- Reposition help button so it doesn't overlap reset button
|
|
Side.h:ClearAllPoints()
|
|
Side.h:SetPoint("LEFT", Side.r, "RIGHT", 10, 0)
|
|
|
|
-- Remove the click texture from the help button
|
|
Side.h:SetPushedTextOffset(0, 0)
|
|
|
|
-- Add a reload button and syncronise it with the main panel reload button
|
|
local reloadb = LeaPlusLC:CreateButton("ConfigReload", Side, "Reload", "BOTTOMRIGHT", -16, 10, 0, 25, true, LeaPlusCB["ReloadUIButton"].tiptext)
|
|
LeaPlusLC:LockItem(reloadb,true)
|
|
reloadb:SetScript("OnClick", ReloadUI)
|
|
|
|
reloadb.f = reloadb:CreateFontString(nil, 'ARTWORK', 'GameFontNormalSmall')
|
|
reloadb.f:SetHeight(32);
|
|
reloadb.f:SetPoint('RIGHT', reloadb, 'LEFT', -10, 0)
|
|
reloadb.f:SetText(LeaPlusCB["ReloadUIButton"].f:GetText())
|
|
reloadb.f:Hide()
|
|
|
|
LeaPlusCB["ReloadUIButton"]:HookScript("OnEnable", function()
|
|
LeaPlusLC:LockItem(reloadb, false)
|
|
reloadb.f:Show()
|
|
end)
|
|
|
|
LeaPlusCB["ReloadUIButton"]:HookScript("OnDisable", function()
|
|
LeaPlusLC:LockItem(reloadb, true)
|
|
reloadb.f:Hide()
|
|
end)
|
|
|
|
-- Set textures
|
|
LeaPlusLC:CreateBar("FootTexture", Side, 570, 48, "BOTTOM", 0.5, 0.5, 0.5, 1.0, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png")
|
|
LeaPlusLC:CreateBar("MainTexture", Side, 570, 323, "TOPRIGHT", 0.7, 0.7, 0.7, 0.7, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png")
|
|
|
|
-- Allow movement
|
|
Side:EnableMouse(true)
|
|
Side:SetMovable(true)
|
|
Side:RegisterForDrag("LeftButton")
|
|
Side:SetScript("OnDragStart", Side.StartMoving)
|
|
Side:SetScript("OnDragStop", function ()
|
|
Side:StopMovingOrSizing();
|
|
Side:SetUserPlaced(false);
|
|
-- Save panel position
|
|
LeaPlusLC["MainPanelA"], void, LeaPlusLC["MainPanelR"], LeaPlusLC["MainPanelX"], LeaPlusLC["MainPanelY"] = Side:GetPoint()
|
|
end)
|
|
|
|
-- Set panel attributes when shown
|
|
Side:SetScript("OnShow", function()
|
|
Side:ClearAllPoints()
|
|
Side:SetPoint(LeaPlusLC["MainPanelA"], UIParent, LeaPlusLC["MainPanelR"], LeaPlusLC["MainPanelX"], LeaPlusLC["MainPanelY"])
|
|
Side:SetScale(LeaPlusLC["PlusPanelScale"])
|
|
Side.t:SetAlpha(1 - LeaPlusLC["PlusPanelAlpha"])
|
|
end)
|
|
|
|
-- Add title
|
|
Side.f = Side:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
Side.f:SetPoint('TOPLEFT', 16, -16);
|
|
Side.f:SetText(L[title])
|
|
|
|
-- Add description
|
|
Side.v = Side:CreateFontString(nil, 'ARTWORK', 'GameFontHighlightSmall')
|
|
Side.v:SetHeight(32);
|
|
Side.v:SetPoint('TOPLEFT', Side.f, 'BOTTOMLEFT', 0, -8);
|
|
Side.v:SetPoint('RIGHT', Side, -32, 0)
|
|
Side.v:SetJustifyH('LEFT'); Side.v:SetJustifyV('TOP');
|
|
Side.v:SetText(L["Configuration Panel"])
|
|
|
|
-- Prevent options panel from showing while side panel is showing
|
|
LeaPlusLC["PageF"]:HookScript("OnShow", function()
|
|
if Side:IsShown() then LeaPlusLC["PageF"]:Hide(); end
|
|
end)
|
|
|
|
-- Create scroll frame if needed
|
|
if scrolling then
|
|
|
|
-- Create backdrop
|
|
Side.backFrame = CreateFrame("FRAME", nil, Side, "BackdropTemplate")
|
|
Side.backFrame:SetSize(Side:GetSize())
|
|
Side.backFrame:SetPoint("TOPLEFT", 16, -68)
|
|
Side.backFrame:SetPoint("BOTTOMRIGHT", -16, 108)
|
|
Side.backFrame:SetBackdrop({bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background"})
|
|
Side.backFrame:SetBackdropColor(0, 0, 1, 0.5)
|
|
|
|
-- Create scroll frame
|
|
Side.scrollFrame = CreateFrame("ScrollFrame", nil, Side.backFrame, "LeaPlusConfigurationPanelScrollFrameTemplate")
|
|
Side.scrollChild = CreateFrame("Frame", nil, Side.scrollFrame)
|
|
|
|
Side.scrollChild:SetSize(1, 1)
|
|
Side.scrollFrame:SetScrollChild(Side.scrollChild)
|
|
Side.scrollFrame:SetPoint("TOPLEFT", -8, -6)
|
|
Side.scrollFrame:SetPoint("BOTTOMRIGHT", -29, 6)
|
|
Side.scrollFrame:SetPanExtent(20)
|
|
|
|
-- Set scroll list to top when shown
|
|
Side.scrollFrame:HookScript("OnShow", function()
|
|
Side.scrollFrame:SetVerticalScroll(0)
|
|
end)
|
|
|
|
-- Add scroll for more message
|
|
local footMessage = LeaPlusLC:MakeTx(Side, "(scroll the list for more)", 16, 0)
|
|
footMessage:ClearAllPoints()
|
|
footMessage:SetPoint("TOPRIGHT", Side.scrollFrame, "TOPRIGHT", 28, 24)
|
|
|
|
-- Give child a file level scope (it's used in LeaPlusLC.TipSee)
|
|
LeaPlusLC[globref .. "ScrollChild"] = Side.scrollChild
|
|
|
|
end
|
|
|
|
-- Return the frame
|
|
return Side
|
|
|
|
end
|
|
|
|
-- Define subheadings
|
|
function LeaPlusLC:MakeTx(frame, title, x, y)
|
|
local text = frame:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
text:SetPoint("TOPLEFT", x, y)
|
|
text:SetText(L[title])
|
|
return text
|
|
end
|
|
|
|
-- Define text
|
|
function LeaPlusLC:MakeWD(frame, title, x, y)
|
|
local text = frame:CreateFontString(nil, 'ARTWORK', 'GameFontHighlight')
|
|
text:SetPoint("TOPLEFT", x, y)
|
|
text:SetText(L[title])
|
|
text:SetJustifyH"LEFT";
|
|
return text
|
|
end
|
|
|
|
-- Create a slider control (uses standard template)
|
|
function LeaPlusLC:MakeSL(frame, field, caption, low, high, step, x, y, form)
|
|
|
|
-- Create slider control
|
|
local Slider = CreateFrame("Slider", nil, frame, "UISliderTemplate")
|
|
LeaPlusCB[field] = Slider
|
|
Slider:SetMinMaxValues(low, high)
|
|
Slider:SetValueStep(step)
|
|
Slider:EnableMouseWheel(true)
|
|
Slider:SetPoint('TOPLEFT', x,y)
|
|
Slider:SetWidth(100)
|
|
Slider:SetHeight(20)
|
|
Slider:SetHitRectInsets(0, 0, 0, 0)
|
|
Slider.tiptext = L[caption]
|
|
Slider:SetScript("OnEnter", LeaPlusLC.TipSee)
|
|
Slider:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Create slider label
|
|
Slider.f = Slider:CreateFontString(nil, 'BACKGROUND')
|
|
Slider.f:SetFontObject('GameFontHighlight')
|
|
Slider.f:SetPoint('LEFT', Slider, 'RIGHT', 12, 0)
|
|
Slider.f:SetFormattedText("%.2f", Slider:GetValue())
|
|
|
|
-- Process mousewheel scrolling
|
|
Slider:SetScript("OnMouseWheel", function(self, arg1)
|
|
if Slider:IsEnabled() then
|
|
local step = step * arg1
|
|
local value = self:GetValue()
|
|
if step > 0 then
|
|
self:SetValue(min(value + step, high))
|
|
else
|
|
self:SetValue(max(value + step, low))
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Process value changed
|
|
Slider:SetScript("OnValueChanged", function(self, value)
|
|
local value = floor((value - low) / step + 0.5) * step + low
|
|
Slider.f:SetFormattedText(form, value)
|
|
LeaPlusLC[field] = value
|
|
end)
|
|
|
|
-- Set slider value when shown
|
|
Slider:SetScript("OnShow", function(self)
|
|
self:SetValue(LeaPlusLC[field])
|
|
end)
|
|
|
|
end
|
|
|
|
-- Create a checkbox control (uses standard template)
|
|
function LeaPlusLC:MakeCB(parent, field, caption, x, y, reload, tip, tipstyle)
|
|
|
|
-- Create the checkbox
|
|
local Cbox = CreateFrame('CheckButton', nil, parent, "ChatConfigCheckButtonTemplate")
|
|
LeaPlusCB[field] = Cbox
|
|
Cbox:SetPoint("TOPLEFT",x, y)
|
|
Cbox:SetScript("OnEnter", LeaPlusLC.TipSee)
|
|
Cbox:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Add label and tooltip
|
|
Cbox.f = Cbox:CreateFontString(nil, 'ARTWORK', 'GameFontHighlight')
|
|
Cbox.f:SetPoint('LEFT', 20, 0)
|
|
if reload then
|
|
-- Checkbox requires UI reload
|
|
Cbox.f:SetText(L[caption] .. "*")
|
|
Cbox.tiptext = L[tip] .. "|n|n* " .. L["Requires UI reload."]
|
|
else
|
|
-- Checkbox does not require UI reload
|
|
Cbox.f:SetText(L[caption])
|
|
Cbox.tiptext = L[tip]
|
|
end
|
|
|
|
-- Set label parameters
|
|
Cbox.f:SetJustifyH("LEFT")
|
|
Cbox.f:SetWordWrap(false)
|
|
|
|
-- Set maximum label width
|
|
if parent:GetParent() == LeaPlusLC["PageF"] then
|
|
-- Main panel checkbox labels
|
|
if Cbox.f:GetWidth() > 152 then
|
|
Cbox.f:SetWidth(152)
|
|
LeaPlusLC["TruncatedLabelsList"] = LeaPlusLC["TruncatedLabelsList"] or {}
|
|
LeaPlusLC["TruncatedLabelsList"][Cbox.f] = L[caption]
|
|
end
|
|
-- Set checkbox click width
|
|
if Cbox.f:GetStringWidth() > 152 then
|
|
Cbox:SetHitRectInsets(0, -142, 0, 0)
|
|
else
|
|
Cbox:SetHitRectInsets(0, -Cbox.f:GetStringWidth() + 4, 0, 0)
|
|
end
|
|
else
|
|
-- Configuration panel checkbox labels (other checkboxes either have custom functions or blank labels)
|
|
if Cbox.f:GetWidth() > 302 then
|
|
Cbox.f:SetWidth(302)
|
|
LeaPlusLC["TruncatedLabelsList"] = LeaPlusLC["TruncatedLabelsList"] or {}
|
|
LeaPlusLC["TruncatedLabelsList"][Cbox.f] = L[caption]
|
|
end
|
|
-- Set checkbox click width
|
|
if Cbox.f:GetStringWidth() > 302 then
|
|
Cbox:SetHitRectInsets(0, -292, 0, 0)
|
|
else
|
|
Cbox:SetHitRectInsets(0, -Cbox.f:GetStringWidth() + 4, 0, 0)
|
|
end
|
|
end
|
|
|
|
-- Set default checkbox state and click area
|
|
Cbox:SetScript('OnShow', function(self)
|
|
if LeaPlusLC[field] == "On" then
|
|
self:SetChecked(true)
|
|
else
|
|
self:SetChecked(false)
|
|
end
|
|
end)
|
|
|
|
-- Process clicks
|
|
Cbox:SetScript('OnClick', function()
|
|
if Cbox:GetChecked() then
|
|
LeaPlusLC[field] = "On"
|
|
else
|
|
LeaPlusLC[field] = "Off"
|
|
end
|
|
LeaPlusLC:SetDim(); -- Lock invalid options
|
|
LeaPlusLC:ReloadCheck(); -- Show reload button if needed
|
|
end)
|
|
end
|
|
|
|
-- Create an editbox (uses standard template)
|
|
function LeaPlusLC:CreateEditBox(frame, parent, width, maxchars, anchor, x, y, tab, shifttab)
|
|
|
|
-- Create editbox
|
|
local eb = CreateFrame("EditBox", nil, parent, "InputBoxTemplate")
|
|
LeaPlusCB[frame] = eb
|
|
eb:SetPoint(anchor, x, y)
|
|
eb:SetWidth(width)
|
|
eb:SetHeight(24)
|
|
eb:SetFontObject("GameFontNormal")
|
|
eb:SetTextColor(1.0, 1.0, 1.0)
|
|
eb:SetAutoFocus(false)
|
|
eb:SetMaxLetters(maxchars)
|
|
eb:SetScript("OnEscapePressed", eb.ClearFocus)
|
|
eb:SetScript("OnEnterPressed", eb.ClearFocus)
|
|
|
|
-- Add editbox border and backdrop
|
|
eb.f = CreateFrame("FRAME", nil, eb, "BackdropTemplate")
|
|
eb.f:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = false, tileSize = 16, edgeSize = 16, insets = { left = 5, right = 5, top = 5, bottom = 5 }})
|
|
eb.f:SetPoint("LEFT", -6, 0)
|
|
eb.f:SetWidth(eb:GetWidth()+6)
|
|
eb.f:SetHeight(eb:GetHeight())
|
|
eb.f:SetBackdropColor(1.0, 1.0, 1.0, 0.3)
|
|
|
|
-- Move onto next editbox when tab key is pressed
|
|
eb:SetScript("OnTabPressed", function(self)
|
|
self:ClearFocus()
|
|
if IsShiftKeyDown() then
|
|
LeaPlusCB[shifttab]:SetFocus()
|
|
else
|
|
LeaPlusCB[tab]:SetFocus()
|
|
end
|
|
end)
|
|
|
|
return eb
|
|
|
|
end
|
|
|
|
-- Create a standard button (using standard button template)
|
|
function LeaPlusLC:CreateButton(name, frame, label, anchor, x, y, width, height, reskin, tip, naked)
|
|
local mbtn = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
|
|
LeaPlusCB[name] = mbtn
|
|
mbtn:SetSize(width, height)
|
|
mbtn:SetPoint(anchor, x, y)
|
|
mbtn:SetHitRectInsets(0, 0, 0, 0)
|
|
mbtn:SetText(L[label])
|
|
|
|
-- Create fontstring so the button can be sized correctly
|
|
mbtn.f = mbtn:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
mbtn.f:SetText(L[label])
|
|
if width > 0 then
|
|
-- Button should have static width
|
|
mbtn:SetWidth(width)
|
|
else
|
|
-- Button should have variable width
|
|
mbtn:SetWidth(mbtn.f:GetStringWidth() + 20)
|
|
end
|
|
|
|
-- Tooltip handler
|
|
mbtn.tiptext = L[tip]
|
|
mbtn:SetScript("OnEnter", LeaPlusLC.TipSee)
|
|
mbtn:SetScript("OnLeave", GameTooltip_Hide)
|
|
|
|
-- Texture the button
|
|
if reskin then
|
|
|
|
-- Set skinned button textures
|
|
if not naked then
|
|
mbtn:SetNormalTexture("Interface\\AddOns\\Leatrix_Plus\\Leatrix_Plus.blp")
|
|
mbtn:GetNormalTexture():SetTexCoord(0.5, 1, 0, 1)
|
|
end
|
|
mbtn:SetHighlightTexture("Interface\\AddOns\\Leatrix_Plus\\Leatrix_Plus.blp")
|
|
mbtn:GetHighlightTexture():SetTexCoord(0, 0.5, 0, 1)
|
|
|
|
-- Hide the default textures
|
|
mbtn:HookScript("OnShow", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end)
|
|
mbtn:HookScript("OnEnable", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end)
|
|
mbtn:HookScript("OnDisable", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end)
|
|
mbtn:HookScript("OnMouseDown", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end)
|
|
mbtn:HookScript("OnMouseUp", function() mbtn.Left:Hide(); mbtn.Middle:Hide(); mbtn.Right:Hide() end)
|
|
|
|
end
|
|
|
|
return mbtn
|
|
end
|
|
|
|
-- Create a dropdown menu (using standard dropdown template)
|
|
function LeaPlusLC:CreateDropdown(frame, label, width, anchor, parent, relative, x, y, items)
|
|
|
|
local RadioDropdown = CreateFrame("DropdownButton", nil, parent, "WowStyle1DropdownTemplate")
|
|
LeaPlusCB[frame] = RadioDropdown
|
|
RadioDropdown:SetPoint(anchor, parent, relative, x, y)
|
|
|
|
local function IsSelected(value)
|
|
return value == LeaPlusLC[frame]
|
|
end
|
|
|
|
local function SetSelected(value)
|
|
LeaPlusLC[frame] = value
|
|
end
|
|
|
|
MenuUtil.CreateRadioMenu(RadioDropdown, IsSelected, SetSelected, unpack(items))
|
|
|
|
local lf = RadioDropdown:CreateFontString(nil, "OVERLAY", "GameFontNormal"); lf:SetPoint("TOPLEFT", RadioDropdown, 0, 20); lf:SetPoint("TOPRIGHT", RadioDropdown, -5, 20); lf:SetJustifyH("LEFT"); lf:SetText(L[label])
|
|
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- Create main options panel frame
|
|
----------------------------------------------------------------------
|
|
|
|
function LeaPlusLC:CreateMainPanel()
|
|
|
|
-- Create the panel
|
|
local PageF = CreateFrame("Frame", nil, UIParent);
|
|
|
|
-- Make it a system frame
|
|
_G["LeaPlusGlobalPanel"] = PageF
|
|
table.insert(UISpecialFrames, "LeaPlusGlobalPanel")
|
|
|
|
-- Set frame parameters
|
|
LeaPlusLC["PageF"] = PageF
|
|
PageF:SetSize(570,370)
|
|
PageF:Hide();
|
|
PageF:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
PageF:SetClampedToScreen(true)
|
|
PageF:SetClampRectInsets(500, -500, -300, 300)
|
|
PageF:EnableMouse(true)
|
|
PageF:SetMovable(true)
|
|
PageF:RegisterForDrag("LeftButton")
|
|
PageF:SetScript("OnDragStart", PageF.StartMoving)
|
|
PageF:SetScript("OnDragStop", function ()
|
|
PageF:StopMovingOrSizing();
|
|
PageF:SetUserPlaced(false);
|
|
-- Save panel position
|
|
LeaPlusLC["MainPanelA"], void, LeaPlusLC["MainPanelR"], LeaPlusLC["MainPanelX"], LeaPlusLC["MainPanelY"] = PageF:GetPoint()
|
|
end)
|
|
|
|
-- Add background color
|
|
PageF.t = PageF:CreateTexture(nil, "BACKGROUND")
|
|
PageF.t:SetAllPoints()
|
|
PageF.t:SetColorTexture(0.05, 0.05, 0.05, 0.9)
|
|
|
|
-- Add textures
|
|
LeaPlusLC:CreateBar("FootTexture", PageF, 570, 48, "BOTTOM", 0.5, 0.5, 0.5, 1.0, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png")
|
|
LeaPlusLC:CreateBar("MainTexture", PageF, 440, 323, "TOPRIGHT", 0.7, 0.7, 0.7, 0.7, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png")
|
|
LeaPlusLC:CreateBar("MenuTexture", PageF, 130, 323, "TOPLEFT", 0.7, 0.7, 0.7, 0.7, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png")
|
|
|
|
-- Set panel position when shown
|
|
PageF:SetScript("OnShow", function()
|
|
PageF:ClearAllPoints()
|
|
PageF:SetPoint(LeaPlusLC["MainPanelA"], UIParent, LeaPlusLC["MainPanelR"], LeaPlusLC["MainPanelX"], LeaPlusLC["MainPanelY"])
|
|
end)
|
|
|
|
-- Add main title (shown above menu in the corner)
|
|
PageF.mt = PageF:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
PageF.mt:SetPoint('TOPLEFT', 16, -16)
|
|
PageF.mt:SetText("Leatrix Plus")
|
|
|
|
-- Add version text (shown underneath main title)
|
|
PageF.v = PageF:CreateFontString(nil, 'ARTWORK', 'GameFontHighlightSmall')
|
|
PageF.v:SetHeight(32);
|
|
PageF.v:SetPoint('TOPLEFT', PageF.mt, 'BOTTOMLEFT', 0, -8);
|
|
PageF.v:SetPoint('RIGHT', PageF, -32, 0)
|
|
PageF.v:SetJustifyH('LEFT'); PageF.v:SetJustifyV('TOP');
|
|
PageF.v:SetNonSpaceWrap(true); PageF.v:SetText(L["Version"] .. " " .. LeaPlusLC["AddonVer"])
|
|
|
|
-- Add reload UI Button
|
|
local reloadb = LeaPlusLC:CreateButton("ReloadUIButton", PageF, "Reload", "BOTTOMRIGHT", -16, 10, 0, 25, true, "Your UI needs to be reloaded for some of the changes to take effect.|n|nYou don't have to click the reload button immediately but you do need to click it when you are done making changes and you want the changes to take effect.")
|
|
LeaPlusLC:LockItem(reloadb,true)
|
|
reloadb:SetScript("OnClick", ReloadUI)
|
|
|
|
reloadb.f = reloadb:CreateFontString(nil, 'ARTWORK', 'GameFontNormalSmall')
|
|
reloadb.f:SetHeight(32);
|
|
reloadb.f:SetPoint('RIGHT', reloadb, 'LEFT', -10, 0)
|
|
reloadb.f:SetText(L["Your UI needs to be reloaded."])
|
|
reloadb.f:Hide()
|
|
|
|
-- Add close Button (LeaPlusLC.DF: Using custom template)
|
|
local CloseB = LeaPlusLC:CreateCloseButton(PageF, 30, 30, "TOPRIGHT", 0, 0)
|
|
CloseB:SetScript("OnClick", LeaPlusLC.HideFrames)
|
|
|
|
-- Add web link Button
|
|
local PageFAlertButton = LeaPlusLC:CreateButton("PageFAlertButton", PageF, "You should keybind web link!", "BOTTOMLEFT", 16, 10, 0, 25, true, "You should set a keybind for the web link feature. It's very useful.|n|nOpen the key bindings window (accessible from the game menu) and click Leatrix Plus.|n|nSet a keybind for Show web link.|n|nNow when your pointer is over an item, NPC, mount, pet, spell, talent, toy or player (and more), press your keybind to get a web link.", true)
|
|
PageFAlertButton:SetPushedTextOffset(0, 0)
|
|
PageF:HookScript("OnShow", function()
|
|
if GetBindingKey("LEATRIX_PLUS_GLOBAL_WEBLINK") then PageFAlertButton:Hide() else PageFAlertButton:Show() end
|
|
end)
|
|
|
|
-- Release memory
|
|
LeaPlusLC.CreateMainPanel = nil
|
|
|
|
end
|
|
|
|
LeaPlusLC:CreateMainPanel();
|
|
|
|
----------------------------------------------------------------------
|
|
-- L80: Commands
|
|
----------------------------------------------------------------------
|
|
|
|
-- Slash command function
|
|
function LeaPlusLC:SlashFunc(str)
|
|
if str and str ~= "" then
|
|
-- Get parameters in lower case with duplicate spaces removed
|
|
local str, arg1, arg2, arg3 = strsplit(" ", string.lower(str:gsub("%s+", " ")))
|
|
-- Traverse parameters
|
|
if str == "wipe" then
|
|
-- Wipe settings
|
|
LeaPlusLC:PlayerLogout(true) -- Run logout function with wipe parameter
|
|
wipe(LeaPlusDB)
|
|
LpEvt:UnregisterAllEvents(); -- Don't save any settings
|
|
ReloadUI();
|
|
elseif str == "nosave" then
|
|
-- Prevent Leatrix Plus from overwriting LeaPlusDB at next logout
|
|
LpEvt:UnregisterEvent("PLAYER_LOGOUT")
|
|
LeaPlusLC:Print("Leatrix Plus will not overwrite LeaPlusDB at next logout.")
|
|
return
|
|
elseif str == "reset" then
|
|
-- Reset panel positions
|
|
LeaPlusLC["MainPanelA"], LeaPlusLC["MainPanelR"], LeaPlusLC["MainPanelX"], LeaPlusLC["MainPanelY"] = "CENTER", "CENTER", 0, 0
|
|
LeaPlusLC["PlusPanelScale"] = 1
|
|
LeaPlusLC["PlusPanelAlpha"] = 0
|
|
LeaPlusLC["PageF"]:SetScale(1)
|
|
LeaPlusLC["PageF"].t:SetAlpha(1 - LeaPlusLC["PlusPanelAlpha"])
|
|
-- Refresh panels
|
|
LeaPlusLC["PageF"]:ClearAllPoints()
|
|
LeaPlusLC["PageF"]:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
|
-- Reset currently showing configuration panel
|
|
for k, v in pairs(LeaConfigList) do
|
|
if v:IsShown() then
|
|
v:ClearAllPoints()
|
|
v:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
|
v:SetScale(1)
|
|
v.t:SetAlpha(1 - LeaPlusLC["PlusPanelAlpha"])
|
|
end
|
|
end
|
|
-- Refresh Leatrix Plus settings menu only
|
|
if LeaPlusLC["Page8"]:IsShown() then
|
|
LeaPlusLC["Page8"]:Hide()
|
|
LeaPlusLC["Page8"]:Show()
|
|
end
|
|
elseif str == "hk" then
|
|
-- Print lifetime honorable kills
|
|
local chagmsg = L["Lifetime honorable kills"]
|
|
local ltphk = GetStatistic(588)
|
|
if ltphk == "--" then ltphk = "0" end
|
|
chagmsg = chagmsg .. ": |cffffffff" .. ltphk
|
|
LeaPlusLC:Print(chagmsg)
|
|
return
|
|
elseif str == "taint" then
|
|
-- Set taint log level
|
|
if arg1 and arg1 ~= "" then
|
|
arg1 = tonumber(arg1)
|
|
if arg1 and arg1 >= 0 and arg1 <= 2 then
|
|
if arg1 == 0 then
|
|
-- Disable taint log
|
|
ConsoleExec("taintLog 0")
|
|
LeaPlusLC:Print("Taint level: Disabled (0).")
|
|
elseif arg1 == 1 then
|
|
-- Basic taint log
|
|
ConsoleExec("taintLog 1")
|
|
LeaPlusLC:Print("Taint level: Basic (1).")
|
|
elseif arg1 == 2 then
|
|
-- Full taint log
|
|
ConsoleExec("taintLog 2")
|
|
LeaPlusLC:Print("Taint level: Full (2).")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Invalid taint level.")
|
|
end
|
|
else
|
|
-- Show current taint level
|
|
local taintCurrent = GetCVar("taintLog")
|
|
if taintCurrent == "0" then
|
|
LeaPlusLC:Print("Taint level: Disabled (0).")
|
|
elseif taintCurrent == "1" then
|
|
LeaPlusLC:Print("Taint level: Basic (1).")
|
|
elseif taintCurrent == "2" then
|
|
LeaPlusLC:Print("Taint level: Full (2).")
|
|
end
|
|
end
|
|
return
|
|
elseif str == "quest" then
|
|
-- Show quest completed status
|
|
if arg1 and arg1 ~= "" then
|
|
if arg1 == "wipe" then
|
|
-- Wipe quest log
|
|
for i = 1, C_QuestLog.GetNumQuestLogEntries() do
|
|
C_QuestLog.SetSelectedQuest(C_QuestLog.GetInfo(i).questID)
|
|
C_QuestLog.SetAbandonQuest()
|
|
C_QuestLog.AbandonQuest()
|
|
end
|
|
LeaPlusLC:Print(L["Quest log wiped."])
|
|
return
|
|
elseif arg1 == "clone" and GetNumSubgroupMembers(1) > 0 then
|
|
-- Share all quests
|
|
local i = 0
|
|
C_Timer.NewTicker(0.3, function()
|
|
i = i + 1
|
|
local selectedQuest = C_QuestLog.GetInfo(i)
|
|
if selectedQuest then
|
|
C_QuestLog.SetSelectedQuest(selectedQuest.questID)
|
|
local title = C_QuestLog.GetTitleForQuestID(selectedQuest.questID)
|
|
if title then
|
|
print(title)
|
|
if C_QuestLog.IsPushableQuest(selectedQuest.questID) then
|
|
QuestLogPushQuest(i)
|
|
else
|
|
LeaPlusLC:Print(L["Not applicable."])
|
|
end
|
|
end
|
|
end
|
|
end, C_QuestLog.GetNumQuestLogEntries())
|
|
return
|
|
elseif tonumber(arg1) and tonumber(arg1) < 999999999 then
|
|
-- Show quest information
|
|
LeaPlusLC.LoadQuestEventFrame = LeaPlusLC.LoadQuestEventFrame or CreateFrame("FRAME")
|
|
LeaPlusLC.LoadQuestEventFrame:SetScript("OnEvent", function(self, event, questID, success)
|
|
if tonumber(questID) == tonumber(arg1) then
|
|
LeaPlusLC.LoadQuestEventFrame:UnregisterEvent("QUEST_DATA_LOAD_RESULT")
|
|
local tempGetQuestInfo = C_QuestLog.GetTitleForQuestID
|
|
local questCompleted = C_QuestLog.IsQuestFlaggedCompleted(arg1)
|
|
local questTitle = C_TaskQuest.GetQuestInfoByQuestID(arg1) or tempGetQuestInfo(arg1)
|
|
if questTitle then
|
|
if success then
|
|
if questCompleted then
|
|
LeaPlusLC:Print(questTitle .. " (" .. arg1 .. "):" .. "|cffffffff " .. L["Completed."])
|
|
else
|
|
LeaPlusLC:Print(questTitle .. " (" .. arg1 .. "):" .. "|cffffffff " .. L["Not completed."])
|
|
end
|
|
else
|
|
LeaPlusLC:Print(questTitle .. " (" .. arg1 .. "):" .. "|cffffffff " .. L["Error retrieving quest."])
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Invalid quest ID.")
|
|
return
|
|
end
|
|
end
|
|
end)
|
|
LeaPlusLC.LoadQuestEventFrame:RegisterEvent("QUEST_DATA_LOAD_RESULT")
|
|
C_QuestLog.RequestLoadQuestByID(arg1)
|
|
else
|
|
LeaPlusLC:Print("Invalid quest ID.")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Missing quest ID.")
|
|
end
|
|
return
|
|
elseif str == "gstaff" then
|
|
-- Buy 10 x Rough Wooden Staff from Larana Drome in Scribes' Sacellum, Dalaran, Northrend (used for testing)
|
|
local npcName = UnitName("target")
|
|
local npcGuid = UnitGUID("target") or nil
|
|
local errmsg = "Requires you to be interacting with Larana Drome. She can be found at Scribes' Sacellum, Dalaran, Northrend."
|
|
if npcName and npcGuid then
|
|
local void, void, void, void, void, npcID = strsplit("-", npcGuid)
|
|
if npcID and npcID == "28723" then
|
|
local id, ida, idb = 0, GetMerchantItemID(5), GetMerchantItemID(6)
|
|
if ida == 1515 then id = 5 elseif idb == 1515 then id = 6 end
|
|
if id > 0 then
|
|
for k = 1, 10 do
|
|
BuyMerchantItem(id)
|
|
end
|
|
end
|
|
else
|
|
LeaPlusLC:Print(errmsg)
|
|
end
|
|
else
|
|
LeaPlusLC:Print(errmsg)
|
|
end
|
|
return
|
|
elseif str == "rest" then
|
|
-- Show rested bubbles
|
|
LeaPlusLC:Print(L["Rested bubbles"] .. ": |cffffffff" .. (math.floor(20 * (GetXPExhaustion() or 0) / UnitXPMax("player") + 0.5)))
|
|
return
|
|
elseif str == "zygor" then
|
|
-- Toggle Zygor addon
|
|
LeaPlusLC:ZygorToggle()
|
|
return
|
|
elseif str == "npcid" then
|
|
-- Print NPC ID
|
|
local npcName = UnitName("target")
|
|
local npcGuid = UnitGUID("target") or nil
|
|
if npcName and npcGuid then
|
|
local void, void, void, void, void, npcID = strsplit("-", npcGuid)
|
|
if npcID then
|
|
LeaPlusLC:Print(npcName .. ": |cffffffff" .. npcID)
|
|
end
|
|
end
|
|
return
|
|
elseif str == "id" then
|
|
-- Show web link for tooltip
|
|
if not LeaPlusLC.WowheadLock then
|
|
-- Set Wowhead link prefix
|
|
if GameLocale == "deDE" then LeaPlusLC.WowheadLock = "de.wowhead.com"
|
|
elseif GameLocale == "esMX" then LeaPlusLC.WowheadLock = "mx.wowhead.com"
|
|
elseif GameLocale == "esES" then LeaPlusLC.WowheadLock = "es.wowhead.com"
|
|
elseif GameLocale == "frFR" then LeaPlusLC.WowheadLock = "fr.wowhead.com"
|
|
elseif GameLocale == "itIT" then LeaPlusLC.WowheadLock = "it.wowhead.com"
|
|
elseif GameLocale == "ptBR" then LeaPlusLC.WowheadLock = "pt.wowhead.com"
|
|
elseif GameLocale == "ruRU" then LeaPlusLC.WowheadLock = "ru.wowhead.com"
|
|
elseif GameLocale == "koKR" then LeaPlusLC.WowheadLock = "ko.wowhead.com"
|
|
elseif GameLocale == "zhCN" then LeaPlusLC.WowheadLock = "cn.wowhead.com"
|
|
elseif GameLocale == "zhTW" then LeaPlusLC.WowheadLock = "tw.wowhead.com"
|
|
else LeaPlusLC.WowheadLock = "wowhead.com"
|
|
end
|
|
end
|
|
if not LeaPlusLC.BlizzardLock then
|
|
-- Set Blizzard link prefix (https://wowpedia.fandom.com/wiki/Localization) (region will be added by website automatically)
|
|
if GameLocale == "deDE" then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/de-de/character/eu/" -- Germany
|
|
elseif GameLocale == "frFR" then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/fr-fr/character/eu/" -- France
|
|
elseif GameLocale == "itIT" then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/it-it/character/eu/" -- Italy
|
|
elseif GameLocale == "ruRU" then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/ru-ru/character/eu/" -- Russia
|
|
elseif GameLocale == "koKR" then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/ko-kr/character/kr/" -- Korea
|
|
elseif GameLocale == "zhTW" then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/zh-tw/character/tw/" -- Tiawan
|
|
elseif GameLocale == "esES" and GetCurrentRegion() == 1 then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/es-es/character/us/" -- Spain (esES connected to US)
|
|
elseif GameLocale == "esES" and GetCurrentRegion() == 3 then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/es-es/character/eu/" -- Spain (esES connected to EU)
|
|
elseif GameLocale == "esMX" and GetCurrentRegion() == 1 then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/es-mx/character/us/" -- Mexico (esMX connected to US)
|
|
elseif GameLocale == "esMX" and GetCurrentRegion() == 3 then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/es-mx/character/eu/" -- Spain (esMX connected to EU)
|
|
elseif GameLocale == "ptBR" and GetCurrentRegion() == 1 then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/pt-br/character/us/" -- Brazil (ptBR connected to US)
|
|
elseif GameLocale == "ptBR" and GetCurrentRegion() == 3 then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/pt-br/character/eu/" -- Portugal (ptBR connected to US)
|
|
elseif GameLocale == "enUS" and GetCurrentRegion() == 3 then LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/en-gb/character/eu/" -- UK (enUS connected to Europe)
|
|
else LeaPlusLC.BlizzardLock = "https://worldofwarcraft.com/en-us/character/us/" -- US (default)
|
|
end
|
|
end
|
|
-- Floating battle pet tooltip (linked in chat)
|
|
if FloatingBattlePetTooltip:IsMouseMotionFocus() and FloatingBattlePetTooltip.Name then
|
|
local tipTitle = FloatingBattlePetTooltip.Name:GetText()
|
|
if tipTitle then
|
|
local speciesId, petGUID = C_PetJournal.FindPetIDByName(tipTitle, false)
|
|
if petGUID then
|
|
local speciesID, customName, level, xp, maxXp, displayID, isFavorite, name, icon, petType, creatureID = C_PetJournal.GetPetInfoByPetID(petGUID)
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/npc=" .. creatureID)
|
|
LeaPlusLC.FactoryEditBox.f:SetText(L["Pet"] .. ": " .. name .. " (" .. creatureID .. ")")
|
|
return
|
|
end
|
|
end
|
|
end
|
|
-- Floating pet battle ability tooltip (linked in chat)
|
|
if FloatingPetBattleAbilityTooltip and FloatingPetBattleAbilityTooltip:IsMouseMotionFocus() and FloatingPetBattleAbilityTooltip.Name then
|
|
local tipTitle = FloatingPetBattleAbilityTooltip.Name:GetText()
|
|
if tipTitle then
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/search?q=" .. tipTitle, false)
|
|
LeaPlusLC.FactoryEditBox.f:SetText("|cffff0000" .. L["Pet Ability"] .. ": " .. tipTitle)
|
|
return
|
|
end
|
|
end
|
|
-- Pet journal ability tooltip (tooltip in pet journal)
|
|
if PetJournalPrimaryAbilityTooltip and PetJournalPrimaryAbilityTooltip:IsShown() and PetJournalPrimaryAbilityTooltip.Name then
|
|
local tipTitle = PetJournalPrimaryAbilityTooltip.Name:GetText()
|
|
if tipTitle then
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/search?q=" .. tipTitle, false)
|
|
LeaPlusLC.FactoryEditBox.f:SetText("|cffff0000" .. L["Pet Ability"] .. ": " .. tipTitle)
|
|
return
|
|
end
|
|
end
|
|
-- ItemRefTooltip or GameTooltip
|
|
local tooltip
|
|
if ItemRefTooltip:IsMouseMotionFocus() then tooltip = ItemRefTooltip else tooltip = GameTooltip end
|
|
-- Process tooltip
|
|
if tooltip:IsShown() then
|
|
-- Item
|
|
local void, itemLink = tooltip:GetItem()
|
|
if itemLink then
|
|
local itemID = GetItemInfoFromHyperlink(itemLink)
|
|
if itemID then
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/item=" .. itemID, false)
|
|
LeaPlusLC.FactoryEditBox.f:SetText(L["Item"] .. ": " .. itemLink .. " (" .. itemID .. ")")
|
|
return
|
|
end
|
|
end
|
|
-- Spell
|
|
local name, spellID = tooltip:GetSpell()
|
|
if name and spellID then
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/spell=" .. spellID, false)
|
|
LeaPlusLC.FactoryEditBox.f:SetText(L["Spell"] .. ": " .. name .. " (" .. spellID .. ")")
|
|
return
|
|
end
|
|
-- NPC
|
|
local npcName = UnitName("mouseover")
|
|
local npcGuid = UnitGUID("mouseover") or nil
|
|
if npcName and npcGuid then
|
|
local void, void, void, void, void, npcID = strsplit("-", npcGuid)
|
|
if npcID then
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/npc=" .. npcID, false)
|
|
LeaPlusLC.FactoryEditBox.f:SetText(L["NPC"] .. ": " .. npcName .. " (" .. npcID .. ")")
|
|
return
|
|
end
|
|
end
|
|
-- Pet, player and unknown tooltip (this must be last)
|
|
local tipTitle = GameTooltipTextLeft1:GetText()
|
|
if tipTitle then
|
|
local speciesId, petGUID = C_PetJournal.FindPetIDByName(GameTooltipTextLeft1:GetText(), false)
|
|
if petGUID then
|
|
-- Pet
|
|
local speciesID, customName, level, xp, maxXp, displayID, isFavorite, name, icon, petType, creatureID = C_PetJournal.GetPetInfoByPetID(petGUID)
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/npc=" .. creatureID)
|
|
LeaPlusLC.FactoryEditBox.f:SetText(L["Pet"] .. ": " .. name .. " (" .. creatureID .. ")")
|
|
return
|
|
else
|
|
-- Show armory link for players outside zhCN
|
|
local unitFocus
|
|
if WorldFrame:IsMouseMotionFocus() then unitFocus = "mouseover" else unitFocus = select(2, GameTooltip:GetUnit()) end
|
|
if unitFocus and UnitIsPlayer(unitFocus) then
|
|
-- Show armory link
|
|
local name, realm = UnitName(unitFocus)
|
|
local class = UnitClassBase(unitFocus)
|
|
if class then
|
|
local color = RAID_CLASS_COLORS[class]
|
|
local escapeColor = string.format("|cff%02x%02x%02x", color.r*255, color.g*255, color.b*255)
|
|
if not realm then realm = GetNormalizedRealmName() end
|
|
if name and realm then
|
|
-- Debug
|
|
-- local realm = "StrandoftheAncients" -- Debug
|
|
-- Chinese armory not available
|
|
if GameLocale == "zhCN" then return end
|
|
-- Fix non-standard names
|
|
if realm == "Area52" then realm = "Area-52"
|
|
elseif realm == "AzjolNerub" then realm = "AzjolNerub"
|
|
elseif realm == "Chantséternels" then realm = "Chants-Éternels"
|
|
elseif realm == "ConfrérieduThorium" then realm = "Confrérie-du-Thorium"
|
|
elseif realm == "ConseildesOmbres" then realm = "Conseil-des-Ombres"
|
|
elseif realm == "CultedelaRivenoire" then realm = "Culte-de-la-Rive-noire"
|
|
elseif realm == "DerRatvonDalaran" then realm = "Der-Rat-von-Dalaran"
|
|
elseif realm == "DieewigeWacht" then realm = "Die-ewige-Wacht"
|
|
elseif realm == "FestungderStürme" then realm = "Festung-der-Stürme"
|
|
elseif realm == "KultderVerdammten" then realm = "Kult-der-Verdammten"
|
|
elseif realm == "LaCroisadeécarlate" then realm = "La-Croisade-Écarlate"
|
|
elseif realm == "MarécagedeZangar" then realm = "Marécage-de-Zangar"
|
|
elseif realm == "Pozzodell'Eternità" then realm = "Pozzo-dellEternità"
|
|
elseif realm == "Templenoir" then realm = "Temple-noir"
|
|
elseif realm == "VanCleef" then realm = "Vancleef"
|
|
elseif realm == "ZirkeldesCenarius" then realm = "Zirkel-des-Cenarius"
|
|
-- Fix Russian names
|
|
elseif realm == "СвежевательДуш" then realm = "Свежеватель-Душ"
|
|
elseif realm == "СтражСмерти" then realm = "Страж-Смерти"
|
|
elseif realm == "Ревущийфьорд" then realm = "Ревущий-фьорд"
|
|
elseif realm == "ТкачСмерти" then realm = "Ткач-Смерти"
|
|
elseif realm == "Борейскаятундра" then realm = "Борейская-тундра"
|
|
elseif realm == "Ясеневыйлес" then realm = "Ясеневый-лес"
|
|
elseif realm == "ПиратскаяБухта" then realm = "Пиратская-Бухта"
|
|
elseif realm == "ВечнаяПесня" then realm = "Вечная-Песня"
|
|
elseif realm == "ЧерныйШрам" then realm = "Черный-Шрам"
|
|
elseif realm == "ВестникРока" then realm = "Вестник-Рока"
|
|
-- Fix all other names
|
|
else
|
|
-- Realm name is not one of the above so fix it
|
|
realm = realm:gsub("(%l[of])(%u)", "-%1-%2") -- Add hyphen after of if capital follows of (CavernsofTime becomes Cavernsof-Time)
|
|
realm = realm:gsub("(ofthe)", "-of-the-") -- Replace ofthe with -of-the- (ShrineoftheDormantFlame becomes Shrine-of-the-DormantFlame)
|
|
realm = realm:gsub("(%l)(%u)", "%1 %2") -- Add space before capital letters (CavernsofTime becomes Cavernsof Time)
|
|
realm = realm:gsub(" ", "-") -- Replace space with hyphen (Cavernsof Time becomes Cavernsof-Time)
|
|
realm = realm:gsub("'", "") -- Remove apostrophe
|
|
realm = realm:gsub("[(]", "-") -- Replace opening parentheses with hyphen
|
|
realm = realm:gsub("[)]", "") -- Remove closing parentheses
|
|
end
|
|
-- print(realm) -- Debug
|
|
LeaPlusLC:ShowSystemEditBox(LeaPlusLC.BlizzardLock .. strlower(realm) .. "/" .. strlower(name))
|
|
realm = realm:gsub("-", " ") -- Replace hyphen with space
|
|
LeaPlusLC.FactoryEditBox.f:SetText(escapeColor .. L["Player"] .. ": " .. name .. " (" .. realm .. ")")
|
|
return
|
|
end
|
|
end
|
|
else
|
|
-- Unknown tooltip
|
|
tipTitle = tipTitle:gsub("|c%x%x%x%x%x%x%x%x", "") -- Remove color tag
|
|
LeaPlusLC:ShowSystemEditBox("https://" .. LeaPlusLC.WowheadLock .. "/search?q=" .. tipTitle, false)
|
|
LeaPlusLC.FactoryEditBox.f:SetText("|cffff0000" .. L["Link will search Wowhead"])
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return
|
|
elseif str == "mountid" then
|
|
-- Get mount ID by mount name
|
|
if not arg1 or arg1 == "" then LeaPlusLC:Print("Missing mount name.") return end
|
|
local mounts = C_MountJournal.GetMountIDs()
|
|
local mountSuccess = false
|
|
for i = 1, #mounts do
|
|
local creatureName, spellID, icon, active, isUsable, sourceType = C_MountJournal.GetMountInfoByID(mounts[i])
|
|
if strfind(strlower(creatureName), strlower(arg1)) then
|
|
LeaPlusLC:Print(creatureName .. ": |cffffffff" .. mounts[i] .. "|r")
|
|
mountSuccess = true
|
|
end
|
|
end
|
|
if not mountSuccess then LeaPlusLC:Print("Mount not found.") end
|
|
return
|
|
elseif str == "petid" then
|
|
-- Get pet ID by pet name
|
|
if not arg1 or arg1 == "" then LeaPlusLC:Print("Missing pet name.") return end
|
|
local numPets = C_PetJournal.GetNumPets()
|
|
local petSuccess = false
|
|
for i = 1, numPets do
|
|
local petID, speciesID, isOwned, customName, level, favorite, isRevoked, name, icon, petType, creatureID, sourceText, description, isWildPet, canBattle, tradable, unique = C_PetJournal.GetPetInfoByIndex(i, false)
|
|
if strfind(strlower(name), strlower(arg1)) then
|
|
if isOwned then
|
|
LeaPlusLC:Print(name .. ": |cffffffff" .. petID .. " |cff00ff00(" .. level .. ")|r")
|
|
petSuccess = true
|
|
elseif not petSuccess then
|
|
LeaPlusLC:Print("You do not own this pet. Only owned pets can be searched.")
|
|
return
|
|
end
|
|
end
|
|
end
|
|
if not petSuccess then
|
|
LeaPlusLC:Print("Pet not found. Only owned pets that are currently showing in the journal can be searched.")
|
|
end
|
|
return
|
|
elseif str == "tooltip" then
|
|
-- Print tooltip frame name
|
|
local enumf = EnumerateFrames()
|
|
while enumf do
|
|
if (enumf:GetObjectType() == "GameTooltip" or strfind((enumf:GetName() or ""):lower(),"tip")) and enumf:IsVisible() and enumf:GetPoint() then
|
|
print(enumf:GetName())
|
|
end
|
|
enumf = EnumerateFrames(enumf)
|
|
end
|
|
collectgarbage()
|
|
return
|
|
elseif str == "soil" then
|
|
-- Enable dark soil and jelly deposit scanning
|
|
if not LeaPlusLC["DarkScriptlEnabled"] then
|
|
GameTooltip:HookScript("OnUpdate", function()
|
|
local a = _G["GameTooltipTextLeft1"]:GetText() or ""
|
|
if a == "Dark Soil" or a == "Jelly Deposit" or a == "Gersahl Shrub" then
|
|
PlaySound(8959, "Master")
|
|
end
|
|
end)
|
|
-- Add Friendly Alpaca spawn locations to Uldum map
|
|
if TomTom then
|
|
for void, v in next, ({{15,62},{24,9},{28,49},{30,29},{39,10},{42,70},{46,48},{53,19},{55,69},{63,53},{63,14},{70,39},{76,68}}) do
|
|
TomTom:AddWaypoint(1527, v[1]/100, v[2]/100, {title = "Friendly Alpaca"})
|
|
end
|
|
end
|
|
LeaPlusLC["DarkScriptlEnabled"] = true
|
|
LeaPlusLC:Print("Dark Soil scanning activated. Reload UI to exit.")
|
|
else
|
|
LeaPlusLC:Print("Dark Soil scanning is already activated. You only need to run this once. Reload UI to exit.")
|
|
end
|
|
return
|
|
elseif str == "rsnd" then
|
|
-- Restart sound system
|
|
if LeaPlusCB["StopMusicBtn"] then LeaPlusCB["StopMusicBtn"]:Click() end
|
|
Sound_GameSystem_RestartSoundSystem()
|
|
LeaPlusLC:Print("Sound system restarted.")
|
|
return
|
|
elseif str == "event" then
|
|
-- List events (used for debug)
|
|
LeaPlusLC["DbF"] = LeaPlusLC["DbF"] or CreateFrame("FRAME")
|
|
if not LeaPlusLC["DbF"]:GetScript("OnEvent") then
|
|
LeaPlusLC:Print("Tracing started.")
|
|
LeaPlusLC["DbF"]:RegisterAllEvents()
|
|
LeaPlusLC["DbF"]:SetScript("OnEvent", function(self, event)
|
|
if event == "ACTIONBAR_UPDATE_COOLDOWN"
|
|
or event == "BAG_UPDATE_COOLDOWN"
|
|
or event == "CHAT_MSG_TRADESKILLS"
|
|
or event == "COMBAT_LOG_EVENT_UNFILTERED"
|
|
or event == "CURSOR_CHANGED"
|
|
or event == "ITEM_DATA_LOAD_RESULT"
|
|
or event == "SPELL_UPDATE_COOLDOWN"
|
|
or event == "SPELL_UPDATE_USABLE"
|
|
or event == "UNIT_POWER_FREQUENT"
|
|
or event == "UPDATE_INVENTORY_DURABILITY"
|
|
or event == "UPDATE_SHAPESHIFT_COOLDOWN"
|
|
or event == "UPDATE_UI_WIDGET"
|
|
or event == "WORLD_CURSOR_TOOLTIP_UPDATE"
|
|
then return
|
|
else
|
|
print(event)
|
|
end
|
|
end)
|
|
else
|
|
LeaPlusLC["DbF"]:UnregisterAllEvents()
|
|
LeaPlusLC["DbF"]:SetScript("OnEvent", nil)
|
|
LeaPlusLC:Print("Tracing stopped.")
|
|
end
|
|
return
|
|
elseif str == "game" then
|
|
-- Show game build
|
|
local version, build, gdate, tocversion = GetBuildInfo()
|
|
LeaPlusLC:Print(L["World of Warcraft"] .. ": |cffffffff" .. version .. "." .. build .. " (" .. gdate .. ") (" .. tocversion .. ")")
|
|
return
|
|
elseif str == "config" then
|
|
-- Show maximum camera distance
|
|
LeaPlusLC:Print(L["Camera distance"] .. ": |cffffffff" .. GetCVar("cameraDistanceMaxZoomFactor"))
|
|
-- Show screen effects
|
|
LeaPlusLC:Print(L["Shaders"] .. ": |cffffffff" .. GetCVar("ffxGlow") .. ", " .. GetCVar("ffxDeath") .. ", " .. GetCVar("ffxNether"))
|
|
-- Show particle density
|
|
LeaPlusLC:Print(L["Particle density"] .. ": |cffffffff" .. GetCVar("particleDensity"))
|
|
LeaPlusLC:Print(L["Weather density"] .. ": |cffffffff" .. GetCVar("weatherDensity"))
|
|
LeaPlusLC:Print(L["Field of view"] .. ": |cffffffff" .. GetCVar("camerafov"))
|
|
-- Show config
|
|
LeaPlusLC:Print("SynchroniseConfig: |cffffffff" .. GetCVar("synchronizeConfig"))
|
|
-- Show raid restrictions
|
|
local unRaid = GetAllowLowLevelRaid()
|
|
if unRaid and unRaid == true then
|
|
LeaPlusLC:Print("GetAllowLowLevelRaid: |cffffffff" .. "True")
|
|
else
|
|
LeaPlusLC:Print("GetAllowLowLevelRaid: |cffffffff" .. "False")
|
|
end
|
|
return
|
|
elseif str == "move" then
|
|
-- Move minimap
|
|
MinimapZoneTextButton:Hide()
|
|
MinimapBorderTop:SetTexture("")
|
|
MiniMapWorldMapButton:Hide()
|
|
MinimapBackdrop:ClearAllPoints()
|
|
MinimapBackdrop:SetPoint("CENTER", UIParent, "CENTER", -330, -75)
|
|
Minimap:SetPoint("CENTER", UIParent, "CENTER", -320, -50)
|
|
return
|
|
elseif str == "tipcol" then
|
|
-- Show default tooltip title color
|
|
if GameTooltipTextLeft1:IsShown() then
|
|
local r, g, b, a = GameTooltipTextLeft1:GetTextColor()
|
|
r = r <= 1 and r >= 0 and r or 0
|
|
g = g <= 1 and g >= 0 and g or 0
|
|
b = b <= 1 and b >= 0 and b or 0
|
|
LeaPlusLC:Print(L["Tooltip title color"] .. ": " .. strupper(string.format("%02x%02x%02x", r * 255, g * 255, b * 255) .. "."))
|
|
else
|
|
LeaPlusLC:Print("No tooltip showing.")
|
|
end
|
|
return
|
|
elseif str == "list" then
|
|
-- Enumerate frames
|
|
local frame = EnumerateFrames()
|
|
while frame do
|
|
if (frame:IsVisible() and MouseIsOver(frame)) then
|
|
LeaPlusLC:Print(frame:GetName() or string.format("[Unnamed Frame: %s]", tostring(frame)))
|
|
end
|
|
frame = EnumerateFrames(frame)
|
|
end
|
|
return
|
|
elseif str == "nohelp" then
|
|
-- Set most help plates to seen
|
|
for i = 1, 100 do
|
|
SetCVarBitfield("closedInfoFrames", i, true)
|
|
end
|
|
return
|
|
elseif str == "grid" then
|
|
-- Toggle frame alignment grid
|
|
if LeaPlusLC.grid:IsShown() then LeaPlusLC.grid:Hide() else LeaPlusLC.grid:Show() end
|
|
return
|
|
elseif str == "chk" then
|
|
-- List truncated checkbox labels
|
|
if LeaPlusLC["TruncatedLabelsList"] then
|
|
for i, v in pairs(LeaPlusLC["TruncatedLabelsList"]) do
|
|
LeaPlusLC:Print(LeaPlusLC["TruncatedLabelsList"][i])
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Checkbox labels are Ok.")
|
|
end
|
|
return
|
|
elseif str == "cv" then
|
|
-- Print and set console variable setting
|
|
if arg1 and arg1 ~= "" then
|
|
if GetCVar(arg1) then
|
|
if arg2 and arg2 ~= "" then
|
|
if tonumber(arg2) then
|
|
SetCVar(arg1, arg2)
|
|
else
|
|
LeaPlusLC:Print("Value must be a number.")
|
|
return
|
|
end
|
|
end
|
|
LeaPlusLC:Print(arg1 .. ": |cffffffff" .. GetCVar(arg1))
|
|
else
|
|
LeaPlusLC:Print("Invalid console variable.")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Missing console variable.")
|
|
end
|
|
return
|
|
elseif str == "torch" or str == "t" then
|
|
-- Torch toggle
|
|
if tonumber(GetCVar("gamma")) ~= 1.0 then
|
|
SetCVar("gamma", 1.0)
|
|
LeaPlusLC:DisplayMessage(L["Torch Off"], true)
|
|
else
|
|
SetCVar("gamma", 1.3)
|
|
LeaPlusLC:DisplayMessage(L["Torch On"], true)
|
|
end
|
|
return
|
|
elseif str == "play" then
|
|
-- Play sound ID
|
|
if arg1 and arg1 ~= "" then
|
|
if tonumber(arg1) then
|
|
-- Stop last played sound ID
|
|
if LeaPlusLC.SNDcanitHandle then
|
|
StopSound(LeaPlusLC.SNDcanitHandle)
|
|
end
|
|
-- Play sound ID
|
|
LeaPlusLC.SNDcanitPlay, LeaPlusLC.SNDcanitHandle = PlaySound(arg1, "Master", false, false)
|
|
if not LeaPlusLC.SNDcanitPlay then LeaPlusLC:Print(L["Invalid sound ID"] .. ": |cffffffff" .. arg1) end
|
|
else
|
|
LeaPlusLC:Print(L["Invalid sound ID"] .. ": |cffffffff" .. arg1)
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Missing sound ID.")
|
|
end
|
|
return
|
|
elseif str == "stop" then
|
|
-- Stop last played sound ID
|
|
if LeaPlusLC.SNDcanitHandle then
|
|
StopSound(LeaPlusLC.SNDcanitHandle)
|
|
end
|
|
return
|
|
elseif str == "team" then
|
|
-- Assign battle pet team
|
|
local p1, s1p1, s1p2, s1p3, p2, s2p1, s2p2, s2p3, p3, s3p1, s3p2, s3p3 = strsplit(",", arg1 or "", 12)
|
|
if p1 and s1p1 and s1p2 and s1p3 and p2 and s2p1 and s2p2 and s2p3 and p3 and s3p1 and s3p2 and s3p3 then
|
|
if LeaPlusLC:PlayerInCombat() then
|
|
return
|
|
else
|
|
-- Ensure all 3 slots are unlocked
|
|
for i = 1, 3 do
|
|
local void, void, void, void, isLocked = C_PetJournal.GetPetLoadOutInfo(i)
|
|
if isLocked and isLocked == true then
|
|
LeaPlusLC:Print("All 3 battle pet slots need to be unlocked.")
|
|
return
|
|
end
|
|
end
|
|
-- Assign pets
|
|
C_PetJournal.SetPetLoadOutInfo(1, p1)
|
|
C_PetJournal.SetAbility(1, 1, s1p1)
|
|
C_PetJournal.SetAbility(1, 2, s1p2)
|
|
C_PetJournal.SetAbility(1, 3, s1p3)
|
|
C_PetJournal.SetPetLoadOutInfo(2, p2)
|
|
C_PetJournal.SetAbility(2, 1, s2p1)
|
|
C_PetJournal.SetAbility(2, 2, s2p2)
|
|
C_PetJournal.SetAbility(2, 3, s2p3)
|
|
C_PetJournal.SetPetLoadOutInfo(3, p3)
|
|
C_PetJournal.SetAbility(3, 1, s3p1)
|
|
C_PetJournal.SetAbility(3, 2, s3p2)
|
|
C_PetJournal.SetAbility(3, 3, s3p3)
|
|
if PetJournal and PetJournal:IsShown() then
|
|
PetJournal_UpdatePetLoadOut()
|
|
end
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Invalid battle pet team parameter.")
|
|
end
|
|
return
|
|
elseif str == "wipecds" then
|
|
-- Wipe cooldowns
|
|
LeaPlusDB["Cooldowns"] = nil
|
|
ReloadUI()
|
|
return
|
|
elseif str == "tipchat" then
|
|
-- Print tooltip contents in chat
|
|
local numLines = GameTooltip:NumLines()
|
|
if numLines then
|
|
for i = 1, numLines do
|
|
print(_G["GameTooltipTextLeft" .. i]:GetText() or "")
|
|
end
|
|
end
|
|
return
|
|
elseif str == "tiplang" then
|
|
-- Tooltip tag locale code constructor
|
|
local msg = ""
|
|
msg = msg .. 'if GameLocale == "' .. GameLocale .. '" then '
|
|
msg = msg .. 'ttLevel = "' .. LEVEL .. '"; '
|
|
msg = msg .. 'ttBoss = "' .. BOSS .. '"; '
|
|
msg = msg .. 'ttElite = "' .. ELITE .. '"; '
|
|
msg = msg .. 'ttRare = "' .. ITEM_QUALITY3_DESC .. '"; '
|
|
msg = msg .. 'ttRareElite = "' .. ITEM_QUALITY3_DESC .. " " .. ELITE .. '"; '
|
|
msg = msg .. 'ttRareBoss = "' .. ITEM_QUALITY3_DESC .. " " .. BOSS .. '"; '
|
|
msg = msg .. 'ttTarget = "' .. TARGET .. '"; '
|
|
msg = msg .. "end"
|
|
print(msg)
|
|
return
|
|
elseif str == "con" then
|
|
-- Show the developer console
|
|
ConsoleSetFontHeight(28)
|
|
DeveloperConsole:Toggle(true)
|
|
return
|
|
elseif str == "movietime" then
|
|
-- Show movie length
|
|
if not LeaPlusLC.movieTimeLoaded then
|
|
hooksecurefunc(MovieFrame, "Show", function()
|
|
LeaPlusLC.startMovieTime = GetTime()
|
|
end)
|
|
hooksecurefunc(MovieFrame, "Hide", function()
|
|
LeaPlusLC.endMovieTime = GetTime()
|
|
local ttime = LeaPlusLC.endMovieTime - LeaPlusLC.startMovieTime
|
|
print(string.format("%0.0f", ttime))
|
|
end)
|
|
LeaPlusLC.movieTimeLoaded = true
|
|
LeaPlusLC:Print("MovieTime loaded.")
|
|
else
|
|
LeaPlusLC:Print("MovieTime is already loaded.")
|
|
end
|
|
return
|
|
elseif str == "movie" then
|
|
-- Playback movie by ID
|
|
arg1 = tonumber(arg1)
|
|
if arg1 and arg1 ~= "" then
|
|
-- Play movie by ID
|
|
if IsMoviePlayable(arg1) then
|
|
MovieFrame_PlayMovie(MovieFrame, arg1)
|
|
else
|
|
LeaPlusLC:Print("Movie not playable.")
|
|
end
|
|
else
|
|
-- List playable movie IDs
|
|
local count = 0
|
|
for i = 1, 5000 do
|
|
if IsMoviePlayable(i) then
|
|
print(i)
|
|
count = count + 1
|
|
end
|
|
end
|
|
LeaPlusLC:Print("Total movies: |cffffffff" .. count)
|
|
end
|
|
return
|
|
elseif str == "cin" then
|
|
-- Play opening cinematic (only works if character has never gained XP) (used for testing)
|
|
OpeningCinematic()
|
|
return
|
|
elseif str == "skit" then
|
|
-- Play a test sound kit
|
|
PlaySound("1020", "Master", false, true)
|
|
return
|
|
elseif str == "dup" then
|
|
-- Print music track duplicates
|
|
local mask, found, badidfound = false, false, false
|
|
for i, e in pairs(Leatrix_Plus["ZoneList"]) do
|
|
if Leatrix_Plus["ZoneList"][e] then
|
|
for a, b in pairs(Leatrix_Plus["ZoneList"][e]) do
|
|
local same = {}
|
|
if b.tracks then
|
|
for k, v in pairs(b.tracks) do
|
|
-- Check for bad sound IDs
|
|
if not strfind(v, "|c") then
|
|
if not v:match("([^,]+)%#([^,]+)%#([^,]+)") then
|
|
local temFile, temSoundID = v:match("([^,]+)%#([^,]+)")
|
|
if temSoundID then
|
|
local temPlay, temHandle = PlaySound(temSoundID, "Master", false, true)
|
|
if temHandle then StopSound(temHandle) end
|
|
temPlay, temHandle = PlaySound(temSoundID, "Master", false, true)
|
|
if not temPlay and not temHandle then
|
|
print("|cffff5400" .. L["Bad ID"] .. ": |r" .. e, v)
|
|
badidfound = true
|
|
else
|
|
if temHandle then StopSound(temHandle) end
|
|
end
|
|
end
|
|
end
|
|
-- Check for duplicate IDs
|
|
if tContains(same, v) and mask == false then
|
|
mask = true
|
|
found = true
|
|
print("|cffec51ff" .. L["Dup ID"] .. ": |r" .. e, v)
|
|
end
|
|
tinsert(same, v)
|
|
mask = false
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if badidfound == false then
|
|
LeaPlusLC:Print("No bad sound IDs found.")
|
|
end
|
|
if found == false then
|
|
LeaPlusLC:Print("No media duplicates found.")
|
|
end
|
|
Sound_GameSystem_RestartSoundSystem()
|
|
collectgarbage()
|
|
return
|
|
elseif str == "enigma" then
|
|
-- Enigma
|
|
if not LeaPlusLC.enimgaFrame then
|
|
local selectedBtn
|
|
local bt = {}
|
|
local eData = {
|
|
{[9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [20]=1, [23]=1, [24]=1, [25]=1, [26]=1, [27]=1, [30]=1, [37]=1, [38]=1, [39]=1, [40]=1, [41]=2, "L4, U2, R4, U2, L4",},
|
|
{[9]=1, [11]=1, [12]=1, [13]=1, [16]=1, [18]=1, [20]=1, [23]=1, [24]=1, [25]=1, [27]=1, [34]=1, [41]=2, "U4, L2, D2, L2, U2",},
|
|
{[9]=1, [10]=1, [11]=1, [12]=1, [19]=1, [25]=1, [26]=1, [32]=1, [39]=1, [40]=1, [41]=2, "L2, U2, R1, U2, L3",},
|
|
{[9]=1, [10]=1, [11]=1, [18]=1, [23]=1, [24]=1, [25]=1, [30]=1, [37]=1, [38]=1, [39]=1, [40]=1, [41]=2, "L4, U2, R2, U2, L2",},
|
|
{[9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [16]=1, [23]=1, [25]=1, [26]=1, [27]=1, [30]=1, [32]=1, [34]=1, [37]=1, [38]=1, [39]=1, [41]=2, "U2, L2, D2, L2, U4, R4",},
|
|
{[12]=1,[13]=1, [18]=1, [19]=1, [25]=1, [32]=1, [33]=1, [40]=1, [41]=2, "L1, U1, L1, U2, R1, U1, R1",},
|
|
{[9]=1, [11]=1, [12]=1, [13]=1, [16]=1, [18]=1, [20]=1, [23]=1, [25]=1, [27]=1, [30]=1, [31]=1, [32]=1, [34]=1, [41]=2, "U4, L2, D3, L2, U3",},
|
|
{[9]=1, [10]=1, [17]=1, [24]=1, [25]=1, [32]=1, [33]=1, [40]=1, [41]=2, "L1, U1, L1, U1, L1, U2, L1",},
|
|
{[9]=1, [16]=1, [17]=1, [18]=1, [19]=1, [20]=1, [27]=1, [34]=1, [41]=2, "U3, L4, U1",},
|
|
{[9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [16]=1, [23]=1, [24]=1, [25]=1, [26]=1, [33]=1, [40]=1, [41]=2, "L1, U2, L3, U2, R4",},
|
|
{[9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [16]=1, [23]=1, [30]=1, [37]=1, [38]=1, [39]=1, [40]=1, [41]=2, "L4, U4, R4",},
|
|
{[11]=1,[12]=1, [13]=1, [18]=1, [23]=1, [24]=1, [25]=1, [30]=1, [37]=1, [38]=1, [39]=1, [40]=1, [41]=2, "L4, U2, R2, U2, R2",},
|
|
{[13]=1,[20]=1, [23]=1, [24]=1, [25]=1, [26]=1, [27]=1, [30]=1, [37]=1, [38]=1, [39]=1, [40]=1, [41]=2, "L4, U2, R4, U2",},
|
|
}
|
|
-- Create frame
|
|
local eFrame = CreateFrame("Frame", nil, UIParent)
|
|
eFrame:SetPoint("TOP", 0, 0)
|
|
eFrame:SetSize(1222, 134)
|
|
eFrame.b = eFrame:CreateTexture(nil, "BACKGROUND")
|
|
eFrame.b:SetAllPoints()
|
|
eFrame.b:SetColorTexture(0, 0, 0, 1)
|
|
eFrame:SetFrameStrata("FULLSCREEN_DIALOG")
|
|
eFrame:SetScale(0.9)
|
|
eFrame:SetToplevel(true)
|
|
eFrame:EnableMouse(true)
|
|
LeaPlusLC.enimgaFrame = eFrame
|
|
|
|
-- Right-click to exit
|
|
eFrame:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then
|
|
eFrame:Hide()
|
|
end
|
|
end)
|
|
|
|
-- Create title fontstring
|
|
eFrame.f = eFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
eFrame.f:SetPoint("BOTTOMLEFT", 10, 10)
|
|
eFrame.f:SetText(L["Choose an Enigma pattern"])
|
|
eFrame.f:SetFont(eFrame.f:GetFont(), 24, nil)
|
|
|
|
-- Create close fontstring
|
|
eFrame.x = eFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
|
eFrame.x:SetPoint("BOTTOMRIGHT", -10, 10)
|
|
eFrame.x:SetText(L["Right-click to close"])
|
|
eFrame.x:SetFont(eFrame.f:GetFont(), 24, nil)
|
|
|
|
-- Create buttons
|
|
for eBtn = 1, #eData do
|
|
local b = CreateFrame("Button", nil, eFrame)
|
|
tinsert(bt, b)
|
|
b:SetSize(94, 94)
|
|
b:SetPoint("TOPLEFT", ((eBtn - 1) % 13) * 94, -2)
|
|
|
|
-- Button highlight bar
|
|
b.line = b:CreateTexture(nil, "ARTWORK")
|
|
b.line:SetTexture("Interface\\PLAYERFRAME\\DruidLunarBarHorizontal")
|
|
b.line:SetSize(84, 6)
|
|
b.line:SetPoint("BOTTOM", 0, -4)
|
|
b.line:Hide()
|
|
|
|
-- Button textures
|
|
for row = 0, 7 - 1 do
|
|
for col = 0, 7 - 1 do
|
|
local t = b:CreateTexture(nil, "ARTWORK")
|
|
t:SetSize(12, 12)
|
|
t:SetPoint("TOPLEFT", 5 + col * 12, - 5 - row * 12)
|
|
local c = eData[eBtn][row * 7 + col + 1]
|
|
-- Do nothing if element is the solution
|
|
if c and strfind(c, ",") then c = nil end
|
|
-- Color textures
|
|
if c == 2 then
|
|
-- Starting block
|
|
t:SetColorTexture(0, 1, 0)
|
|
elseif c then
|
|
-- Path
|
|
t:SetColorTexture(1, 1, 1)
|
|
else
|
|
-- Background
|
|
t:SetColorTexture(.4, .4, .9)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Button scripts
|
|
b:SetScript("OnEnter", function()
|
|
bt[eBtn].line:Show()
|
|
end)
|
|
|
|
b:SetScript("OnLeave", function()
|
|
if b ~= selectedBtn then bt[eBtn].line:Hide() end
|
|
end)
|
|
|
|
b:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "RightButton" then
|
|
-- Right-click to exit
|
|
eFrame:Hide()
|
|
return
|
|
else
|
|
-- Deselect all buttons
|
|
for test = 1, #bt do
|
|
bt[test].line:Hide()
|
|
end
|
|
-- Select current button
|
|
bt[eBtn].line:Show()
|
|
selectedBtn = b
|
|
PlaySound(115, "Master", false, true)
|
|
-- Print button data
|
|
eFrame.f:SetText(L["Enigma"] .. " " .. eBtn .. ": |cffffffff" .. eData[eBtn][#eData[eBtn]])
|
|
end
|
|
end)
|
|
|
|
end
|
|
else
|
|
-- Toggle frame
|
|
if LeaPlusLC.enimgaFrame:IsShown() then
|
|
LeaPlusLC.enimgaFrame:Hide()
|
|
else
|
|
LeaPlusLC.enimgaFrame:Show()
|
|
end
|
|
end
|
|
return
|
|
elseif str == "showinst" then
|
|
-- List instance IDs for currently selected Encounter Journal expansion filter dropdown
|
|
for i = 1, 5000 do
|
|
local instanceID, name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = EJ_GetInstanceByIndex(i, false)
|
|
if instanceID then print(instanceID, name) end
|
|
end
|
|
for i = 1, 5000 do
|
|
local instanceID, name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = EJ_GetInstanceByIndex(i, true)
|
|
if instanceID then print(instanceID, name) end
|
|
end
|
|
return
|
|
elseif str == "marker" then
|
|
-- Prevent showing raid target markers on self
|
|
if not LeaPlusLC.MarkerFrame then
|
|
LeaPlusLC.MarkerFrame = CreateFrame("FRAME")
|
|
LeaPlusLC.MarkerFrame:RegisterEvent("RAID_TARGET_UPDATE")
|
|
end
|
|
LeaPlusLC.MarkerFrame.Update = true
|
|
if LeaPlusLC.MarkerFrame.Toggle == false then
|
|
-- Show markers
|
|
LeaPlusLC.MarkerFrame:SetScript("OnEvent", nil)
|
|
LeaPlusLC:DisplayMessage(L["Self Markers Allowed"], true)
|
|
LeaPlusLC.MarkerFrame.Toggle = true
|
|
else
|
|
-- Hide markers
|
|
SetRaidTarget("player", 0)
|
|
LeaPlusLC.MarkerFrame:SetScript("OnEvent", function()
|
|
if LeaPlusLC.MarkerFrame.Update == true then
|
|
LeaPlusLC.MarkerFrame.Update = false
|
|
SetRaidTarget("player", 0)
|
|
end
|
|
LeaPlusLC.MarkerFrame.Update = true
|
|
end)
|
|
LeaPlusLC:DisplayMessage(L["Self Markers Blocked"], true)
|
|
LeaPlusLC.MarkerFrame.Toggle = false
|
|
end
|
|
return
|
|
elseif str == "exit" then
|
|
-- Exit a vehicle
|
|
VehicleExit()
|
|
return
|
|
elseif str == "pos" then
|
|
-- Map POI code builder
|
|
local mapID = C_Map.GetBestMapForUnit("player") or nil
|
|
local mapName = C_Map.GetMapInfo(mapID).name or nil
|
|
local mapRects = {}
|
|
local tempVec2D = CreateVector2D(0, 0)
|
|
local void
|
|
-- Get player map position
|
|
tempVec2D.x, tempVec2D.y = UnitPosition("player")
|
|
if not tempVec2D.x then return end
|
|
local mapRect = mapRects[mapID]
|
|
if not mapRect then
|
|
mapRect = {}
|
|
void, mapRect[1] = C_Map.GetWorldPosFromMapPos(mapID, CreateVector2D(0, 0))
|
|
void, mapRect[2] = C_Map.GetWorldPosFromMapPos(mapID, CreateVector2D(1, 1))
|
|
mapRect[2]:Subtract(mapRect[1])
|
|
mapRects[mapID] = mapRect
|
|
end
|
|
tempVec2D:Subtract(mapRects[mapID][1])
|
|
local pX, pY = tempVec2D.y/mapRects[mapID][2].y, tempVec2D.x/mapRects[mapID][2].x
|
|
pX = string.format("%0.1f", 100 * pX)
|
|
pY = string.format("%0.1f", 100 * pY)
|
|
if mapID and mapName and pX and pY then
|
|
ChatFrame1:Clear()
|
|
local dnType, dnTex = "Dungeon", "dnTex"
|
|
if arg1 == "raid" then dnType, dnTex = "Raid", "rdTex" end
|
|
if arg1 == "portal" then dnType = "Portal" end
|
|
print('[' .. mapID .. '] = --[[' .. mapName .. ']] {{"Dungeon", ' .. pX .. ', ' .. pY .. ', L[' .. '"Name"' .. '], L[' .. '"' .. dnType .. '"' .. ']},},')
|
|
end
|
|
return
|
|
elseif str == "mapref" then
|
|
-- Print map reveal structure code
|
|
if not WorldMapFrame:IsShown() then
|
|
LeaPlusLC:Print("Open the map first!")
|
|
return
|
|
end
|
|
ChatFrame1:Clear()
|
|
local msg = ""
|
|
local mapID = WorldMapFrame.mapID
|
|
local mapName = C_Map.GetMapInfo(mapID).name
|
|
local mapArt = C_Map.GetMapArtID(mapID)
|
|
msg = msg .. "--[[" .. mapName .. "]] [" .. mapArt .. "] = {"
|
|
local exploredMapTextures = C_MapExplorationInfo.GetExploredMapTextures(mapID);
|
|
if exploredMapTextures then
|
|
for i, exploredTextureInfo in ipairs(exploredMapTextures) do
|
|
local twidth = exploredTextureInfo.textureWidth or 0
|
|
if twidth > 0 then
|
|
local theight = exploredTextureInfo.textureHeight or 0
|
|
local offsetx = exploredTextureInfo.offsetX
|
|
local offsety = exploredTextureInfo.offsetY
|
|
local filedataIDS = exploredTextureInfo.fileDataIDs
|
|
msg = msg .. "[" .. '"' .. twidth .. ":" .. theight .. ":" .. offsetx .. ":" .. offsety .. '"' .. "] = " .. '"'
|
|
for fileData = 1, #filedataIDS do
|
|
msg = msg .. filedataIDS[fileData]
|
|
if fileData < #filedataIDS then
|
|
msg = msg .. ", "
|
|
else
|
|
msg = msg .. '",'
|
|
if i < #exploredMapTextures then
|
|
msg = msg .. " "
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
msg = msg .. "},"
|
|
print(msg)
|
|
end
|
|
return
|
|
elseif str == "map" then
|
|
-- Set map by ID, print currently showing map ID or print character map ID
|
|
if not arg1 then
|
|
-- Print map ID
|
|
if WorldMapFrame:IsShown() then
|
|
-- Show world map ID
|
|
local mapID = WorldMapFrame.mapID or nil
|
|
local artID = C_Map.GetMapArtID(mapID) or nil
|
|
local mapName = C_Map.GetMapInfo(mapID).name or nil
|
|
if mapID and artID and mapName then
|
|
LeaPlusLC:Print(mapID .. " (" .. artID .. "): " .. mapName .. " (map)")
|
|
end
|
|
else
|
|
-- Show character map ID
|
|
local mapID = C_Map.GetBestMapForUnit("player") or nil
|
|
local artID = C_Map.GetMapArtID(mapID) or nil
|
|
local mapName = C_Map.GetMapInfo(mapID).name or nil
|
|
if mapID and artID and mapName then
|
|
LeaPlusLC:Print(mapID .. " (" .. artID .. "): " .. mapName .. " (player)")
|
|
end
|
|
end
|
|
return
|
|
elseif not tonumber(arg1) or not C_Map.GetMapInfo(arg1) then
|
|
-- Invalid map ID
|
|
LeaPlusLC:Print("Invalid map ID.")
|
|
else
|
|
-- Set map by ID
|
|
WorldMapFrame:SetMapID(tonumber(arg1))
|
|
end
|
|
return
|
|
elseif str == "cls" then
|
|
-- Clear chat frame
|
|
ChatFrame1:Clear()
|
|
return
|
|
elseif str == "al" then
|
|
-- Enable auto loot
|
|
SetCVar("autoLootDefault", "1")
|
|
LeaPlusLC:Print("Auto loot is now enabled.")
|
|
return
|
|
elseif str == "realm" then
|
|
-- Show list of connected realms
|
|
local titleRealm = GetRealmName()
|
|
local userRealm = GetNormalizedRealmName()
|
|
local connectedServers = GetAutoCompleteRealms()
|
|
if titleRealm and userRealm and connectedServers then
|
|
LeaPlusLC:Print(L["Connections for"] .. "|cffffffff " .. titleRealm)
|
|
if #connectedServers > 0 then
|
|
local count = 1
|
|
for i = 1, #connectedServers do
|
|
if userRealm ~= connectedServers[i] then
|
|
LeaPlusLC:Print(count .. ". " .. connectedServers[i])
|
|
count = count + 1
|
|
end
|
|
end
|
|
else
|
|
LeaPlusLC:Print("None")
|
|
end
|
|
end
|
|
return
|
|
elseif str == "deletelooms" then
|
|
-- Delete heirlooms from bags
|
|
for bag = 0, 4 do
|
|
for slot = 1, C_Container.GetContainerNumSlots(bag) do
|
|
local name = C_Container.GetContainerItemLink(bag, slot)
|
|
if name and string.find(name, "00ccff") then
|
|
print(name)
|
|
PickupContainerItem(bag, slot)
|
|
DeleteCursorItem()
|
|
end
|
|
end
|
|
end
|
|
return
|
|
elseif str == "help" then
|
|
-- Help panel
|
|
if not LeaPlusLC.HelpFrame then
|
|
local frame = CreateFrame("FRAME", nil, UIParent)
|
|
frame:SetSize(570, 400); frame:SetFrameStrata("FULLSCREEN_DIALOG"); frame:SetFrameLevel(100)
|
|
frame.tex = frame:CreateTexture(nil, "BACKGROUND"); frame.tex:SetAllPoints(); frame.tex:SetColorTexture(0.05, 0.05, 0.05, 0.9)
|
|
frame.close = LeaPlusLC:CreateCloseButton(frame, 30, 30, "TOPRIGHT", 0, 0)
|
|
frame.close:SetScript("OnClick", function() frame:Hide() end)
|
|
frame:ClearAllPoints(); frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
|
frame:SetClampedToScreen(true)
|
|
frame:SetClampRectInsets(450, -450, -300, 300)
|
|
frame:EnableMouse(true)
|
|
frame:SetMovable(true)
|
|
frame:RegisterForDrag("LeftButton")
|
|
frame:SetScript("OnDragStart", frame.StartMoving)
|
|
frame:SetScript("OnDragStop", function() frame:StopMovingOrSizing() frame:SetUserPlaced(false) end)
|
|
frame:Hide()
|
|
LeaPlusLC:CreateBar("HelpPanelMainTexture", frame, 570, 400, "TOPRIGHT", 0.7, 0.7, 0.7, 0.7, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png")
|
|
-- Panel contents
|
|
local col1, col2, color1 = 10, 120, "|cffffffaa"
|
|
LeaPlusLC:MakeTx(frame, "Leatrix Plus Help", col1, -10)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp|r", col1, -30)
|
|
LeaPlusLC:MakeWD(frame, "Toggle opttions panel.", col2, -30)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp reset", col1, -50)
|
|
LeaPlusLC:MakeWD(frame, "Reset addon panel position and scale.", col2, -50)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp wipe", col1, -70)
|
|
LeaPlusLC:MakeWD(frame, "Wipe all addon settings (reloads UI).", col2, -70)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp realm", col1, -90)
|
|
LeaPlusLC:MakeWD(frame, "Show realms connected to yours.", col2, -90)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp rest", col1, -110)
|
|
LeaPlusLC:MakeWD(frame, "Show number of rested XP bubbles remaining.", col2, -110)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp quest <id>", col1, -130)
|
|
LeaPlusLC:MakeWD(frame, "Show quest completion status for <quest id>.", col2, -130)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp quest wipe", col1, -150)
|
|
LeaPlusLC:MakeWD(frame, "Wipe your quest log.", col2, -150)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp hk", col1, -170)
|
|
LeaPlusLC:MakeWD(frame, "Show your lifetime honorable kills.", col2, -170)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp grid", col1, -190)
|
|
LeaPlusLC:MakeWD(frame, "Toggle a frame alignment grid.", col2, -190)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp id", col1, -210)
|
|
LeaPlusLC:MakeWD(frame, "Show a web link for whatever the pointer is over.", col2, -210)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp zygor", col1, -230)
|
|
LeaPlusLC:MakeWD(frame, "Toggle the Zygor addon (reloads UI).", col2, -230)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp movie <id>", col1, -250)
|
|
LeaPlusLC:MakeWD(frame, "Play a movie by its ID.", col2, -250)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp enigma", col1, -270)
|
|
LeaPlusLC:MakeWD(frame, "Toggle the Enigmatic quest solver.", col2, -270)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp marker", col1, -290)
|
|
LeaPlusLC:MakeWD(frame, "Block target markers (toggle) (requires assistant or leader in raid).", col2, -290)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp rsnd", col1, -310)
|
|
LeaPlusLC:MakeWD(frame, "Restart the sound system.", col2, -310)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp ra", col1, -330)
|
|
LeaPlusLC:MakeWD(frame, "Announce target in General chat channel (useful for rares).", col2, -330)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/ltp con", col1, -350)
|
|
LeaPlusLC:MakeWD(frame, "Launch the developer console with a large font.", col2, -350)
|
|
LeaPlusLC:MakeWD(frame, color1 .. "/rl", col1, -370)
|
|
LeaPlusLC:MakeWD(frame, "Reload the UI.", col2, -370)
|
|
LeaPlusLC.HelpFrame = frame
|
|
_G["LeaPlusGlobalHelpPanel"] = frame
|
|
table.insert(UISpecialFrames, "LeaPlusGlobalHelpPanel")
|
|
end
|
|
if LeaPlusLC.HelpFrame:IsShown() then LeaPlusLC.HelpFrame:Hide() else LeaPlusLC.HelpFrame:Show() end
|
|
return
|
|
elseif str == "who" then
|
|
-- Print out who list URLs
|
|
ChatFrame1:Clear()
|
|
local realmName = gsub(GetRealmName(), " ", "-")
|
|
for i = 1,C_FriendList.GetNumWhoResults() do
|
|
local p = C_FriendList.GetWhoInfo(i)
|
|
if not string.find(p.fullName, "-") then
|
|
print("https://worldofwarcraft.com/en-gb/character/eu/" .. realmName .. "/" .. p.fullName .. "/collections/pets")
|
|
end
|
|
end
|
|
return
|
|
elseif str == "ra" then
|
|
-- Announce target name, health percentage, coordinates and map pin link in General chat channel
|
|
local genChannel
|
|
if GameLocale == "deDE" then genChannel = "Allgemein"
|
|
elseif GameLocale == "esMX" then genChannel = "General"
|
|
elseif GameLocale == "esES" then genChannel = "General"
|
|
elseif GameLocale == "frFR" then genChannel = "Général"
|
|
elseif GameLocale == "itIT" then genChannel = "Generale"
|
|
elseif GameLocale == "ptBR" then genChannel = "Geral"
|
|
elseif GameLocale == "ruRU" then genChannel = "Общий"
|
|
elseif GameLocale == "koKR" then genChannel = "공개"
|
|
elseif GameLocale == "zhCN" then genChannel = "综合"
|
|
elseif GameLocale == "zhTW" then genChannel = "綜合"
|
|
else genChannel = "General"
|
|
end
|
|
if genChannel then
|
|
local index = GetChannelName(genChannel)
|
|
if index and index > 0 then
|
|
local mapID = C_Map.GetBestMapForUnit("player")
|
|
if C_Map.CanSetUserWaypointOnMap(mapID) then
|
|
local pos = C_Map.GetPlayerMapPosition(mapID, "player")
|
|
if pos.x and pos.x ~= "0" and pos.y and pos.y ~= "0" then
|
|
local mapPoint = UiMapPoint.CreateFromVector2D(mapID, pos)
|
|
if mapPoint then
|
|
local uHealth = UnitHealth("target")
|
|
local uHealthMax = UnitHealthMax("target")
|
|
-- Store original pin if there is one
|
|
local currentPin = C_Map.GetUserWaypointHyperlink()
|
|
-- Set map pin and get the link
|
|
C_Map.SetUserWaypoint(mapPoint)
|
|
local myPin = C_Map.GetUserWaypointHyperlink()
|
|
-- Put original pin back if there was one
|
|
if currentPin then
|
|
C_Timer.After(0.1, function()
|
|
local oldPin = C_Map.GetUserWaypointFromHyperlink(currentPin)
|
|
C_Map.SetUserWaypoint(oldPin)
|
|
end)
|
|
end
|
|
-- Announce in chat
|
|
if uHealth and uHealth > 0 and uHealthMax and uHealthMax > 0 and myPin then
|
|
-- Get unit classification (elite, rare, rare elite or boss)
|
|
local unitType, unitTag = UnitClassification("target"), ""
|
|
if unitType then
|
|
if unitType == "rare" or unitType == "rareelite" then unitTag = "(" .. L["Rare"] .. ") " elseif unitType == "worldboss" then unitTag = "(" .. L["Boss"] .. ") " end
|
|
end
|
|
SendChatMessage(format("%%t " .. unitTag .. "(%d%%)%s", uHealth / uHealthMax * 100, " ") .. " " .. myPin, "CHANNEL", nil, index)
|
|
-- SendChatMessage(format("%%t " .. unitTag .. "(%d%%)%s", uHealth / uHealthMax * 100, " ") .. " " .. myPin, "WHISPER", nil, GetUnitName("player")) -- Debug
|
|
C_Map.ClearUserWaypoint()
|
|
else
|
|
LeaPlusLC:Print("Invalid target.")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Cannot announce in this zone.")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Cannot announce in this zone.")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Cannot announce in this zone.")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Cannot find General chat channel.")
|
|
end
|
|
end
|
|
return
|
|
elseif str == "ach" then
|
|
-- Set Instance Achievement Tracker window properties
|
|
if AchievementTracker then
|
|
AchievementTracker:SetScale(1.4)
|
|
AchievementTracker:SetClampRectInsets(500, -500, -10, 300)
|
|
table.insert(UISpecialFrames, "AchievementTracker")
|
|
LeaPlusLC:Print("IAT scale set and window can now be closed with escape.")
|
|
end
|
|
return
|
|
elseif str == "blanchy" then
|
|
-- Sound alert when Dead Blanchy emotes nearby
|
|
LeaPlusLC.BlanchyFrame = LeaPlusLC.BlanchyFrame or CreateFrame("FRAME")
|
|
if LeaPlusLC.BlanchyFrame:IsEventRegistered("CHAT_MSG_MONSTER_EMOTE") then
|
|
C_Map.ClearUserWaypoint()
|
|
LeaPlusLC.BlanchyFrame:UnregisterEvent("CHAT_MSG_MONSTER_EMOTE")
|
|
LeaPlusLC:Print("Dead Blanchy alert disabled.")
|
|
else
|
|
C_Map.SetUserWaypoint(UiMapPoint.CreateFromVector2D(1525, CreateVector2D(63.1/100, 43.0/100)))
|
|
LeaPlusLC.BlanchyFrame:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
|
|
LeaPlusLC:Print("Dead Blanchy alert active. Spawn point has been pinned to the Revendreth map. An alert will sound 20 times when Blanchy emotes nearby.")
|
|
end
|
|
LeaPlusLC.BlanchyFrame:SetScript("OnEvent", function(self, event, void, pname)
|
|
if pname == L["Dead Blanchy"] then
|
|
C_Timer.NewTicker(1, function() PlaySound(8959, "Master") end, 20)
|
|
end
|
|
end)
|
|
return
|
|
elseif str == "perf" then
|
|
-- Average FPS during combat
|
|
local fTab = {}
|
|
if not LeaPlusLC.perf then
|
|
LeaPlusLC.perf = CreateFrame("FRAME")
|
|
end
|
|
local fFrm = LeaPlusLC.perf
|
|
local k, startTime = 0, 0
|
|
if fFrm:IsEventRegistered("PLAYER_REGEN_DISABLED") then
|
|
fFrm:UnregisterAllEvents()
|
|
fFrm:SetScript("OnUpdate", nil)
|
|
LeaPlusLC:Print("PERF unloaded.")
|
|
else
|
|
fFrm:RegisterEvent("PLAYER_REGEN_DISABLED")
|
|
fFrm:RegisterEvent("PLAYER_REGEN_ENABLED")
|
|
LeaPlusLC:Print("Waiting for combat to start...")
|
|
end
|
|
fFrm:SetScript("OnEvent", function(self, event)
|
|
if event == "PLAYER_REGEN_DISABLED" then
|
|
LeaPlusLC:Print("Monitoring FPS during combat...")
|
|
fFrm:SetScript("OnUpdate", function()
|
|
k = k + 1
|
|
fTab[k] = GetFramerate()
|
|
end)
|
|
startTime = GetTime()
|
|
else
|
|
fFrm:SetScript("OnUpdate", nil)
|
|
local tSum = 0
|
|
for i = 1, #fTab do
|
|
tSum = tSum + fTab[i]
|
|
end
|
|
local timeTaken = string.format("%.0f", GetTime() - startTime)
|
|
if tSum > 0 then
|
|
LeaPlusLC:Print("Average FPS for " .. timeTaken .. " seconds of combat: " .. string.format("%.0f", tSum / #fTab))
|
|
end
|
|
end
|
|
end)
|
|
return
|
|
elseif str == "col" then
|
|
-- Convert color values
|
|
LeaPlusLC:Print("|n")
|
|
local r, g, b = tonumber(arg1), tonumber(arg2), tonumber(arg3)
|
|
if r and g and b then
|
|
-- RGB source
|
|
LeaPlusLC:Print("Source: |cffffffff" .. r .. " " .. g .. " " .. b .. " ")
|
|
-- RGB to Hex
|
|
if r > 1 and g > 1 and b > 1 then
|
|
-- RGB to Hex
|
|
LeaPlusLC:Print("Hex: |cffffffff" .. strupper(string.format("%02x%02x%02x", r, g, b)) .. " (from RGB)")
|
|
else
|
|
-- Wow to Hex
|
|
LeaPlusLC:Print("Hex: |cffffffff" .. strupper(string.format("%02x%02x%02x", r * 255, g * 255, b * 255)) .. " (from Wow)")
|
|
-- Wow to RGB
|
|
local rwow = string.format("%.0f", r * 255)
|
|
local gwow = string.format("%.0f", g * 255)
|
|
local bwow = string.format("%.0f", b * 255)
|
|
if rwow ~= "0.0" and gwow ~= "0.0" and bwow ~= "0.0" then
|
|
LeaPlusLC:Print("RGB: |cffffffff" .. rwow .. " " .. gwow .. " " .. bwow .. " (from Wow)")
|
|
end
|
|
end
|
|
-- RGB to Wow
|
|
local rwow = string.format("%.1f", r / 255)
|
|
local gwow = string.format("%.1f", g / 255)
|
|
local bwow = string.format("%.1f", b / 255)
|
|
if rwow ~= "0.0" and gwow ~= "0.0" and bwow ~= "0.0" then
|
|
LeaPlusLC:Print("Wow: |cffffffff" .. rwow .. " " .. gwow .. " " .. bwow)
|
|
end
|
|
LeaPlusLC:Print("|n")
|
|
elseif arg1 and strlen(arg1) == 6 and strmatch(arg1,"%x") and arg2 == nil and arg3 == nil then
|
|
-- Hex source
|
|
local rhex, ghex, bhex = string.sub(arg1, 1, 2), string.sub(arg1, 3, 4), string.sub(arg1, 5, 6)
|
|
if strmatch(rhex,"%x") and strmatch(ghex,"%x") and strmatch(bhex,"%x") then
|
|
LeaPlusLC:Print("Source: |cffffffff" .. strupper(arg1))
|
|
LeaPlusLC:Print("Wow: |cffffffff" .. string.format("%.1f", tonumber(rhex, 16) / 255) .. " " .. string.format("%.1f", tonumber(ghex, 16) / 255) .. " " .. string.format("%.1f", tonumber(bhex, 16) / 255))
|
|
LeaPlusLC:Print("RGB: |cffffffff" .. tonumber(rhex, 16) .. " " .. tonumber(ghex, 16) .. " " .. tonumber(bhex, 16))
|
|
else
|
|
LeaPlusLC:Print("Invalid arguments.")
|
|
end
|
|
LeaPlusLC:Print("|n")
|
|
else
|
|
LeaPlusLC:Print("Invalid arguments.")
|
|
end
|
|
return
|
|
elseif str == "click" then
|
|
-- Click a button so a user can test if it is allowed (optional number of times to click)
|
|
local mouseFoci = GetMouseFoci()
|
|
if mouseFoci then
|
|
local frame = mouseFoci[#mouseFoci]
|
|
local ftype = frame:GetObjectType()
|
|
if frame and ftype and ftype == "Button" then
|
|
if arg1 and tonumber(arg1) > 1 and tonumber(arg1) < 1000 then
|
|
for i =1, tonumber(arg1) do C_Timer.After(0.1 * i, function() frame:Click() end) end
|
|
else
|
|
frame:Click()
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Hover the pointer over a button.")
|
|
end
|
|
return
|
|
end
|
|
elseif str == "frame" then
|
|
-- Print frame name under mouse
|
|
local mouseFoci = GetMouseFoci()
|
|
if mouseFoci then
|
|
local frame = mouseFoci[#mouseFoci]
|
|
local ftype = frame:GetObjectType()
|
|
if frame and ftype then
|
|
local fname = frame:GetName()
|
|
local issecure, tainted = issecurevariable(fname)
|
|
if issecure then issecure = "Yes" else issecure = "No" end
|
|
if tainted then tainted = "Yes" else tainted = "No" end
|
|
if fname then
|
|
LeaPlusLC:Print("Name: |cffffffff" .. fname)
|
|
LeaPlusLC:Print("Type: |cffffffff" .. ftype)
|
|
LeaPlusLC:Print("Secure: |cffffffff" .. issecure)
|
|
LeaPlusLC:Print("Tainted: |cffffffff" .. tainted)
|
|
end
|
|
end
|
|
end
|
|
return
|
|
elseif str == "arrow" then
|
|
-- Arrow (left: drag, shift/ctrl: rotate, mouseup: loc, pointer must be on arrow stem)
|
|
local f = CreateFrame("Frame", nil, WorldMapFrame.ScrollContainer)
|
|
f:SetSize(64, 64)
|
|
f:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
|
f:SetFrameLevel(500)
|
|
f:SetParent(WorldMapFrame.ScrollContainer)
|
|
f:SetScale(0.6)
|
|
|
|
f.t = f:CreateTexture(nil, "ARTWORK")
|
|
f.t:SetAtlas("Garr_LevelUpgradeArrow")
|
|
f.t:SetAllPoints()
|
|
|
|
f.f = f:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
|
f.f:SetText("0.0")
|
|
|
|
local x = 0
|
|
f:SetScript("OnUpdate", function()
|
|
if IsShiftKeyDown() then
|
|
x = x + 0.01
|
|
if x > 6.3 then x = 0 end
|
|
f.t:SetRotation(x)
|
|
f.f:SetFormattedText("%.1f", x)
|
|
elseif IsControlKeyDown() then
|
|
x = x - 0.01
|
|
if x < 0 then x = 6.3 end
|
|
f.t:SetRotation(x)
|
|
f.f:SetFormattedText("%.1f", x)
|
|
end
|
|
-- Print coordinates when mouse is in right place
|
|
local x, y = WorldMapFrame.ScrollContainer:GetNormalizedCursorPosition()
|
|
if x and y and x > 0 and y > 0 then
|
|
if MouseIsOver(f, -31, 31, 31, -31) then
|
|
ChatFrame1:Clear()
|
|
print(('{"Arrow", ' .. floor(x * 1000 + 0.5) / 10) .. ',', (floor(y * 1000 + 0.5) / 10) .. ', L["Step 1"], L["Start here."], arTex, nil, nil, nil, nil, nil, ' .. f.f:GetText() .. "},")
|
|
PlaySoundFile(567412, "Master", false, true)
|
|
end
|
|
end
|
|
end)
|
|
|
|
f:SetMovable(true)
|
|
f:SetScript("OnMouseDown", function(self, btn)
|
|
if btn == "LeftButton" then
|
|
f:StartMoving()
|
|
end
|
|
end)
|
|
|
|
f:SetScript("OnMouseUp", function()
|
|
f:StopMovingOrSizing()
|
|
--ChatFrame1:Clear()
|
|
--local x, y = WorldMapFrame.ScrollContainer:GetNormalizedCursorPosition()
|
|
--if x and y and x > 0 and y > 0 and MouseIsOver(f) then
|
|
-- print(('{"Arrow", ' .. floor(x * 1000 + 0.5) / 10) .. ',', (floor(y * 1000 + 0.5) / 10) .. ', L["Step 1"], L["Start here."], ' .. f.f:GetText() .. "},")
|
|
--end
|
|
end)
|
|
return
|
|
elseif str == "dis" then
|
|
-- Disband group
|
|
if not LeaPlusLC:IsInLFGQueue() and not IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
|
|
local x = GetNumGroupMembers() or 0
|
|
for i = x, 1, -1 do
|
|
if GetNumGroupMembers() > 0 then
|
|
local name = GetRaidRosterInfo(i)
|
|
if name and name ~= UnitName("player") then
|
|
UninviteUnit(name)
|
|
end
|
|
end
|
|
end
|
|
else
|
|
LeaPlusLC:Print("You cannot do that while in group finder.")
|
|
end
|
|
return
|
|
elseif str == "reinv" then
|
|
-- Disband and reinvite raid
|
|
if not LeaPlusLC:IsInLFGQueue() and not IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
|
|
if UnitIsGroupLeader("player") then
|
|
-- Disband
|
|
local groupNames = {}
|
|
local x = GetNumGroupMembers() or 0
|
|
for i = x, 1, -1 do
|
|
if GetNumGroupMembers() > 0 then
|
|
local name = GetRaidRosterInfo(i)
|
|
if name and name ~= UnitName("player") then
|
|
UninviteUnit(name)
|
|
tinsert(groupNames, name)
|
|
end
|
|
end
|
|
end
|
|
-- Reinvite
|
|
C_Timer.After(0.1, function()
|
|
for k, v in pairs(groupNames) do
|
|
C_PartyInfo.InviteUnit(v)
|
|
end
|
|
end)
|
|
else
|
|
LeaPlusLC:Print("You need to be group leader.")
|
|
end
|
|
else
|
|
LeaPlusLC:Print("You cannot do that while in group finder.")
|
|
end
|
|
return
|
|
elseif str == "limit" then
|
|
-- Sound Limit
|
|
if not LeaPlusLC.MuteFrame then
|
|
-- Panel frame
|
|
local frame = CreateFrame("FRAME", nil, UIParent)
|
|
frame:SetSize(294, 86); frame:SetFrameStrata("FULLSCREEN_DIALOG"); frame:SetFrameLevel(100); frame:SetScale(2)
|
|
frame.tex = frame:CreateTexture(nil, "BACKGROUND"); frame.tex:SetAllPoints(); frame.tex:SetColorTexture(0.05, 0.05, 0.05, 0.9)
|
|
frame.close = LeaPlusLC:CreateCloseButton(frame, 30, 30, "TOPRIGHT", 0, 0)
|
|
frame.close:SetScript("OnClick", function() frame:Hide() end)
|
|
frame:ClearAllPoints(); frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
|
|
frame:SetClampedToScreen(true)
|
|
frame:EnableMouse(true)
|
|
frame:SetMovable(true)
|
|
frame:RegisterForDrag("LeftButton")
|
|
frame:SetScript("OnDragStart", frame.StartMoving)
|
|
frame:SetScript("OnDragStop", function() frame:StopMovingOrSizing() frame:SetUserPlaced(false) end)
|
|
frame:Hide()
|
|
LeaPlusLC:CreateBar("MutePanelMainTexture", frame, 294, 86, "TOPRIGHT", 0.7, 0.7, 0.7, 0.7, "Interface\\ACHIEVEMENTFRAME\\UI-GuildAchievement-Parchment-Horizontal-Desaturated.png")
|
|
-- Panel contents
|
|
LeaPlusLC:MakeTx(frame, "Sound Limit", 16, -12)
|
|
local endBox = LeaPlusLC:CreateEditBox("SoundEndBox", frame, 116, 10, "TOPLEFT", 16, -32, "SoundEndBox", "SoundEndBox")
|
|
endBox:SetText(9000000)
|
|
endBox:SetScript("OnMouseWheel", function(self, delta)
|
|
local endSound = tonumber(endBox:GetText())
|
|
if endSound then
|
|
if delta == 1 then endSound = endSound + LeaPlusLC.SoundByte else endSound = endSound - LeaPlusLC.SoundByte end
|
|
if endSound < 1 then endSound = 1 elseif endSound >= 9000000 then endSound = 9000000 end
|
|
endBox:SetText(endSound)
|
|
else
|
|
endSound = 100000
|
|
endBox:SetText(endSound)
|
|
end
|
|
end)
|
|
-- Set limit button
|
|
frame.btn = LeaPlusLC:CreateButton("muteRangeButton", frame, "SET LIMIT", "TOPLEFT", 16, -72, 0, 25, true, "Click to set the sound file limit. Use the mousewheel on the editbox along with the step buttons below to adjust the sound limit. Acceptable range is from 1 to 9000000. Sound files higher than this limit will be muted.")
|
|
frame.btn:ClearAllPoints()
|
|
frame.btn:SetPoint("LEFT", endBox, "RIGHT", 10, 0)
|
|
frame.btn:SetScript("OnClick", function()
|
|
local endSound = tonumber(endBox:GetText())
|
|
if endSound then
|
|
if endSound > 9000000 then endSound = 9000000 endBox:SetText(endSound) end
|
|
frame.btn:SetText("WAIT")
|
|
C_Timer.After(0.1, function()
|
|
for i = 1, 9000000 do
|
|
MuteSoundFile(i)
|
|
end
|
|
for i = 1, endSound do
|
|
UnmuteSoundFile(i)
|
|
end
|
|
Sound_GameSystem_RestartSoundSystem()
|
|
frame.btn:SetText("SET LIMIT")
|
|
end)
|
|
else
|
|
frame.btn:SetText("INVALID")
|
|
frame.btn:EnableMouse(false)
|
|
C_Timer.After(2, function()
|
|
frame.btn:SetText("SET LIMIT")
|
|
frame.btn:EnableMouse(true)
|
|
end)
|
|
end
|
|
end)
|
|
-- Mute all button
|
|
frame.MuteAllBtn = LeaPlusLC:CreateButton("muteMuteAllButton", frame, "MUTE ALL", "TOPLEFT", 16, -92, 0, 25, true, "Click to mute every sound in the game.")
|
|
frame.MuteAllBtn:SetScale(0.5)
|
|
frame.MuteAllBtn:ClearAllPoints()
|
|
frame.MuteAllBtn:SetPoint("TOPLEFT", frame.btn, "TOPRIGHT", 20, 0)
|
|
frame.MuteAllBtn:SetScript("OnClick", function()
|
|
frame.MuteAllBtn:SetText("WAIT")
|
|
C_Timer.After(0.1, function()
|
|
for i = 1, 9000000 do
|
|
MuteSoundFile(i)
|
|
end
|
|
Sound_GameSystem_RestartSoundSystem()
|
|
frame.MuteAllBtn:SetText("MUTE ALL")
|
|
end)
|
|
return
|
|
end)
|
|
-- Unmute all button
|
|
frame.UnmuteAllBtn = LeaPlusLC:CreateButton("muteUnmuteAllButton", frame, "UNMUTE ALL", "TOPLEFT", 16, -92, 0, 25, true, "Click to unmute every sound in the game.")
|
|
frame.UnmuteAllBtn:SetScale(0.5)
|
|
frame.UnmuteAllBtn:ClearAllPoints()
|
|
frame.UnmuteAllBtn:SetPoint("TOPLEFT", frame.MuteAllBtn, "BOTTOMLEFT", 0, -10)
|
|
frame.UnmuteAllBtn:SetScript("OnClick", function()
|
|
frame.UnmuteAllBtn:SetText("WAIT")
|
|
C_Timer.After(0.1, function()
|
|
for i = 1, 9000000 do
|
|
UnmuteSoundFile(i)
|
|
end
|
|
Sound_GameSystem_RestartSoundSystem()
|
|
frame.UnmuteAllBtn:SetText("UNMUTE ALL")
|
|
end)
|
|
return
|
|
end)
|
|
-- Step buttons
|
|
frame.millionBtn = LeaPlusLC:CreateButton("SoundMillionButton", frame, "1000000", "TOPLEFT", 26, -122, 0, 25, true, "Set the editbox step value to 1000000.")
|
|
frame.millionBtn:SetScale(0.5)
|
|
|
|
frame.hundredThousandBtn = LeaPlusLC:CreateButton("SoundHundredThousandButton", frame, "100000", "TOPLEFT", 16, -112, 0, 25, true, "Set the editbox step value to 100000.")
|
|
frame.hundredThousandBtn:ClearAllPoints()
|
|
frame.hundredThousandBtn:SetPoint("LEFT", frame.millionBtn, "RIGHT", 10, 0)
|
|
frame.hundredThousandBtn:SetScale(0.5)
|
|
|
|
frame.tenThousandBtn = LeaPlusLC:CreateButton("SoundTenThousandButton", frame, "10000", "TOPLEFT", 16, -112, 0, 25, true, "Set the editbox step value to 10000.")
|
|
frame.tenThousandBtn:ClearAllPoints()
|
|
frame.tenThousandBtn:SetPoint("LEFT", frame.hundredThousandBtn, "RIGHT", 10, 0)
|
|
frame.tenThousandBtn:SetScale(0.5)
|
|
|
|
frame.thousandBtn = LeaPlusLC:CreateButton("SoundThousandButton", frame, "1000", "TOPLEFT", 16, -112, 0, 25, true, "Set the editbox step value to 1000.")
|
|
frame.thousandBtn:ClearAllPoints()
|
|
frame.thousandBtn:SetPoint("LEFT", frame.tenThousandBtn, "RIGHT", 10, 0)
|
|
frame.thousandBtn:SetScale(0.5)
|
|
|
|
frame.hundredBtn = LeaPlusLC:CreateButton("SoundHundredButton", frame, "100", "TOPLEFT", 16, -112, 0, 25, true, "Set the editbox step value to 100.")
|
|
frame.hundredBtn:ClearAllPoints()
|
|
frame.hundredBtn:SetPoint("LEFT", frame.thousandBtn, "RIGHT", 10, 0)
|
|
frame.hundredBtn:SetScale(0.5)
|
|
|
|
frame.tenBtn = LeaPlusLC:CreateButton("SoundTenButton", frame, "10", "TOPLEFT", 16, -112, 0, 25, true, "Set the editbox step value to 10.")
|
|
frame.tenBtn:ClearAllPoints()
|
|
frame.tenBtn:SetPoint("LEFT", frame.hundredBtn, "RIGHT", 10, 0)
|
|
frame.tenBtn:SetScale(0.5)
|
|
|
|
frame.oneBtn = LeaPlusLC:CreateButton("SoundTenButton", frame, "1", "TOPLEFT", 16, -112, 0, 25, true, "Set the editbox step value to 1.")
|
|
frame.oneBtn:ClearAllPoints()
|
|
frame.oneBtn:SetPoint("LEFT", frame.tenBtn, "RIGHT", 10, 0)
|
|
frame.oneBtn:SetScale(0.5)
|
|
|
|
local function DimAllBoxes()
|
|
frame.millionBtn:SetAlpha(0.3)
|
|
frame.hundredThousandBtn:SetAlpha(0.3)
|
|
frame.tenThousandBtn:SetAlpha(0.3)
|
|
frame.thousandBtn:SetAlpha(0.3)
|
|
frame.hundredBtn:SetAlpha(0.3)
|
|
frame.tenBtn:SetAlpha(0.3)
|
|
frame.oneBtn:SetAlpha(0.3)
|
|
end
|
|
|
|
LeaPlusLC.SoundByte = 1000000
|
|
DimAllBoxes()
|
|
frame.millionBtn:SetAlpha(1)
|
|
|
|
-- Step button handlers
|
|
frame.millionBtn:SetScript("OnClick", function()
|
|
LeaPlusLC.SoundByte = 1000000
|
|
DimAllBoxes()
|
|
frame.millionBtn:SetAlpha(1)
|
|
end)
|
|
|
|
frame.hundredThousandBtn:SetScript("OnClick", function()
|
|
LeaPlusLC.SoundByte = 100000
|
|
DimAllBoxes()
|
|
frame.hundredThousandBtn:SetAlpha(1)
|
|
end)
|
|
|
|
frame.tenThousandBtn:SetScript("OnClick", function()
|
|
LeaPlusLC.SoundByte = 10000
|
|
DimAllBoxes()
|
|
frame.tenThousandBtn:SetAlpha(1)
|
|
end)
|
|
|
|
frame.thousandBtn:SetScript("OnClick", function()
|
|
LeaPlusLC.SoundByte = 1000
|
|
DimAllBoxes()
|
|
frame.thousandBtn:SetAlpha(1)
|
|
end)
|
|
|
|
frame.hundredBtn:SetScript("OnClick", function()
|
|
LeaPlusLC.SoundByte = 100
|
|
DimAllBoxes()
|
|
frame.hundredBtn:SetAlpha(1)
|
|
end)
|
|
|
|
frame.tenBtn:SetScript("OnClick", function()
|
|
LeaPlusLC.SoundByte = 10
|
|
DimAllBoxes()
|
|
frame.tenBtn:SetAlpha(1)
|
|
end)
|
|
|
|
frame.oneBtn:SetScript("OnClick", function()
|
|
LeaPlusLC.SoundByte = 1
|
|
DimAllBoxes()
|
|
frame.oneBtn:SetAlpha(1)
|
|
end)
|
|
|
|
-- Final code
|
|
LeaPlusLC.MuteFrame = frame
|
|
_G["LeaPlusGlobalMutePanel"] = frame
|
|
table.insert(UISpecialFrames, "LeaPlusGlobalMutePanel")
|
|
end
|
|
if LeaPlusLC.MuteFrame:IsShown() then LeaPlusLC.MuteFrame:Hide() else LeaPlusLC.MuteFrame:Show() end
|
|
return
|
|
elseif str == "tz" then
|
|
-- Tazavesh Helper
|
|
if arg1 and arg ~= "" then
|
|
-- Aggramar's Vault
|
|
if not string.find(arg1, "o") or not string.find(arg1, "y") or not string.find(arg1, "p") or not string.find(arg1, "b") then
|
|
LeaPlusLC:Print("Valid letters are O (Orange), Y (Yellow), P (Purple), B (Blue).")
|
|
return
|
|
end
|
|
arg1 = arg1:gsub("%w", {["o"] = "ORANGE,", ["y"] = "YELLOW,", ["p"] = "PURPLE,", ["b"] = "BLUE,"})
|
|
local a, b, c, d = arg1:match("([^,]+),([^,]+),([^,]+),([^,]+)")
|
|
if a and b and c and d then
|
|
local chatDestination
|
|
if IsInRaid() then
|
|
return
|
|
elseif IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
|
|
chatDestination = "INSTANCE_CHAT"
|
|
elseif IsInGroup(LE_PARTY_CATEGORY_HOME) then
|
|
chatDestination = "PARTY"
|
|
end
|
|
LeaPlusLC:Print("Letters need to be in clockwise order as they appear.")
|
|
SendChatMessage("Quickly take orbs to these positions and click.", chatDestination)
|
|
SendChatMessage(a .. ": Front left of boss (north)", chatDestination)
|
|
SendChatMessage(b .. ": Front right of boss (east)", chatDestination)
|
|
SendChatMessage(d .. ": Back left of boss (west)", chatDestination)
|
|
SendChatMessage(c .. ": Back right of boss (south)", chatDestination)
|
|
end
|
|
return
|
|
end
|
|
-- Myza's Oasis
|
|
local target
|
|
for i = 1, 40 do
|
|
local DebuffData = C_UnitAuras.GetDebuffDataByIndex("player", i)
|
|
if DebuffData then
|
|
local spellID = DebuffData.spellId
|
|
if spellID then
|
|
if spellID == 352125 or spellID == 358911 or spellID == 358912 then
|
|
target = "Xy'ghana"
|
|
elseif spellID == 352127 or spellID == 358905 or spellID == 358906 then
|
|
target = "Xy'aqida"
|
|
elseif spellID == 352128 or spellID == 358907 or spellID == 358908 then
|
|
target = "Xy'tadir"
|
|
elseif spellID == 352129 or spellID == 358915 or spellID == 358916 then
|
|
target = "Xy'nara"
|
|
elseif spellID == 352130 or spellID == 358900 or spellID == 358901 then
|
|
target = "Xy'mal"
|
|
elseif spellID == 352131 or spellID == 358917 or spellID == 358918 then
|
|
target = "Xy'jahid"
|
|
elseif spellID == 352132 or spellID == 358903 or spellID == 358904 then
|
|
target = "Xy'kitaab"
|
|
elseif spellID == 352133 or spellID == 358913 or spellID == 358914 then
|
|
target = "Xy'har"
|
|
elseif spellID == 352134 or spellID == 358909 or spellID == 358910 then
|
|
target = "Xy'zaro"
|
|
-- elseif spellID == 15007 then target = "Ghost" -- Resurrection sickness (debug)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if target and target ~= "" then
|
|
LeaPlusLC:ShowSystemEditBox("/tar" .. " " .. target, true)
|
|
LeaPlusLC.FactoryEditBox.f:SetText(L["Myza's Oasis"] .. ": " .. target)
|
|
end
|
|
return
|
|
elseif str == "mem" or str == "m" then
|
|
-- Show addon panel with memory usage
|
|
if LeaPlusLC.ShowMemoryUsage then
|
|
LeaPlusLC:ShowMemoryUsage(LeaPlusLC["Page8"], "TOPLEFT", 146, -262)
|
|
end
|
|
-- Prevent options panel from showing if Blizzard Store is showing
|
|
if StoreFrame and StoreFrame:GetAttribute("isshown") then return end
|
|
-- Toggle the options panel if game options panel is not showing
|
|
if LeaPlusLC:IsPlusShowing() then
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC:HideConfigPanels()
|
|
else
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC["PageF"]:Show()
|
|
end
|
|
LeaPlusLC["Page"..LeaPlusLC["LeaStartPage"]]:Show()
|
|
return
|
|
elseif str == "gossinfo" then
|
|
-- Print gossip frame information
|
|
if GossipFrame:IsShown() then
|
|
local npcName = UnitName("npc")
|
|
local npcGuid = UnitGUID("npc") or nil
|
|
if npcName and npcGuid then
|
|
local void, void, void, void, void, npcID = strsplit("-", npcGuid)
|
|
if npcID then
|
|
LeaPlusLC:Print(npcName .. ": |cffffffff" .. npcID)
|
|
end
|
|
end
|
|
LeaPlusLC:Print("Available quests: |cffffffff" .. C_GossipInfo.GetNumAvailableQuests())
|
|
LeaPlusLC:Print("Active quests: |cffffffff" .. C_GossipInfo.GetNumActiveQuests())
|
|
local gossipInfoTable = C_GossipInfo.GetOptions()
|
|
if gossipInfoTable and gossipInfoTable[1] and gossipInfoTable[1].name then
|
|
LeaPlusLC:Print("Gossip count: |cffffffff" .. #gossipInfoTable)
|
|
LeaPlusLC:Print("Gossip name: |cffffffff" .. gossipInfoTable[1].name)
|
|
else
|
|
LeaPlusLC:Print("Gossip info: |cffffffff" .. "Nil")
|
|
end
|
|
if GossipTitleButton1 and GossipTitleButton1:GetText() then
|
|
LeaPlusLC:Print("First option: |cffffffff" .. GossipTitleButton1:GetText())
|
|
end
|
|
-- LeaPlusLC:Print("Gossip text: |cffffffff" .. GetGossipText())
|
|
if not IsShiftKeyDown() then
|
|
SelectGossipOption(1)
|
|
end
|
|
else
|
|
LeaPlusLC:Print("Gossip frame not open.")
|
|
end
|
|
return
|
|
elseif str == "traits" then
|
|
-- Set dragonriding traits
|
|
if C_AddOns.IsAddOnLoaded("Blizzard_GenericTraitUI") and GenericTraitFrame:IsShown() then
|
|
local c = C_Traits.GetConfigIDBySystemID(1)
|
|
for count = 1, 10 do
|
|
for i, n in ipairs(C_Traits.GetTreeNodes(672)) do
|
|
local f = C_Traits.GetNodeInfo(c, n)
|
|
if #f.entryIDs < 2 then
|
|
-- One trait only
|
|
C_Traits.PurchaseRank(c, n)
|
|
else
|
|
-- Two trait choices
|
|
C_Traits.SetSelection(c, n, f.entryIDs[2]) -- 1 for left-side trait, 2 for right-side trait
|
|
end
|
|
end
|
|
end
|
|
-- Save changes
|
|
C_Traits.CommitConfig(c)
|
|
-- Reload to clear everything
|
|
ReloadUI()
|
|
else
|
|
LeaPlusLC:Print("Open the dragonriding trait frame first!")
|
|
end
|
|
return
|
|
elseif str == "talents" or str == "tal" then
|
|
-- Ensure the talents window is loaded
|
|
if not ClassTalentFrame then
|
|
LeaPlusLC:Print("Open the talents window first.")
|
|
return
|
|
end
|
|
-- Get player class
|
|
local void, class = UnitClass("player")
|
|
local importStream
|
|
if class == "PALADIN" then
|
|
importStream = ExportUtil.MakeImportDataStream("BIEAomTTpSA9oX6huYLb5nP3r3iWSi2BSIlkIlWLRCJkIBAAIAAAAAAAgikkkQiQCRgWiAAAAABBA")
|
|
elseif class == "WARLOCK" then
|
|
importStream = ExportUtil.MakeImportDataStream("BsQAj5LiEN4VXhSin5RcWeAUgoIhIJSCBBkSSSCFQS0SSItkEEAAAAAAAAAAAAIEaJJJA")
|
|
elseif class == "PRIEST" then
|
|
importStream = ExportUtil.MakeImportDataStream("BEQA/KVNHBYFUG61hTBXiMbcYCAAAAAAAokCCkQEJhkkkSUSoEAAAAAl0IkEJgSSSSQISCBlAA")
|
|
else
|
|
return
|
|
end
|
|
-- Delete the loadout called Mine
|
|
local activeSpecID = GetSpecialization()
|
|
local specID = GetSpecializationInfo(activeSpecID)
|
|
local configs = C_ClassTalents.GetConfigIDsBySpecID(specID)
|
|
for void, configID in ipairs(configs) do
|
|
local configInfo = C_Traits.GetConfigInfo(configID)
|
|
if configInfo.name == "Mine" then
|
|
C_ClassTalents.DeleteConfig(configID)
|
|
end
|
|
end
|
|
-- Create a new loadout called Mine
|
|
local headerValid, serializationVersion, specID, treeHash = ClassTalentFrame.TalentsTab:ReadLoadoutHeader(importStream)
|
|
|
|
local treeInfo = ClassTalentFrame.TalentsTab:GetTreeInfo()
|
|
local configID = ClassTalentFrame.TalentsTab:GetConfigID()
|
|
|
|
local loadoutContent = ClassTalentFrame.TalentsTab:ReadLoadoutContent(importStream, treeInfo.ID)
|
|
local loadoutEntryInfo = ClassTalentFrame.TalentsTab:ConvertToImportLoadoutEntryInfo(configID, treeInfo.ID, loadoutContent)
|
|
|
|
local newConfigHasPurchasedRanks = #loadoutEntryInfo > 0
|
|
local configInfo = C_Traits.GetConfigInfo(configID)
|
|
local success, errorString = C_ClassTalents.ImportLoadout(configID, loadoutEntryInfo, "Mine")
|
|
ClassTalentFrame.TalentsTab:OnTraitConfigCreateStarted(newConfigHasPurchasedRanks)
|
|
-- Add reload button
|
|
if not LeaPlusLC.TalentsReloadButton then
|
|
local reloadButton = LeaPlusLC:CreateButton("TalentsReloadButton", ClassTalentFrame.TalentsTab, ">>> RELOAD <<<", "BOTTOM", 0, 10, 200, 45, true, "")
|
|
reloadButton:ClearAllPoints()
|
|
reloadButton:SetPoint("LEFT", ClassTalentFrame.TalentsTab.ResetButton, "RIGHT", 60, -4)
|
|
reloadButton:SetScript("OnClick", ReloadUI)
|
|
reloadButton:Hide(); reloadButton:Show()
|
|
LeaPlusLC.TalentsReloadButton = reloadButton
|
|
end
|
|
return
|
|
elseif str == "svars" then
|
|
-- Print saved variables
|
|
LeaPlusLC:Print(L["Saved Variables"] .. "|n")
|
|
LeaPlusLC:Print(L["The following list shows option label, setting name and currently saved value. Enable |cffffffffIncrease chat history|r (chat) and |cffffffffRecent chat window|r (chat) to make it easier."] .. "|n")
|
|
LeaPlusLC:Print(L["Modifying saved variables must start with |cffffffff/ltp nosave|r to prevent your changes from being reverted during reload or logout."] .. "|n")
|
|
LeaPlusLC:Print(L['Syntax is |cffffffff/run LeaPlusDB[' .. '"' .. 'setting name' .. '"' .. '] = ' .. '"' .. 'value' .. '" |r(case sensitive).'])
|
|
LeaPlusLC:Print(L["When done, |cffffffff/reload|r to save your changes."] .. "|n")
|
|
-- Checkboxes
|
|
LeaPlusLC:Print(L["Checkboxes"] .. "|n")
|
|
LeaPlusLC:Print(L["Checkboxes can be set to On or Off."] .. "|n")
|
|
for key, value in pairs(LeaPlusDB) do
|
|
if LeaPlusCB[key] and LeaPlusCB[key].f then
|
|
if LeaPlusCB[key]:GetObjectType() ~= "Slider" and LeaPlusCB[key]:GetObjectType() ~= "Button" then
|
|
LeaPlusLC:Print(string.gsub(LeaPlusCB[key].f:GetText(), "%*$", "") .. ": |cffffffff" .. key .. "|r |cff1eff0c(" .. value .. ")|r")
|
|
end
|
|
end
|
|
end
|
|
-- Sliders
|
|
LeaPlusLC:Print("|n" .. L["Sliders"] .. "|n")
|
|
LeaPlusLC:Print(L["Sliders can be set to a numeric value which must be in the range supported by the slider."] .. "|n")
|
|
for key, value in pairs(LeaPlusDB) do
|
|
if LeaPlusCB[key] and LeaPlusCB[key].f then
|
|
if LeaPlusCB[key]:GetObjectType() == "Slider" then
|
|
LeaPlusLC:Print("Slider: " .. "|cffffffff" .. key .. "|r |cff1eff0c(" .. value .. ")|r" .. " (" .. string.gsub(LeaPlusCB[key].f:GetText(), "%*$", "") .. ")" )
|
|
end
|
|
end
|
|
end
|
|
-- Dropdowns
|
|
LeaPlusLC:Print("|n" .. L["Dropdowns"] .. "|n")
|
|
LeaPlusLC:Print(L["Dropdowns can be set to a numeric value which must be in the range supported by the dropdown."] .. "|n")
|
|
for key, value in pairs(LeaPlusDB) do
|
|
if LeaPlusCB[key] and LeaPlusCB[key]:GetObjectType() == "Button" and LeaPlusLC[key] then
|
|
LeaPlusLC:Print("Dropdown: " .. "|cffffffff" .. key .. "|r |cff1eff0c(" .. value .. ")|r")
|
|
end
|
|
end
|
|
return
|
|
elseif str == "tags" then
|
|
-- Print open menu tags (such as dropdown menus)
|
|
Menu.PrintOpenMenuTags()
|
|
return
|
|
elseif str == "editmode" then
|
|
-- Open Edit Mode (useful for new player experience)
|
|
if not LeaPlusLC:PlayerInCombat() then
|
|
RunScript('ShowUIPanel(EditModeManagerFrame)')
|
|
end
|
|
return
|
|
elseif str == "taintmap" then
|
|
-- TaintMap
|
|
if LeaPlusLC.TaintMap then
|
|
LeaPlusLC.TaintMap:Cancel()
|
|
LeaPlusLC.TaintMap = nil
|
|
LeaPlusLC:Print("TaintMap stopped.")
|
|
return
|
|
end
|
|
LeaPlusLC.TaintMap = C_Timer.NewTicker(1, function()
|
|
for k,v in pairs(WorldMapFrame) do
|
|
local ok, who = issecurevariable(WorldMapFrame, k)
|
|
if not ok then
|
|
print("Tainted:", k, "by", who or "unknown")
|
|
end
|
|
end
|
|
end)
|
|
LeaPlusLC:Print("TaintMap started.")
|
|
return
|
|
elseif str == "admin" then
|
|
-- Preset profile (used for testing)
|
|
LpEvt:UnregisterAllEvents() -- Prevent changes
|
|
wipe(LeaPlusDB) -- Wipe settings
|
|
LeaPlusLC:PlayerLogout(true) -- Reset permanent settings
|
|
-- Automation
|
|
LeaPlusDB["AutomateQuests"] = "On" -- Automate quests
|
|
LeaPlusDB["AutoQuestShift"] = "Off" -- Automate quests requires shift
|
|
LeaPlusDB["AutoQuestRegular"] = "On" -- Accept regular quests
|
|
LeaPlusDB["AutoQuestDaily"] = "On" -- Accept daily quests
|
|
LeaPlusDB["AutoQuestWeekly"] = "On" -- Accept weekly quests
|
|
LeaPlusDB["AutoQuestCompleted"] = "On" -- Turn-in completed quests
|
|
LeaPlusDB["AutoQuestKeyMenu"] = 1 -- Automate quests override key
|
|
LeaPlusDB["AutomateGossip"] = "On" -- Automate gossip
|
|
LeaPlusDB["AutoAcceptSummon"] = "On" -- Accept summon
|
|
LeaPlusDB["AutoAcceptRes"] = "On" -- Accept resurrection
|
|
LeaPlusDB["AutoReleasePvP"] = "On" -- Release in PvP
|
|
LeaPlusDB["AutoSellJunk"] = "On" -- Sell junk automatically
|
|
LeaPlusDB["AutoSellExcludeList"] = "" -- Sell junk exclusions list
|
|
LeaPlusDB["AutoRepairGear"] = "On" -- Repair automatically
|
|
|
|
-- Social
|
|
LeaPlusDB["NoDuelRequests"] = "On" -- Block duels
|
|
LeaPlusDB["NoPetDuels"] = "On" -- Block pet battle duels
|
|
LeaPlusDB["NoPartyInvites"] = "Off" -- Block party invites
|
|
LeaPlusDB["NoRequestedInvites"] = "Off" -- Block requested invites
|
|
LeaPlusDB["NoFriendRequests"] = "Off" -- Block friend requests
|
|
LeaPlusDB["NoSharedQuests"] = "Off" -- Block shared quests
|
|
|
|
LeaPlusDB["AcceptPartyFriends"] = "On" -- Party from friends
|
|
LeaPlusDB["SyncFromFriends"] = "On" -- Sync from friends
|
|
LeaPlusDB["AutoConfirmRole"] = "On" -- Queue from friends
|
|
LeaPlusDB["InviteFromWhisper"] = "On" -- Invite from whispers
|
|
LeaPlusDB["InviteFriendsOnly"] = "On" -- Restrict invites to friends
|
|
LeaPlusDB["FriendlyCommunities"] = "On" -- Friendly communities
|
|
LeaPlusDB["FriendlyGuild"] = "On" -- Friendly guild
|
|
|
|
-- Chat
|
|
LeaPlusDB["UseEasyChatResizing"] = "On" -- Use easy resizing
|
|
LeaPlusDB["NoCombatLogTab"] = "On" -- Hide the combat log
|
|
LeaPlusDB["NoChatButtons"] = "On" -- Hide chat buttons
|
|
LeaPlusDB["ShowVoiceButtons"] = "On" -- Show voice buttons
|
|
LeaPlusDB["ShowChatMenuButton"] = "Off" -- Show chat menu button
|
|
LeaPlusDB["NoSocialButton"] = "On" -- Hide social button
|
|
LeaPlusDB["UnclampChat"] = "On" -- Unclamp chat frame
|
|
LeaPlusDB["MoveChatEditBoxToTop"] = "On" -- Move editbox to top
|
|
LeaPlusDB["SetChatFontSize"] = "On" -- Set chat font size
|
|
LeaPlusDB["LeaPlusChatFontSize"] = 20 -- Chat font size value
|
|
|
|
LeaPlusDB["NoStickyChat"] = "On" -- Disable sticky chat
|
|
LeaPlusDB["UseArrowKeysInChat"] = "On" -- Use arrow keys in chat
|
|
LeaPlusDB["NoChatFade"] = "On" -- Disable chat fade
|
|
LeaPlusDB["UnivGroupColor"] = "On" -- Universal group color
|
|
LeaPlusDB["RecentChatWindow"] = "On" -- Recent chat window
|
|
LeaPlusDB["RecentChatSize"] = 170 -- Recent chat size
|
|
LeaPlusDB["MaxChatHstory"] = "Off" -- Increase chat history
|
|
LeaPlusDB["FilterChatMessages"] = "On" -- Filter chat messages
|
|
LeaPlusDB["BlockSpellLinks"] = "On" -- Block spell links
|
|
LeaPlusDB["BlockDrunkenSpam"] = "On" -- Block drunken spam
|
|
LeaPlusDB["BlockDuelSpam"] = "On" -- Block duel spam
|
|
LeaPlusDB["BlockAngelisSinny"] = "On" -- Block Angelis and Sinny spam
|
|
LeaPlusDB["RestoreChatMessages"] = "On" -- Restore chat messages
|
|
|
|
-- Text
|
|
LeaPlusDB["HideErrorMessages"] = "On" -- Hide error messages
|
|
LeaPlusDB["NoHitIndicators"] = "On" -- Hide portrait numbers
|
|
LeaPlusDB["HideKeybindText"] = "On" -- Hide keybind text
|
|
LeaPlusDB["HideMacroText"] = "On" -- Hide macro text
|
|
|
|
LeaPlusDB["MailFontChange"] = "On" -- Resize mail text
|
|
LeaPlusDB["LeaPlusMailFontSize"] = 22 -- Mail font size
|
|
LeaPlusDB["QuestFontChange"] = "On" -- Resize quest text
|
|
LeaPlusDB["LeaPlusQuestFontSize"] = 18 -- Quest font size
|
|
|
|
-- Interface
|
|
LeaPlusDB["MinimapModder"] = "On" -- Enhance minimap
|
|
LeaPlusDB["SquareMinimap"] = "On" -- Square minimap
|
|
LeaPlusDB["ShowWhoPinged"] = "On" -- Show who pinged
|
|
LeaPlusDB["HideMiniAddonMenu"] = "On" -- Hide addon menu
|
|
LeaPlusDB["UnclampMinimap"] = "On" -- Unclamp minimap cluster
|
|
LeaPlusDB["CombineAddonButtons"] = "On" -- Combine addon buttons
|
|
LeaPlusDB["MiniExcludeList"] = "BugSack, Leatrix_Plus" -- Excluded addon list
|
|
LeaPlusDB["MiniClusterScale"] = 1 -- Minimap cluster scale
|
|
LeaPlusDB["MinimapNoScale"] = "Off" -- Minimap not minimap
|
|
LeaPlusDB["MinimapA"] = "TOPRIGHT" -- Minimap anchor
|
|
LeaPlusDB["MinimapR"] = "TOPRIGHT" -- Minimap relative
|
|
LeaPlusDB["MinimapX"] = 0 -- Minimap X
|
|
LeaPlusDB["MinimapY"] = 0 -- Minimap Y
|
|
|
|
LeaPlusDB["TipModEnable"] = "On" -- Enhance tooltip
|
|
LeaPlusDB["TipBackSimple"] = "On" -- Color backdrops
|
|
LeaPlusDB["LeaPlusTipSize"] = 1.25 -- Tooltip scale slider
|
|
LeaPlusDB["TooltipAnchorMenu"] = 1 -- Tooltip anchor
|
|
LeaPlusDB["TipCursorX"] = 0 -- X offset
|
|
LeaPlusDB["TipCursorY"] = 0 -- Y offset
|
|
LeaPlusDB["EnhanceDressup"] = "On" -- Enhance dressup
|
|
LeaPlusDB["DressupWiderPreview"] = "On" -- Enhance dressup wider character preview
|
|
LeaPlusDB["DressupMoreZoomOut"] = "Off" -- Enhance dressup increase zoom out distance
|
|
LeaPlusDB["DressupTransmogAnim"] = "Off" -- Enhance dressup transmogrify animation control
|
|
LeaPlusDB["DressupFasterZoom"] = 3 -- Dressup zoom speed
|
|
LeaPlusDB["ShowVolume"] = "On" -- Show volume slider
|
|
LeaPlusDB["ShowCooldowns"] = "On" -- Show cooldowns
|
|
LeaPlusDB["DurabilityStatus"] = "On" -- Show durability status
|
|
LeaPlusDB["ShowPetSaveBtn"] = "On" -- Show pet save button
|
|
LeaPlusDB["ShowRaidToggle"] = "On" -- Show raid toggle button
|
|
LeaPlusDB["ShowTrainAllButton"] = "On" -- Show train all button
|
|
LeaPlusDB["ShowBorders"] = "On" -- Show borders
|
|
LeaPlusDB["ShowPlayerChain"] = "On" -- Show player chain
|
|
LeaPlusDB["PlayerChainMenu"] = 1 -- Player chain style
|
|
LeaPlusDB["ShowReadyTimer"] = "On" -- Show ready timer
|
|
LeaPlusDB["ShowWowheadLinks"] = "On" -- Show Wowhead links
|
|
LeaPlusDB["WowheadLinkComments"] = "On" -- Show Wowhead links to comments
|
|
|
|
-- Interface: Manage frames
|
|
LeaPlusDB["ManageWidgetTop"] = "On" -- Manage widget top
|
|
LeaPlusDB["WidgetTopA"] = "TOP" -- Manage widget top anchor
|
|
LeaPlusDB["WidgetTopR"] = "TOP" -- Manage widget top relative
|
|
LeaPlusDB["WidgetTopX"] = 0 -- Manage widget top position X
|
|
LeaPlusDB["WidgetTopY"] = -432 -- Manage widget top position Y
|
|
LeaPlusDB["WidgetTopScale"] = 1.25 -- Manage widget top scale
|
|
|
|
LeaPlusDB["ManageControl"] = "On" -- Manage control
|
|
LeaPlusDB["ControlA"] = "CENTER" -- Manage control anchor
|
|
LeaPlusDB["ControlR"] = "CENTER" -- Manage control relative
|
|
LeaPlusDB["ControlX"] = 0 -- Manage control position X
|
|
LeaPlusDB["ControlY"] = 0 -- Manage control position Y
|
|
LeaPlusDB["ControlScale"] = 1.00 -- Manage control scale
|
|
|
|
LeaPlusDB["ClassColFrames"] = "On" -- Class colored frames
|
|
|
|
LeaPlusDB["NoAlerts"] = "On" -- Hide alerts
|
|
LeaPlusDB["HideBodyguard"] = "On" -- Hide bodyguard window
|
|
LeaPlusDB["HideTalkingFrame"] = "On" -- Hide talking frame
|
|
LeaPlusDB["HideCleanupBtns"] = "On" -- Hide cleanup buttons
|
|
LeaPlusDB["HideBossBanner"] = "On" -- Hide boss banner
|
|
LeaPlusDB["HideEventToasts"] = "On" -- Hide event toasts
|
|
LeaPlusDB["NoClassBar"] = "On" -- Hide stance bar
|
|
LeaPlusDB["NoCommandBar"] = "On" -- Hide order hall bar
|
|
LeaPlusDB["NoRestedSleep"] = "On" -- Hide rested sleep
|
|
|
|
-- System
|
|
LeaPlusDB["NoScreenGlow"] = "On" -- Disable screen glow
|
|
LeaPlusDB["NoScreenEffects"] = "On" -- Disable screen effects
|
|
LeaPlusDB["SetWeatherDensity"] = "On" -- Set weather density
|
|
LeaPlusDB["WeatherLevel"] = 0 -- Weather density level
|
|
LeaPlusDB["MaxCameraZoom"] = "On" -- Max camera zoom
|
|
LeaPlusDB["NoRestedEmotes"] = "On" -- Silence rested emotes
|
|
LeaPlusDB["KeepAudioSynced"] = "On" -- Keep audio synced
|
|
LeaPlusDB["MuteGameSounds"] = "On" -- Mute game sounds
|
|
LeaPlusDB["MuteMountSounds"] = "On" -- Mute mount sounds
|
|
LeaPlusDB["MuteCustomSounds"] = "On" -- Mute custom sounds
|
|
LeaPlusDB["MuteCustomList"] = "" -- Mute custom sounds list
|
|
|
|
LeaPlusDB["NoBagAutomation"] = "On" -- Disable bag automation
|
|
LeaPlusDB["NoPetAutomation"] = "On" -- Disable pet automation
|
|
LeaPlusDB["NoRaidRestrictions"] = "On" -- Remove raid restrictions
|
|
LeaPlusDB["NoConfirmLoot"] = "On" -- Disable loot warnings
|
|
LeaPlusDB["FasterLooting"] = "On" -- Faster auto loot
|
|
LeaPlusDB["LeaPlusFasterLootDelay"] = 0.3 -- Faster loot delay
|
|
|
|
LeaPlusDB["FasterMovieSkip"] = "On" -- Faster movie skip
|
|
LeaPlusDB["CombatPlates"] = "On" -- Combat plates
|
|
LeaPlusDB["EasyItemDestroy"] = "On" -- Easy item destroy
|
|
LeaPlusDB["NoTransforms"] = "On" -- Remove transforms
|
|
LeaPlusDB["SetAddtonOptions"] = "On" -- Set additional options
|
|
LeaPlusDB["AddOptNoCombatBox"] = "On" -- Uncheck combat animation checkbox
|
|
LeaPlusDB["AddOptNoMountBox"] = "On" -- Uncheck mount special animation checkbox
|
|
|
|
-- Function to assign cooldowns
|
|
local function setIcon(pclass, pspec, sp1, pt1, sp2, pt2, sp3, pt3, sp4, pt4, sp5, pt5)
|
|
-- Set spell ID
|
|
if sp1 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R1Idn"] = "" else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R1Idn"] = sp1 end
|
|
if sp2 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R2Idn"] = "" else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R2Idn"] = sp2 end
|
|
if sp3 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R3Idn"] = "" else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R3Idn"] = sp3 end
|
|
if sp4 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R4Idn"] = "" else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R4Idn"] = sp4 end
|
|
if sp5 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R5Idn"] = "" else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R5Idn"] = sp5 end
|
|
-- Set pet checkbox
|
|
if pt1 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R1Pet"] = false else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R1Pet"] = true end
|
|
if pt2 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R2Pet"] = false else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R2Pet"] = true end
|
|
if pt3 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R3Pet"] = false else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R3Pet"] = true end
|
|
if pt4 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R4Pet"] = false else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R4Pet"] = true end
|
|
if pt5 == 0 then LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R5Pet"] = false else LeaPlusDB["Cooldowns"][pclass]["S" .. pspec .. "R5Pet"] = true end
|
|
end
|
|
|
|
-- Create main table
|
|
LeaPlusDB["Cooldowns"] = {}
|
|
|
|
-- Create class tables
|
|
for index = 1, GetNumClasses() do
|
|
local classDisplayName, classTag, classID = GetClassInfo(index)
|
|
LeaPlusDB["Cooldowns"][classTag] = {}
|
|
end
|
|
|
|
-- Assign cooldowns
|
|
setIcon("WARRIOR", 1, --[[Arms]] --[[1]] 32216, 0, --[[2]] 209574, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Victory Rush, Shattered Defences
|
|
setIcon("WARRIOR", 2, --[[Fury]] --[[1]] 32216, 0, --[[2]] 184362, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Victory Rush, Enrage
|
|
setIcon("WARRIOR", 3, --[[Protection]] --[[1]] 32216, 0, --[[2]] 190456, 0, --[[3]] 132404, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Victory Rush, Ignore Pain, Shield Block
|
|
|
|
setIcon("PALADIN", 1, --[[Holy]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 203539, 0, --[[5]] 203538, 0) -- nil, nil, nil, Wisdom, Kings
|
|
setIcon("PALADIN", 2, --[[Protection]] --[[1]] 132403, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Shield of the Righteous, nil, nil, nil, nil
|
|
setIcon("PALADIN", 3, --[[Retribution]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 203539, 0, --[[5]] 203538, 0) -- nil, nil, nil, Wisdom, Kings
|
|
|
|
setIcon("SHAMAN", 1, --[[Elemental]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 215864, 0, --[[5]] 546, 0) -- nil, nil, nil, Rainfall, Water Walking
|
|
setIcon("SHAMAN", 2, --[[Enhancement]] --[[1]] 194084, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 215864, 0, --[[5]] 546, 0) -- Flametongue, nil, nil, Rainfall, Water Walking
|
|
setIcon("SHAMAN", 3, --[[Resto]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 215864, 0, --[[5]] 546, 0) -- nil, nil, nil, Rainfall, Water Walking
|
|
|
|
setIcon("ROGUE", 1, --[[Assassination]] --[[1]] 1784, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 2823, 0, --[[5]] 3408, 0) -- Stealth, nil, nil, Deadly Poison, Crippling Poison
|
|
setIcon("ROGUE", 2, --[[Outlaw]] --[[1]] 1784, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 2823, 0, --[[5]] 3408, 0) -- Stealth, nil, nil, Deadly Poison, Crippling Poison
|
|
setIcon("ROGUE", 3, --[[Subtetly]] --[[1]] 1784, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 2823, 0, --[[5]] 3408, 0) -- Stealth, nil, nil, Deadly Poison, Crippling Poison
|
|
|
|
setIcon("DRUID", 1, --[[Balance]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
setIcon("DRUID", 2, --[[Feral]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
setIcon("DRUID", 3, --[[Guardian]] --[[1]] 192081, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Ironfur
|
|
setIcon("DRUID", 4, --[[Resto]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
|
|
setIcon("MONK", 1, --[[Brewmaster]] --[[1]] 125359, 0, --[[2]] 115307, 0, --[[3]] 124274, 0, --[[4]] 124273, 0, --[[5]] 116781, 0) -- Tiger Power, Shuffle, Moderate Stagger, Heavy Stagger, Legacy of the White Tiger
|
|
setIcon("MONK", 2, --[[Mistweaver]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
setIcon("MONK", 3, --[[Windwalker]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
|
|
setIcon("MAGE", 1, --[[Arcane]] --[[1]] 235450, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 1459, 0) -- Prismatic Barrier, nil, nil, nil, Arcane Intellect
|
|
setIcon("MAGE", 2, --[[Fire]] --[[1]] 235313, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 1459, 0) -- Blazing Barrier, nil, nil, nil, Arcane Intellect
|
|
setIcon("MAGE", 3, --[[Frost]] --[[1]] 11426, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 1459, 0) -- Ice Barrier, nil, nil, nil, Arcane Intellect
|
|
|
|
setIcon("WARLOCK", 1, --[[Affliction]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
setIcon("WARLOCK", 2, --[[Demonology]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
setIcon("WARLOCK", 3, --[[Destruction]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
|
|
setIcon("PRIEST", 1, --[[Discipline]] --[[1]] 17, 0, --[[2]] 194384, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Power Word: Shield
|
|
setIcon("PRIEST", 2, --[[Holy]] --[[1]] 17, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Power Word: Shield
|
|
setIcon("PRIEST", 3, --[[Shadow]] --[[1]] 17, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0) -- Power Word: Shield
|
|
|
|
setIcon("HUNTER", 1, --[[Beast Mastery]] --[[1]] 136, 1, --[[2]] 118455, 1, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 5384, 0) -- Mend Pet, nil, nil, nil, Feign Death
|
|
setIcon("HUNTER", 2, --[[Marksmanship]] --[[1]] 136, 1, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 5384, 0) -- Mend Pet, nil, nil, nil, Feign Death
|
|
setIcon("HUNTER", 3, --[[Survival]] --[[1]] 136, 1, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 5384, 0) -- Mend Pet, nil, nil, nil, Feign Death
|
|
|
|
setIcon("DEATHKNIGHT", 1, --[[Blood]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 195181, 0) -- nil, nil, nil, nil, Bone Shield
|
|
setIcon("DEATHKNIGHT", 2, --[[Frost]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
setIcon("DEATHKNIGHT", 3, --[[Unholy]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
|
|
setIcon("DEMONHUNTER", 1, --[[Havoc]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 0, 0)
|
|
setIcon("DEMONHUNTER", 2, --[[Vengeance]] --[[1]] 0, 0, --[[2]] 0, 0, --[[3]] 0, 0, --[[4]] 0, 0, --[[5]] 203819, 0) -- nil, nil, nil, nil, Demon Spikes
|
|
|
|
-- Mute game sounds (LeaPlusLC["MuteGameSounds"])
|
|
for k, v in pairs(LeaPlusLC["muteTable"]) do
|
|
LeaPlusDB[k] = "On"
|
|
end
|
|
LeaPlusDB["MuteReady"] = "Off" -- Mute ready check
|
|
LeaPlusDB["MuteVigor"] = "Off" -- Mute vigor
|
|
|
|
-- Mute mount sounds (LeaPlusLC["MuteMountSounds"])
|
|
for k, v in pairs(LeaPlusLC["mountTable"]) do
|
|
LeaPlusDB[k] = "On"
|
|
end
|
|
|
|
-- Remove transforms (LeaPlusLC["NoTransforms"])
|
|
for k, v in pairs(LeaPlusLC["transTable"]) do
|
|
LeaPlusDB[k] = "On"
|
|
end
|
|
|
|
-- Set chat font sizes
|
|
for i = 1, 50 do if _G["ChatFrame" .. i] then FCF_SetChatWindowFontSize(self, _G["ChatFrame" .. i], 18) end end
|
|
|
|
-- Reload
|
|
ReloadUI()
|
|
else
|
|
LeaPlusLC:Print("Invalid parameter.")
|
|
end
|
|
return
|
|
else
|
|
-- Prevent options panel from showing if Blizzard Store is showing
|
|
if StoreFrame and StoreFrame:GetAttribute("isshown") then return end
|
|
-- Toggle the options panel if game options panel is not showing
|
|
if LeaPlusLC:IsPlusShowing() then
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC:HideConfigPanels()
|
|
else
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC["PageF"]:Show()
|
|
end
|
|
LeaPlusLC["Page"..LeaPlusLC["LeaStartPage"]]:Show()
|
|
end
|
|
end
|
|
|
|
-- Slash command for global function
|
|
_G.SLASH_Leatrix_Plus1 = "/ltp"
|
|
_G.SLASH_Leatrix_Plus2 = "/leaplus"
|
|
|
|
SlashCmdList["Leatrix_Plus"] = function(self)
|
|
-- Run slash command function
|
|
LeaPlusLC:SlashFunc(self)
|
|
end
|
|
|
|
-- Slash command for UI reload
|
|
_G.SLASH_LEATRIX_PLUS_RL1 = "/rl"
|
|
SlashCmdList["LEATRIX_PLUS_RL"] = function()
|
|
ReloadUI()
|
|
end
|
|
|
|
----------------------------------------------------------------------
|
|
-- L90: Create options panel pages (no content yet)
|
|
----------------------------------------------------------------------
|
|
|
|
-- Function to add menu button
|
|
function LeaPlusLC:MakeMN(name, text, parent, anchor, x, y, width, height)
|
|
|
|
local mbtn = CreateFrame("Button", nil, parent)
|
|
LeaPlusLC[name] = mbtn
|
|
mbtn:Show();
|
|
mbtn:SetSize(width, height)
|
|
mbtn:SetAlpha(1.0)
|
|
mbtn:SetPoint(anchor, x, y)
|
|
|
|
mbtn.t = mbtn:CreateTexture(nil, "BACKGROUND")
|
|
mbtn.t:SetAllPoints()
|
|
mbtn.t:SetColorTexture(0.3, 0.3, 0.00, 0.8)
|
|
mbtn.t:SetAlpha(0.7)
|
|
mbtn.t:Hide()
|
|
|
|
mbtn.s = mbtn:CreateTexture(nil, "BACKGROUND")
|
|
mbtn.s:SetAllPoints()
|
|
mbtn.s:SetColorTexture(0.3, 0.3, 0.00, 0.8)
|
|
mbtn.s:Hide()
|
|
|
|
mbtn.f = mbtn:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
|
|
mbtn.f:SetPoint('LEFT', 16, 0)
|
|
mbtn.f:SetText(L[text])
|
|
|
|
mbtn:SetScript("OnEnter", function()
|
|
mbtn.t:Show()
|
|
end)
|
|
|
|
mbtn:SetScript("OnLeave", function()
|
|
mbtn.t:Hide()
|
|
end)
|
|
|
|
return mbtn, mbtn.s
|
|
|
|
end
|
|
|
|
-- Function to create individual options panel pages
|
|
function LeaPlusLC:MakePage(name, title, menu, menuname, menuparent, menuanchor, menux, menuy, menuwidth, menuheight)
|
|
|
|
-- Create frame
|
|
local oPage = CreateFrame("Frame", nil, LeaPlusLC["PageF"])
|
|
LeaPlusLC[name] = oPage
|
|
oPage:SetAllPoints(LeaPlusLC["PageF"])
|
|
oPage:Hide()
|
|
|
|
-- Add page title
|
|
oPage.s = oPage:CreateFontString(nil, 'ARTWORK', 'GameFontNormalLarge')
|
|
oPage.s:SetPoint('TOPLEFT', 146, -16)
|
|
oPage.s:SetText(L[title])
|
|
|
|
-- Add menu item if needed
|
|
if menu then
|
|
LeaPlusLC[menu], LeaPlusLC[menu .. ".s"] = LeaPlusLC:MakeMN(menu, menuname, menuparent, menuanchor, menux, menuy, menuwidth, menuheight)
|
|
LeaPlusLC[name]:SetScript("OnShow", function() LeaPlusLC[menu .. ".s"]:Show(); end)
|
|
LeaPlusLC[name]:SetScript("OnHide", function() LeaPlusLC[menu .. ".s"]:Hide(); end)
|
|
end
|
|
|
|
return oPage
|
|
|
|
end
|
|
|
|
-- Create options pages
|
|
LeaPlusLC["Page0"] = LeaPlusLC:MakePage("Page0", "Home" , "LeaPlusNav0", "Home" , LeaPlusLC["PageF"], "TOPLEFT", 16, -72, 112, 20)
|
|
LeaPlusLC["Page1"] = LeaPlusLC:MakePage("Page1", "Automation" , "LeaPlusNav1", "Automation" , LeaPlusLC["PageF"], "TOPLEFT", 16, -112, 112, 20)
|
|
LeaPlusLC["Page2"] = LeaPlusLC:MakePage("Page2", "Social" , "LeaPlusNav2", "Social" , LeaPlusLC["PageF"], "TOPLEFT", 16, -132, 112, 20)
|
|
LeaPlusLC["Page3"] = LeaPlusLC:MakePage("Page3", "Chat" , "LeaPlusNav3", "Chat" , LeaPlusLC["PageF"], "TOPLEFT", 16, -152, 112, 20)
|
|
LeaPlusLC["Page4"] = LeaPlusLC:MakePage("Page4", "Text" , "LeaPlusNav4", "Text" , LeaPlusLC["PageF"], "TOPLEFT", 16, -172, 112, 20)
|
|
LeaPlusLC["Page5"] = LeaPlusLC:MakePage("Page5", "Interface" , "LeaPlusNav5", "Interface" , LeaPlusLC["PageF"], "TOPLEFT", 16, -192, 112, 20)
|
|
LeaPlusLC["Page6"] = LeaPlusLC:MakePage("Page6", "Frames" , "LeaPlusNav6", "Frames" , LeaPlusLC["PageF"], "TOPLEFT", 16, -212, 112, 20)
|
|
LeaPlusLC["Page7"] = LeaPlusLC:MakePage("Page7", "System" , "LeaPlusNav7", "System" , LeaPlusLC["PageF"], "TOPLEFT", 16, -232, 112, 20)
|
|
LeaPlusLC["Page8"] = LeaPlusLC:MakePage("Page8", "Settings" , "LeaPlusNav8", "Settings" , LeaPlusLC["PageF"], "TOPLEFT", 16, -272, 112, 20)
|
|
LeaPlusLC["Page9"] = LeaPlusLC:MakePage("Page9", "Media" , "LeaPlusNav9", "Media" , LeaPlusLC["PageF"], "TOPLEFT", 16, -292, 112, 20)
|
|
|
|
-- Page navigation mechanism
|
|
for i = 0, LeaPlusLC["NumberOfPages"] do
|
|
LeaPlusLC["LeaPlusNav"..i]:SetScript("OnClick", function()
|
|
LeaPlusLC:HideFrames()
|
|
LeaPlusLC["PageF"]:Show()
|
|
LeaPlusLC["Page"..i]:Show()
|
|
LeaPlusLC["LeaStartPage"] = i
|
|
end)
|
|
end
|
|
|
|
-- Use a variable to contain the page number (makes it easier to move options around)
|
|
local pg;
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC0: Welcome
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page0"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Welcome to Leatrix Plus.", 146, -72)
|
|
LeaPlusLC:MakeWD(LeaPlusLC[pg], "To begin, choose an options page.", 146, -92)
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Support", 146, -132);
|
|
LeaPlusLC:MakeWD(LeaPlusLC[pg], "www.leatrix.com", 146, -152)
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC1: Automation
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page1"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Character" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutomateQuests" , "Automate quests" , 146, -92, false, "If checked, quests will be selected, accepted and turned-in automatically.|n|nQuests which require gold, currency, a crafting reagent or an account-bound item will not be turned-in automatically.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutomateGossip" , "Automate gossip" , 146, -112, false, "If checked, you can hold down the alt key while opening a gossip window to automatically select a single gossip option.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutoAcceptSummon" , "Accept summon" , 146, -132, false, "If checked, summon requests will be accepted automatically unless you are in combat.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutoAcceptRes" , "Accept resurrection" , 146, -152, false, "If checked, resurrection requests will be accepted automatically.|n|nResurrection requests from a Brazier of Awakening or a Failure Detection Pylon will not be accepted automatically.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutoReleasePvP" , "Release in PvP" , 146, -172, false, "If checked, you will release automatically after you die in Ashran, Tol Barad (PvP), Wintergrasp or any battleground.|n|nYou will not release automatically if you have the ability to self-resurrect (soulstone, reincarnation, etc).")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Vendors" , 340, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutoSellJunk" , "Sell junk automatically" , 340, -92, true, "If checked, all grey items in your bags will be sold automatically when you visit a merchant.|n|nYou can hold the shift key down when you talk to a merchant to override this setting.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutoRepairGear" , "Repair automatically" , 340, -112, false, "If checked, your gear will be repaired automatically when you visit a suitable merchant.|n|nYou can hold the shift key down when you talk to a merchant to override this setting.")
|
|
|
|
LeaPlusLC:CfgBtn("AutomateQuestsBtn", LeaPlusCB["AutomateQuests"])
|
|
LeaPlusLC:CfgBtn("AutoAcceptResBtn", LeaPlusCB["AutoAcceptRes"])
|
|
LeaPlusLC:CfgBtn("AutoReleasePvPBtn", LeaPlusCB["AutoReleasePvP"])
|
|
LeaPlusLC:CfgBtn("AutoSellJunkBtn", LeaPlusCB["AutoSellJunk"])
|
|
LeaPlusLC:CfgBtn("AutoRepairBtn", LeaPlusCB["AutoRepairGear"])
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC2: Social
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page2"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Blocks" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoDuelRequests" , "Block duels" , 146, -92, false, "If checked, duel requests will be blocked unless the player requesting the duel is a friend.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoPetDuels" , "Block pet battle duels" , 146, -112, false, "If checked, pet battle duel requests will be blocked unless the player requesting the duel is a friend.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoPartyInvites" , "Block party invites" , 146, -132, false, "If checked, party invitations will be blocked unless the player inviting you is a friend.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoRequestedInvites" , "Block requested invites" , 146, -152, false, "If checked, requests to invite a player to your group will be declined unless the player requesting to join is a friend.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoFriendRequests" , "Block friend requests" , 146, -172, false, "If checked, BattleTag and Real ID friend requests will be automatically declined.|n|nEnabling this option will automatically decline any pending requests.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoSharedQuests" , "Block shared quests" , 146, -192, false, "If checked, shared quests will be declined unless the player sharing the quest is a friend.")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Groups" , 340, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AcceptPartyFriends" , "Party from friends" , 340, -92, false, "If checked, party invitations from friends will be automatically accepted unless you are queued in Dungeon Finder.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "SyncFromFriends" , "Sync from friends" , 340, -112, false, "If checked, party sync requests from friends will be automatically accepted.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "AutoConfirmRole" , "Queue from friends" , 340, -132, false, "If checked, requests initiated by your party leader to join the Dungeon Finder queue will be automatically accepted if the party leader is a friend.|n|nThis option requires that you have selected a role for your character in the Dungeon Finder window.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "InviteFromWhisper" , "Invite from whispers" , 340, -152, false, L["If checked, a group invite will be sent to anyone who whispers you with a set keyword as long as you are ungrouped, group leader or raid assistant and not queued for a dungeon or raid.|n|nFriends who message the keyword using Battle.net will not be sent a group invite if they are appearing offline. They need to either change their online status or use character whispers."] .. "|n|n" .. L["Keyword"] .. ": |cffffffff" .. "dummy" .. "|r")
|
|
|
|
-- Show footer
|
|
LeaPlusLC:MakeFT(LeaPlusLC[pg], "For all of the social options above, you can treat guild members and members of your communities as friends too.", 146, 380, 96)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "FriendlyGuild" , "Guild" , 146, -282, false, "If checked, members of your guild will be treated as friends for all of the options on this page.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "FriendlyCommunities" , "Communities" , 340, -282, false, "If checked, members of your communities will be treated as friends for all of the options on this page.")
|
|
|
|
if LeaPlusCB["FriendlyGuild"].f:GetStringWidth() > 90 then
|
|
LeaPlusCB["FriendlyGuild"].f:SetWidth(90)
|
|
end
|
|
if LeaPlusCB["FriendlyCommunities"].f:GetStringWidth() > 90 then
|
|
LeaPlusCB["FriendlyCommunities"].f:SetWidth(90)
|
|
end
|
|
|
|
LeaPlusCB["FriendlyCommunities"]:ClearAllPoints()
|
|
LeaPlusCB["FriendlyCommunities"]:SetPoint("LEFT", LeaPlusCB["FriendlyGuild"], "RIGHT", LeaPlusCB["FriendlyGuild"].f:GetWidth() + 6, 0)
|
|
|
|
LeaPlusLC:CfgBtn("InvWhisperBtn", LeaPlusCB["InviteFromWhisper"])
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC3: Chat
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page3"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Chat Frame" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "UseEasyChatResizing" , "Use easy resizing" , 146, -92, true, "If checked, dragging the General chat tab will expand the chat frame upwards.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoCombatLogTab" , "Hide the combat log" , 146, -112, true, "If checked, the combat log will be hidden.|n|nThe combat log must be docked in order for this option to work.|n|nIf the combat log is undocked, you can dock it by dragging the tab (and reloading your UI) or by resetting the chat windows (from the chat menu).")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoChatButtons" , "Hide chat buttons" , 146, -132, true, "If checked, chat frame buttons will be hidden.|n|nClicking chat tabs will automatically show the latest messages.|n|nUse the mouse wheel to scroll through the chat history. Hold down SHIFT for page jump or CTRL to jump to the top or bottom of the chat history.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoSocialButton" , "Hide social button" , 146, -152, true, "If checked, the social button and quick-join notification will be hidden.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "UnclampChat" , "Unclamp chat frame" , 146, -172, true, "If checked, you will be able to drag the chat frame to the edge of the screen.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MoveChatEditBoxToTop" , "Move editbox to top" , 146, -192, true, "If checked, the editbox will be moved to the top of the chat frame.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "SetChatFontSize" , "Set chat font size" , 146, -212, true, "If checked, you will be able to set the chat font size.|n|nThis option offers a greater range of chat font sizes than the default UI and your chosen chat font size is saved account-wide.|n|nNote that enabling this option will prevent you from using the default UI to change the chat font size.")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Mechanics" , 340, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoStickyChat" , "Disable sticky chat" , 340, -92, true, "If checked, sticky chat will be disabled.|n|nNote that this does not apply to temporary chat windows.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "UseArrowKeysInChat" , "Use arrow keys in chat" , 340, -112, true, "If checked, you can press the arrow keys to move the insertion point left and right in the chat frame.|n|nIf unchecked, the arrow keys will use the default keybind setting.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoChatFade" , "Disable chat fade" , 340, -132, true, "If checked, chat text will not fade out after a time period.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "UnivGroupColor" , "Universal group color" , 340, -152, false, "If checked, raid chat and instance chat will both be colored blue (to match the default party chat color).")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "RecentChatWindow" , "Recent chat window" , 340, -172, true, "If checked, you can hold down the control key and click a chat tab to view recent chat in a copy-friendly window.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MaxChatHstory" , "Increase chat history" , 340, -192, true, "If checked, your chat history will increase to 4096 lines. If unchecked, the default will be used (128 lines).|n|nEnabling this option may prevent some chat text from showing during login.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "FilterChatMessages" , "Filter chat messages" , 340, -212, true, "If checked, you can block spell links, drunken spam and duel spam.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "RestoreChatMessages" , "Restore chat messages" , 340, -232, true, "If checked, recent chat will be restored when you reload your interface.")
|
|
|
|
LeaPlusLC:CfgBtn("NoChatButtonsBtn", LeaPlusCB["NoChatButtons"])
|
|
LeaPlusLC:CfgBtn("SetChatFontSizeBtn", LeaPlusCB["SetChatFontSize"])
|
|
LeaPlusLC:CfgBtn("FilterChatMessagesBtn", LeaPlusCB["FilterChatMessages"])
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC4: Text
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page4"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Visibility" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideErrorMessages" , "Hide error messages" , 146, -92, true, "If checked, most error messages (such as 'Not enough rage') will not be shown. Some important errors are excluded.|n|nIf you have the minimap button enabled, you can hold down the alt key and click it to toggle error messages without affecting this setting.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoHitIndicators" , "Hide portrait numbers" , 146, -112, true, "If checked, damage and healing numbers in the player and pet portrait frames will be hidden.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideZoneText" , "Hide zone text" , 146, -132, true, "If checked, zone text will not be shown (eg. 'Ironforge').")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideKeybindText" , "Hide keybind text" , 146, -152, true, "If checked, keybind text will not be shown on action buttons.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideMacroText" , "Hide macro text" , 146, -172, true, "If checked, macro text will not be shown on action buttons.")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Text Size" , 340, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MailFontChange" , "Resize mail text" , 340, -92, true, "If checked, you will be able to change the font size of standard mail text.|n|nThis does not affect mail created using templates (such as auction house invoices).")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "QuestFontChange" , "Resize quest text" , 340, -112, true, "If checked, you will be able to change the font size of quest text.|n|nEnabling this option will also change the text size of other frames which inherit the same font (such as the Dungeon Finder frame).")
|
|
|
|
LeaPlusLC:CfgBtn("MailTextBtn", LeaPlusCB["MailFontChange"])
|
|
LeaPlusLC:CfgBtn("QuestTextBtn", LeaPlusCB["QuestFontChange"])
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC5: Interface
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page5"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Enhancements" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MinimapModder" , "Enhance minimap" , 146, -92, true, "If checked, you will be able to customise the minimap.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "TipModEnable" , "Enhance tooltip" , 146, -112, true, "If checked, the tooltip will be color coded and you will be able to modify the tooltip layout and scale.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "EnhanceDressup" , "Enhance dressup" , 146, -132, true, "If checked, gear toggle buttons will be added to the dressup frame and model positioning controls will be removed.")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Extras" , 340, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowVolume" , "Show volume slider" , 340, -92, true, "If checked, a master volume slider will be shown in the character frame.|n|nThe volume slider can be placed in either of two locations in the character frame. To toggle between them, hold the shift key down and right-click the slider.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowCooldowns" , "Show cooldowns" , 340, -112, true, "If checked, you will be able to place up to five beneficial cooldown icons above the target frame.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "DurabilityStatus" , "Show durability status" , 340, -132, true, "If checked, a button will be added to the character frame which will show your equipped item durability when you hover the pointer over it.|n|nIn addition, an overall percentage will be shown in the chat frame when you die.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowPetSaveBtn" , "Show pet save button" , 340, -152, true, "If checked, you will be able to save your current battle pet team (including abilities) to a single command.|n|nA button will be added to the Pet Journal. Clicking the button will toggle showing the assignment command for your current team. Pressing CTRL/C will copy the command to memory.|n|nYou can then paste the command (with CTRL/V) into the chat window or a macro to instantly assign your team.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowRaidToggle" , "Show raid button" , 340, -172, true, "If checked, the button to toggle the raid container frame will be shown just above the raid management frame (left side of the screen) instead of in the raid management frame itself.|n|nThis allows you to toggle the raid container frame without needing to open the raid management frame.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowTrainAllButton" , "Show train all button" , 340, -192, true, "If checked, a button will be added to the skill trainer frame which will allow you to train all available skills instantly.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowBorders" , "Show borders" , 340, -212, true, "If checked, you will be able to show customisable borders around the edges of the screen.|n|nThe borders are placed on top of the game world but under the UI so you can place UI elements over them.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowPlayerChain" , "Show player chain" , 340, -232, true, "If checked, you will be able to show a rare, elite or rare elite chain around the player frame.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowReadyTimer" , "Show ready timer" , 340, -252, true, "If checked, a timer will be shown under the dungeon ready frame and the PvP encounter ready frame so that you know how long you have left to click the enter button.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowWowheadLinks" , "Show Wowhead links" , 340, -272, true, "If checked, Wowhead links will be shown in the world map frame and the achievements frame.")
|
|
|
|
LeaPlusLC:CfgBtn("ModMinimapBtn", LeaPlusCB["MinimapModder"])
|
|
LeaPlusLC:CfgBtn("MoveTooltipButton", LeaPlusCB["TipModEnable"])
|
|
LeaPlusLC:CfgBtn("EnhanceDressupBtn", LeaPlusCB["EnhanceDressup"])
|
|
LeaPlusLC:CfgBtn("CooldownsButton", LeaPlusCB["ShowCooldowns"])
|
|
LeaPlusLC:CfgBtn("ModBordersBtn", LeaPlusCB["ShowBorders"])
|
|
LeaPlusLC:CfgBtn("ModPlayerChain", LeaPlusCB["ShowPlayerChain"])
|
|
LeaPlusLC:CfgBtn("ShowWowheadLinksBtn", LeaPlusCB["ShowWowheadLinks"])
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC6: Frames
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page6"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Features" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ManageWidgetTop" , "Manage widget top" , 146, -92, true, "If checked, you will be able to change the position and scale of the widget top frame.|n|nThe widget top frame is commonly used for showing PvP scores and tracking objectives.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ManageControl" , "Manage control" , 146, -112, true, "If checked, you will be able to change the position and scale of the loss of control frame.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ClassColFrames" , "Class colored frames" , 146, -132, true, "If checked, class coloring will be used in the player frame, target frame and focus frame.")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Visibility" , 340, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoAlerts" , "Hide alerts" , 340, -92, true, "If checked, alert frames will not be shown.|n|nAlert frames are toast frames used for things like achievement earned, loot won, new recipe learned, new mount collected, etc.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideBodyguard" , "Hide bodyguard gossip" , 340, -112, true, "If checked, the gossip window will not be shown when you talk to an active garrison bodyguard.|n|nYou can hold the shift key down when you talk to a bodyguard to override this setting.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideTalkingFrame" , "Hide talking frame" , 340, -132, true, "If checked, the talking frame will not be shown.|n|nThe talking frame normally appears in the lower portion of the screen when certain NPCs communicate with you.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideCleanupBtns" , "Hide clean-up buttons" , 340, -152, true, "If checked, the backpack clean-up button and the bank frame clean-up button will not be shown.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideBossBanner" , "Hide boss banner" , 340, -172, true, "If checked, the boss banner will not be shown.|n|nThe boss banner appears when a boss is defeated. It shows the name of the boss and the loot that was distributed.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "HideEventToasts" , "Hide event toasts" , 340, -192, true, "If checked, event toasts will not be shown.|n|nEvent toasts are used for encounter objectives, level-ups, pet battle rewards, etc.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoClassBar" , "Hide stance bar" , 340, -212, true, "If checked, the stance bar will not be shown.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoCommandBar" , "Hide order hall bar" , 340, -232, true, "If checked, the order hall command bar will not be shown.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoRestedSleep" , "Hide rested sleep" , 340, -252, true, "If checked, the player frame rested sleep animation will not be shown.")
|
|
|
|
LeaPlusLC:CfgBtn("ManageWidgetTopButton", LeaPlusCB["ManageWidgetTop"])
|
|
LeaPlusLC:CfgBtn("ManageControlButton", LeaPlusCB["ManageControl"])
|
|
LeaPlusLC:CfgBtn("ClassColFramesBtn", LeaPlusCB["ClassColFrames"])
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC7: System
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page7"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Graphics and Sound" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoScreenGlow" , "Disable screen glow" , 146, -92, false, "If checked, the screen glow will be disabled.|n|nEnabling this option will also disable the drunken haze effect.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoScreenEffects" , "Disable screen effects" , 146, -112, false, "If checked, the grey screen of death, the netherworld effect and the Cloak of Ven'ari effect will be disabled.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "SetWeatherDensity" , "Set weather density" , 146, -132, false, "If checked, you will be able to set the density of weather effects.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MaxCameraZoom" , "Max camera zoom" , 146, -152, false, "If checked, you will be able to zoom out to a greater distance.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoRestedEmotes" , "Silence rested emotes" , 146, -172, true, "If checked, emote sounds will be silenced while your character is:|n|n- resting|n- in a pet battle|n- at the Halfhill Market|n- at the Grim Guzzler|n|nEmote sounds will be enabled when none of the above apply.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "KeepAudioSynced" , "Keep audio synced" , 146, -192, true, "If checked, when you change the audio output device in your operating system, the game audio output device will change automatically as long as a cinematic is not playing at the time.|n|nFor this to work, the game audio output device will be set to system default.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MuteGameSounds" , "Mute game sounds" , 146, -212, false, "If checked, you will be able to mute a selection of game sounds.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MuteMountSounds" , "Mute mount sounds" , 146, -232, false, "If checked, you will be able to mute a selection of mount sounds.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "MuteCustomSounds" , "Mute custom sounds" , 146, -252, false, "If checked, you will be able to mute your own choice of sounds.")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Game Options" , 340, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoBagAutomation" , "Disable bag automation" , 340, -92, true, "If checked, your bags will not be opened or closed automatically when you interact with a merchant or bank.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoPetAutomation" , "Disable pet automation" , 340, -112, true, "If checked, battle pets which are automatically summoned will be dismissed within a few seconds.|n|nThis includes dragging a pet onto the first team slot in the pet journal and entering a battle pet team save command.|n|nNote that pets which are automatically summoned during combat will be dismissed when combat ends.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoRaidRestrictions" , "Remove raid restrictions" , 340, -132, false, "If checked, converting a party group to a raid group will succeed even if there are low level characters in the group.|n|nEveryone in the group needs to have Leatrix Plus installed with this option enabled.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoConfirmLoot" , "Disable loot warnings" , 340, -152, false, "If checked, confirmations will no longer appear when you choose a loot roll option or attempt to sell or mail a tradable item.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "FasterLooting" , "Faster auto loot" , 340, -172, true, "If checked, the amount of time it takes to auto loot creatures will be significantly reduced.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "FasterMovieSkip" , "Faster movie skip" , 340, -192, true, "If checked, you will be able to cancel movies without being prompted for confirmation.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "CombatPlates" , "Combat plates" , 340, -212, true, "If checked, enemy nameplates will be shown during combat and hidden when combat ends.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "EasyItemDestroy" , "Easy item destroy" , 340, -232, true, "If checked, you will no longer need to type delete when destroying a superior quality item.|n|nIn addition, item links will be shown in all item destroy confirmation windows.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "NoTransforms" , "Remove transforms" , 340, -252, false, "If checked, you will be able to have certain transforms removed automatically when they are applied to your character.|n|nYou can choose the transforms in the configuration panel.|n|nExamples include Weighted Jack-o'-Lantern and Hallowed Wand.|n|nTransforms applied during combat will be removed when combat ends.")
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "SetAddtonOptions" , "Set additional options" , 340, -272, true, "If checked, you will be able to set some additional options.")
|
|
|
|
LeaPlusLC:CfgBtn("SetWeatherDensityBtn", LeaPlusCB["SetWeatherDensity"])
|
|
LeaPlusLC:CfgBtn("MuteGameSoundsBtn", LeaPlusCB["MuteGameSounds"])
|
|
LeaPlusLC:CfgBtn("MuteMountSoundsBtn", LeaPlusCB["MuteMountSounds"])
|
|
LeaPlusLC:CfgBtn("MuteCustomSoundsBtn", LeaPlusCB["MuteCustomSounds"])
|
|
LeaPlusLC:CfgBtn("FasterLootingBtn", LeaPlusCB["FasterLooting"])
|
|
LeaPlusLC:CfgBtn("NoTransformsBtn", LeaPlusCB["NoTransforms"])
|
|
LeaPlusLC:CfgBtn("SetAddtonOptionsBtn", LeaPlusCB["SetAddtonOptions"])
|
|
|
|
----------------------------------------------------------------------
|
|
-- LC8: Settings
|
|
----------------------------------------------------------------------
|
|
|
|
pg = "Page8"
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Addon" , 146, -72)
|
|
LeaPlusLC:MakeCB(LeaPlusLC[pg], "ShowMinimapIcon" , "Show minimap button" , 146, -92, false, "If checked, a minimap button will be available.|n|nClick - Toggle options panel.|n|nSHIFT-click - Toggle music.|n|nCTRL-click - Toggle minimap target tracking.|n|nALT-click - Toggle errors (if enabled).|n|nCTRL/SHIFT-click - Toggle windowed mode.|n|nCTRL/ALT-click - Toggle Zygor (if installed).")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Scale", 340, -72)
|
|
LeaPlusLC:MakeSL(LeaPlusLC[pg], "PlusPanelScale", "Drag to set the scale of the Leatrix Plus panel.", 1, 2, 0.1, 340, -92, "%.1f")
|
|
|
|
LeaPlusLC:MakeTx(LeaPlusLC[pg], "Transparency", 340, -132)
|
|
LeaPlusLC:MakeSL(LeaPlusLC[pg], "PlusPanelAlpha", "Drag to set the transparency of the Leatrix Plus panel.", 0, 1, 0.1, 340, -152, "%.1f")
|
|
|