当前位置:首页>>攻略文章>>正文
盗贼实用代码分享:技能打断喊话、宏等
2014-04-27 12:14:04 作者:百川 来源: 浏览次数:0
摘要:分享整合一些不错很实用的盗贼代码,不能用代码修改后都能使用,独乐不如众乐。
  
--[分享代码整合在一起,不能用代码修改后都能使用,独乐不如众乐]
-[默认的目标和焦点头像背景职业染色]

local frame = CreateFrame("FRAME") 
frame:RegisterEvent("GROUP_ROSTER_UPDATE") 
frame:RegisterEvent("PLAYER_TARGET_CHANGED") 
frame:RegisterEvent("PLAYER_FOCUS_CHANGED") 
frame:RegisterEvent("UNIT_FACTION") 
 
local function eventHandler(self, event, ...) 
if UnitIsPlayer("target") then 
c = RAID_CLASS_COLORS[select(2, UnitClass("target"))] 
TargetFrameNameBackground:SetVertexColor(c.r, c.g, c.b) 
end 
if UnitIsPlayer("focus") then 
c = RAID_CLASS_COLORS[select(2, UnitClass("focus"))] 
FocusFrameNameBackground:SetVertexColor(c.r, c.g, c.b) 
end 
end 
 
frame:SetScript("OnEvent", eventHandler) 
 
for _, BarTextures in pairs({TargetFrameNameBackground, FocusFrameNameBackground}) do 
BarTextures:SetTexture("Interface\\TargetingFrame\\UI-StatusBar") 
end
 
--[技能按下带闪光效果]
local bars = {"ActionButton","MultiBarBottomLeftButton","MultiBarBottomRightButton"} 
for _,bar in ipairs(bars) do 
for i = 1,12 do 
local btn = getglobal(bar..i) 
local name = getglobal(bar..i.."Name") 
local hotkey = getglobal(bar..i.."HotKey") 
local border = getglobal(bar..i.."Border") 
btn:SetPushedTexture([[Interface\Cooldown\star4]]) 
btn:GetPushedTexture():SetBlendMode("ADD") 
btn:GetPushedTexture():SetTexCoord(0.2,0.8,0.2,0.8) 
btn:GetPushedTexture():SetVertexColor(1.5,1.5,1) 
end 
end
--[隐藏玩家头像伤害治疗量]
PlayerHitIndicator:SetText(nil) 
PlayerHitIndicator.SetText = function() end
PetHitIndicator:SetText(nil) 
PetHitIndicator.SetText = function() end
--[血量多少万为单位] ---------------------------------------------------------------
local function HealthBarText(statusFrame, textString, value, valueMin, valueMax) 
if string.find(textString:GetName(), "Health") or string.find then 
if valueMax ~= 0 then 
local percent = tostring(math.ceil((value / valueMax) * 100)) 
value = HealthBarText_CapDisplayOfNumericValue(value) 
valueMax = HealthBarText_CapDisplayOfNumericValue(valueMax) 
textString:SetText(value.."") 
end 
end 
end 
hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", HealthBarText) 
 
 
function HealthBarText_CapDisplayOfNumericValue(value) 
local strLen = strlen(value); 
local retString = value; 
if ( strLen > 8 ) then 
retString = string.sub(value, 1, -9).."."..string.sub(value,-8,-8)..SECOND_NUMBER_CAP; 
elseif ( strLen > 4 ) then 
retString = string.sub(value, 1, -5).."."..string.sub(value,-4,-4)..FIRST_NUMBER_CAP; 
end 
return retString; 
end
 
 
--[焦点框架大小和移动施法条.大小]
FocusFrame:SetScale(1.1) 
FocusFrameSpellBar:SetScale(1.3)
FocusFrameSpellBar:ClearAllPoints() 
FocusFrameSpellBar:SetPoint("TOPLEFT",FocusFrame,"TOPLEFT",15,6) 
FocusFrameSpellBar.SetPoint = function() end
 
 
--聊天输入框置顶的
-- Editbox 
for i= 1,10 do 
local editbox = _G['ChatFrame'..i..'EditBox'] 
local a, b, c = select(6, editbox:GetRegions()) 
a:SetAlpha(0) 
b:SetAlpha(0) 
c:SetAlpha(0) 
editbox:ClearAllPoints() 
editbox:SetPoint('BOTTOMLEFT', _G.ChatFrame1, 'TOPLEFT', 0, 20) 
editbox:SetPoint('BOTTOMRIGHT', _G.ChatFrame1, 'TOPRIGHT', 0, 20) 
editbox:SetAltArrowKeyMode(false) 
end
 
--[隐藏玩家头像伤害治疗量]
PlayerHitIndicator:SetText(nil) 
PlayerHitIndicator.SetText = function() end
 
--[敌对,焦点,目标阵营战斗PVP图标清除]
PlayerPVPIcon:SetAlpha(0) 
TargetFrameTextureFramePVPIcon:SetAlpha(0) 
FocusFrameTextureFramePVPIcon:SetAlpha(0)
 
--[隐藏宏名称]
local r={"MultiBarBottomLeft", "MultiBarBottomRight", "Action", "MultiBarLeft", "MultiBarRight"} for b=1,#r do for i=1,12 do _G[r[b].."Button"..i.."Name"]:SetAlpha(0) end end
 
--[隐藏快捷键名称]
local r={"MultiBarBottomLeft", "MultiBarBottomRight", "Action", "MultiBarLeft", "MultiBarRight"} for b=1,#r do for i=1,12 do _G[r[b].."Button"..i.."HotKey"]:SetAlpha(0) end end
 
--[敌对,焦点,目标阵营战斗PVP图标清除]
PlayerPVPIcon:SetAlpha(0) 
TargetFrameTextureFramePVPIcon:SetAlpha(0) 
FocusFrameTextureFramePVPIcon:SetAlpha(0)
 
--[左右鹰隐藏,屏蔽红字错误]
MainMenuBarLeftEndCap:Hide() 
MainMenuBarRightEndCap:Hide() 
UIErrorsFrame:Hide()
 
