Advertisement
Luunii

Untitled

Aug 5th, 2022
1,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.43 KB | None | 0 0
  1. -- Arena Frame Mods
  2. LoadAddOn("Blizzard_ArenaUI")
  3. ArenaPrepFrames:SetAlpha(0)
  4. ArenaEnemyFrames:SetAlpha(0)
  5.  
  6. -- Framerate
  7. ToggleFramerate()
  8. FramerateText:ClearAllPoints()
  9. FramerateText:SetPoint("BottomLeft")
  10.  
  11. -- Portrait Text Hides
  12. PlayerHitIndicator:SetText(nil)
  13. PlayerHitIndicator.SetText = function() end
  14.  
  15. PetHitIndicator:SetText(nil)
  16. PetHitIndicator.SetText = function() end
  17.  
  18. -- Hide Player Combo Point Frame
  19. -- (For Combo Point Location 1 + Easy Frames)
  20. ComboPointPlayerFrame.Show=function() return end
  21.  
  22. -- Hide Blizzard Art Bar
  23.     for i,v in pairs({
  24.         FramerateLabel,
  25.         StanceBarLeft,
  26.         StanceBarMiddle,
  27.         StanceBarRight,
  28.         SlidingActionBarTexture0,
  29.         SlidingActionBarTexture1,
  30.         MainMenuBarArtFrameBackground,
  31.         MicroButtonAndBagsBar.MicroBagBar,
  32.         MainMenuBarArtFrame.LeftEndCap,
  33.         MainMenuBarArtFrame.RightEndCap,
  34.     }) do
  35.         v:SetAlpha(0)
  36.     end
  37.  
  38. -- Darken Textures
  39.     for i,v in pairs({
  40.         MirrorTimer1Border,
  41.         MirrorTimer2Border,
  42.         MirrorTimer3Border,
  43.     TargetFrameTextureFrameTexture,
  44.     FocusFrameTextureFrameTexture,
  45.         StatusTrackingBarManager.SingleBarLarge,
  46.         StatusTrackingBarManager.SingleBarLargeUpper,
  47.         StatusTrackingBarManager.SingleBarSmall,
  48.         StatusTrackingBarManager.SingleBarSmallUpper,
  49.     }) do
  50.         v:SetVertexColor(.05, .05, .05)
  51.     v.SetVertexColor = function() return end
  52.     end
  53.  
  54. -- MacroName + HotKey Hide
  55. local r={"Action", "MultiBarBottomLeft",
  56. "MultiBarBottomRight", "MultiBarRight", "MultiBarLeft"}
  57. for b=1,#r do
  58.         for i=1,12 do
  59.                 _G[r[b].."Button"..i.."Name"]:SetAlpha(0)
  60.                 _G[r[b].."Button"..i.."HotKey"]:SetAlpha(0)
  61.         end
  62. end
  63.  
  64.         for i=1,10 do
  65.                 _G["PetAction".."Button"..i.."HotKey"]:SetAlpha(0)
  66.         end
  67.  
  68. -- Casting Bar
  69. SBF={CastingBarFrame,TargetFrameSpellBar,FocusFrameSpellBar}
  70. for i,v in pairs(SBF) do
  71.  v.Border:Hide()
  72.  v.Text:ClearAllPoints()
  73.  v.Text:SetPoint("Left",v)
  74.  v.Text:SetFont(STANDARD_TEXT_FONT,10,"OUTLINE")
  75.  v:SetSize(208,21)
  76.  v.Icon:Show()
  77.  v.Icon:SetSize(25,25)
  78.  v.Icon:SetPoint("RIGHT",v,30,0)
  79.  v:HookScript("OnShow",function (self)
  80.   if self.BorderShield then
  81.    self.BorderShield:SetSize(273,65)
  82.    self.BorderShield:ClearAllPoints()
  83.    self.BorderShield:SetPoint("CENTER",self,5,0)
  84.   end
  85.  end)
  86.  v.Flash.Show=function() return end
  87.  v.timer=v:CreateFontString(nil)
  88.  v.timer:SetFont(STANDARD_TEXT_FONT,10,"OUTLINE")
  89.  v.timer:SetPoint("Right", v)
  90.  v:HookScript("OnUpdate",function(self)
  91.   self.timer:SetText(format("%.1f/%.1f", max(self.value, 0), self.maxValue))
  92.  end)
  93. end
  94. CBF={CastingBarFrame}
  95. for i,v in pairs(CBF) do
  96.   v:SetSize(230,28)
  97.   v.Icon:SetSize(33,33)
  98.   v.Icon:SetPoint("RIGHT",v,40,0)
  99.   v.Text:SetPoint("Left",v)
  100.   v.Text:SetFont(STANDARD_TEXT_FONT,12,"OUTLINE")
  101.   v.timer:SetFont(STANDARD_TEXT_FONT,12,"OUTLINE")
  102. end
  103. TFSB={TargetFrameSpellBar,FocusFrameSpellBar}
  104. for i,v in pairs(TFSB) do
  105.  v:HookScript("OnShow",function (self)
  106.  Target_Spellbar_AdjustPosition(self)
  107.  end)
  108. end
  109. function Target_Spellbar_AdjustPosition(self)
  110.     local parentFrame = self:GetParent();
  111.     if ( self.boss ) then
  112.         self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 5, 10 );
  113.     elseif ( parentFrame.haveToT ) then
  114.         if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
  115.             self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 5, -21 );
  116.         else
  117.             self:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 0, -15);
  118.         end
  119.     elseif ( parentFrame.haveElite ) then
  120.         if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
  121.             self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 5, -5 );
  122.         else
  123.             self:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 0, -15);
  124.         end
  125.     else
  126.         if ( (not parentFrame.buffsOnTop) and parentFrame.auraRows > 0 ) then
  127.             self:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 0, -15);
  128.         else
  129.             self:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 5, 7 );
  130.         end
  131.     end
  132. end
  133.  
  134. -- Range Indicator
  135. hooksecurefunc("ActionButton_OnEvent",function(self, event, ...)
  136. if ( event == "PLAYER_TARGET_CHANGED" ) then
  137. self.newTimer = self.rangeTimer
  138. end
  139. end)
  140. hooksecurefunc("ActionButton_UpdateUsable",function(self)
  141. local icon = _G[self:GetName().."Icon"]
  142. local valid = IsActionInRange(self.action)
  143. if ( valid == false ) then
  144. icon:SetVertexColor(1, 0, 0)
  145. end
  146. end)
  147. hooksecurefunc("ActionButton_OnUpdate",function(self, elapsed)
  148. local rangeTimer = self.newTimer
  149. if ( rangeTimer ) then
  150. rangeTimer = rangeTimer - elapsed
  151. if ( rangeTimer <= 0 ) then
  152. ActionButton_UpdateUsable(self)
  153. rangeTimer = TOOLTIP_UPDATE_TIME
  154. end
  155. self.newTimer = rangeTimer
  156. end
  157. end)
  158.  
  159. -- Frame Class Colors
  160. local function check(self)
  161.  local unit = self.unit
  162.  if not (unit == "target" or unit == "focus") then return end
  163.  
  164.   if UnitIsPlayer(unit) then
  165.   local _, class = UnitClass(unit)
  166.   local c = RAID_CLASS_COLORS[class]
  167.   _G[(unit=="target" and "Target" or "Focus").."FrameNameBackground"]:SetVertexColor(c.r, c.g, c.b)
  168.  end
  169. end
  170.  
  171. hooksecurefunc("TargetFrame_CheckFaction", check)
  172. hooksecurefunc("TargetFrame_CheckClassification", check)
  173.  
  174. TargetFrameNameBackground:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
  175. FocusFrameNameBackground:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
  176.  
  177. -- Spellsteal Border
  178. hooksecurefunc("TargetFrame_UpdateAuras", function(s)
  179.         for i = 1, MAX_TARGET_BUFFS do
  180.                 _, _, ic, _, dT = UnitBuff(s.unit, i)
  181.                 if(ic and (not s.maxBuffs or i<=s.maxBuffs)) then
  182.                         fS=_G[s:GetName()..'Buff'..i..'Stealable']
  183.                         if(UnitIsEnemy(PlayerFrame.unit, s.unit) and dT=='Magic') then
  184.                                 fS:Show()
  185.                         else
  186.                                 fS:Hide()
  187.                         end
  188.                 end
  189.         end
  190. end)
  191.  
  192. -- Health Bar Text
  193. local FrameList = {"Player", "Target", "Focus"}
  194. local function UpdateHealthValues(statusFrame, textString, value, valueMin, valueMax)
  195.     for _, unit in pairs(FrameList) do
  196.         if unit.."FrameHealthBar" == statusFrame:GetName() then
  197.             textString:SetText((textString:GetText() or "")..format(" (%.0f%%)", value/valueMax*100))
  198.         end
  199.     end
  200. end
  201. hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", UpdateHealthValues)
  202.  
  203. -- Combat Indicator
  204. CTT=CreateFrame("Frame")
  205. CTT:SetParent(TargetFrame)
  206. CTT:SetPoint("Bottom",TargetFrame,40,24)
  207. CTT:SetSize(18,18)
  208. CTT.t=CTT:CreateTexture(nil,BORDER)
  209. CTT.t:SetAllPoints()
  210. CTT.t:SetTexture("Interface\\Icons\\ABILITY_DUALWIELD")
  211. CTT:Hide()
  212.  
  213. local function FrameOnUpdate(self) if UnitAffectingCombat("target") then self:Show() else self:Hide() end end
  214. local g = CreateFrame("Frame")
  215. g:SetScript("OnUpdate", function(self) FrameOnUpdate(CTT) end)
  216.  
  217. CFT=CreateFrame("Frame")
  218. CFT:SetParent(FocusFrame)
  219. CFT:SetPoint("Bottom",FocusFrame,40,24)
  220. CFT:SetSize(18,18)
  221. CFT.t=CFT:CreateTexture(nil,BORDER)
  222. CFT.t:SetAllPoints()
  223. CFT.t:SetTexture("Interface\\Icons\\ABILITY_DUALWIELD")
  224. CFT:Hide()
  225.  
  226. local function FrameOnUpdate(self) if UnitAffectingCombat("focus") then self:Show() else self:Hide() end end
  227. local g = CreateFrame("Frame")
  228. g:SetScript("OnUpdate", function(self) FrameOnUpdate(CFT) end)
  229.  
  230. -- Autosell and Repair
  231. local g = CreateFrame("Frame")
  232. g:RegisterEvent("MERCHANT_SHOW")
  233.  
  234. g:SetScript("OnEvent", function()  
  235.     local bag, slot
  236.     for bag = 0, 4 do
  237.         for slot = 0, GetContainerNumSlots(bag) do
  238.             local link = GetContainerItemLink(bag, slot)
  239.             if link and (select(3, GetItemInfo(link)) == 0) then
  240.                 UseContainerItem(bag, slot)
  241.             end
  242.         end
  243.     end
  244.  
  245.     if(CanMerchantRepair()) then
  246.         local cost = GetRepairAllCost()
  247.         if cost > 0 then
  248.             local money = GetMoney()
  249.             if IsInGuild() then
  250.                 local guildMoney = GetGuildBankWithdrawMoney()
  251.                 if guildMoney > GetGuildBankMoney() then
  252.                     guildMoney = GetGuildBankMoney()
  253.                 end
  254.                 if guildMoney > cost and CanGuildBankRepair() then
  255.                     RepairAllItems(1)
  256.                     print(format("|cfff07100Repair cost covered by G-Bank: %.1fg|r", cost * 0.0001))
  257.                     return
  258.                 end
  259.             end
  260.             if money > cost then
  261.                 RepairAllItems()
  262.                 print(format("|cffead000Repair cost: %.1fg|r", cost * 0.0001))
  263.             else
  264.                 print("Not enough gold to cover the repair cost.")
  265.             end
  266.         end
  267.     end
  268. end)
  269.  
  270. -- Raid Profiles Auto-Activate
  271. local ARENA_PROFILE = "Primary";
  272. local BG_PROFILE = "Secondary";
  273. local PARTY_PROFILE = "Primary"
  274. local RAID_25_PROFILE = "Tertiary";
  275. local RAID_40_PROFILE = "Quaternary";
  276.  
  277. function switchProfile()
  278.     if InCombatLockdown() == false then --This should fix in-combat issues.
  279.         isArena, _ = IsActiveBattlefieldArena();
  280.         if isArena == true then --**IN ARENA**.
  281.             if GetActiveRaidProfile() ~= ARENA_PROFILE then --if arena profile is not active
  282.                 CompactUnitFrameProfiles_ActivateRaidProfile(ARENA_PROFILE); --...set arena profile.
  283.                 print("Activated RaidProfile: "..ARENA_PROFILE)
  284.             end
  285.         elseif InActiveBattlefield() then --**IN BG**.
  286.             if GetActiveRaidProfile() ~= BG_PROFILE then --if battleground profile is not active
  287.                 CompactUnitFrameProfiles_ActivateRaidProfile(BG_PROFILE); --...set battleground profile.
  288.                 print("Activated RaidProfile: "..BG_PROFILE)
  289.             end
  290.         elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 0 then --**IN INSTANCE GROUP**
  291.             if GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 25 then
  292.                 if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
  293.                     CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
  294.                     print("Activated RaidProfile: "..RAID_40_PROFILE)
  295.                 end
  296.             elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 5 then
  297.                 if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if Raid25 profile is not active
  298.                     CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set raid25 profile.
  299.                     print("Activated RaidProfile: "..RAID_25_PROFILE)
  300.                 end
  301.             else
  302.                 if GetActiveRaidProfile() ~= PARTY_PROFILE then --if Party profile is not active
  303.                     CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set Party profile.
  304.                     print("Activated RaidProfile: "..PARTY_PROFILE)
  305.                 end
  306.             end
  307.         elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 0 then --**IN MANUAL GROUP**
  308.             if GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 25 then
  309.                 if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
  310.                     CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
  311.                     print("Activated RaidProfile: "..RAID_40_PROFILE)
  312.                 end
  313.             elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 5 then
  314.                 if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if Raid25 profile is not active
  315.                     CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set raid25 profile.
  316.                     print("Activated RaidProfile: "..RAID_25_PROFILE)
  317.                 end
  318.             else
  319.                 if GetActiveRaidProfile() ~= PARTY_PROFILE then --if Party profile is not active
  320.                     CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set Party profile.
  321.                     print("Activated RaidProfile: "..PARTY_PROFILE)
  322.                 end
  323.             end
  324.         end
  325.     end
  326. end
  327.  
  328. local f = CreateFrame("Frame")
  329. f:RegisterEvent("GROUP_ROSTER_UPDATE") --fires when player joins or leaves group
  330. f:RegisterEvent("PLAYER_REGEN_ENABLED") --fires when leaving combat
  331. f:SetScript("OnEvent",switchProfile);
  332.  
  333. -- Snowfall KeyPress Visial
  334. local animationsCount, animations = 5, {}
  335. local animationNum = 1
  336. local frame, texture, alpha1, scale1, scale2, rotation2
  337. for i = 1, animationsCount do
  338.     frame = CreateFrame("Frame")
  339.     texture = frame:CreateTexture() texture:SetTexture('Interface\\Cooldown\\star4') texture:SetAlpha(0) texture:SetAllPoints() texture:SetBlendMode("ADD")
  340.     animationGroup = texture:CreateAnimationGroup()
  341.     alpha1 = animationGroup:CreateAnimation("Alpha") alpha1:SetFromAlpha(0) alpha1:SetToAlpha(1) alpha1:SetDuration(0) alpha1:SetOrder(1)
  342.     scale1 = animationGroup:CreateAnimation("Scale") scale1:SetScale(1.0, 1.0) scale1:SetDuration(0) scale1:SetOrder(1)
  343.     scale2 = animationGroup:CreateAnimation("Scale") scale2:SetScale(1.5, 1.5) scale2:SetDuration(0.3) scale2:SetOrder(2)
  344.     rotation2 = animationGroup:CreateAnimation("Rotation") rotation2:SetDegrees(90) rotation2:SetDuration(0.3) rotation2:SetOrder(2)
  345.     animations[i] = {frame = frame, animationGroup = animationGroup}
  346. end
  347. local AnimateButton = function(self)
  348.     if not self:IsVisible() then return true end
  349.     local animation = animations[animationNum]
  350.     local frame = animation.frame
  351.     local animationGroup = animation.animationGroup
  352.     frame:SetFrameStrata("HIGH")
  353.     frame:SetFrameLevel(20)
  354.     frame:SetAllPoints(self)
  355.     animationGroup:Stop()
  356.     animationGroup:Play()
  357.     animationNum = (animationNum % animationsCount) + 1
  358.     return true
  359. end
  360.  
  361. hooksecurefunc('MultiActionButtonDown', function(bname, id)
  362.      AnimateButton(_G[bname..'Button'..id])
  363. end)
  364.  
  365. hooksecurefunc('PetActionButtonDown', function(id)
  366.      local button
  367.          if PetActionBarFrame then
  368.              if id > NUM_PET_ACTION_SLOTS then return end
  369.              button = _G["PetActionButton"..id]
  370.              if not button then return end
  371.          end
  372.          return
  373.      AnimateButton(button)
  374. end)
  375.  
  376. hooksecurefunc('ActionButtonDown', function(id)
  377.      local button
  378.      if C_PetBattles.IsInBattle() then
  379.          if PetBattleFrame then
  380.              if id > NUM_BATTLE_PET_HOTKEYS then return end
  381.              button = PetBattleFrame.BottomFrame.abilityButtons[id]
  382.              if id == BATTLE_PET_ABILITY_SWITCH then
  383.                     button = PetBattleFrame.BottomFrame.SwitchPetButton
  384.              elseif id == BATTLE_PET_ABILITY_CATCH then
  385.                     button = PetBattleFrame.BottomFrame.CatchButton
  386.              end
  387.              if not button then return end
  388.          end
  389.          return
  390.      end
  391.      if OverrideActionBar and OverrideActionBar:IsShown() then
  392.          if id > NUM_OVERRIDE_BUTTONS then return end
  393.          button = _G["OverrideActionBarButton"..id]
  394.      else
  395.          button = _G["ActionButton"..id]
  396.      end
  397.      if not button then return end
  398.      AnimateButton(button)
  399. end)
  400.  
  401. -- Old AlternateManaBar Trigger
  402. local _, class = UnitClass("player")
  403. if class == "DRUID" then
  404. ADDITIONAL_POWER_BAR_NAME = "MANA";
  405. ADDITIONAL_POWER_BAR_INDEX = 0;
  406.  
  407. function AlternatePowerBar_OnLoad(self)
  408.     self.textLockable = 1;
  409.     self.cvar = "playerStatusText";
  410.     self.cvarLabel = "STATUS_TEXT_PLAYER";
  411.     AlternatePowerBar_Initialize(self);
  412.     TextStatusBar_Initialize(self);
  413. end
  414.  
  415. function AlternatePowerBar_Initialize(self)
  416.     if ( not self.powerName ) then
  417.         self.powerName = ADDITIONAL_POWER_BAR_NAME;
  418.         self.powerIndex = ADDITIONAL_POWER_BAR_INDEX;
  419.     end
  420.    
  421.     self:RegisterEvent("UNIT_POWER");
  422.     self:RegisterEvent("UNIT_MAXPOWER");
  423.     self:RegisterEvent("PLAYER_ENTERING_WORLD");
  424.     self:RegisterEvent("UNIT_DISPLAYPOWER");
  425.    
  426.     SetTextStatusBarText(self, _G[self:GetName().."Text"])
  427.    
  428.     local info = PowerBarColor[self.powerName];
  429.     self:SetStatusBarColor(info.r, info.g, info.b);
  430. end
  431.  
  432. function AlternatePowerBar_OnEvent(self, event, arg1)
  433.     local parent = self:GetParent();
  434.     if ( event == "UNIT_DISPLAYPOWER" ) then
  435.         AlternatePowerBar_UpdatePowerType(self);
  436.     elseif ( event=="PLAYER_ENTERING_WORLD" ) then
  437.         AlternatePowerBar_UpdateMaxValues(self);
  438.         AlternatePowerBar_UpdateValue(self);
  439.         AlternatePowerBar_UpdatePowerType(self);
  440.     elseif( (event == "UNIT_MAXPOWER") and (arg1 == parent.unit) ) then
  441.         AlternatePowerBar_UpdateMaxValues(self);
  442.     elseif ( self:IsShown() ) then
  443.         if ( (event == "UNIT_POWER") and (arg1 == parent.unit) ) then
  444.             AlternatePowerBar_UpdateValue(self);
  445.         end
  446.     end
  447. end
  448.  
  449. function AlternatePowerBar_OnUpdate(self, elapsed)
  450.     AlternatePowerBar_UpdateValue(self);
  451. end
  452.  
  453. function AlternatePowerBar_UpdateValue(self)
  454.     local currmana = UnitPower(self:GetParent().unit,self.powerIndex);
  455.     self:SetValue(currmana);
  456.     self.value = currmana
  457. end
  458.  
  459. function AlternatePowerBar_UpdateMaxValues(self)
  460.     local maxmana = UnitPowerMax(self:GetParent().unit,self.powerIndex);
  461.     self:SetMinMaxValues(0,maxmana);
  462. end
  463.  
  464. function AlternatePowerBar_UpdatePowerType(self)
  465.     if ( (UnitPowerType(self:GetParent().unit) ~= self.powerIndex) and (UnitPowerMax(self:GetParent().unit,self.powerIndex) ~= 0) ) then
  466.         self.pauseUpdates = false;
  467.         self:Show();
  468.     else
  469.         self.pauseUpdates = true;
  470.         self:Hide();
  471.     end
  472. end
  473. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement