Advertisement
Guest User

Luni's Scripts

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