--[[ 被闷棍喊话 ]] 
local SaySapped = CreateFrame("Frame") 
SaySapped:SetScript("OnEvent",function(_, _, _, eventType, _, _, _, _, _, _, destName, _, _, spellID) 
if ((eventType == "SPELL_AURA_APPLIED" or eventType == "SPELL_AURA_REFRESH") 
and (spellID == 51724 or spellID == 11297 or spellID == 2070 or spellID == 6770) 
and (destName == UnitName("player"))) 
then 
SendChatMessage(">>>有贼!<<<", "YELL") 
end 
end) 
SaySapped:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") 
 
--[框架团队变小队]------------------------
/run local f=CreateFrame("Frame") f:RegisterEvent("LOSS_OF_CONTROL_ADDED") f:RegisterEvent("LOSS_OF_CONTROL_UPDATE") f:SetScript("OnEvent",function() for b in pairs(ActionBarActionEventsFrame.frames) do 
-[目标的目标移动]--------------------------
/run local f = GetMouseFocus(); f:SetUserPlaced(true) f:SetMovable(true) f:EnableMouse(true) f:RegisterForDrag("LeftButton") f:SetScript("OnDragStart",f.StartMoving) f:SetScript("OnDragStop",f.StopMovingOrSizing) 
b.cooldown:SetLossOfControlCooldown(0,0) end end
 
--[界面缩放大小]
UIErrorsFrame:SetScale(0.8)
MainMenuBar:SetScale(0.85)
BuffFrame:SetScale(0.85)
MultiBarRight:SetScale(0.8)
MinimapCluster:SetScale(0.9)
WatchFrame:SetScale(0.9)
WorldStateAlwaysUpFrame:SetScale(0.7)
 
--[技能打断喊话]
local AfterInterrupt = CreateFrame("Frame", nil, UIParent)
AfterInterrupt:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
local function InterruptUpdate(self, event, ...)
   if event == "COMBAT_LOG_EVENT_UNFILTERED" then      
      local timestamp, eventType, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, _, spellID, spellName, _, extraskillID, extraSkillName = ...
      if eventType == "SPELL_INTERRUPT" and sourceName == UnitName("player") then
         SendChatMessage("Interrupted %t's "..GetSpellLink(extraskillID), "SAY") --这里频道喊话
      end
   end
end
AfterInterrupt:SetScript("OnEvent", InterruptUpdate)
 
--[自动修理] 
local AutoRepair = true 
local g = CreateFrame("Frame") 
g:RegisterEvent("MERCHANT_SHOW") 
g:SetScript("OnEvent", function() 
if(AutoRepair==true and CanMerchantRepair()) then 
local cost = GetRepairAllCost() 
if cost > 0 then 
local money = GetMoney() 
if IsInGuild() then 
local guildMoney = GetGuildBankWithdrawMoney() 
if guildMoney > GetGuildBankMoney() then 
guildMoney = GetGuildBankMoney() 
end 
if guildMoney > cost and CanGuildBankRepair() then 
RepairAllItems(1) 
print(format("|cfff07100-/+ %.1fg|r", cost * 0.0001)) --print(L[" 公会银行自动修理费用: "].. GetCoinTextureString(cost) )
return 
end 
end 
if money > cost then 
RepairAllItems() 
print(format("|cffead000- %.1fg|r", cost * 0.0001)) 
else 
print("Go farm newbie.") 
end 
end 
end 
end)
 
--[自动出售灰色物品] 
local f = CreateFrame("Frame") 
f:SetScript("OnEvent", function() 
local c = 0 
for b=0,4 do 
for s=1,GetContainerNumSlots(b) do 
local l = GetContainerItemLink(b, s) 
if l then 
local p = select(11, GetItemInfo(l))*select(2, GetContainerItemInfo(b, s)) 
if select(3, GetItemInfo(l))==0 and p>0 then 
UseContainerItem(b, s) 
PickupMerchantItem() 
c = c+p 
end 
end 
end 
end 
if c>0 then 
local g, s, c = math.floor(c/10000) or 0, math.floor((c%10000)/100) or 0, c%100 
DEFAULT_CHAT_FRAME:AddMessage("+".." |cffffffff"..g.."|cffffc125g|r".." |cffffffff"..s.."|cffc7c7cfs|r".." |cffffffff"..c.."|cffeda55fc|r"..".",255,255,255) 
end 
end) 
f:RegisterEvent("MERCHANT_SHOW")
 
--[低血量报警]---------------------------------------------------------------------------------------------
function RunicPercent_OnLoad()
end
frame = CreateFrame("Frame","Frame", WorldFrame)
frame:SetPoint("CENTER")
frame:SetWidth(50)
frame:SetHeight(50)
frame:Hide()
frame:SetScale(1) -- this does not effect the text size.
FrameText = frame:CreateFontString(nil,"ARTWORK");
FrameText:SetFontObject(GameFontNormal);
FrameText:SetFont(STANDARD_TEXT_FONT, 20,"outline")
FrameText:SetTextColor(0.8,0,0,1) -- change this to change color
FrameText:SetPoint("CENTER",UIParent,"CENTER",0,50)
frame:SetScript("OnEvent", function(self, event, arg1,arg2, ...) 
   if event == "UNIT_HEALTH" then
      FrameText:SetText(format("%d",UnitHealth("player")/UnitHealthMax("player")*100).."%")
   end
   local hp = UnitHealth("player") / UnitHealthMax("player")
   if hp > 0.60 then
         frame:Hide()
         else
         frame:Show()
         end
end)
frame:RegisterEvent("UNIT_HEALTH")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
RunicPercent_OnLoad()
 
--[动作条背景祛除]
MainMenuBarTexture0:Hide() 
MainMenuBarTexture1:Hide() 
MainMenuBarTexture2:Hide() 
MainMenuBarTexture3:Hide() 
MainMenuMaxLevelBar0:Hide() 
MainMenuMaxLevelBar1:Hide() 
MainMenuMaxLevelBar3:Hide() 
MainMenuMaxLevelBar2:Hide()
 
--[祛除背景和生命为K单位]
local f=function(v)if(v>=1e4) then return ('%.1fk'):format(v/1e3):gsub('%.?0+([km])$','%1') else return v end end 
hooksecurefunc("TextStatusBar_UpdateTextString",function(s) 
if not GetCVarBool("statusTextPercentage") then 
if s.TextString and s.currValue then 
s.TextString:SetText(f(s.currValue)) 
end 
end 
end) 
local frame = CreateFrame("FRAME") 
frame:RegisterEvent("PLAYER_ENTERING_WORLD") 
frame:RegisterEvent("PARTY_MEMBERS_CHANGED") 
frame:RegisterEvent("PLAYER_TARGET_CHANGED") 
frame:RegisterEvent("PLAYER_FOCUS_CHANGED") 
frame:RegisterEvent("UNIT_FACTION") 
frame:RegisterEvent("ARENA_OPPONENT_UPDATE") 
frame:RegisterEvent("PLAYER_CONTROL_GAINED") 
frame:RegisterEvent("PLAYER_CONTROL_LOST") 
frame:RegisterEvent("ADDON_LOADED"); 
local function eventHandler(self, event, arg, ...) 
if (event == "UNIT_FACTION" and arg ~= "target" and arg ~= "focus") then return end 
if UnitExists("target") then 
TargetFrameNameBackground:SetVertexColor(0.0, 0.0, 0.0, 0.5) 
end 
if UnitExists("focus") then 
FocusFrameNameBackground:SetVertexColor(0.0, 0.0, 0.0, 0.5) 
end 
end 
 
--[脱战回收内存] 
local F = CreateFrame("Frame") 
F:RegisterEvent("PLAYER_REGEN_ENABLED") 
F:SetScript("OnEvent", function() _G.collectgarbage("collect") end)
frame:SetScript("OnEvent", eventHandler)
 
--[最大视角]-------------------------------------------------------
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function()
   SetCVar("cameraDistanceMax", 50)
   SetCVar("CameraDistanceMaxFactor", 3.4)
end)
f:RegisterEvent("PLAYER_ENTERING_WORLD") 
 
--[敌对技能监视] 
InterruptBarDB = InterruptBarDB or { scale = 1.1, columns = 8, hidden = false, lock = false, }--尺寸 隐藏 解锁 
local abilities = {} 
local order 
local band = bit.band 
 
local spellids = { 
[44572] = 30, -- 深度冻结 
[2139] = 20, -- 法术反制 
[31224] = 60, -- 暗影斗篷
[6552] = 15, -- 拳击 
[1766] = 15, -- 脚踢 
[8122] = 27, -- 心灵尖啸 
[15487] = 45, -- 沉默 
[96231] = 15, -- 责难 
[8177] = 15, -- 根基图腾
[51713] = 60, -- 暗影之舞 
[47528] = 15, -- 心灵冰冻 
[19503] = 30, -- 驱散射击 
[34490] = 24, -- 沉默射击 
[116705] = 15, -- 切吼手 
[80965] = 15, -- 迎头痛击 
[19647] = 24, -- 法术封锁 
[5484] = 40, -- 恐惧嚎叫 
[57994] = 12, -- 风剪 
[107570] = 30, -- 风暴之锤
[23920] = 25, -- 法术反射
[108194] = 30, -- 窒息 
 
}
 
for spellid,time in pairs(spellids) do 
local name,_,spellicon = GetSpellInfo(spellid) 
abilities[name] = { icon = spellicon, duration = time } 
end 
 
----------------------------------------------------- 
-- Edit this table to change the order 
----------------------------------------------------- 
 
local order = { 
2139, -- 法术反制 
51713, -- 暗影之舞 
19647, -- 法术封锁 
15487, -- 沉默 
31224, -- 暗影斗篷
34490, -- 沉默射击 
 
44572, -- 深度冻结 
5484, -- 恐惧嚎叫 
8177, -- 根基图腾
8122, -- 心灵尖啸 
19503, -- 驱散射击 
 
 
57994, -- 风剪 
23920, -- 法术反射
107570, -- 风暴之锤
47528, -- 心灵冰冻 
1766, -- 脚踢 
108194, -- 窒息 
 
 
6552, -- 拳击 
96231, -- 责难 
116705, -- 切吼手 
80965, -- 迎头痛击 

 
----------------------------------------------------- 

 
for k,v in ipairs(order) do order[k] = GetSpellInfo(v) end 
 
local frame 
local bar 
 
local GetTime = GetTime 
local ipairs = ipairs 
local pairs = pairs 
local select = select 
local floor = floor 
local band = bit.band 
local GetSpellInfo = GetSpellInfo 
 
local GROUP_UNITS = bit.bor(0x00000010, 0x00000400) 
 
local activetimers = {} 
 
local size = 0 
local function getsize() 
size = 0 
for k in pairs(activetimers) do 
size = size + 1 
end 
end 
 
local function InterruptBar_AddIcons() 
local x = -45 
local y = 0 
local r = 0 
for _,ability in ipairs(order) do 
local btn = CreateFrame("Frame",nil,bar) 
btn:SetWidth(30) 
btn:SetHeight(30) 
if x < (InterruptBarDB.columns * 30 - 45) then 
btn:SetPoint("CENTER",bar,"CENTER",x,y) 
else 
x = x-(InterruptBarDB.columns * 30) 
y = y-30 
btn:SetPoint("Center",bar,"Center",x,y) 
 
end 
btn:SetFrameStrata("LOW") 
 
local cd = CreateFrame("Cooldown",nil,btn) 
cd.noomnicc = true 
cd.noCooldownCount = true 
cd:SetAllPoints(true) 
cd:SetFrameStrata("MEDIUM") 
cd:Hide() 
 
local texture = btn:CreateTexture(nil,"BACKGROUND") 
texture:SetAllPoints(true) 
texture:SetTexture(abilities[ability].icon) 
texture:SetTexCoord(0.07,0.9,0.07,0.90) 
 
local text = cd:CreateFontString(nil,"ARTWORK") 
text:SetFont(STANDARD_TEXT_FONT,18,"OUTLINE") 
text:SetTextColor(1,1,0,1) 
text:SetPoint("LEFT",btn,"LEFT",2,0) 
 
btn.texture = texture 
btn.text = text 
btn.duration = abilities[ability].duration 
btn.cd = cd 
 
bar[ability] = btn 
 
x = x + 30 
end 
end 
 
local function InterruptBar_SavePosition() 
local point, _, relativePoint, xOfs, yOfs = bar:GetPoint() 
if not InterruptBarDB.Position then 
InterruptBarDB.Position = {} 
end 
InterruptBarDB.Position.point = point 
InterruptBarDB.Position.relativePoint = relativePoint 
InterruptBarDB.Position.xOfs = xOfs 
InterruptBarDB.Position.yOfs = yOfs 
end 
 
local function InterruptBar_LoadPosition() 
if InterruptBarDB.Position then 
bar:SetPoint(InterruptBarDB.Position.point,UIParent,InterruptBarDB.Position.relativePoint,InterruptBarDB.Position.xOfs,InterruptBarDB.Position.yOfs) 
else 
bar:SetPoint("BOTTOM", CastingBarFrame, "TOP", 0, 100) 
end 
end 
 
local function InterruptBar_UpdateBar() 
bar:SetScale(InterruptBarDB.scale) 
if InterruptBarDB.hidden then 
for _,v in ipairs(order) do bar[v]:Hide() end 
else 
for _,v in ipairs(order) do bar[v]:Show() end 
end 
if InterruptBarDB.lock then 
bar:EnableMouse(false) 
else 
bar:EnableMouse(true) 
end 
end 
 
local function InterruptBar_CreateBar() 
bar = CreateFrame("Frame", nil, UIParent) 
bar:SetMovable(true) 
bar:SetWidth(120) 
bar:SetHeight(30) 
bar:SetClampedToScreen(true) 
bar:SetScript("OnMouseDown",function(self,button) if button == "LeftButton" then self:StartMoving() end end) 
bar:SetScript("OnMouseUp",function(self,button) if button == "LeftButton" then self:StopMovingOrSizing() InterruptBar_SavePosition() end end) 
bar:Show() 
 
InterruptBar_AddIcons() 
InterruptBar_UpdateBar() 
InterruptBar_LoadPosition() 
end 
 
local function InterruptBar_UpdateText(text,cooldown) 
if cooldown < 10 then 
if cooldown <= 0.5 then 
text:SetText("") 
else 
text:SetFormattedText(" %d",cooldown) 
end 
else 
text:SetFormattedText("%d",cooldown) 
end 
if cooldown < 6 then 
text:SetTextColor(1,0,0,1) 
else 
text:SetTextColor(1,1,0,1) 
end 
if cooldown > 60 then 
text:SetFont(STANDARD_TEXT_FONT,14,"OUTLINE") 
else 
text:SetFont(STANDARD_TEXT_FONT,18,"OUTLINE") 
end 
end 
 
local function InterruptBar_StopAbility(ref,ability) 
if InterruptBarDB.hidden then ref:Hide() end 
if activetimers[ability] then activetimers[ability] = nil end 
ref.text:SetText("") 
ref.cd:Hide() 
end 
 
local time = 0 
local function InterruptBar_OnUpdate(self, elapsed) 
time = time + elapsed 
if time > 0.25 then 
getsize() 
for ability,ref in pairs(activetimers) do 
ref.cooldown = ref.start + ref.duration - GetTime() 
if ref.cooldown <= 0 then 
InterruptBar_StopAbility(ref,ability) 
else 
InterruptBar_UpdateText(ref.text,floor(ref.cooldown+0.5)) 
end 
end 
if size == 0 then frame:SetScript("OnUpdate",nil) end 
time = time - 0.25 
end 
end 
 
local function InterruptBar_StartTimer(ref,ability) 
if not ref then return end 
 
if InterruptBarDB.hidden then 
ref:Show() 
end 
if not activetimers[ability] then 
local duration 
activetimers[ability] = ref 
ref.cd:Show() 
ref.cd:SetCooldown(GetTime()-0.40,ref.duration) 
ref.start = GetTime() 
InterruptBar_UpdateText(ref.text,ref.duration) 
end 
frame:SetScript("OnUpdate",InterruptBar_OnUpdate) 
end 
 
local function InterruptBar_COMBAT_LOG_EVENT_UNFILTERED(...) 
local spellID, ability, useSecondDuration 
return function(_, eventtype, _, _, srcName, srcFlags, _, _, dstName, dstFlags, _, id) 
if (band(srcFlags, 0x00000040) == 0x00000040 and eventtype == "SPELL_CAST_SUCCESS") then 
spellID = id 
else 
return 
end 
useSecondDuration = false 
ability = GetSpellInfo(spellID) 
if abilities[ability] then 
InterruptBar_StartTimer(bar[ability],ability) 
end 
end 
end 
 
InterruptBar_COMBAT_LOG_EVENT_UNFILTERED = InterruptBar_COMBAT_LOG_EVENT_UNFILTERED() 
 
local function InterruptBar_ResetAllTimers() 
for _,ability in ipairs(order) do 
InterruptBar_StopAbility(bar[ability]) 
end 
active = 0 
end 
 
local function InterruptBar_PLAYER_ENTERING_WORLD(self) 
InterruptBar_ResetAllTimers() 
end 
 
local function InterruptBar_Reset() 
InterruptBarDB = { scale = 1, hidden = false, lock = false } 
InterruptBar_UpdateBar() 
InterruptBar_LoadPosition() 
end 
 
local function InterruptBar_Test() 
for _,ability in ipairs(order) do 
InterruptBar_StartTimer(bar[ability],ability) 
end 
end 
 
local cmdfuncs = { 
scale = function(v) InterruptBarDB.scale = v; InterruptBar_UpdateBar() end, 
hidden = function() InterruptBarDB.hidden = not InterruptBarDB.hidden; InterruptBar_UpdateBar() end, 
lock = function() InterruptBarDB.lock = not InterruptBarDB.lock; InterruptBar_UpdateBar() end, 
reset = function() InterruptBar_Reset() end, 
test = function() InterruptBar_Test() end, 
columns = function(v) InterruptBarDB.columns = v 
ChatFrame1:AddMessage("Type '/console reloadui' Or reload Wow to update the interface of InterruptBar.",0,1,0) 
end, 

 
local cmdtbl = {} 
function InterruptBar_Command(cmd) 
for k in ipairs(cmdtbl) do 
cmdtbl[k] = nil 
end 
for v in gmatch(cmd, "[^ ]+") do 
tinsert(cmdtbl, v) 
end 
local cb = cmdfuncs[cmdtbl[1]] 
if cb then 
local s = tonumber(cmdtbl[2]) 
cb(s) 
else 
ChatFrame1:AddMessage("InterruptBar Options | /ib <option>",0,1,0) 
ChatFrame1:AddMessage("-- scale <number> | value: " .. InterruptBarDB.scale,0,1,0) 
ChatFrame1:AddMessage("-- hidden (toggle) | value: " .. tostring(InterruptBarDB.hidden),0,1,0) 
ChatFrame1:AddMessage("-- lock (toggle) | value: " .. tostring(InterruptBarDB.lock),0,1,0) 
ChatFrame1:AddMessage("-- test (execute)",0,1,0) 
ChatFrame1:AddMessage("-- reset (execute)",0,1,0) 
ChatFrame1:AddMessage("-- columns <number> | value: " .. InterruptBarDB.columns,0,1,0) 
end 
end 
 
local function InterruptBar_OnLoad(self) 
self:RegisterEvent("PLAYER_ENTERING_WORLD") 
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") 
if not InterruptBarDB.scale then InterruptBarDB.scale = 1 end 
if not InterruptBarDB.columns then InterruptBarDB.columns = 4 end 
if not InterruptBarDB.hidden then InterruptBarDB.hidden = false end 
if not InterruptBarDB.lock then InterruptBarDB.lock = false end 
InterruptBar_CreateBar() 
 
SlashCmdList["InterruptBar"] = InterruptBar_Command 
SLASH_InterruptBar1 = "/ib" 
 
ChatFrame1:AddMessage("Interrupt Bar by Kollektiv. Type /ib for options.",0,1,0) 
end 
 
local eventhandler = { 
["VARIABLES_LOADED"] = function(self) InterruptBar_OnLoad(self) end, 
["PLAYER_ENTERING_WORLD"] = function(self) InterruptBar_PLAYER_ENTERING_WORLD(self) end, 
["COMBAT_LOG_EVENT_UNFILTERED"] = function(self,...) InterruptBar_COMBAT_LOG_EVENT_UNFILTERED(...) end, 

 
local function InterruptBar_OnEvent(self,event,...) 
eventhandler[event](self,...) 
end 
 
frame = CreateFrame("Frame",nil,UIParent) 
frame:SetScript("OnEvent",InterruptBar_OnEvent) 
frame:RegisterEvent("VARIABLES_LOADED")
--[命令/ib lock 锁定框架 /ib hidden 隐藏 /ib scale 大小设置]
 
--[网格界面校正]
SLASH_EA1 = "/align"
 
local f
 
SlashCmdList["EA"] = function()
   if f then
      f:Hide()
      f = nil      
   else
      f = CreateFrame('Frame', nil, UIParent) 
      f:SetAllPoints(UIParent)
      local w = GetScreenWidth() / 64
      local h = GetScreenHeight() / 36
      for i = 0, 64 do
         local t = f:CreateTexture(nil, 'BACKGROUND')
         if i == 32 then
            t:SetTexture(1, 0, 0, 0.5)
         else
            t:SetTexture(0, 0, 0, 0.5)
         end
         t:SetPoint('TOPLEFT', f, 'TOPLEFT', i * w - 1, 0)
         t:SetPoint('BOTTOMRIGHT', f, 'BOTTOMLEFT', i * w + 1, 0)
      end
      for i = 0, 36 do
         local t = f:CreateTexture(nil, 'BACKGROUND')
         if i == 18 then
            t:SetTexture(1, 0, 0, 0.5)
         else
            t:SetTexture(0, 0, 0, 0.5)
         end
         t:SetPoint('TOPLEFT', f, 'TOPLEFT', 0, -i * h + 1)
         t:SetPoint('BOTTOMRIGHT', f, 'TOPRIGHT', 0, -i * h - 1)
      end   
   end
end
--[换天赋自动换装备] -----------------------------------------
local F = CreateFrame("Frame") 
F:RegisterEvent("UNIT_SPELLCAST_STOP") 
F:SetScript("OnEvent", function(_,_,unit,_,_,_,spell) 
if unit == "player" then 
if spell == 63645 then 
EquipmentManager_EquipSet("战场军装") -- 主天赋装备名称zhu
elseif spell == 63644 then 
EquipmentManager_EquipSet("副本装备") -- 副天赋装备名称fu
end 
end 
end)
 
--[重载命令]
SlashCmdList["RELOADUI"] = function() ReloadUI() end
SLASH_RELOADUI1 = "/rl" 
 
--[错误框体位置及透明度] 
UIErrorsFrame:ClearAllPoints() 
UIErrorsFrame:SetPoint("TOP", UIParent, "TOP", 0, 0)
--[头像位置大小及施法条修改]---------------------------------------------------------------------------------------------------
 
TargetFrame:ClearAllPoints() 
TargetFrame:SetPoint("CENTER", UIParent, "CENTER",-210, 180)--目标头像位置 
 
FocusFrame:ClearAllPoints() 
FocusFrame:SetPoint("CENTER", UIParent, "CENTER", 240, 180)--焦点头像位置 
 
TargetFrameSpellBar:ClearAllPoints() 
TargetFrameSpellBar:SetPoint("BOTTOM", TargetFrame, "TOP")--目标施法条位置 
TargetFrameSpellBar.SetPoint = function() end
 
--[竞技场框体测试]
ArenaEnemyFrame1:Show();ArenaEnemyFrame2:Show();ArenaEnemyFrame3:Show()
LoadAddOn("Blizzard_ArenaUI");ArenaEnemyFrames:Show();ArenaEnemyFrame1:Show();ArenaEnemyFrame2:Show();ArenaEnemyFrame3:Show();ArenaEnemyFrame1CastingBar:Show() 
 
--[战场灵魂自动释放]----------------
local R = CreateFrame("Frame")
R:RegisterEvent("PLAYER_DEAD")
R:SetScript("OnEvent",function()
if UnitInBattleground("player") then
RepopMe()
end
end )
 
--[玩家法术监视图标,监视自身buff] ----------------------------------------------------------------
bl={1463,11426,45438,108978,111264,12472,12043,114003,79683,108978,13616,116257,116267,108843,32612,115610}
bs=26;xb=-1;yb=-60;br=6;bdr="BORDER"be="UNIT_AURA"cbf=CreateFrame;gi=GetSpellInfo;bm=math.ceil;fm=math.floor;st=STANDARD_TEXT_FONT;function cu(s) return UnitBuff("Player",gi(s))end
function Cb(i,s)local _,_,t3=gi(s)local f=cbf("Frame")f:SetSize(bs,bs)f.t=f:CreateTexture(nil,bdr)f.t:SetAllPoints(true)f.t:SetTexture(t3)f.f=f:CreateFontString(nil,bdr)f.f:SetFont(st,12,"OUTLINE")f.f:SetPoint("BOTTOMRIGHT",0,0)return f;end
function vb(s,i,row)local b1,_,_,b4=cu(s)local f=_G["B"..i]if b1 then f:Show()f:SetPoint("CENTER",xb-(bs+5)*bm((row-1)%br),yb-(bs+10)*bm(row/br))if(b4>1)then f.f:SetText(b4)end row=row+1;end return row;end
function ub()for i,s in ipairs(bl)do local b,_,_,_,_,_,k=cu(s)if b then local vt=fm(k-GetTime())if (vt>=60)then vt=bm(vt/60)_G["B"..i].c:SetText(vt.."m")elseif vt >= 0 then _G["B"..i].c:SetText(vt.."s")end end end end
function Cc(f)f.c=f:CreateFontString(nil,bdr)f.c:SetFont(st,12,"OUTLINE")f.c:SetPoint("CENTER",0,-20)end function db()for i in ipairs(bl)do _G["B"..i]:Hide()end end
for i,s in ipairs(bl)do _G["B"..i]=Cb(i,s)Cc(_G["B"..i])_G["B"..i]:Hide()end function bb()db()local bw=1;for i,s in ipairs(bl)do bw=vb(s,i,bw)end end bk=cbf("Frame")bk:SetScript("OnEvent",bb)bk:SetScript("OnUpdate",ub)bk:RegisterEvent(be)
 
--[Omicc冷却计时] --------------------------------------------------------------
cs=20;ps=1;ctp="CENTER"ptp="BOTTOMRIGHT"cp=5;ct=UNIT_NAME_FONT;crt=2;cDB={}action={}ccf=CreateFrame;gac=GetActionCooldown;ol="OUTLINE"cpe="PLAYER_ENTERING_WORLD"cau="ACTIONBAR_UPDATE_COOLDOWN"co="OnUpdate"
function rt(f)f.e=nil f.t:SetText("")f:SetScript(co,nil)end function sf(f,v)f.t:SetFont(ct,f.s*v,ol)end function acv(b)local x=b.cooldown x.a=b.action action[x]=x end function scv(p,f,po,s)if(s>1)then f.t:SetPoint(po,p)end f.s=s;end
function sr(f,e)if(e>60)then sf(f,0.7)if(f.s==cs)then return"%d:%02d",e,e else return"%dm",e+60,e end elseif(e>=cp)then sf(f,1)f.t:SetTextColor(1,1,0,1)return"%d",e elseif(e>0)then sf(f,0.9)f.t:SetTextColor(1,0,0,1)return"%d",e else return end end
function suc(f)if not f.e then f.e=1;f:SetScript(co,function(s,e)f.c=f.c+e;local fo,v1,v2=sr(f,f.r-f.c)if not fo then rt(f)elseif not v2 then f.t:SetFormattedText(fo,v1)else f.t:SetTextColor(1,1,1,1)f.t:SetFormattedText(fo,v1/60,v2%60)end end)end end
function scs(p,f)if(p:GetSize()<35)then scv(p,f,ptp,ps)else scv(p,f,ctp,cs)end end function gict(f)local c=ccf("Frame",nil,f)c:SetFrameLevel(f:GetFrameLevel()+5)c.t=c:CreateFontString(nil,"OVERLAY")c.t:SetAllPoints(c)scs(f:GetParent(),c)return c;end
function gct(f)if not cDB[f]then local c=gict(f)c:SetSize(c.s*crt,c.s*crt)sf(c,1)cDB[f]=c;end return cDB[f]end function cvf(f,s,d)local c=gct(f)if(s and d)then c.b=s;c.d=d;if(s>0 and d>1.5)then c.c=0;c.r=d-(GetTime()-s);suc(c)else rt(c)end end end
function cvc(DB)for c in pairs(DB)do if c.a then local s,d=gac(c.a)cvf(c,s,d)end end end function pcv(_,e)if e==cau then cvc(action)else cvc(cDB)end end for _,b in pairs(ActionBarButtonEventsFrame.frames)do acv(b)end
vc=ccf("Frame")vc:SetScript("OnEvent",pcv)vc:RegisterEvent(cpe)vc:RegisterEvent(cau)hooksecurefunc(getmetatable(ActionButton1Cooldown).__index,"SetCooldown",cvf)hooksecurefunc("SetActionUIButton",acv)
 
--[移动宝宝并隐藏姓名]
PetFrame:SetScript("OnShow", nil) 
PetFrame:SetParent(UIParent) 
PetFrame:ClearAllPoints() 
PetFrame:SetPoint("TOP", PlayerFrame, "BOTTOM",) 
PetName:Hide()
 
--[目标及焦点战斗状态指示]-----------------------------------------------------------------------------------------------------------
local t = CreateFrame("Frame", UIParent) 
t.t = t:CreateTexture() 
t.t:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon.blp") 
t.t:SetTexCoord(0.5,1,0,0.49); 
t.t:SetAllPoints(t) 
t:SetWidth(25) 
t:SetHeight(25) 
t:SetPoint("CENTER", TargetFrame, "RIGHT", -25, 25) -----目标位置 
t:Show() 
 
local function FrameOnUpdate(self) 
if UnitAffectingCombat("target") then 
self:Show() 
else 
self:Hide() 
end 
end 
local g = CreateFrame("Frame") 
g:SetScript("OnUpdate", function(self) FrameOnUpdate(t) end) 
 
local f = CreateFrame("Frame", UIParent) 
f.t = f:CreateTexture() 
f.t:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon.blp") 
f.t:SetTexCoord(0.5,1,0,0.49); 
f.t:SetAllPoints(f) 
f:SetWidth(25) 
f:SetHeight(25) 
f:SetPoint("CENTER", FocusFrame, "RIGHT", -25, -15) ---焦点位置 
f:Show() 
 
local function FrameOnUpdateFocus(self) 
if UnitAffectingCombat("focus") then 
self:Show() 
else 
self:Hide() 
end 
end 
local g = CreateFrame("Frame") 
g:SetScript("OnUpdate", function(self) FrameOnUpdateFocus(f) end)
 
--[技能远距离指示红]
hooksecurefunc("ActionButton_OnEvent",function(self, event, ...) 
if ( event == "PLAYER_TARGET_CHANGED" ) then 
self.newTimer = self.rangeTimer 
end 
end) 
 
hooksecurefunc("ActionButton_UpdateUsable",function(self) 
local icon = _G[self:GetName().."Icon"] 
local valid = IsActionInRange(self.action) 
 
if ( valid == 0 ) then 
icon:SetVertexColor(1.0, 0.1, 0.1) 
end 
end) 
 
hooksecurefunc("ActionButton_OnUpdate",function(self, elapsed) 
local rangeTimer = self.newTimer 
 
if ( rangeTimer ) then 
rangeTimer = rangeTimer - elapsed 
 
if ( rangeTimer <= 0 ) then 
ActionButton_UpdateUsable(self) 
rangeTimer = TOOLTIP_UPDATE_TIME 
end 
 
self.newTimer = rangeTimer 
end 
end)
 
--[脱离战斗头像渐隐]
local Event = CreateFrame("Frame") 
Event:RegisterEvent("PLAYER_ENTERING_WORLD",Update) 
Event:RegisterEvent("PLAYER_REGEN_DISABLED",Update) 
Event:RegisterEvent("PLAYER_REGEN_ENABLED",Update) 
Event:RegisterEvent("UNIT_TARGET",Update) 
Event:RegisterEvent("UNIT_HEALTH",Update) 
Event:RegisterEvent("UNIT_POWER",Update) 
Event:SetScript("OnEvent",function(self, event, ...) 
 
local FrameFadeOut, FrameFadeIn = UIFrameFadeOut, UIFrameFadeIn 
local InCombat, Target, IsDead = InCombatLockdown(), UnitExists("target"), UnitIsDeadOrGhost("player") 
local PlayerMaxHp, PlayerMaxMp = UnitHealth("player") == UnitHealthMax("player"), UnitPower("player") == UnitPowerMax("player") 
local PlayerNoMaxHp, PlayerNoMaxMp = UnitHealth("player") ~= UnitHealthMax("player"), {} 
local _, powerTypeString = UnitPowerType("player") 
if powerTypeString == "RAGE" or powerTypeString == "RUNIC_POWER" then 
PlayerNoMaxMp = UnitPower("player") == UnitPowerMax("player") 
else 
PlayerNoMaxMp = UnitPower("player") ~= UnitPowerMax("player") 
end 
 
if event == "PLAYER_REGEN_ENABLED" or not Target or not IsDead and PlayerMaxHp or not IsDead and PlayerMaxMp then 
FrameFadeOut(PlayerFrame, 2.0, PlayerFrame:GetAlpha(), 0) 
end 
if event == "PLAYER_REGEN_DISABLED" or Target or not IsDead and PlayerNoMaxHp or not IsDead and PlayerNoMaxMp then 
FrameFadeIn(PlayerFrame, 0.1, PlayerFrame:GetAlpha(), 1) 
end 
if (InCombat and not Target) or (not InCombat and Target) then 
FrameFadeIn(PlayerFrame, 0.1, PlayerFrame:GetAlpha(), 1) 
end 
end)
--[目标debuff和buff大小]
local function UpdateTargetAuraPositions(self, auraName, numAuras, numOppositeAuras, largeAuraList, updateFunc, maxRowWidth, offsetX) 
local AURA_OFFSET_Y = 3; 
local LARGE_AURA_SIZE = 30; ---目标debuff大小
local SMALL_AURA_SIZE = 18; ---buff 大小
local size; 
local offsetY = AURA_OFFSET_Y; 
local rowWidth = 0; 
local firstBuffOnRow = 1; 
for i=1, numAuras do 
if ( largeAuraList[i] ) then 
size = LARGE_AURA_SIZE; 
offsetY = AURA_OFFSET_Y + AURA_OFFSET_Y; 
else 
size = SMALL_AURA_SIZE; 
end 
if ( i == 1 ) then 
rowWidth = size; 
self.auraRows = self.auraRows + 1; 
else 
rowWidth = rowWidth + size + offsetX; 
end 
if ( rowWidth > maxRowWidth ) then 
updateFunc(self, auraName, i, numOppositeAuras, firstBuffOnRow, size, offsetX, offsetY); 
rowWidth = size; 
self.auraRows = self.auraRows + 1; 
firstBuffOnRow = i; 
offsetY = AURA_OFFSET_Y; 
else 
updateFunc(self, auraName, i, numOppositeAuras, i - 1, size, offsetX, offsetY); 
end 
end; 
end; 
hooksecurefunc("TargetFrame_UpdateAuraPositions", UpdateTargetAuraPositions) 
 
--[[crapcleaner]] 
 
local f = CreateFrame("Frame") 
f:SetScript("OnEvent", function() 
local c = 0 
for b=0,4 do 
for s=1,GetContainerNumSlots(b) do 
local l = GetContainerItemLink(b, s) 
if l then 
local p = select(11, GetItemInfo(l))*select(2, GetContainerItemInfo(b, s)) 
if select(3, GetItemInfo(l))==0 and p>0 then 
UseContainerItem(b, s) 
PickupMerchantItem() 
c = c+p 
end 
end 
end 
end 
if c>0 then 
local g, s, c = math.floor(c/10000) or 0, math.floor((c%10000)/100) or 0, c%100 
DEFAULT_CHAT_FRAME:AddMessage("Your vendor trash has been sold and you earned".." |cffffffff"..g.."|cffffc125g|r".." |cffffffff"..s.."|cffc7c7cfs|r".." |cffffffff"..c.."|cffeda55fc|r"..".",255,255,255) --"Your vendor trash has been sold and you earned" 
end 
end) 
f:RegisterEvent("MERCHANT_SHOW")
 
--[竞技场徽章和移动框架]
rc=30;rfc=CooldownFrame_SetTimer;aef="ArenaEnemyFrame";hb="HealthBar";trt=GetItemIcon(37864)ctf = CreateFrame;oe="ARENA_OPPONENT_UPDATE"ve="PLAYER_ENTERING_WORLD"tr="RIGHT"LoadAddOn("Blizzard_ArenaUI")
function Cr(i)local f=ctf("Frame",nil,UIParent)f:SetPoint(tr,_G[aef..i..hb],tr,80,0)f:SetSize(rc,rc)f.t=f:CreateTexture(nil,"BORDER")f.t:SetAllPoints(true)f.t:SetTexture(trt)f.c=CreateFrame("Cooldown",nil,f)f.c:SetAllPoints(f)return f;end
function ur(f,i)f:SetScript("OnEvent",function(_,e,u,_,_,_,s)if(u=="arena"..i)then if(s==42292 or s==59752)then rfc(f.c,GetTime(),120,1)elseif(s==7744)then rfc(f.c,GetTime(),30,1)end end end)f:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")end
for i=1,5 do _G["rf"..i]=Cr(i)local f=_G["rf"..i]ur(f,i)f:Hide()end function str(o,m)for i=1, m do local f=_G["rf"..i]if o then f:Show()else f:Hide()f.c:Hide()end end end
tk=ctf("Frame")tk:SetScript("OnEvent",function(_,e)if e==oe then str(1,GetNumArenaOpponents())else str(nil,5)end end)tk:RegisterEvent(oe)tk:RegisterEvent(ve)
LoadAddOn("Blizzard_ArenaUI") 
ArenaEnemyFrames:SetScale(1.47)
ArenaEnemyFrame1:ClearAllPoints()
ArenaEnemyFrame1:SetPoint("TOPRIGHT", -760, -180)
ArenaEnemyFrame2:ClearAllPoints() 
ArenaEnemyFrame2:SetPoint("TOPRIGHT", -760, -245)
ArenaEnemyFrame3:ClearAllPoints() 
ArenaEnemyFrame3:SetPoint("TOPRIGHT", -760, -305)
 
--[职业头像 ] -----------------------------------------------------------------------
hooksecurefunc("UnitFramePortrait_Update",function(self) 
if self.portrait then 
if UnitIsPlayer(self.unit) then 
local t = CLASS_ICON_TCOORDS[select(2, UnitClass(self.unit))] 
if t then 
self.portrait:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles") 
self.portrait:SetTexCoord(unpack(t)) 
end 
else 
self.portrait:SetTexCoord(0,1,0,1) 
end 
end 
end)
 
--[框体大小]
BuffFrame:SetScale(1.1) 
ConsolidatedBuffs:SetScale(1.1) 
TemporaryEnchantFrame:SetScale(1)
FocusFrame:SetScale(1.1) 
PlayerFrame:SetScale(1.12) 
TargetFrame:SetScale(1.12) 
TargetFrameNameBackground:Hide()
FocusFrameNameBackground:Hide()
TargetFrameSpellBar:SetScale(1.1)
MainMenuBar:SetScale(1.05)
 
--[登录自动载入以上插件]
local frame = CreateFrame("Frame") 
frame:RegisterEvent("PLAYER_LOGIN") 
frame:RegisterEvent("ADDON_LOADED") 
frame:RegisterEvent("PLAYER_ENTERING_WORLD") 
SLASH_AF1 = "/af" 
local function eventHandler(self,event,arg1) 
if event == "PLAYER_LOGIN" then 
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE") 
end 
 
end 
frame:SetScript("OnEvent",eventHandler)
 
---[自带LoseControl去转圈、调大小、位置、去阴影]------------------------
local f=CreateFrame("Frame") f:RegisterEvent("LOSS_OF_CONTROL_ADDED") f:RegisterEvent("LOSS_OF_CONTROL_UPDATE") f:SetScript("OnEvent",function() for b in pairs(ActionBarActionEventsFrame.frames) do b.cooldown:SetLossOfControlCooldown(0,0) end end)
LossOfControlFrame:SetScale(1.0)
LossOfControlFrame:ClearAllPoints() LossOfControlFrame:SetPoint("CENTER",UIParent,"CENTER",8,-35)
select(1,LossOfControlFrame:GetRegions()):SetAlpha(0)
select(2,LossOfControlFrame:GetRegions()):SetAlpha(0) select(3,LossOfControlFrame:GetRegions()):SetAlpha(0)
 
--[本身移动施法条]---------------------------------------
CastingBarFrame:ClearAllPoints()
CastingBarFrame:SetPoint("CENTER",UIParent,"CENTER",0,-200)
CastingBarFrame.SetPoint = function() end 


相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度