Advertisement
Guest User

Luni's Scripts

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