Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- UiMisc.lua
- -------------------------------------------------------------------------------
- -------------------------------------------------------------------------------
- -- Locals
- --
- -- UIErrorsOn Flag to keep track of errors on or off.
- -- UiMisc_Hidden If true then errors are hidden.
- -- UiMisc_InCombat If true then in combat.
- -- UiMisc_Bubble Flag to prevent bubbles from getting turned on automatically.
- -- FirstTime Flag for player entering world initialization.
- -- TeamP2
- -- TeamP3
- -- teamP5 These three variables were used by /acalc. No longer used.
- -------------------------------------------------------------------------------
- local ErrorRedirect_Org_AddMessage
- local UIErrorsOn = nil
- local UiMisc_Hidden = 1
- local UiMisc_InCombat = nil
- local UiMisc_Bubble = false
- local TeamP2 = 0.76
- local TeamP3 = 0.88
- local TeamP5 = 1.0
- local FirstTime = false
- -------------------------------------------------------------------------------
- -- GLOBAL modifcation to blizzard UI here
- -------------------------------------------------------------------------------
- -- CHAT_FRAME_TAB_SELECTED_MOUSEOVER_ALPHA = 1
- CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0
- -- Opacity of the currently selected chat tab.
- -- Defaults are 1 and 0.4.
- -- CHAT_FRAME_TAB_ALERTING_MOUSEOVER_ALPHA = 1
- CHAT_FRAME_TAB_ALERTING_NOMOUSE_ALPHA = 0
- -- Opacity of currently alerting chat tabs.
- -- Defaults are 1 and 1.
- -- CHAT_FRAME_TAB_NORMAL_MOUSEOVER_ALPHA = 1
- CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0
- -- Opacity of non-selected, non-alerting chat tabs.
- -- Defaults are 0.6 and 0.2.
- -- Unsticky the current channels
- ChatTypeInfo["WHISPER"].sticky = 0
- ChatTypeInfo["CHANNEL"].sticky = 0
- ChatTypeInfo["OFFICER"].sticky = 0
- ChatTypeInfo["BN_WHISPER"].sticky = 0
- -- Removes the colored border in the chatframe edit box
- local e = ChatFrame1EditBox
- e.focusLeft.Show = e.focusLeft.Hide
- e.focusRight.Show = e.focusRight.Hide
- e.focusMid.Show = e.focusMid.Hide
- -- Removes the social button from the chat box
- FriendsMicroButton:Hide()
- -- Mature language filter - false
- BNSetMatureLanguageFilter(false)
- --[[
- local a = CreateFrame("Frame")
- local Imsg = ''
- a:SetScript ("OnEvent", function(self, event, ...)
- local aEvent = select(2, ...)
- local aUser = select(4, ...)
- local spellID = select(12, ...)
- local spellName=select (10,...)
- local destName=select (7,...)
- if (aEvent == "SPELL_INTERRUPT") or (aEvent=="SPELL_CAST_SUCCESS" and spellName=="Skull Bash") then
- if aUser==UnitName("player") and Imsg ~= '' then
- SendChatMessage(Imsg, "SAY")
- Imsg = ""
- -- SendChatMessage(GetSpellLink(spellID).." successfully interrupted "..destName, "SAY" )
- end
- end
- end)
- a:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
- local function Imsg_SlashHandler(arg1)
- Imsg = arg1
- end
- SLASH_IMSG1 = "/imsg"
- SlashCmdList["IMSG"] = Imsg_SlashHandler
- --]]
- -------------------------------------------------------------------------------
- -- Events defined here
- -------------------------------------------------------------------------------
- local UIMiscEvents = CreateFrame("Frame", nil, UIParent)
- -- UIMiscEvents:RegisterEvent("RAID_ROSTER_UPDATE")
- UIMiscEvents:RegisterEvent("PLAYER_REGEN_DISABLED") -- in combat got aggro (shapeshift bar code)
- UIMiscEvents:RegisterEvent("PLAYER_REGEN_ENABLED") -- out of combat no aggro (shapeshift bar code)
- UIMiscEvents:RegisterEvent("UPDATE_MOUSEOVER_UNIT") -- Mousing over player/mob tooltips
- UIMiscEvents:RegisterEvent("PLAYER_LOGIN") -- Load UiMiscInit_OnLoad on login
- UIMiscEvents:SetScript("OnEvent", function(self, event, ...)
- return UIMiscEvents[event](self, event, ...)
- end)
- -------------------------------------------------------------------------------
- -- Showhelp and status
- -------------------------------------------------------------------------------
- local function UiMisc_Chat(msg)
- if ( DEFAULT_CHAT_FRAME ) then
- DEFAULT_CHAT_FRAME:AddMessage(msg, 1.0, 1.0, 0.0)
- end
- end
- local function UiMisc_ShowHelp()
- UiMisc_Chat("user Interface Miscellaneous mod")
- UiMisc_Chat("/rl reloads the user interface")
- UiMisc_Chat("/uierr hide turn off error output")
- UiMisc_Chat("/uierr show turn on error output")
- UiMisc_Chat("/uishow show the shapeshift bar")
- UiMisc_Chat("/uihide hide the shapeshift bar")
- UiMisc_Chat("/uiphide hide ping name on minimap (saves)")
- UiMisc_Chat("/uipshow show ping name on minimap (saves)")
- UiMisc_Chat("/uiraid Hides the raids frames on the left side")
- UiMisc_Chat("/uiboff Turns off automatic bubble hiding when in combat")
- UiMisc_Chat("/uibon Turns on automatic bubble hiding")
- UiMisc_Chat("/calc <exp> Returns value of <exp>")
- UiMisc_Chat("/uimisc status Shows the current settings")
- end
- local function UiMisc_ShowStatus()
- local uierrstatus1, uierrstatus2, uibubblestatus
- if UIErrorsOn then
- uierrstatus1 = "ON"
- else
- uierrstatus1 = "OFF"
- end
- if UiMisc_Bubble then
- uibubblestatus = "ON"
- else
- uibubblestatus = "OFF"
- end
- UiMisc_Chat("UI MISC SETTINGS")
- UiMisc_Chat("Errors Shown (not saved): " .. uierrstatus1)
- UiMisc_Chat("Bubbles (not saved): " .. uibubblestatus)
- end
- -----------------------------------------------------------------------------------
- -- Returns up to two parameters
- -- example: a, b = UiMisc_GetCmd("parm1 parm2")
- -- a = "parm1" b = "parm2"
- -----------------------------------------------------------------------------------
- local function UiMisc_GetCmd(msg)
- if msg then
- local a,b,c=strfind(msg, "(%S+)") --contiguous string of non-space characters
- if a then
- return c, strsub(msg, b+2)
- else
- return ""
- end
- else
- return ""
- end
- end
- local function UiMisc_SlashHandler(arg1)
- local command, args = UiMisc_GetCmd(arg1)
- if (command > "") then
- command = strlower(command)
- if (command == "status") then
- UiMisc_ShowStatus()
- end
- else
- command = ""
- UiMisc_ShowHelp()
- end
- end
- -----------------------------------------------------------------------------------
- -- Raid detection code here
- -----------------------------------------------------------------------------------
- --function UIMiscEvents:RAID_ROSTER_UPDATE()
- -- if (GetNumGroupMembers() > 0) then
- -- CompactRaidFrameContainer:Hide()
- -- CompactRaidFrameManager:Hide()
- -- else
- -- CompactRaidFrameContainer:Show()
- -- CompactRaidFrameManager:Hide()
- -- end
- --end
- -----------------------------------------------------------------------------------
- -- Combat log event register remmed out DONT'T DELETE *****************************
- -----------------------------------------------------------------------------------
- -- local UIMiscBossE = CreateFrame("Frame", nil, UIParent)
- -- UIMiscBossE:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
- -- UIMiscBossE:SetScript("OnEvent", function(self, event, ...) self[event](...) end)
- -----------------------------------------------------------------------------------
- -- UI Errors system stuff goes here
- -- /uierr hide - will not display red error messages above characters head
- -- /uierr show - will allow messages in red to appear above charactrs head
- -----------------------------------------------------------------------------------
- local function UIBubbles_On()
- UiMisc_Bubble = true
- end
- local function UIBubbles_Off()
- UiMisc_Bubble = false
- end
- local function UIError_Hide()
- UIErrorsOn = nil
- end
- local function UIError_Show()
- UIErrorsOn = 1
- end
- local function UIError_Update()
- if (UIErrorsOn) then
- UIErrorsFrame:Show()
- else
- UIErrorsFrame:Hide()
- end
- end
- local function UIErrors_SlashHandler(arg1)
- local command, _ = UiMisc_GetCmd(arg1)
- if (command > "") then
- command = strlower(command)
- else
- command = ""
- end
- if (command == "hide") then
- UIError_Hide()
- end
- if (command == "show") then
- UIError_Show()
- end
- UIError_Update()
- end
- -----------------------------------------------------------------------------------
- -- Shapeshift realted stuff goes here
- -- Hides the shapeshift bar
- -- wow calls their own bar_update function
- -----------------------------------------------------------------------------------
- local function HideShapeshiftBar_Update()
- if not UiMisc_InCombat then
- if UiMisc_Hidden then
- RegisterStateDriver(StanceBarFrame, "visibility", "hide")
- else
- RegisterStateDriver(StanceBarFrame, "visibility", "show")
- end
- end
- end
- local function HideShapeshiftBar_Set()
- UiMisc_Hidden = 1
- HideShapeshiftBar_Update()
- end
- local function ShowShapeshiftBar_Set()
- UiMisc_Hidden = nil
- HideShapeshiftBar_Update()
- end
- -----------------------------------------------------------------------------------
- -- Event trigger for boss fights This uses the UIMiscBossE frame
- -- Current boss fights supported
- -- Anub'arak
- -----------------------------------------------------------------------------------
- --function UIMiscBossE:COMBAT_LOG_EVENT_UNFILTERED(...)
- -- local event, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags = select(1, ...)
- -- if event == "SPELL_CAST_START" then
- -- local spellId, spellName, spellSchool = select(8, ...)
- -- if srcName == "Anub'arak" and spellName == "Leeching Swarm" then
- -- local buffs = {
- -- 47440, -- Commanding Shout
- -- 1243, -- Power Word: Fortitude
- -- 21562, -- Prayer of Fortitude
- -- 69377 -- Runescroll of Fortitude
- -- }
- -- for i, buff in next, buffs do
- -- CancelUnitBuff("player", (GetSpellInfo(buff)))
- -- end
- -- end
- -- end
- --end
- -----------------------------------------------------------------------------------
- -- Tooltip hiding stuff here.
- -- Hiding mouse over players when in a raid during combat
- -----------------------------------------------------------------------------------
- local function GameTooltip_Hide()
- if UiMisc_InCombat then
- if (GetNumGroupMembers() > 0) then
- GameTooltip:Hide()
- end
- else
- GameTooltip:Show()
- end
- end
- function UIMiscEvents:UPDATE_MOUSEOVER_UNIT()
- GameTooltip_Hide()
- end
- local function HideGameTooltip_OnLoad()
- hooksecurefunc(GameTooltip, "SetUnit", GameTooltip_Hide)
- end
- -----------------------------------------------------------------------------------
- -- /calc returns the result of a math equation
- -----------------------------------------------------------------------------------
- local function Calc_SlashHandler(arg1)
- if (not arg1 or arg1 == "") then
- return
- end
- RunScript(string.format([[DEFAULT_CHAT_FRAME:AddMessage("calc: %s", 1.0, 1.0, 1.0)
- DEFAULT_CHAT_FRAME:AddMessage(%s, 1.0, 1.0, 1.0)]], arg1, arg1))
- end
- -------------------------------------------------------------------------------
- -- Event handlers
- -------------------------------------------------------------------------------
- function UIMiscEvents:PLAYER_REGEN_ENABLED()
- UiMisc_InCombat = nil -- player out of combat
- HideShapeshiftBar_Update()
- -- Turn off chat bubbles when out of combat
- SetCVar("ChatBubbles", "0")
- end
- function UIMiscEvents:PLAYER_REGEN_DISABLED()
- UiMisc_InCombat = 1 -- player in combat
- HideShapeshiftBar_Update()
- -- Check to see if we're in a pvp battle ground
- local InInstance, IsPvP = IsInInstance()
- -- Turn on chat bubbles if in a raid and in combat
- if (GetNumGroupMembers() > 0) and (IsPvP ~= 'pvp') and UiMisc_Bubble then
- SetCVar("ChatBubbles", "1")
- end
- end
- -----------------------------------------------------------------------------------
- -- Hide blizzard raid frame
- -----------------------------------------------------------------------------------
- local function HideRaidFrame()
- -- Hide the blizzard raid frames
- CompactRaidFrameManager:UnregisterAllEvents()
- CompactRaidFrameManager:Hide()
- CompactRaidFrameContainer:UnregisterAllEvents()
- CompactRaidFrameContainer:Hide()
- end
- -----------------------------------------------------------------------------------
- -- UiMiscInit_OnLoad() : loads stuff at startup only
- -----------------------------------------------------------------------------------
- function UIMiscEvents:PLAYER_LOGIN()
- HideRaidFrame()
- -- Hide the clock
- TimeManagerClockButton:Hide()
- -- Set camera to max distance.
- SetCVar("cameraDistanceMax",30)
- SetCVar("cameraDistanceMaxFactor","4")
- -- ChatFrame1EditBox:SetTexture(nil)
- -- Hide/show the shapeshift bar.
- HideShapeshiftBar_Update()
- -- Hide/show errors.
- UIError_Update()
- -- Hiding mouse over players when in a raid during combat
- HideGameTooltip_OnLoad()
- -- Hide the icons on each side of the menu bar.
- MainMenuBarLeftEndCap:Hide()
- MainMenuBarRightEndCap:Hide()
- -- Initialize slash commands
- SLASH_UIMISC1 = "/uimisc"
- SlashCmdList["UIMISC"] = UiMisc_SlashHandler
- SLASH_RL1 = "/rl"
- SlashCmdList["RL"] = function() ReloadUI() end
- SLASH_UIERRORS1 = "/uierr"
- SlashCmdList["UIERRORS"] = UIErrors_SlashHandler
- SLASH_UIHIDE1 = "/uihide"
- SlashCmdList["UIHIDE"] = HideShapeshiftBar_Set
- SLASH_UISHOW1 = "/uishow"
- SlashCmdList["UISHOW"] = ShowShapeshiftBar_Set
- SLASH_CALC1 = "/calc"
- SlashCmdList["CALC"] = Calc_SlashHandler
- SLASH_UIPHIDE1 = "/uiphide"
- SlashCmdList["UIPHIDE"] = UIHidePingName_Set
- SLASH_UIPSHOW1 = "/uipshow"
- SlashCmdList["UIPSHOW"] = UIShowPingName_Set
- SLASH_UIRAID1 = "/uiraid"
- SlashCmdList["UIRAID"] = HideRaidFrame
- SLASH_UIBON1 = "/uibon"
- SlashCmdList["UIBON"] = UIBubbles_On
- SLASH_UIBOFF1 = "/uiboff"
- SlashCmdList["UIBOFF"] = UIBubbles_Off
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement