This commit is contained in:
Andrew6810
2022-10-21 07:30:59 -07:00
parent cb55a92503
commit 3b75efe038
107 changed files with 25274 additions and 2 deletions
File diff suppressed because it is too large Load Diff
+156
View File
@@ -0,0 +1,156 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Flight"
local Flight = Quartz3:NewModule(MODNAME, "AceHook-3.0", "AceEvent-3.0")
local Player = Quartz3:GetModule("Player")
----------------------------
-- Upvalues
local GetTime = GetTime
local unpack = unpack
local db, getOptions
local defaults = {
profile = {
color = {0.7, 1, 0.7},
deplete = false,
},
}
do
local options
function getOptions()
options = options or {
type = "group",
name = L["Flight"],
order = 600,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
order = 100,
},
color = {
type = "color",
name = L["Flight Map Color"],
desc = L["Set the color to turn the cast bar when taking a flight path"],
get = function() return unpack(db.color) end,
set = function(info, ...) db.color = {...} end,
order = 101,
},
deplete = {
type = "toggle",
name = L["Deplete"],
desc = L["Deplete"],
get = function() return db.deplete end,
set = function(info, v) db.deplete = v end,
order = 102,
},
},
}
return options
end
end
function Flight:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Flight"])
end
function Flight:ApplySettings()
db = self.db.profile
end
--[[
if InFlight then
function Flight:OnEnable()
self:RawHook(InFlight, "StartTimer")
end
function Flight:StartTimer(object, ...)
self.hooks[object].StartTimer(object, ...)
local f = InFlightBar
local _, duration = f:GetMinMaxValues()
local _, locText = f:GetRegions()
local destination = locText:GetText()
self:BeginFlight(duration, destination)
end
else ]]
if FlightMapTimes_BeginFlight then
function Flight:OnEnable()
self:RawHook("FlightMapTimes_BeginFlight")
end
function Flight:FlightMapTimes_BeginFlight(duration, destination)
if duration and duration > 0 then
self:BeginFlight(duration, destination)
end
return self.hooks.FlightMapTimes_BeginFlight(duration, destination)
end
end
function Flight:BeginFlight(duration, destination)
Player.Bar.casting = true
Player.Bar.startTime = GetTime()
Player.Bar.endTime = GetTime() + duration
Player.Bar.delay = 0
Player.Bar.fadeOut = nil
if db.deplete then
Player.Bar.casting = nil
Player.Bar.channeling = true
else
Player.Bar.casting = true
Player.Bar.channeling = nil
end
Player.Bar.Bar:SetStatusBarColor(unpack(db.color))
Player.Bar.Bar:SetValue(0)
Player.Bar:Show()
Player.Bar:SetAlpha(Player.db.profile.alpha)
Player.Bar.Spark:Show()
Player.Bar.Icon:SetTexture(nil)
Player.Bar.Text:SetText(destination)
local position = Player.db.profile.timetextposition
if position == "caststart" then
Player.Bar.TimeText:SetPoint("LEFT", Player.Bar.Bar, "LEFT", Player.db.profile.timetextx, Player.db.profile.timetexty)
Player.Bar.TimeText:SetJustifyH("LEFT")
elseif position == "castend" then
Player.Bar.TimeText:SetPoint("RIGHT", Player.Bar.Bar, "RIGHT", -1 * Player.db.profile.timetextx, Player.db.profile.timetexty)
Player.Bar.TimeText:SetJustifyH("RIGHT")
end
end
+122
View File
@@ -0,0 +1,122 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Focus"
local Focus = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
----------------------------
-- Upvalues
local UnitIsEnemy, UnitIsFriend, UnitIsUnit = UnitIsEnemy, UnitIsFriend, UnitIsUnit
local db, getOptions
local defaults = {
profile = Quartz3:Merge(Quartz3.CastBarTemplate.defaults,
{
--x = -- applied automatically in :ApplySettings()
y = 250,
h = 18,
w = 200,
texture = "LiteStep",
showfriendly = true,
showhostile = true,
showtarget = true,
})
}
do
local options
function getOptions()
if not options then
options = Focus.Bar:CreateOptions()
options.args.showfriendly = {
type = "toggle",
name = L["Show for Friends"],
desc = L["Show this castbar for friendly units"],
order = 101,
}
options.args.showhostile = {
type = "toggle",
name = L["Show for Enemies"],
desc = L["Show this castbar for hostile units"],
order = 101,
}
options.args.showtarget = {
type = "toggle",
name = L["Show if Target"],
desc = L["Show this castbar if focus is also target"],
order = 101,
}
end
return options
end
end
function Focus:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Focus"])
self.Bar = Quartz3.CastBarTemplate:new(self, "focus", MODNAME, L["Focus"], db)
end
function Focus:OnEnable()
self.Bar:RegisterEvents()
self.Bar:RegisterEvent("PLAYER_TARGET_CHANGED")
self.Bar:RegisterEvent("PLAYER_FOCUS_CHANGED")
self.Bar.PLAYER_TARGET_CHANGED = self.Bar.UpdateUnit
self.Bar.PLAYER_FOCUS_CHANGED = self.Bar.UpdateUnit
self.lastNotInterruptible = false
self:ApplySettings()
end
function Focus:OnDisable()
self.Bar:UnregisterEvents()
self.Bar:Hide()
end
function Focus:PreShowCondition(bar, unit)
if (not db.showfriendly and UnitIsFriend("player", unit)) or
(not db.showhostile and UnitIsEnemy("player", unit)) or
(not db.showtarget and UnitIsUnit("target", unit)) then
return true
end
end
function Focus:ApplySettings()
db = self.db.profile
self.Bar:SetConfig(db)
if self:IsEnabled() then
self.Bar:ApplySettings()
end
end
function Focus:Unlock()
self.Bar:Unlock()
end
function Focus:Lock()
self.Bar:Lock()
end
+290
View File
@@ -0,0 +1,290 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "GCD"
local GCD = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
local Player = Quartz3:GetModule("Player")
----------------------------
-- Upvalues
local CreateFrame, GetTime, UIParent, GetSpellCooldown = CreateFrame, GetTime, UIParent, GetSpellCooldown
local unpack = unpack
local gcdbar, gcdbar_width, gcdspark
local starttime, duration, warned
local db, getOptions
local defaults = {
profile = {
sparkcolor = {1, 1, 1},
gcdalpha = 0.9,
gcdheight = 4,
gcdposition = "bottom",
gcdgap = -4,
deplete = false,
x = 500,
y = 300,
}
}
local function OnUpdate()
if not starttime then return gcdbar:Hide() end
gcdspark:ClearAllPoints()
local perc = (GetTime() - starttime) / duration
if perc > 1 then
return gcdbar:Hide()
else
if db.deplete then
gcdspark:SetPoint("CENTER", gcdbar, "LEFT", gcdbar_width * (1-perc), 0)
else
gcdspark:SetPoint("CENTER", gcdbar, "LEFT", gcdbar_width * perc, 0)
end
end
end
local function OnHide()
gcdbar:SetScript("OnUpdate", nil)
end
local function OnShow()
gcdbar:SetScript("OnUpdate", OnUpdate)
end
function GCD:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["GCD"])
end
function GCD:OnEnable()
--self:RegisterEvent("UNIT_SPELLCAST_SENT","CheckGCD")
self:RegisterEvent("UNIT_SPELLCAST_START","CheckGCD")
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED","CheckGCD")
if not gcdbar then
gcdbar = CreateFrame("Frame", "Quartz3GCDBar", UIParent)
gcdbar:SetFrameStrata("HIGH")
gcdbar:SetScript("OnShow", OnShow)
gcdbar:SetScript("OnHide", OnHide)
gcdbar:SetMovable(true)
gcdbar:RegisterForDrag("LeftButton")
gcdbar:SetClampedToScreen(true)
gcdspark = gcdbar:CreateTexture(nil, "DIALOG")
gcdbar:Hide()
end
self:ApplySettings()
end
function GCD:OnDisable()
gcdbar:Hide()
end
function GCD:CheckGCD(event, unit, spell)
if unit == "player" then
local start, dur = GetSpellCooldown(spell)
if dur and dur > 0 and dur <= 1.5 then
starttime = start
duration = dur
gcdbar:Show()
end
end
end
function GCD:ApplySettings()
db = self.db.profile
if gcdbar and self:IsEnabled() then
gcdbar:ClearAllPoints()
gcdbar:SetHeight(db.gcdheight)
gcdbar_width = Player.Bar:GetWidth() - 8
gcdbar:SetWidth(gcdbar_width)
gcdbar:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
gcdbar:SetBackdropColor(0,0,0)
gcdbar:SetAlpha(db.gcdalpha)
gcdbar:SetScale(Player.db.profile.scale)
if db.gcdposition == "bottom" then
gcdbar:SetPoint("TOP", Player.Bar, "BOTTOM", 0, -1 * db.gcdgap)
elseif db.gcdposition == "top" then
gcdbar:SetPoint("BOTTOM", Player.Bar, "TOP", 0, db.gcdgap)
else -- L["Free"]
gcdbar:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", db.x, db.y)
end
gcdspark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
gcdspark:SetVertexColor(unpack(db.sparkcolor))
gcdspark:SetBlendMode("ADD")
gcdspark:SetWidth(25)
gcdspark:SetHeight(db.gcdheight*2.5)
end
end
do
local locked = true
local function nothing()
end
local function dragstart()
gcdbar:StartMoving()
end
local function dragstop()
db.x = gcdbar:GetLeft()
db.y = gcdbar:GetBottom()
gcdbar:StopMovingOrSizing()
end
local function hiddennofree()
return db.gcdposition ~= "free"
end
local function setOpt(info, value)
db[info[#info]] = value
GCD:ApplySettings()
end
local function getOpt(info)
return db[info[#info]]
end
local function getColor(info)
return unpack(getOpt(info))
end
local function setColor(info, r, g, b, a)
setOpt(info, {r, g, b, a})
end
local options
function getOptions()
if not options then
options = {
type = "group",
name = L["Global Cooldown"],
order = 600,
get = getOpt,
set = setOpt,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
desc = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
order = 100,
},
sparkcolor = {
type = "color",
name = L["Spark Color"],
desc = L["Set the color of the GCD bar spark"],
get = getColor,
set = setColor,
order = 103,
},
gcdheight = {
type = "range",
name = L["Height"],
desc = L["Set the height of the GCD bar"],
min = 1, max = 30, step = 1,
order = 104,
},
gcdalpha = {
type = "range",
name = L["Alpha"],
desc = L["Set the alpha of the GCD bar"],
min = 0.05, max = 1, bigStep = 0.05,
isPercent = true,
order = 105,
},
gcdposition = {
type = "select",
name = L["Bar Position"],
desc = L["Set the position of the GCD bar"],
values = {["top"] = L["Top"], ["bottom"] = L["Bottom"], ["free"] = L["Free"]},
order = 106,
},
lock = {
type = "toggle",
name = L["Lock"],
desc = L["Toggle Cast Bar lock"],
get = function()
return locked
end,
set = function(info, v)
if v then
gcdbar.Hide = nil
gcdbar:EnableMouse(false)
gcdbar:SetScript("OnDragStart", nil)
gcdbar:SetScript("OnDragStop", nil)
gcdbar:Hide()
else
gcdbar:Show()
gcdbar:EnableMouse(true)
gcdbar:SetScript("OnDragStart", dragstart)
gcdbar:SetScript("OnDragStop", dragstop)
gcdbar:SetAlpha(1)
gcdbar.Hide = nothing
end
locked = v
end,
hidden = hiddennofree,
order = 107,
},
x = {
type = "range",
name = L["X"],
desc = L["Set an exact X value for this bar's position."],
min = 0, max = 2560, step = 1,
order = 108,
hidden = hiddennofree,
},
y = {
type = "range",
name = L["Y"],
desc = L["Set an exact Y value for this bar's position."],
min = 0, max = 1600, step = 1,
order = 108,
hidden = hiddennofree,
},
gcdgap = {
type = "range",
name = L["Gap"],
desc = L["Tweak the distance of the GCD bar from the cast bar"],
min = -35, max = 35, step = 1,
order = 109,
},
deplete = {
type = "toggle",
name = L["Deplete"],
desc = L["Reverses the direction of the GCD spark, causing it to move right-to-left"],
order = 110,
},
},
}
end
return options
end
end
+99
View File
@@ -0,0 +1,99 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Interrupt"
local Interrupt = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
local Player = Quartz3:GetModule("Player")
local db, getOptions
----------------------------
-- Upvalues
local GetTime = GetTime
local unpack = unpack
local SPELLINTERRUPTOTHERSELF, UNKNOWN = SPELLINTERRUPTOTHERSELF, UNKNOWN
local defaults = {
profile = {
interruptcolor = {0,0,0},
},
}
function Interrupt:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Interrupt"])
end
function Interrupt:OnEnable()
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
function Interrupt:ApplySettings()
db = self.db.profile
end
function Interrupt:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, combatEvent, _, sourceName, _, _, _, destFlags)
if combatEvent == "SPELL_INTERRUPT" and destFlags == 0x511 then
Player.Bar.Text:SetFormattedText(L["INTERRUPTED (%s)"], (sourceName or UNKNOWN):upper())
Player.Bar.Bar:SetStatusBarColor(unpack(db.interruptcolor))
Player.Bar.stopTime = GetTime()
end
end
do
local options
function getOptions()
options = options or {
type = "group",
name = L["Interrupt"],
order = 600,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
order = 100,
},
interruptcolor = {
type = "color",
name = L["Interrupt Color"],
desc = L["Set the color the cast bar is changed to when you have a spell interrupted"],
set = function(info, ...)
db.interruptcolor = {...}
end,
get = function()
return unpack(db.interruptcolor)
end,
order = 101,
},
},
}
return options
end
end
+376
View File
@@ -0,0 +1,376 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Latency"
local Latency = Quartz3:NewModule(MODNAME, "AceEvent-3.0", "AceHook-3.0")
local Player = Quartz3:GetModule("Player")
local media = LibStub("LibSharedMedia-3.0")
local lsmlist = AceGUIWidgetLSMlists
----------------------------
-- Upvalues
local GetTime = GetTime
local unpack = unpack
local lagbox, lagtext, db, timeDiff, sendTime, alignoutside
local getOptions
local defaults = {
profile = {
lagcolor = {1, 0, 0},
lagalpha = 0.6,
lagtext = true,
lagfont = "Friz Quadrata TT",
lagfontsize = 7,
lagtextcolor = {0.7, 0.7, 0.7, 0.8},
lagtextalignment = "center", -- L["Left"], L["Right"]
lagtextposition = "bottom", --L["Top"], L["Above"], L["Below"]
-- With "embed", the lag indicator is placed on the left hand side of the bar instead of right for normal casting
-- and the castbar time is shifted so that the end of the time accounting for lag lines up with the right hand side of the castbar
-- For channeled spells, the lag indicator is shown on the right, and the cast bar is adjusted down from there
-- lagpadding is applied only if lagembed is enabled
lagembed = false,
lagpadding = 0.0,
}
}
function Latency:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Latency"])
end
function Latency:OnEnable()
self:RawHook(Player, "UNIT_SPELLCAST_START")
self:RawHook(Player, "UNIT_SPELLCAST_DELAYED")
self:RegisterEvent("UNIT_SPELLCAST_SENT")
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
media.RegisterCallback(self, "LibSharedMedia_SetGlobal", function(mtype, override)
if mtype == "statusbar" then
lagbox:SetTexture(media:Fetch("statusbar", override))
end
end)
if not lagbox then
lagbox = Player.Bar.Bar:CreateTexture(nil, "BACKGROUND")
lagtext = Player.Bar.Bar:CreateFontString(nil, "OVERLAY")
self.lagbox = lagbox
self.lagtext = lagtext
end
self:ApplySettings()
end
function Latency:OnDisable()
media.UnregisterCallback(self, "LibSharedMedia_SetGlobal")
lagbox:Hide()
lagtext:Hide()
end
function Latency:UNIT_SPELLCAST_SENT(event, unit)
if unit ~= "player" and unit ~= "vehicle" then
return
end
sendTime = GetTime()
end
function Latency:UNIT_SPELLCAST_START(object, bar, unit)
self.hooks[object].UNIT_SPELLCAST_START(object, bar, unit)
local startTime, endTime = bar.startTime, bar.endTime
if not sendTime or not endTime then return end
timeDiff = GetTime() - sendTime
local castlength = endTime - startTime
timeDiff = timeDiff > castlength and castlength or timeDiff
local perc = timeDiff / castlength
lagbox:ClearAllPoints()
local side
if db.lagembed then
if bar.casting then
side = "LEFT"
lagbox:SetTexCoord(0,perc,0,1)
else -- channeling
side = "RIGHT"
lagbox:SetTexCoord(1-perc,1,0,1)
end
startTime = startTime - timeDiff + db.lagpadding
bar.startTime = startTime
endTime = endTime - timeDiff + db.lagpadding
bar.endTime = endTime
else
if bar.casting then
side = "RIGHT"
lagbox:SetTexCoord(1-perc,1,0,1)
else -- channeling
side = "LEFT"
lagbox:SetTexCoord(perc,1,0,1)
end
end
lagbox:SetDrawLayer(side == "LEFT" and "OVERLAY" or "BACKGROUND")
lagbox:SetPoint(side, Player.Bar.Bar, side)
lagbox:SetWidth(Player.db.profile.w * perc)
lagbox:Show()
if db.lagtext then
if alignoutside then
lagtext:SetJustifyH(side)
lagtext:ClearAllPoints()
local lagtextposition = db.lagtextposition
local point, relpoint
if lagtextposition == "bottom" then
point = "BOTTOM"
relpoint = "BOTTOM"
elseif lagtextposition == "top" then
point = "TOP"
relpoint = "TOP"
elseif lagtextposition == "above" then
point = "BOTTOM"
relpoint = "TOP"
else --L["Below"]
point = "TOP"
relpoint = "BOTTOM"
end
if side == "LEFT" then
lagtext:SetPoint(point.."LEFT", lagbox, relpoint.."LEFT", 1, 0)
else
lagtext:SetPoint(point.."RIGHT", lagbox, relpoint.."RIGHT", -1, 0)
end
end
lagtext:SetFormattedText(L["%dms"], timeDiff*1000)
lagtext:Show()
else
lagtext:Hide()
end
end
function Latency:UNIT_SPELLCAST_DELAYED(object, bar, unit)
self.hooks[object].UNIT_SPELLCAST_DELAYED(object, bar, unit)
if db.lagembed then
local startTime = bar.startTime - timeDiff + db.lagpadding
bar.startTime = startTime
local endTime = bar.endTime - timeDiff + db.lagpadding
bar.endTime = endTime
end
end
function Latency:UNIT_SPELLCAST_INTERRUPTED(event, unit)
if unit ~= "player" and unit ~= "vehicle" then
return
end
lagbox:Hide()
lagtext:Hide()
end
function Latency:ApplySettings()
db = self.db.profile
if lagbox and self:IsEnabled() then
lagbox:SetHeight(Player.Bar.Bar:GetHeight())
lagbox:SetTexture(media:Fetch("statusbar", Player.db.profile.texture))
lagbox:SetAlpha(db.lagalpha)
lagbox:SetVertexColor(unpack(db.lagcolor))
lagtext:SetFont(media:Fetch("font", db.lagfont), db.lagfontsize)
lagtext:SetShadowColor( 0, 0, 0, 1)
lagtext:SetShadowOffset( 0.8, -0.8 )
lagtext:SetTextColor(unpack(db.lagtextcolor))
lagtext:SetNonSpaceWrap(false)
local lagtextposition = db.lagtextposition
local point, relpoint
if lagtextposition == "bottom" then
point = "BOTTOM"
relpoint = "BOTTOM"
elseif lagtextposition == "top" then
point = "TOP"
relpoint = "TOP"
elseif lagtextposition == "above" then
point = "BOTTOM"
relpoint = "TOP"
else --L["Below"]
point = "TOP"
relpoint = "BOTTOM"
end
local lagtextalignment = db.lagtextalignment
if lagtextalignment == "center" then
lagtext:SetJustifyH("CENTER")
lagtext:ClearAllPoints()
lagtext:SetPoint(point, lagbox, relpoint)
alignoutside = false
elseif lagtextalignment == "right" then
lagtext:SetJustifyH("RIGHT")
lagtext:ClearAllPoints()
lagtext:SetPoint(point.."RIGHT", lagbox, relpoint.."RIGHT", -1, 0)
alignoutside = false
elseif lagtextalignment == "left" then
lagtext:SetJustifyH("LEFT")
lagtext:ClearAllPoints()
lagtext:SetPoint(point.."LEFT", lagbox, relpoint.."LEFT", 1, 0)
alignoutside = false
else -- ["Outside"] is set on cast start
alignoutside = true
end
end
end
do
local function hidelagtextoptions()
return not db.lagtext
end
local function setOpt(info, value)
db[info[#info]] = value
Latency:ApplySettings()
end
local function getOpt(info)
return db[info[#info]]
end
local function getColor(info)
return unpack(getOpt(info))
end
local function setColor(info, r, g, b, a)
setOpt(info, {r, g, b, a})
end
local options
function getOptions()
if not options then
options = {
type = "group",
name = L["Latency"],
order = 600,
get = getOpt,
set = setOpt,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
desc = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
order = 100,
},
lagembed = {
type = "toggle",
name = L["Embed"],
desc = L["Include Latency time in the displayed cast bar."],
order = 101,
},
lagalpha ={
type = "range",
name = L["Alpha"],
desc = L["Set the alpha of the latency bar"],
min = 0.05, max = 1, bigStep = 0.05,
isPercent = true,
order = 102,
},
lagpadding = {
type = "range",
name = L["Embed Safety Margin"],
desc = L["Embed mode will decrease it's lag estimates by this amount. Ideally, set it to the difference between your highest and lowest ping amounts. (ie, if your ping varies from 200ms to 400ms, set it to 0.2)"],
min = 0, max = 1, bigStep = 0.05,
disabled = function()
return not db.lagembed
end,
order = 103,
},
lagcolor = {
type = "color",
name = L["Bar Color"],
desc = L["Set the color of the %s"]:format(L["Latency Bar"]),
get = getColor,
set = setColor,
order = 111,
},
header = {
type = "header",
name = L["Font and Text"],
order = 113,
},
lagtext = {
type = "toggle",
name = L["Show Text"],
desc = L["Display the latency time as a number on the latency bar"],
order = 114,
},
lagtextcolor = {
type = "color",
name = L["Text Color"],
desc = L["Set the color of the latency text"],
get = getColor,
set = setColor,
disabled = hidelagtextoptions,
hasAlpha = true,
order = 115,
},
lagfont = {
type = "select",
dialogControl = "LSM30_Font",
name = L["Font"],
desc = L["Set the font used for the latency text"],
values = lsmlist.font,
disabled = hidelagtextoptions,
order = 116,
},
lagfontsize = {
type = "range",
name = L["Font Size"],
desc = L["Set the size of the latency text"],
min = 3, max = 15, step = 1,
disabled = hidelagtextoptions,
order = 117,
},
lagtextalignment = {
type = "select",
name = L["Text Alignment"],
desc = L["Set the position of the latency text"],
values = {["center"] = L["Center"], ["left"] = L["Left"], ["right"] = L["Right"], ["outside"] = L["Outside"]},
disabled = hidelagtextoptions,
order = 118,
},
lagtextposition = {
type = "select",
name = L["Text Position"],
desc = L["Set the vertical position of the latency text"],
values = {["above"] = L["Above"], ["top"] = L["Top"], ["bottom"] = L["Bottom"], ["below"] = L["Below"]},
disabled = hidelagtextoptions,
order = 119,
},
},
}
end
return options
end
end
File diff suppressed because it is too large Load Diff
+125
View File
@@ -0,0 +1,125 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Pet"
local Pet = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
----------------------------
-- Upvalues
-- GLOBALS: PetCastingBarFrame
local db, getOptions
local defaults = {
profile = Quartz3:Merge(Quartz3.CastBarTemplate.defaults,
{
hideblizz = true,
--x = -- applied automatically in :ApplySettings()
y = 300,
h = 18,
w = 200,
texture = "LiteStep",
})
}
do
local function setOpt(info, value)
db[info[#info]] = value
Pet:ApplySettings()
end
local options
function getOptions()
if not options then
options = Pet.Bar:CreateOptions()
options.args.hideblizz = {
type = "toggle",
name = L["Disable Blizzard Cast Bar"],
desc = L["Disable and hide the default UI's casting bar"],
set = setOpt,
order = 101,
}
options.args.noInterruptGroup = nil
end
return options
end
end
function Pet:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Pet"])
self.Bar = Quartz3.CastBarTemplate:new(self, "pet", MODNAME, L["Pet"], db)
end
function Pet:OnEnable()
self.Bar:RegisterEvents()
self:ApplySettings()
end
function Pet:OnDisable()
self.Bar:UnregisterEvents()
self.Bar:Hide()
end
function Pet:ApplySettings()
db = self.db.profile
-- obey the hideblizz setting no matter if disabled or not
if db.hideblizz then
PetCastingBarFrame.RegisterEvent = function() end
PetCastingBarFrame:UnregisterAllEvents()
PetCastingBarFrame:Hide()
else
PetCastingBarFrame.RegisterEvent = nil
PetCastingBarFrame:UnregisterAllEvents()
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_START")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_STOP")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_DELAYED")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE")
PetCastingBarFrame:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE")
PetCastingBarFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
PetCastingBarFrame:RegisterEvent("UNIT_PET")
end
self.Bar:SetConfig(db)
if self:IsEnabled() then
self.Bar:ApplySettings()
end
end
function Pet:Unlock()
self.Bar:Unlock()
end
function Pet:Lock()
self.Bar:Lock()
end
+238
View File
@@ -0,0 +1,238 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Player"
local Player = Quartz3:NewModule(MODNAME)
----------------------------
-- Upvalues
-- GLOBALS: CastingBarFrame
local unpack = unpack
local UnitChannelInfo = UnitChannelInfo
local db, getOptions, castBar
local defaults = {
profile = Quartz3:Merge(Quartz3.CastBarTemplate.defaults,
{
hideblizz = true,
showticks = true,
-- no interrupt is pointless for player, disable all options
noInterruptBorderChange = false,
noInterruptColorChange = false,
noInterruptShield = false,
})
}
do
local function setOpt(info, value)
db[info[#info]] = value
Player:ApplySettings()
end
local options
function getOptions()
if not options then
options = Player.Bar:CreateOptions()
options.args.hideblizz = {
type = "toggle",
name = L["Disable Blizzard Cast Bar"],
desc = L["Disable and hide the default UI's casting bar"],
set = setOpt,
order = 101,
}
options.args.showticks = {
type = "toggle",
name = L["Show channeling ticks"],
desc = L["Show damage / mana ticks while channeling spells like Drain Life or Blizzard"],
order = 102,
}
options.args.targetname = {
type = "toggle",
name = L["Show Target Name"],
desc = L["Display target name of spellcasts after spell name"],
disabled = function() return db.hidenametext end,
order = 402,
}
options.args.noInterruptGroup = nil
end
return options
end
end
function Player:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Player"])
self.Bar = Quartz3.CastBarTemplate:new(self, "player", MODNAME, L["Player"], db)
castBar = self.Bar.Bar
end
function Player:OnEnable()
self.Bar:RegisterEvents()
self:ApplySettings()
end
function Player:OnDisable()
self.Bar:UnregisterEvents()
self.Bar:Hide()
end
function Player:ApplySettings()
db = self.db.profile
-- obey the hideblizz setting no matter if disabled or not
if db.hideblizz then
CastingBarFrame.RegisterEvent = function() end
CastingBarFrame:UnregisterAllEvents()
CastingBarFrame:Hide()
else
CastingBarFrame.RegisterEvent = nil
CastingBarFrame:UnregisterAllEvents()
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_START")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_STOP")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_DELAYED")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE")
CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE")
CastingBarFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
end
self.Bar:SetConfig(db)
if self:IsEnabled() then
self.Bar:ApplySettings()
end
end
function Player:Unlock()
self.Bar:Unlock()
end
function Player:Lock()
self.Bar:Lock()
end
----------------------------
-- Cast Bar Hooks
function Player:OnHide()
local Latency = Quartz3:GetModule(L["Latency"],true)
if Latency then
if Latency:IsEnabled() and Latency.lagbox then
Latency.lagbox:Hide()
Latency.lagtext:Hide()
end
end
end
local sparkfactory = {
__index = function(t,k)
local spark = castBar:CreateTexture(nil, 'OVERLAY')
t[k] = spark
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
spark:SetVertexColor(unpack(Quartz3.db.profile.sparkcolor))
spark:SetBlendMode('ADD')
spark:SetWidth(20)
spark:SetHeight(db.h*2.2)
return spark
end
}
local barticks = setmetatable({}, sparkfactory)
local function setBarTicks(ticknum)
if( ticknum and ticknum > 0) then
local delta = ( db.w / ticknum )
for k = 1,ticknum do
local t = barticks[k]
t:ClearAllPoints()
t:SetPoint("CENTER", castBar, "LEFT", delta * k, 0 )
t:Show()
end
else
barticks[1].Hide = nil
for i=1,#barticks do
barticks[i]:Hide()
end
end
end
local channelingTicks = {
-- warlock
[GetSpellInfo(1120)] = 5, -- drain soul
[GetSpellInfo(689)] = 5, -- drain life
[GetSpellInfo(5138)] = 5, -- drain mana
[GetSpellInfo(5740)] = 4, -- rain of fire
-- druid
[GetSpellInfo(740)] = 4, -- Tranquility
[GetSpellInfo(16914)] = 10, -- Hurricane
-- priest
[GetSpellInfo(15407)] = 3, -- mind flay
[GetSpellInfo(48045)] = 5, -- mind sear
[GetSpellInfo(47540)] = 2, -- penance
-- mage
[GetSpellInfo(5143)] = 5, -- arcane missiles
[GetSpellInfo(10)] = 5, -- blizzard
[GetSpellInfo(12051)] = 4, -- evocation
-- hunter
[GetSpellInfo(1510)] = 6, -- volley
}
local function getChannelingTicks(spell)
if not db.showticks then
return 0
end
return channelingTicks[spell] or 0
end
function Player:UNIT_SPELLCAST_START(bar, unit)
if bar.channeling then
local spell = UnitChannelInfo(unit)
bar.channelingTicks = getChannelingTicks(spell)
setBarTicks(bar.channelingTicks)
else
setBarTicks(0)
end
end
function Player:UNIT_SPELLCAST_STOP(bar, unit)
setBarTicks(0)
end
function Player:UNIT_SPELLCAST_FAILED(bar, unit)
setBarTicks(0)
end
function Player:UNIT_SPELLCAST_INTERRUPTED(bar, unit)
setBarTicks(0)
end
function Player:UNIT_SPELLCAST_DELAYED(bar, unit)
end
+164
View File
@@ -0,0 +1,164 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Range"
local Range = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
local Player = Quartz3:GetModule("Player")
----------------------------
-- Upvalues
local CreateFrame, UIParent = CreateFrame, UIParent
local UnitCastingInfo, UnitChannelInfo, UnitName, IsSpellInRange = UnitCastingInfo, UnitChannelInfo, UnitName, IsSpellInRange
local unpack = unpack
local f, OnUpdate, db, getOptions, spell, target, modified, r, g, b, castBar
local defaults ={
profile = {
rangecolor = {1, 1, 1},
}
}
do
local refreshtime = 0.25
local sincelast = 0
function OnUpdate(frame, elapsed)
sincelast = sincelast + elapsed
if sincelast >= refreshtime then
sincelast = 0
if not castBar:IsVisible() or Player.Bar.fadeOut then
return f:SetScript("OnUpdate", nil)
end
if IsSpellInRange(spell, target) == 0 then
r, g, b = castBar:GetStatusBarColor()
modified = true
castBar:SetStatusBarColor(unpack(db.rangecolor))
elseif modified then
castBar:SetStatusBarColor(r,g,b)
modified, r, g, b = nil, nil, nil, nil
end
end
end
end
function Range:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Range"])
f = CreateFrame("Frame", nil, UIParent)
end
function Range:OnEnable()
self:RegisterEvent("UNIT_SPELLCAST_SENT")
self:RegisterEvent("UNIT_SPELLCAST_START")
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
end
function Range:ApplySettings()
db = self.db.profile
end
function Range:UNIT_SPELLCAST_START(event, unit)
if unit ~= "player" then
return
end
if not castBar then
castBar = Player.Bar.Bar
end
if target then
spell = UnitCastingInfo(unit)
modified, r, g, b = nil, nil, nil, nil
f:SetScript("OnUpdate", OnUpdate)
end
end
function Range:UNIT_SPELLCAST_CHANNEL_START(event, unit)
if unit ~= "player" then
return
end
if not castBar then
castBar = Player.Bar.Bar
end
if target then
spell = UnitChannelInfo(unit)
modified, r, g, b = nil, nil, nil, nil
f:SetScript("OnUpdate", OnUpdate)
end
end
function Range:UNIT_SPELLCAST_SENT(event, unit, _, _, name)
if unit ~= "player" then
return
end
if name then
if name == UnitName("player") then
target = "player"
elseif name == UnitName("target") then
target = "target"
elseif name == UnitName("focus") then
target = "focus"
else
target = nil
end
else
target = nil
end
end
do
local options
function getOptions()
if not options then
options = {
type = "group",
name = L["Range"],
desc = L["Range"],
order = 600,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
desc = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
order = 100,
},
rangecolor = {
type = "color",
name = L["Out of Range Color"],
desc = L["Set the color to turn the cast bar when the target is out of range"],
get = function() return unpack(db.rangecolor) end,
set = function(info, ...) db.rangecolor = {...} end,
order = 101,
},
},
}
end
return options
end
end
+464
View File
@@ -0,0 +1,464 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Swing"
local Swing = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
local Player = Quartz3:GetModule("Player")
local media = LibStub("LibSharedMedia-3.0")
local lsmlist = AceGUIWidgetLSMlists
----------------------------
-- Upvalues
local CreateFrame, GetTime, UIParent = CreateFrame, GetTime, UIParent
local UnitClass, UnitDamage, UnitAttackSpeed, UnitRangedDamage = UnitClass, UnitDamage, UnitAttackSpeed, UnitRangedDamage
local math_abs, bit_band, unpack = math.abs, bit.band, unpack
local COMBATLOG_FILTER_ME = COMBATLOG_FILTER_ME
local playerclass
local autoshotname = GetSpellInfo(75)
local slam = GetSpellInfo(1464)
local swordprocname = GetSpellInfo(12281)
local resetspells = {
[GetSpellInfo(845)] = true, -- Cleave
[GetSpellInfo(78)] = true, -- Heroic Strike
[GetSpellInfo(6807)] = true, -- Maul
[GetSpellInfo(2973)] = true, -- Raptor Strike
[GetSpellInfo(56815)] = true, -- Rune Strike
}
local resetautoshotspells = {
--[GetSpellInfo(19434)] = true, -- Aimed Shot
}
local swingbar, swingbar_width, swingstatusbar, remainingtext, durationtext
local swingmode -- nil is none, 0 is meleeing, 1 is autoshooting
local starttime, duration
local slamstart
local db, getOptions
local defaults = {
profile = {
barcolor = {1, 1, 1},
swingalpha = 1,
swingheight = 4,
swingposition = "top",
swinggap = -4,
durationtext = true,
remainingtext = true,
x = 300,
y = 300,
}
}
local function OnUpdate()
if slamstart then return end
if starttime then
local spent = GetTime() - starttime
remainingtext:SetFormattedText("%.1f", duration - spent)
local perc = spent / duration
if perc > 1 then
return swingbar:Hide()
else
swingstatusbar:SetValue(perc)
end
end
end
local function OnHide()
swingbar:SetScript("OnUpdate", nil)
end
local function OnShow()
swingbar:SetScript("OnUpdate", OnUpdate)
end
function Swing:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Swing"])
end
function Swing:OnEnable()
local _, c = UnitClass("player")
playerclass = playerclass or c
-- fired when autoattack is enabled/disabled.
self:RegisterEvent("PLAYER_ENTER_COMBAT")
self:RegisterEvent("PLAYER_LEAVE_COMBAT")
-- fired when autoshot (or autowand) is enabled/disabled
self:RegisterEvent("START_AUTOREPEAT_SPELL")
self:RegisterEvent("STOP_AUTOREPEAT_SPELL")
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
-- slam stuff
if playerclass == "WARRIOR" then
self:RegisterEvent("UNIT_SPELLCAST_START")
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
end
self:RegisterEvent("UNIT_ATTACK")
if not swingbar then
swingbar = CreateFrame("Frame", "Quartz3SwingBar", UIParent)
swingbar:SetFrameStrata("HIGH")
swingbar:SetScript("OnShow", OnShow)
swingbar:SetScript("OnHide", OnHide)
swingbar:SetMovable(true)
swingbar:RegisterForDrag("LeftButton")
swingbar:SetClampedToScreen(true)
swingstatusbar = CreateFrame("StatusBar", nil, swingbar)
durationtext = swingstatusbar:CreateFontString(nil, "OVERLAY")
remainingtext = swingstatusbar:CreateFontString(nil, "OVERLAY")
swingbar:Hide()
end
self:ApplySettings()
end
function Swing:OnDisable()
swingbar:Hide()
end
function Swing:PLAYER_ENTER_COMBAT()
local _,_,offhandlow, offhandhigh = UnitDamage("player")
if math_abs(offhandlow - offhandhigh) <= 0.1 or playerclass == "DRUID" then
swingmode = 0 -- shouldn"t be dual-wielding
end
end
function Swing:PLAYER_LEAVE_COMBAT()
if not swingmode or swingmode == 0 then
swingmode = nil
end
end
function Swing:START_AUTOREPEAT_SPELL()
swingmode = 1
end
function Swing:STOP_AUTOREPEAT_SPELL()
if not swingmode or swingmode == 1 then
swingmode = nil
end
end
do
local swordspecproc = false
function Swing:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, combatevent, srcGUID, srcName, srcFlags, dstName, dstGUID, dstFlags, spellID, spellName)
if swingmode ~= 0 then return end
if combatevent == "SPELL_EXTRA_ATTACKS" and spellName == swordprocname and (bit_band(srcFlags, COMBATLOG_FILTER_ME) == COMBATLOG_FILTER_ME) then
swordspecproc = true
elseif (combatevent == "SWING_DAMAGE" or combatevent == "SWING_MISSED") and (bit_band(srcFlags, COMBATLOG_FILTER_ME) == COMBATLOG_FILTER_ME) then
if swordspecproc then
swordspecproc = false
else
self:MeleeSwing()
end
elseif (combatevent == "SWING_MISSED") and (bit_band(dstFlags, COMBATLOG_FILTER_ME) == COMBATLOG_FILTER_ME) and spellID == "PARRY" and duration then
duration = duration * 0.6
end
end
end
function Swing:UNIT_SPELLCAST_SUCCEEDED(event, unit, spell)
if unit ~= "player" then return end
if swingmode == 0 then
if resetspells[spell] then
self:MeleeSwing()
elseif spell == slam and slamstart then
starttime = starttime + GetTime() - slamstart
slamstart = nil
end
elseif swingmode == 1 then
if spell == autoshotname then
self:Shoot()
end
end
if resetautoshotspells[spell] then
swingmode = 1
self:Shoot()
end
end
function Swing:UNIT_SPELLCAST_START(event, unit, spell)
if unit == "player" and spell == slam then
slamstart = GetTime()
end
end
function Swing:UNIT_SPELLCAST_INTERRUPTED(event, unit, spell)
if unit == "player" and spell == slam and slamstart then
slamstart = nil
end
end
function Swing:UNIT_ATTACK(event, unit)
if unit == "player" then
if not swingmode then
return
elseif swingmode == 0 then
duration = UnitAttackSpeed("player")
else
duration = UnitRangedDamage("player")
end
durationtext:SetFormattedText("%.1f", duration)
end
end
function Swing:MeleeSwing()
duration = UnitAttackSpeed("player")
durationtext:SetFormattedText("%.1f", duration)
starttime = GetTime()
swingbar:Show()
end
function Swing:Shoot()
duration = UnitRangedDamage("player")
durationtext:SetFormattedText("%.1f", duration)
starttime = GetTime()
swingbar:Show()
end
function Swing:ApplySettings()
db = self.db.profile
if swingbar and self:IsEnabled() then
swingbar:ClearAllPoints()
swingbar:SetHeight(db.swingheight)
swingbar_width = Player.Bar:GetWidth() - 8
swingbar:SetWidth(swingbar_width)
swingbar:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
swingbar:SetBackdropColor(0,0,0)
swingbar:SetAlpha(db.swingalpha)
swingbar:SetScale(Player.db.profile.scale)
if db.swingposition == "bottom" then
swingbar:SetPoint("TOP", Player.Bar, "BOTTOM", 0, -1 * db.swinggap)
elseif db.swingposition == "top" then
swingbar:SetPoint("BOTTOM", Player.Bar, "TOP", 0, db.swinggap)
else -- L["Free"]
swingbar:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", db.x, db.y)
end
swingstatusbar:SetAllPoints(swingbar)
swingstatusbar:SetStatusBarTexture(media:Fetch("statusbar", Player.db.profile.texture))
swingstatusbar:GetStatusBarTexture():SetHorizTile(false)
swingstatusbar:GetStatusBarTexture():SetVertTile(false)
swingstatusbar:SetStatusBarColor(unpack(db.barcolor))
swingstatusbar:SetMinMaxValues(0, 1)
if db.durationtext then
durationtext:Show()
durationtext:ClearAllPoints()
durationtext:SetPoint("BOTTOMLEFT", swingbar, "BOTTOMLEFT")
durationtext:SetJustifyH("LEFT")
else
durationtext:Hide()
end
durationtext:SetFont(media:Fetch("font", Player.db.profile.font), 9)
durationtext:SetShadowColor( 0, 0, 0, 1)
durationtext:SetShadowOffset( 0.8, -0.8 )
durationtext:SetTextColor(1,1,1)
durationtext:SetNonSpaceWrap(false)
durationtext:SetWidth(swingbar_width)
if db.remainingtext then
remainingtext:Show()
remainingtext:ClearAllPoints()
remainingtext:SetPoint("BOTTOMRIGHT", swingbar, "BOTTOMRIGHT")
remainingtext:SetJustifyH("RIGHT")
else
remainingtext:Hide()
end
remainingtext:SetFont(media:Fetch("font", Player.db.profile.font), 9)
remainingtext:SetShadowColor( 0, 0, 0, 1)
remainingtext:SetShadowOffset( 0.8, -0.8 )
remainingtext:SetTextColor(1,1,1)
remainingtext:SetNonSpaceWrap(false)
remainingtext:SetWidth(swingbar_width)
end
end
do
local locked = true
local function nothing()
end
local function dragstart()
swingbar:StartMoving()
end
local function dragstop()
db.x = swingbar:GetLeft()
db.y = swingbar:GetBottom()
swingbar:StopMovingOrSizing()
end
local function setOpt(info, value)
db[info[#info]] = value
Swing:ApplySettings()
end
local function getOpt(info)
return db[info[#info]]
end
local function getColor(info)
return unpack(getOpt(info))
end
local function setColor(info, r, g, b, a)
setOpt(info, {r, g, b, a})
end
local options
function getOptions()
options = options or {
type = "group",
name = L["Swing"],
desc = L["Swing"],
get = getOpt,
set = setOpt,
order = 600,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
desc = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
order = 100,
},
barcolor = {
type = "color",
name = L["Bar Color"],
desc = L["Set the color of the swing timer bar"],
get = getColor,
set = setColor,
order = 103,
},
swingheight = {
type = "range",
name = L["Height"],
desc = L["Set the height of the swing timer bar"],
min = 1, max = 20, step = 1,
order = 104,
},
swingalpha = {
type = "range",
name = L["Alpha"],
desc = L["Set the alpha of the swing timer bar"],
min = 0.05, max = 1, bigStep = 0.05,
isPercent = true,
order = 105,
},
swingposition = {
type = "select",
name = L["Bar Position"],
desc = L["Set the position of the swing timer bar"],
values = {["top"] = L["Top"], ["bottom"] = L["Bottom"], ["free"] = L["Free"]},
order = 106,
},
lock = {
type = "toggle",
name = L["Lock"],
desc = L["Toggle Cast Bar lock"],
get = function()
return locked
end,
set = function(info, v)
if v then
swingbar.Hide = nil
swingbar:EnableMouse(false)
swingbar:SetScript("OnDragStart", nil)
swingbar:SetScript("OnDragStop", nil)
if not swingmode then
swingbar:Hide()
end
else
swingbar:Show()
swingbar:EnableMouse(true)
swingbar:SetScript("OnDragStart", dragstart)
swingbar:SetScript("OnDragStop", dragstop)
swingbar:SetAlpha(1)
swingbar.Hide = nothing
end
locked = v
end,
hidden = function()
return db.swingposition ~= "free"
end,
order = 107,
},
x = {
type = "range",
name = L["X"],
desc = L["Set an exact X value for this bar's position."],
min = -2560, max = 2560, bigStep = 1,
order = 108,
hidden = function()
return db.swingposition ~= "free"
end,
},
y = {
type = "range",
name = L["Y"],
desc = L["Set an exact Y value for this bar's position."],
min = -2560,
max = 2560,
order = 108,
hidden = function()
return db.swingposition ~= "free"
end,
},
swinggap = {
type = "range",
name = L["Gap"],
desc = L["Tweak the distance of the swing timer bar from the cast bar"],
min = -35, max = 35, step = 1,
order = 108,
},
durationtext = {
type = "toggle",
name = L["Duration Text"],
desc = L["Toggle display of text showing your total swing time"],
order = 109,
},
remainingtext = {
type = "toggle",
name = L["Remaining Text"],
desc = L["Toggle display of text showing the time remaining until you can swing again"],
order = 110,
},
},
}
return options
end
end
+113
View File
@@ -0,0 +1,113 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Target"
local Target = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
----------------------------
-- Upvalues
local UnitIsEnemy, UnitIsFriend = UnitIsEnemy, UnitIsFriend
local db, getOptions
local defaults = {
profile = Quartz3:Merge(Quartz3.CastBarTemplate.defaults,
{
--x = -- applied automatically in :ApplySettings()
y = 250,
h = 18,
w = 200,
texture = "LiteStep",
iconposition = "right",
showfriendly = true,
showhostile = true,
})
}
do
local options
function getOptions()
if not options then
options = Target.Bar:CreateOptions()
options.args.showfriendly = {
type = "toggle",
name = L["Show for Friends"],
desc = L["Show this castbar for friendly units"],
order = 101,
}
options.args.showhostile = {
type = "toggle",
name = L["Show for Enemies"],
desc = L["Show this castbar for hostile units"],
order = 101,
}
end
return options
end
end
function Target:OnInitialize()
self.db = Quartz3.db:RegisterNamespace(MODNAME, defaults)
db = self.db.profile
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Target"])
self.Bar = Quartz3.CastBarTemplate:new(self, "target", MODNAME, L["Target"], db)
end
function Target:OnEnable()
self.Bar:RegisterEvents()
self.Bar:RegisterEvent("PLAYER_TARGET_CHANGED")
self.Bar.PLAYER_TARGET_CHANGED = self.Bar.UpdateUnit
self.lastNotInterruptible = false
self:ApplySettings()
end
function Target:OnDisable()
self.Bar:UnregisterEvents()
self.Bar:Hide()
end
function Target:PreShowCondition(bar, unit)
if (not db.showfriendly and UnitIsFriend("player", unit)) or
(not db.showhostile and UnitIsEnemy("player", unit)) then
return true
end
end
function Target:ApplySettings()
db = self.db.profile
self.Bar:SetConfig(db)
if self:IsEnabled() then
self.Bar:ApplySettings()
end
end
function Target:Unlock()
self.Bar:Unlock()
end
function Target:Lock()
self.Bar:Lock()
end
+211
View File
@@ -0,0 +1,211 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Timer"
local Timer = Quartz3:NewModule(MODNAME, "AceEvent-3.0")
local Mirror = Quartz3:GetModule("Mirror")
----------------------------
-- Upvalues
local GetTime = GetTime
local unpack, pairs, ipairs, tonumber = unpack, pairs, ipairs, tonumber
local table_remove = table.remove
local external = Mirror.ExternalTimers
local thistimers = {}
local getOptions
function Timer:ChatHandler(msg)
if self:IsEnabled() then
if msg:match("^kill") then
local name = msg:match("^kill (.+)$")
if name then
external[name] = nil
for k, v in ipairs(thistimers) do
if v == name then
table_remove(thistimers, k)
break
end
end
self:SendMessage("Quartz3Mirror_UpdateCustom")
else
return Quartz3:Print(L["Usage: /quartztimer timername 60 or /quartztimer kill timername"])
end
else
local duration = tonumber(msg:match("^(%d+)"))
local name
if duration then
name = msg:match("^%d+ (.+)$")
else
duration = tonumber(msg:match("(%d+)$"))
if not duration then
return Quartz3:Print(L["Usage: /quartztimer timername 60 or /quartztimer 60 timername"])
end
name = msg:match("^(.+) %d+$")
end
if not name then
return Quartz3:Print(L["Usage: /quartztimer timername 60 or /quartztimer kill timername"])
end
local currentTime = GetTime()
external[name].startTime = currentTime
external[name].endTime = currentTime + duration
for k, v in ipairs(thistimers) do
if v == name then
table_remove(thistimers, k)
break
end
end
thistimers[#thistimers+1] = name
self:SendMessage("Quartz3Mirror_UpdateCustom")
end
end
end
function Timer:OnDisable()
for k, v in pairs(thistimers) do
external[v] = nil
thistimers[k] = nil
end
self:SendMessage("Quartz3Mirror_UpdateCustom")
end
local function chatHandler(message)
Timer:ChatHandler(message)
end
function Timer:OnInitialize()
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Timer"])
Quartz3:RegisterChatCommand("qt", chatHandler)
Quartz3:RegisterChatCommand("quartzt", chatHandler)
Quartz3:RegisterChatCommand("quartztimer", chatHandler)
end
do
local newname, newlength
local options
function getOptions()
if not options then
options = {
type = "group",
name = L["Timer"],
order = 600,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
desc = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
order = 99,
width = "full",
},
newtimername = {
type = "input",
name = L["New Timer Name"],
desc = L["Set a name for the new timer"],
get = function()
return newname or ""
end,
set = function(info, v)
newname = v
end,
order = 100,
},
newtimerlength = {
type = "input",
name = L["New Timer Length"],
desc = L["Length of the new timer, in seconds"],
get = function()
return newlength or 0
end,
set = function(info, v)
newlength = tonumber(v)
end,
usage = L["<Time in seconds>"],
order = 101,
},
makenewtimer = {
type = "execute",
name = L["Make Timer"],
desc = L["Make a new timer using the above settings. NOTE: it may be easier for you to simply use the command line to make timers, /qt"],
func = function()
local currentTime = GetTime()
external[newname].startTime = currentTime
external[newname].endTime = currentTime + newlength
for k, v in ipairs(thistimers) do
if v == newname then
table_remove(thistimers, k)
break
end
end
thistimers[#thistimers+1] = newname
Timer:SendMessage("Quartz3Mirror_UpdateCustom")
newname = nil
newlength = nil
end,
disabled = function()
return not (newname and newlength)
end,
order = -3,
},
nl = {
type = "description",
name = "",
order = -2,
},
killtimer = {
type = "select",
name = L["Stop Timer"],
desc = L["Select a timer to stop"],
get = function()
return ""
end,
set = function(info, name)
if name then
external[name] = nil
for k, v in ipairs(thistimers) do
if v == name then
table_remove(thistimers, k)
break
end
end
Timer:SendMessage("Quartz3Mirror_UpdateCustom")
end
end,
values = thistimers,
order = -1,
},
},
}
end
return options
end
end
+195
View File
@@ -0,0 +1,195 @@
--[[
Copyright (C) 2006-2007 Nymbia
Copyright (C) 2010 Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
]]
local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3")
local L = LibStub("AceLocale-3.0"):GetLocale("Quartz3")
local MODNAME = "Tradeskill"
local Tradeskill = Quartz3:NewModule(MODNAME, "AceEvent-3.0", "AceHook-3.0")
local Player = Quartz3:GetModule("Player")
local TimeFmt = Quartz3.Util.TimeFormat
----------------------------
-- Upvalues
local GetTime, UnitCastingInfo = GetTime, UnitCastingInfo
local unpack, tonumber, format = unpack, tonumber, format
local getOptions
local castBar, castBarText, castBarTimeText, castBarIcon, castBarSpark, castBarParent
local repeattimes, castname, duration, totaltime, starttime, casting, bail
local completedcasts = 0
local restartdelay = 1
local function tradeskillOnUpdate()
local currentTime = GetTime()
if casting then
local elapsed = duration * completedcasts + currentTime - starttime
castBar:SetValue(elapsed)
local perc = (currentTime - starttime) / duration
castBarSpark:ClearAllPoints()
castBarSpark:SetPoint("CENTER", castBar, "LEFT", perc * Player.db.profile.w, 0)
if Player.db.profile.hidecasttime then
castBarTimeText:SetFormattedText(TimeFmt(totaltime - elapsed))
else
castBarTimeText:SetFormattedText("%s / %s", format(TimeFmt(totaltime - elapsed)), format(TimeFmt(totaltime)))
end
else
if (starttime + duration + restartdelay < currentTime) or (completedcasts >= repeattimes) or bail or completedcasts == 0 then
Player.Bar.fadeOut = true
Player.Bar.stopTime = currentTime
castBar:SetValue(duration * repeattimes)
castBarTimeText:SetText("")
castBarSpark:Hide()
castBarParent:SetScript("OnUpdate", Player.Bar.OnUpdate)
castBar:SetMinMaxValues(0, 1)
else
local elapsed = duration * completedcasts
castBar:SetValue(elapsed)
castBarSpark:ClearAllPoints()
castBarSpark:SetPoint("CENTER", castBar, "LEFT", Player.db.profile.w, 0)
if Player.db.profile.hidecasttime then
castBarTimeText:SetFormattedText(TimeFmt(totaltime - elapsed))
else
castBarTimeText:SetFormattedText("%s / %s", format(TimeFmt(totaltime - elapsed)), format(TimeFmt(totaltime)))
end
end
end
end
function Tradeskill:OnInitialize()
self:SetEnabledState(Quartz3:GetModuleEnabled(MODNAME))
Quartz3:RegisterModuleOptions(MODNAME, getOptions, L["Tradeskill Merge"])
end
function Tradeskill:OnEnable()
self:RawHook(Player, "UNIT_SPELLCAST_START")
self:RegisterEvent("UNIT_SPELLCAST_STOP")
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
self:Hook("DoTradeSkill", true)
end
function Tradeskill:UNIT_SPELLCAST_START(object, event, unit)
if unit ~= "player" then
return self.hooks[object].UNIT_SPELLCAST_START(object, event, unit)
end
local spell, _, displayName, icon, startTime, endTime, isTradeskill = UnitCastingInfo(unit)
if isTradeskill then
repeattimes = repeattimes or 1
duration = (endTime - startTime) / 1000
totaltime = duration * (repeattimes or 1)
starttime = GetTime()
casting = true
Player.Bar.fadeOut = nil
castname = spell
bail = nil
Player.Bar.endTime = nil
castBar:SetStatusBarColor(unpack(Quartz3.db.profile.castingcolor))
castBar:SetMinMaxValues(0, totaltime)
castBar:SetValue(0)
castBarParent:Show()
castBarParent:SetScript("OnUpdate", tradeskillOnUpdate)
castBarParent:SetAlpha(Player.db.profile.alpha)
local numleft = repeattimes - completedcasts
if numleft <= 1 then
castBarText:SetText(displayName)
else
castBarText:SetFormattedText("%s (%s)", displayName, numleft)
end
castBarSpark:Show()
castBarIcon:SetTexture(icon)
else
castBar:SetMinMaxValues(0, 1)
return self.hooks[object].UNIT_SPELLCAST_START(object, event, unit)
end
end
function Tradeskill:UNIT_SPELLCAST_STOP(event, unit)
if unit ~= "player" then
return
end
casting = false
end
function Tradeskill:UNIT_SPELLCAST_SUCCEEDED(event, unit, spell)
if unit ~= "player" then
return
end
if castname == spell then
completedcasts = completedcasts + 1
end
end
function Tradeskill:UNIT_SPELLCAST_INTERRUPTED(event, unit)
if unit ~= "player" then
return
end
bail = true
end
function Tradeskill:DoTradeSkill(index, num)
completedcasts = 0
repeattimes = tonumber(num) or 1
end
function Tradeskill:ApplySettings()
castBarParent = Player.Bar
castBar = Player.Bar.Bar
castBarText = Player.Bar.Text
castBarTimeText = Player.Bar.TimeText
castBarIcon = Player.Bar.Icon
castBarSpark = Player.Bar.Spark
end
do
local options
function getOptions()
if not options then
options = {
type = "group",
name = L["Tradeskill Merge"],
order = 600,
args = {
toggle = {
type = "toggle",
name = L["Enable"],
desc = L["Enable"],
get = function()
return Quartz3:GetModuleEnabled(MODNAME)
end,
set = function(info, v)
Quartz3:SetModuleEnabled(MODNAME, v)
end,
},
},
}
end
return options
end
end