/
if not DotIt then |
error("DotIt has to be loaded first") |
end |
local newList, del, deepDel, deepCopy = DotIt.sb:GetRecyclingFunctions() |
local config = DotIt:NewModule("config") |
local aceconfig = LibStub:GetLibrary("AceConfig-3.0") |
local acedialog = LibStub:GetLibrary("AceConfigDialog-3.0") |
local acedboptions = LibStub:GetLibrary("AceDBOptions-3.0") |
local tmp = newList() |
local lsm = LibStub:GetLibrary("LibSharedMedia-3.0") |
DotIt.sp = DotIt:GetModule("spells") |
local function refreshScale() |
DotIt.sb:RedrawScale(DotIt.db.profile.width, DotIt.db.profile.maxtime, DotIt.db.profile.steps, |
DotIt.db.profile.maxneg, DotIt.db.profile.position,DotIt.db.profile.horizontal, |
DotIt.db.profile.loflag, DotIt.db.profile.scaletexture, DotIt.db.profile.locked, DotIt.db.profile.scale, |
DotIt.db.profile.height, DotIt.db.profile.fonts, DotIt.db.profile.scaletext, DotIt.db.profile.amaxtimes, |
DotIt.db.profile.ehidescale, DotIt.db.profile.eiconpos) |
end |
local function isSpell(id) |
if GetSpellInfo(id) then return true end |
end |
local function isAV(id, typ) |
if DotIt.db.profile.spells[id..typ] then return true end |
end |
local function insertDefaultSpell(info, db) |
db.defaults.profile.spells[info.spellid..info.typ] = deepCopy(info) |
end |
function config:insertSpell(info, db) |
if info and info.typ then |
if not (info.typ == "Dots" or info.typ == "Shortbuffs" or info.typ == "Debuffs" or info.typ == "CCs" or info.typ == "Cooldowns" or info.typ == "ItemCooldowns" or info.typ == "SharedDebuffs" or info.typ == "InternalCooldowns") then |
return |
end |
else |
return |
end |
db.profile.spells[info.spellid..info.typ] = deepCopy(info) |
if not DotItConfig.args.spells.args[info.typ].args then DotItConfig.args.spells.args[info.typ].args = {} end |
DotItConfig.args.spells.args[info.typ].args[tostring(info.spellid)] = { |
name = function() |
if select(2, GetSpellInfo(info.spellid)) then |
if select(2, GetSpellInfo(info.spellid)) ~= "" then |
return GetSpellInfo(info.spellid) .. " (" .. select(2, GetSpellInfo(info.spellid)) .. ")" |
else |
return GetSpellInfo(info.spellid) |
end |
else |
return GetSpellInfo(info.spellid) |
end |
end, |
type = "group" |
} |
DotItConfig.args.spells.args[info.typ].args[tostring(info.spellid)].args = { |
duration = { |
name = "Duration", |
desc = "This should return the time. For example if you want that this spell is 10 seconds then type: return 10 (you can use any lua code here).", |
multiline = true, |
type = "input", |
get = function() return tostring(DotIt.db.profile.spells[info.spellid..info.typ].duration or "") end, |
set = function(self, inp) |
if tonumber(inp) then |
DotIt.db.profile.spells[info.spellid..info.typ].duration = tonumber(inp) |
else |
DotIt.db.profile.spells[info.spellid..info.typ].duration = inp |
end |
end, |
}, |
disabled = { |
name = "Disabled", |
type = "toggle", |
get = function() return DotIt.db.profile.spells[info.spellid..info.typ].disabled end, |
set = function(self, inp) DotIt.db.profile.spells[info.spellid..info.typ].disabled = inp end, |
}, |
applications = { |
name = "Applications", |
desc = "The maximum number of applications that are possible for this spell. This leads to a changing alpha value. If you want that your spell always uses the alpha value (instead of actual_applications/maxapplications) from the color input then leave this at one.", |
type = "range", |
min = 1, |
max = 10, |
step = 1, |
get = function() return DotIt.db.profile.spells[info.spellid..info.typ].applications or 1 end, |
set = function(self, inp) |
if inp == 0 then inp = 1 end |
DotIt.db.profile.spells[info.spellid..info.typ].applications = tonumber(inp) end, |
}, |
color = { |
name = "Positive color", |
desc = "This value overrides the default values for this spell. For the default values see the color dialogue.", |
type = "color", |
hasAlpha = true, |
get = function() if DotIt.db.profile.spells[info.spellid..info.typ].color then |
return DotIt.db.profile.spells[info.spellid..info.typ].color.r, DotIt.db.profile.spells[info.spellid..info.typ].color.g, DotIt.db.profile.spells[info.spellid..info.typ].color.b, DotIt.db.profile.spells[info.spellid..info.typ].color.a |
end |
end, |
set = function(self, r, g, b, a) DotIt.db.profile.spells[info.spellid..info.typ].color = {r = r, g = g, b = b, a = a} end, |
}, |
colorzero = { |
name = "Negative color", |
desc = "This value overrides the default values for this spell. For the default values see the color dialogue.", |
type = "color", |
hasAlpha = true, |
get = function() if DotIt.db.profile.spells[info.spellid..info.typ].colorzero then |
return DotIt.db.profile.spells[info.spellid..info.typ].colorzero.r, DotIt.db.profile.spells[info.spellid..info.typ].colorzero.g, DotIt.db.profile.spells[info.spellid..info.typ].colorzero.b, DotIt.db.profile.spells[info.spellid..info.typ].colorzero.a |
end |
end, |
set = function(self, rc, gc, bc, ac) DotIt.db.profile.spells[info.spellid..info.typ].colorzero = {r = rc, g = gc, b = bc, a = ac} end, |
}, |
typ = { |
name = "Type", |
desc = "The type of the Spell", |
type = "select", |
values = {Dots = "Dots", Shortbuffs = "Short Buffs", Debuffs = "Debuffs", SharedDebuffs = "Shared debuffs", InternalCooldowns = "Internal cooldowns", CCs = "CCs", Cooldowns = "Spell cooldowns", ItemCooldowns = "Item cooldowns"}, |
get = function() return DotIt.db.profile.spells[info.spellid..info.typ].typ end, |
set = function(self, inp) DotIt.db.profile.spells[info.spellid..info.typ].typ = inp end, |
}, |
class = { |
name = "Type", |
desc = "The type of the Spell", |
type = "select", |
values = {["DEATHKNIGHT"] = "Death Knight", ["DRUID"] = "Druid", ["HUNTER"] = "Hunter", ["MAGE"] = "Mage", ["PALADIN"] = "Paladin", ["ROGUE"] = "Rogue", ["SHAMAN"] = "Shaman", ["WARLOCK"] = "Warlock", ["WARRIOR"] = "Warrior" , ["GENERAL"] = "General"}, |
get = function() |
if not DotIt.db.profile.spells[info.spellid..info.typ].class then DotIt.db.profile.spells[info.spellid..info.typ].class = select(2, UnitClass("player")) end |
return DotIt.db.profile.spells[info.spellid..info.typ].class |
end, |
set = function(self, inp) DotIt.db.profile.spells[info.spellid..info.typ].class = inp end, |
}, |
} |
end |
function config:insertConfigSpell() |
if isSpell(tmp.spellid) and not isAV(tmp.spellid, tmp.typ) then |
if not tmp.spellid or tmp.spellid == "" then error("Insert a spell ID!") end |
if not GetSpellInfo(tmp.spellid) then error("Invalid spell ID!") end |
if not tmp.duration or tmp.duration == "" then error("Insert a duration!") end |
if type(tmp.duration) == "number" then tmp.duration = DotIt.db.profile.spells[tmp.typ..tmp.duration] end |
loadstring(tmp.duration) |
config:insertSpell(deepCopy(tmp), DotIt.db) |
end |
deepDel(tmp) |
tmp = newList() |
end |
DotItConfig = { |
type = "group", |
args = { |
general = { |
name = "General", |
desc = "General options", |
type = "group", |
get = function(info) |
local leaf = info[#info] |
if leaf ~= "owndots" then |
leaf = "e"..leaf |
end |
return DotIt.db.profile[leaf] |
end, |
set = function(info, inp) |
local leaf = info[#info] |
if leaf ~= "owndots" then |
leaf = "e"..leaf |
end |
DotIt.db.profile[leaf] = inp |
if leaf == "iconpos" then |
DotIt.sb:SetIcon(inp) |
end |
end, |
args = { |
locked = { |
name = "Locked", |
desc = "Locks or unlocks the bar (use ALT+Click to drag when unlocked!)", |
type = "toggle", |
get = function() |
return DotIt.db.profile.locked |
end, |
set = function(self, lock) |
DotIt.db.profile.locked = lock |
DotIt.sb:SetLock(lock) |
end, |
order = 0, |
}, |
owndots = { |
name = "Only debuffs from Target", |
desc = "Shows only the dots for your current target", |
type = "toggle", |
}, |
iconpos = { |
name = "Icon out of the bar", |
desc = "As soon as the icon reaches zero the bar will fade", |
type = "toggle", |
}, |
hidescale = { |
name = "Hide the scale", |
desc = "... if there is nothing to track", |
type = "toggle", |
}, |
removedots = { |
name = "Remove debuffs on target change", |
desc = "Removes all the debuff bars that do not belong to your current target", |
type = "toggle", |
get = function() |
return DotIt.db.profile.removedots |
end, |
set = function(info, inp) |
DotIt.db.profile.removedots = inp |
if inp then |
DotIt:RegisterEvent("UNIT_TARGET", "TargetChanged") |
else |
DotIt:UnregisterEvent("UNIT_TARGET") |
end |
end, |
}, |
dots = { |
name = "Enable dots", |
type = "toggle", |
}, |
cooldowns = { |
name = "Enable cooldowns", |
type = "toggle", |
}, |
debuffs = { |
name = "Enable debuffs", |
type = "toggle", |
}, |
ccs = { |
name = "Enable ccs", |
type = "toggle", |
}, |
shortbuffs = { |
name = "Enable short buffs", |
type = "toggle", |
}, |
internalcooldowns = { |
name = "Enable internal cooldowns", |
desc = "Mainly like the shortbuffs category but the bar will not be removed when the buff fades", |
type = "toggle", |
}, |
shareddebuffs = { |
name = "Enable shared debuffs", |
desc = "Shared debuffs are things that can be refreshed from other people (eg Sunder Armor)", |
type = "toggle", |
}, |
}, |
}, |
additionalscale = { |
name = "Logarithmic scale", |
type = "group", |
args = { |
segments = { |
name = "Input segments", |
desc = "Every segement is seperated by a comma", |
type = "input", |
multiline = true, |
get = function(info) |
if not DotIt.db.profile.amaxtimes then return "" end |
local ret = "" |
for k, v in pairs(DotIt.db.profile.amaxtimes) do |
ret = ret .. v .. ", " |
end |
if ret then |
ret = string.sub(ret, 1, string.len(ret) - 2) |
end |
return ret |
end, |
set = function(info, inp) |
deepDel(DotIt.db.profile.amaxtimes) |
DotIt.db.profile.amaxtimes = nil |
DotIt.db.profile.amaxtimes = newList() |
if inp and inp ~= "" then |
for _, v in pairs({strsplit(",", inp)}) do |
tinsert(DotIt.db.profile.amaxtimes, tonumber(strtrim(v))) |
end |
end |
refreshScale() |
end, |
}, |
}, |
}, |
view = { |
name = "View", |
type = "group", |
args = { |
scaletext = { |
name = "Scale text", |
desc = "Hides or shows the text on the scale", |
type = "toggle", |
order = 0, |
get = function() return DotIt.db.profile.scaletext end, |
set = function(self, inp) DotIt.db.profile.scaletext = inp |
refreshScale() |
end, |
}, |
textures = { |
type = "group", |
name = "Textures", |
get = function(info) |
for k, v in pairs(lsm:HashTable("statusbar")) do |
if v == DotIt.db.profile[info[#info]] then |
return k |
end |
end |
end, |
set = function(info, inp) DotIt.db.profile[info[#info]] = lsm:Fetch("statusbar",inp) |
refreshScale() |
end, |
args = { |
scaletexture = { |
order = 1, |
name = "Scaletexture", |
desc = "The texture of the scale", |
type = "select", |
dialogControl = 'LSM30_Statusbar', |
values = AceGUIWidgetLSMlists.statusbar , |
}, |
bartexture = { |
order = 2, |
name = "Bartexture", |
desc = "The texture of the bar", |
type = "select", |
dialogControl = 'LSM30_Statusbar', |
values = AceGUIWidgetLSMlists.statusbar, |
}, |
}, |
}, |
position = { |
type = "group", |
name = "Position", |
desc = "The Position on the screen (bottom left corner)", |
args = { |
x = { |
name = "X", |
type = "input", |
validate = function(self, inp) |
if tonumber(inp) then |
return true |
end |
return "Only numbers are a valid input" |
end, |
get = function() return tostring(DotIt.db.profile.position.x) end, |
set = function(self, inp) DotIt.db.profile.position.x = tonumber(inp) |
DotIt.sb:SetPosition(DotIt.db.profile.position.x, |
DotIt.db.profile.position.y) |
end, |
}, |
y = { |
name = "Y", |
type = "input", |
validate = function(self, inp) |
if tonumber(inp) then |
return true |
end |
return "Only numbers are a valid input" |
end, |
get = function() return tostring(DotIt.db.profile.position.y) end, |
set = function(self, inp) DotIt.db.profile.position.y = tonumber(inp) |
DotIt.sb:SetPosition(DotIt.db.profile.position.x, |
DotIt.db.profile.position.y) |
end, |
}, |
}, |
}, |
width = { |
order = 3, |
name = "Scalesize", |
desc = "The size of the scale.", |
type = "range", |
min = 10, |
max = 1000, |
step = 1, |
get = function() return DotIt.db.profile.width end, |
set = function(self, inp) DotIt.db.profile.width = inp |
refreshScale() |
end, |
}, |
height = { |
order = 4, |
name = "Barsize", |
desc = "The size of the bars.", |
type = "range", |
min = 10, |
max = 100, |
step = 1, |
get = function() return DotIt.db.profile.height end, |
set = function(self, inp) DotIt.db.profile.height = inp |
refreshScale() |
end, |
}, |
scale = { |
order = 5, |
name = "Scale", |
desc = "Scales everything.", |
type = "range", |
min = 0.5, |
max = 3.0, |
step = 0.1, |
isPercent = true, |
get = function() return DotIt.db.profile.scale end, |
set = function(self, inp) DotIt.db.profile.scale = inp |
DotIt.sb:SetScale(inp) |
end, |
}, |
maxtime = { |
order = 6, |
name = "Maximum time", |
type = "range", |
min = 5, |
max = 100, |
step = 1, |
get = function() return DotIt.db.profile.maxtime end, |
set = function(self, inp) DotIt.db.profile.maxtime = inp |
refreshScale() |
end, |
}, |
steps = { |
order = 7, |
name = "Steps", |
desc = "In how many steps the bar should be devided (if you have a 10 second bar and want a mark every second then you should input 10 here", |
type = "range", |
min = 1, |
max = 20, |
step = 1, |
get = function() return DotIt.db.profile.steps end, |
set = function(self, inp) DotIt.db.profile.steps = inp |
refreshScale() |
end, |
}, |
maxneg = { |
order = 8, |
name = "Maximum negative time", |
desc = "Time limit where the bar should be truncated (If you want standard bars that do not show negative values use 0 here)", |
type = "range", |
min = -10, |
max = 0, |
step = 1, |
get = function() return DotIt.db.profile.maxneg end, |
set = function(self, inp) DotIt.db.profile.maxneg = inp |
refreshScale() |
end, |
}, |
horizontal = { |
order = 1, |
name = "Horizontal", |
desc = "If we use a horizontal (true) or vertical (false) scale and bars.", |
type = "toggle", |
get = function() return DotIt.db.profile.horizontal end, |
set = function(self, inp) DotIt.db.profile.horizontal = inp |
refreshScale() |
end, |
}, |
loflag = { |
order = 2, |
name = "Left/above Flag", |
desc = "If this is true the scale will be above or on the left side of the bars.", |
type = "toggle", |
get = function() return DotIt.db.profile.loflag end, |
set = function(self, inp) DotIt.db.profile.loflag = inp |
refreshScale() |
end, |
}, |
barcolors = { |
order = 7, |
name = "Barcolors", |
desc = "Sets the colors for the bars.", |
type = "group", |
get = function(info) |
local l1, l2 = _, info[#info] |
if info[#info-1] == "positive" then |
l1 = "barcolor" |
else |
l1 = "barcolorzero" |
end |
return DotIt.db.profile[l1][l2].r, |
DotIt.db.profile[l1][l2].g, |
DotIt.db.profile[l1][l2].b, |
DotIt.db.profile[l1][l2].a |
end, |
set = function(info, r, g, b, a) |
local l1, l2 = _, info[#info] |
if info[#info-1] == "positive" then |
l1 = "barcolor" |
else |
l1 = "barcolorzero" |
end |
DotIt.db.profile[l1][l2].r = r |
DotIt.db.profile[l1][l2].g = g |
DotIt.db.profile[l1][l2].b = b |
DotIt.db.profile[l1][l2].a = a |
end, |
args = { |
positive = { |
order = 120, |
name = "Positive Barcolor", |
desc = "The color of the positive area of the bar.", |
type = "group", |
args = { |
arcane = { |
name = "Arcane", |
type = "color", |
hasAlpha = true, |
}, |
fire = { |
name = "Fire", |
type = "color", |
hasAlpha = true, |
}, |
nature = { |
name = "Nature", |
type = "color", |
hasAlpha = true, |
}, |
frost = { |
name = "Frost", |
type = "color", |
hasAlpha = true, |
}, |
shadow = { |
name = "Shadow", |
type = "color", |
hasAlpha = true, |
}, |
holy = { |
name = "Holy", |
type = "color", |
hasAlpha = true, |
}, |
physical = { |
name = "Physical", |
type = "color", |
hasAlpha = true, |
}, |
}, |
}, |
negative = { |
order = 121, |
name = "Negative Barcolor", |
desc = "The color of the negative area of the bar.", |
type = "group", |
args = { |
arcane = { |
name = "Arcane", |
type = "color", |
hasAlpha = true, |
}, |
fire = { |
name = "Fire", |
type = "color", |
hasAlpha = true, |
}, |
nature = { |
name = "Nature", |
type = "color", |
hasAlpha = true, |
}, |
frost = { |
name = "Frost", |
type = "color", |
hasAlpha = true, |
}, |
shadow = { |
name = "Shadow", |
type = "color", |
hasAlpha = true, |
}, |
holy = { |
name = "Holy", |
type = "color", |
hasAlpha = true, |
}, |
physical = { |
name = "Physical", |
type = "color", |
hasAlpha = true, |
}, |
}, |
}, |
}, |
}, |
fonts = { |
order = 200, |
name = "Fonts", |
type = "group", |
get = function(info) |
local l1, l2 = info[#info-1], info[#info] |
return DotIt.db.profile.fonts[l1][l2] |
end, |
set = function(info, inp) |
local l1, l2 = info[#info-1], info[#info] |
DotIt.db.profile.fonts[l1][l2] = inp |
refreshScale() |
end, |
args = { |
bar = { |
name = "Font of the bar", |
type = "group", |
desc = "The font of the bar.", |
args = { |
font = { |
order = 1, |
name = "Font", |
type = "select", |
dialogControl = 'LSM30_Font', |
values = AceGUIWidgetLSMlists.font, |
get = function() |
for k, v in pairs(lsm:HashTable("font")) do |
if v == DotIt.db.profile.fonts.bar.font then |
return k |
end |
end |
end, |
set = function(info, inp) |
DotIt.db.profile.fonts.bar.font = lsm:Fetch("font",inp) |
end, |
}, |
size = { |
order = 2, |
name = "Size", |
type = "range", |
min = 10, |
max = 30, |
}, |
monochrome = { |
order = 3, |
name = "Monochrome", |
type = "toggle", |
}, |
outline = { |
order = 4, |
name = "Outline", |
type = "toggle", |
}, |
thickoutline = { |
order = 5, |
name = "Thick Outline", |
type = "toggle", |
}, |
}, |
}, |
scale = { |
name = "Font of the scale", |
type = "group", |
desc = "The font of the scale.", |
args = { |
font = { |
order = 1, |
name = "Font", |
type = "select", |
dialogControl = 'LSM30_Font', |
values = AceGUIWidgetLSMlists.font, |
get = function() |
for k, v in pairs(lsm:HashTable("font")) do |
if v == DotIt.db.profile.fonts.scale.font then |
return k |
end |
end |
end, |
set = function(info, inp) |
DotIt.db.profile.fonts.scale.font = lsm:Fetch("font",inp) |
end, |
}, |
size = { |
order = 2, |
name = "Size", |
type = "range", |
min = 10, |
max = 30, |
}, |
monochrome = { |
order = 3, |
name = "Monochrome", |
type = "toggle", |
}, |
outline = { |
order = 4, |
name = "Outline", |
type = "toggle", |
}, |
thickoutline = { |
order = 5, |
name = "Thick Outline", |
type = "toggle", |
}, |
}, |
}, |
}, |
}, |
}, |
}, |
spells = { |
order = 999, |
name = "Spells", |
type = "group", |
args = { |
Insert = { |
order = 0, |
name = "Insert new Spell", |
type = "group", |
args = { |
spellid = { |
name = "Spell Id", |
type = "input", |
get = function() return tostring(tmp.spellid or "") end, |
set = function(self, inp) |
if not tonumber(inp) then |
-- inp is a link |
local temp = string.match(inp, "Hspell:(%d+)") |
if temp and GetSpellInfo(temp) then tmp.spellid = tonumber(temp) return end |
temp = string.match(GetSpellLink(inp), "Hspell:(%d+)") |
if temp and GetSpellInfo(temp) then tmp.spellid = tonumber(temp) return end |
error("Input has to be a number, a spell link or a spell name (last two options are only possible for spells in your spellbook!)") |
else tmp.spellid = tonumber(inp) end |
end, |
}, |
duration = { |
name = "Duration", |
desc = "This should return the time. For example if you want that this spell is 10 seconds then type: return 10 (you can use any lua code here).", |
multiline = true, |
type = "input", |
get = function() return tostring(tmp.duration or "") end, |
set = function(self, inp) |
if tonumber(inp) then |
tmp.duration = tonumber(inp) |
else |
tmp.duration = inp |
end |
end, |
}, |
applications = { |
name = "Applications", |
desc = "The maximum number of applications that are possible for this spell. This leads to a changing alpha value. If you want that your spell always uses the alpha value (instead of actual_applications/maxapplications) from the color input then leave this at one.", |
type = "range", |
min = 1, |
max = 10, |
step = 1, |
get = function() return tmp.applications or 1 end, |
set = function(self, inp) |
if inp == 0 then inp = 1 end |
tmp.applications = inp end, |
}, |
color = { |
name = "Positive color", |
desc = "This value overrides the default values for this spell. For the default values see the color dialogue.", |
type = "color", |
hasAlpha = true, |
get = function() if tmp.color then |
return tmp.color.r, tmp.color.g, tmp.color.b, tmp.color.a |
end |
end, |
set = function(self, rc, gc, bc, ac) |
tmp.color = {r = rc, g = gc, b = bc, a = ac} end, |
}, |
colorzero = { |
name = "Negative color", |
desc = "This value overrides the default values for this spell. For the default values see the color dialogue.", |
type = "color", |
hasAlpha = true, |
get = function() if tmp.colorzero then |
return tmp.colorzero.r, tmp.colorzero.g, tmp.colorzero.b, tmp.colorzero.a |
end |
end, |
set = function(self, rc, gc, bc, ac) tmp.colorzero = {r = rc, g = gc, b = bc, a = ac} end, |
}, |
typ = { |
name = "Type", |
desc = "The type of the Spell", |
type = "select", |
values = {Dots = "Dots", Shortbuffs = "Short Buffs", SharedDebuffs = "Shared debuffs", InternalCooldowns = "Internal cooldowns", Debuffs = "Debuffs", CCs = "CCs", Cooldowns = "Spell cooldowns", ItemCooldowns = "Item cooldowns"}, |
get = function() return tmp.typ end, |
set = function(self, inp) tmp.typ = inp end, |
}, |
class = { |
name = "Type", |
desc = "The type of the Spell", |
type = "select", |
values = {["DEATHKNIGHT"] = "Death Knight", ["DRUID"] = "Druid", ["HUNTER"] = "Hunter", ["MAGE"] = "Mage", ["PALADIN"] = "Paladin", ["ROGUE"] = "Rogue", ["SHAMAN"] = "Shaman", ["WARLOCK"] = "Warlock", ["WARRIOR"] = "Warrior", ["GENERAL"] = "General"}, |
get = function() |
if not tmp.class then tmp.class = select(2, UnitClass("player")) end |
return tmp.class |
end, |
set = function(self, inp) tmp.class = inp end, |
}, |
exec = { |
order = -1, |
name = "Insert", |
desc = "Insert the details you entered.", |
type = "execute", |
func = function() config:insertConfigSpell() end, |
}, |
}, |
}, |
["Dots"] = { |
name = "Dots", |
type = "group", |
args = {}, |
}, |
["Shortbuffs"] = { |
name = "Short buffs", |
desc = "Important buffs", |
type = "group", |
args = {}, |
}, |
["Debuffs"] = { |
name = "Debuffs", |
desc = "Effects that don't belong to the other categories", |
type = "group", |
args = {}, |
}, |
["CCs"] = { |
name = "CCs", |
desc = "CCs and Silences", |
type = "group", |
args = {}, |
}, |
["Cooldowns"] = { |
name = "Spell cooldowns", |
type = "group", |
args = {}, |
}, |
["ItemCooldowns"] = { |
name = "Item cooldowns", |
type = "group", |
args = {}, |
}, |
["InternalCooldowns"] = { |
name = "Internal cooldowns", |
type = "group", |
args = {}, |
}, |
["SharedDebuffs"] = { |
name = "Shared Debuffs", |
desc = "Debuffs which can be refreshed from other people", |
type = "group", |
args = {}, |
}, |
}, |
}, |
}, |
} |
local function initSpells(db) |
for id, info in pairs(db.profile.spells) do |
if type(info) == "number" then info = nil else |
config:insertSpell(info, db) |
end |
end |
end |
local function initDefaultSpells(data) |
-- class |
local db = DotIt.Spells[select(2, UnitClass("player"))] |
local info = newList() |
info.class = select(2, UnitClass("player")) |
for k, tab in pairs(db) do |
info.typ = k |
for id, val in pairs(tab) do |
info.spellid = id |
if type(val) == "number" then |
val = tab[tab[id]] |
end |
info.duration = val |
-- duration, applications, color, colorzero |
if not val then |
insertDefaultSpell(deepCopy(info), data) |
else |
local func = loadstring(val) |
if func then |
_, info.applications, info.color, info.colorzero = func(sp) |
if not info.applications then info.applications = 1 end |
insertDefaultSpell(deepCopy(info), data) |
end |
end |
end |
end |
-- important for everyone |
del(info) |
db = DotIt.Spells["GENERAL"] |
info = newList() |
info.class = "GENERAL" |
for k, tab in pairs(db) do |
info.typ = k |
for id, val in pairs(tab) do |
info.spellid = id |
if type(val) == "number" then |
val = tab[tab[id]] |
end |
info.duration = val |
-- duration, applications, color, colorzero |
if not val then |
insertDefaultSpell(deepCopy(info), data) |
else |
local func = loadstring(val) |
if func then |
_, info.applications, info.color, info.colorzero = func() |
if not info.applications then info.applications = 1 end |
insertDefaultSpell(deepCopy(info), data) |
end |
end |
end |
end |
end |
-- duration, applications, color, colorzero |
function DotIt:GetSpellInfo(typ, id) |
if not DotIt.db.profile["e"..string.lower(typ)] then return false end |
if DotIt.db.profile.spells[id..typ] and DotIt.db.profile.spells[id..typ].typ == typ and not DotIt.db.profile.spells[id..typ].disabled then |
local dur |
if DotIt.db.profile.spells[id..typ].duration == "" then DotIt.db.profile.spells[id..typ].duration = nil end |
if DotIt.db.profile.spells[id..typ].duration then |
if type(DotIt.db.profile.spells[id..typ].duration) == "number" then |
dur = DotIt.db.profile.spells[DotIt.db.profile.spells[id..typ].duration].duration |
else |
dur = DotIt.db.profile.spells[id..typ].duration |
end |
else |
dur = nil |
end |
if dur then |
dur = loadstring(dur) |
dur = dur() |
else |
dur = 0 |
end |
return dur, DotIt.db.profile.spells[id..typ].applications, deepCopy(DotIt.db.profile.spells[id..typ].color), deepCopy(DotIt.db.profile.spells[id..typ].colorzero) |
end |
return false |
end |
function config:OnInitialize() |
self = DotIt |
local db = newList() |
db.defaults = newList() |
db.defaults.profile = { |
amaxtimes = {}, eiconpos = false, ehidescale = false, |
owndots = false, scaletext = true, edots = true, edebuffs = true, |
eccs = true, eshortbuffs = true, |
spells = {}, |
scale = 1.0, |
height = 10, |
fonts = {scale = {font = "Fonts\\FRIZQT__.TTF", size = 11, outline = true, |
thickoutline = false, monochrome = true}, |
bar = {font = "Fonts\\FRIZQT__.TTF", size = 11, outline = true, |
thickoutline = false, monochrome = true} |
}, |
position = {x = 600, y = 400}, |
width = 200, maxtime = 30, |
steps = 5, maxneg = -1, horizontal = true, |
loflag = false, |
barcolor = { |
physical = {r = 0, g = 0, b = 0, a = 1.0}, |
nature = {r = 34/255, g = 139/255, b = 34/255, a = 1.0}, |
shadow = {r = 148/255, g = 0, b = 211/255, a = 1.0}, |
fire = {r = 1, g = 0, b = 0, a = 1.0}, |
frost = {r = 0, g = 0, b = 1, a = 1.0}, |
arcane = {r = 216/255, g = 191/255, b = 216/255, a = 1.0}, |
holy = {r = 1.0, g = 215/255, b = 0, a = 1.0}}, |
barcolorzero = { |
physical = {r = 0, g = 0, b = 0, a = 0.2}, |
nature = {r = 34/255, g = 139/255, b = 34/255, a = 0.2}, |
shadow = {r = 148/255, g = 0, b = 211/255, a = 0.2}, |
fire = {r = 1, g = 0, b = 0, a = 0.2}, |
frost = {r = 0, g = 0, b = 1, a = 0.2}, |
arcane = {r = 216/255, g = 191/255, b = 216/255, a = 0.2}, |
holy = {r = 1.0, g = 215/255, b = 0, a = 0.2}}, |
scaletexture = nil, |
bartexture = nil, |
locked = false |
} |
lsm:Register("statusbar", "DotIt - Default", "Interface\\ChatFrame\\ChatFrameBackground") --]] |
initDefaultSpells(db) |
db = LibStub:GetLibrary("AceDB-3.0"):New("DotITDB", db.defaults) |
DotIt.db = db |
if DotIt.db.profile.removedots then |
self:RegisterEvent("UNIT_TARGET", "TargetChanged") |
end |
initSpells(db) |
DotItConfig.args.profile = acedboptions:GetOptionsTable(DotIt.db) |
DotItConfig.args.profile.order = -1 |
aceconfig:RegisterOptionsTable("DotIt", DotItConfig) |
acedialog:AddToBlizOptions("DotIt") |
acedialog:SetDefaultSize("DotIt", 900, 600) |
InterfaceOptionsFrame:SetWidth(900) |
end |
## Interface: 30000 |
## Title: DotIT |
## Notes: Tracks your debuffs on enemy targets. |
## Author: Eggi |
## Version: 1.0 |
## SavedVariables: DotITDB |
## OptionalDeps: SharedMedia |
libs.xml |
core.lua |
spells.lua |
modules\modules.xml |
config.lua |
cooldowns.lua |
if not DotIt then |
error("DotIt has to be loaded first") |
end |
local newList, del, deepDel, deepCopy = DotIt.sb:GetRecyclingFunctions() |
local cooldowns = DotIt:NewModule("cooldowns") |
local oncd = newList() |
local mincd = 3 |
local match = string.match |
local GetSpellLink = GetSpellLink |
local GetSpellName = GetSpellName |
local GetSpellCooldown = GetSpellCooldown |
local books = { |
"BOOKTYPE_SPELL", |
"BOOKTYPE_PET" |
} |
local function getSpellId(link) |
return match(link, "Hspell:(%d+)") |
end |
local function getItemId(link) |
return match(link, "Hitem:(%d+)") |
end |
local function spellNeeded(id) |
return DotIt:GetSpellInfo("Cooldowns", id) |
end |
local function itemNeeded(id) |
return DotIt:GetSpellInfo("ItemCooldowns", id) |
end |
local start, duration, enabled, id, dur |
local function spellUpdate() |
for _, book in pairs(books) do |
local i = 1 |
local link = GetSpellLink(i, book) |
local name = GetSpellName(i, book) |
local prvname = "" |
while link do |
if prvname ~= name then |
start, duration, enabled = GetSpellCooldown(i, book) |
-- for example vanish uses this mechanic |
if enabled == 0 then |
if oncd[link] then |
id = oncd[link] |
oncd[link] = nil |
DotIt:SpellCooldownEnd(id) |
end |
else |
-- this spell is ready |
if start == 0 then |
if oncd[link] then |
id = oncd[link] |
oncd[link] = nil |
DotIt:SpellCooldownEnd(id) |
end |
else |
id = getSpellId(link) |
if spellNeeded(id) then |
dur = duration - (GetTime() - start) |
if dur > mincd then |
oncd[link] = id |
DotIt:SpellCooldownStart(id, dur) |
end |
end |
end |
end |
end |
i = i + 1 |
prvname = name |
name = GetSpellName(i, book) |
link = GetSpellLink(i, book) |
end |
end |
end |
local function bagUpdate() |
for i = 0, 4 do |
for j = 1, GetContainerNumSlots(i) do |
local start, duration, enable = GetContainerItemCooldown(i, j) |
if start ~= 0 then |
local link = GetContainerItemLink(i, j) |
local id = getItemId(link) |
if itemNeeded(id) then |
local dur = duration - (GetTime() - start) |
DotIt:StartItemCooldown(id, dur) |
end |
end |
end |
end |
end |
local function inventoryUpdate() |
for i = 1, 23 do |
local start, duration, enable = GetInventoryItemCooldown("player", i) |
if start ~= 0 then |
local link = GetInventoryItemLink("player", i) |
local id = getItemId(link) |
if itemNeeded(id) then |
local dur = duration - (GetTime() - start) |
DotIt:StartItemCooldown(id, dur) |
end |
end |
end |
end |
function DotIt:SpellUpdate() |
spellUpdate() |
end |
function cooldowns:OnInitialize() |
-- spells |
DotIt:RegisterEvent("SPELL_UPDATE_COOLDOWN", function() spellUpdate() end) |
DotIt:RegisterEvent("SPELLS_CHANGED", function() spellUpdate() end) |
DotIt:RegisterEvent("PET_BAR_UPDATE_COOLDOWN", function() spellUpdate() end) |
DotIt:RegisterEvent("ZONE_CHANGED_NEW_AREA", function() spellUpdate() end) |
-- items (do not need to call) |
DotIt:RegisterEvent("BAG_UPDATE_COOLDOWN", function() bagUpdate() end) |
DotIt:RegisterEvent("UNIT_INVENTORY_CHANGED", function() inventoryUpdate() end) |
DotIt:RegisterEvent("ZONE_CHANGED_NEW_AREA", function() bagUpdate() inventoryUpdate() end) |
end |
DotIt = LibStub("AceAddon-3.0"):NewAddon("DotIT-0.1", "AceEvent-3.0") |
local sb = LibStub:GetLibrary("SBar-0.1") |
local cps = 0 |
DotIt.sb = sb |
local newList, del, deepDel, deepCopy = sb:GetRecyclingFunctions() |
DotIt.colorcache = {} |
local expT = newList() |
local function hideFixedText(uid, pos) |
local bars = sb:GetBars() |
if not bars then return end |
for _, bar in pairs(bars) do |
if bar.pos and bar.pos == pos then return end |
end |
sb:SetFixedText(nil, pos) |
end |
local function hideBar(info) |
local bars = sb:GetBars() |
if not bars then return end |
for _, bar in pairs(bars) do |
if bar.data and bar.data.dguid == info.dguid and bar.data.spellid == info.spellid and bar.data.typ == info.typ then |
bar.frame:Hide() |
bar.frame = nil |
local pos = bar.pos |
bar.pos = nil |
bar.data = nil |
bar.start = nil |
bar.dur = nil |
deepDel(bar) |
bar = nil |
hideFixedText(info.dguid, pos) |
end |
end |
end |
local function findFirstEmptyBar(init) |
local bars = sb:GetBars() |
if not bars then return init end |
for i = init, 10 do |
local flag = true |
for _, bar in pairs(bars) do |
if bar.pos and bar.pos == i then |
flag = false |
end |
end |
if flag then return i end |
end |
end |
local function getBarPos(uid, typ) |
if typ == "Shortbuffs" then |
return 0 |
elseif typ == "Cooldowns" or typ == "ItemCooldowns" or typ == "InternalCooldowns" then |
if DotIt.db.profile.ecooldowns then |
return 1 |
elseif DotIt.db.profile.eitemcooldowns then |
return 1 |
else |
return 0 |
end |
else |
local init = 0 |
if DotIt.db.profile.eshortbuffs then |
init = init + 1 |
end |
if DotIt.db.profile.ecooldowns or DotIt.db.profile.ein then |
init = init + 1 |
end |
local bars = sb:GetBars() |
if not bars then return init end |
local maxpos = init |
local prv = init |
for _, bar in pairs(bars) do |
if bar.data then |
if bar.data.dguid == uid then |
return bar.pos |
end |
end |
end |
return findFirstEmptyBar(init) |
end |
end |
local function isBarActive(info) |
local bars = sb:GetBars() |
if not bars then return end |
for _, bar in pairs(bars) do |
if bar.data and bar.data.dguid == info.dguid and bar.data.spellid == info.spellid and bar.data.typ == info.typ then |
return true |
end |
end |
return false |
end |
local function setBarDur(info, dur) |
local bars = sb:GetBars() |
if bars then |
for _, bar in pairs(bars) do |
if bar.data and bar.data.dguid == info.dguid and bar.data.spellid == info.spellid then |
bar.dur = dur |
bar.start = 0 |
return |
end |
end |
end |
local dur, appl, color, colorzero = DotIt:GetSpellInfo(info.typ, info.spellid) |
if not color then color = {r = 1, g = 1, b = 1, a = 1} end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if not dur then return end |
if info and info.typ and not isBarActive(info) then |
sb:CreateBar(info, dur, 0, nil, select(3, GetSpellInfo(info.spellid)), getBarPos(info.dguid, info.typ), color, colorzero, DotIt.db.profile.bartexture, DotIt.db.profile.scale, DotIt.db.profile.fonts) |
end |
end |
local function setBarColor(info, color, colorzero) |
local bars = sb:GetBars() |
if not bars then return end |
for _, bar in pairs(bars) do |
if bar.data and bar.data.dguid == info.dguid and bar.data.spellid == info.spellid then |
bar.color = deepCopy(color) |
bar.colorzero = deepCopy(colorzero) |
bar.tex:SetVertexColor(color.r, color.g, color.b, color.a) |
bar.texg:SetVertexColor(colorzero.r, colorzero.g, colorzero.b, colorzero.a) |
end |
end |
end |
function DotIt:StartItemCooldown(itemid, duration) |
if not DotIt:GetSpellInfo("ItemCooldowns", itemid) then return end |
local infocd = newList() |
infocd.typ = "ItemCooldowns" |
infocd.spellid = itemid |
infocd.dguid = UnitGUID("player") |
local dur, appl, color, colorzero = DotIt:GetSpellInfo(infocd.typ, itemid) |
if not color then color = {r = 1, g = 1, b = 1, a = 1} end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if not isBarActive(infocd) and getBarPos(infocd.dguid, infocd.typ) then |
if dur == 0 then |
sb:CreateBar(deepCopy(infocd), duration, 0, nil, select(3, GetSpellInfo(itemid)), getBarPos(infocd.dguid, infocd.typ), color, colorzero, DotIt.db.profile.bartexture, DotIt.db.profile.scale, DotIt.db.profile.fonts) |
else |
sb:CreateBar(deepCopy(infocd), dur, 0, nil, select(3, GetSpellInfo(itemid)), getBarPos(infocd.dguid, infocd.typ), color, colorzero, DotIt.db.profile.bartexture, DotIt.db.profile.scale, DotIt.db.profile.fonts) |
end |
end |
del(infocd) |
end |
local function schoolColor(spellschool) |
if spellschool == 1 then |
return deepCopy(DotIt.db.profile.barcolor.physical), deepCopy(DotIt.db.profile.barcolorzero.physical) |
elseif spellschool == 2 then |
return deepCopy(DotIt.db.profile.barcolor.holy), deepCopy(DotIt.db.profile.barcolorzero.holy) |
elseif spellschool == 4 then |
return deepCopy(DotIt.db.profile.barcolor.fire), deepCopy(DotIt.db.profile.barcolorzero.fire) |
elseif spellschool == 8 then |
return deepCopy(DotIt.db.profile.barcolor.nature), deepCopy(DotIt.db.profile.barcolorzero.nature) |
elseif spellschool == 16 then |
return deepCopy(DotIt.db.profile.barcolor.frost), deepCopy(DotIt.db.profile.barcolorzero.frost) |
elseif spellschool == 32 then |
return deepCopy(DotIt.db.profile.barcolor.shadow), deepCopy(DotIt.db.profile.barcolorzero.shadow) |
elseif spellschool == 64 then |
return deepCopy(DotIt.db.profile.barcolor.arcane), deepCopy(DotIt.db.profile.barcolorzero.arcane) |
end |
end |
function DotIt:getTyp(spellid) |
if DotIt:GetSpellInfo("Dots", spellid) then |
return "Dots" |
elseif DotIt:GetSpellInfo("Debuffs", spellid) then |
return "Debuffs" |
elseif DotIt:GetSpellInfo("CCs", spellid) then |
return "CCs" |
elseif DotIt:GetSpellInfo("Shortbuffs", spellid) then |
return "Shortbuffs" |
elseif DotIt:GetSpellInfo("InternalCooldowns", spellid) then |
return "InternalCooldowns" |
elseif DotIt:GetSpellInfo("SharedDebuffs", spellid) then |
return "SharedDebuffs" |
else return false end |
end |
local function createSpellInfo(dguid, spellid, typ) |
if not typ then return false end |
local infos = newList() |
infos.dguid = dguid |
infos.spellid = spellid |
infos.typ = typ |
return infos |
end |
function DotIt:SpellCooldownStart(spellid, duration) |
if not DotIt:GetSpellInfo("Cooldowns", spellid) then return end |
local infocd = newList() |
infocd.typ = "Cooldowns" |
infocd.spellid = spellid |
infocd.dguid = UnitGUID("player") |
local dur, appl, color, colorzero = DotIt:GetSpellInfo(infocd.typ, spellid) |
if not color then color = {r = 1, g = 1, b = 1, a = 1} end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if not isBarActive(infocd) and getBarPos(infocd.dguid, infocd.typ) then |
if dur == 0 then |
sb:CreateBar(deepCopy(infocd), duration, 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(infocd.dguid, infocd.typ), color, colorzero, DotIt.db.profile.bartexture, DotIt.db.profile.scale, DotIt.db.profile.fonts) |
else |
sb:CreateBar(deepCopy(infocd), dur, 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(infocd.dguid, infocd.typ), color, colorzero, DotIt.db.profile.bartexture, DotIt.db.profile.scale, DotIt.db.profile.fonts) |
end |
end |
del(infocd) |
end |
function DotIt:SpellCooldownEnd(spellid) |
if not DotIt:GetSpellInfo("Cooldowns", spellid) then return end |
local info = newList() |
info.typ = "Cooldowns" |
info.spellid = spellid |
info.dguid = UnitGUID("player") |
hideBar(info) |
end |
function DotIt:PLAYER_LOGIN() |
DotIt.sb:CreateScale(DotIt.db.profile.width, DotIt.db.profile.maxtime, DotIt.db.profile.steps, |
DotIt.db.profile.maxneg, DotIt.db.profile.position,DotIt.db.profile.horizontal, |
DotIt.db.profile.loflag, DotIt.db.profile.scaletexture, DotIt.db.profile.locked, |
DotIt.db.profile.scale, DotIt.db.profile.height, DotIt.db.profile.fonts, |
DotIt.db.profile.scaletext, DotIt.db.profile.amaxtimes, DotIt.db.profile.ehidescale, |
DotIt.db.profile.eiconpos) |
self:SpellUpdate() |
end |
function DotIt:OnInitialize() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", "CombatLogEvent") |
self:RegisterEvent("UNIT_COMBO_POINTS", "SaveCombo") |
self:RegisterEvent("PLAYER_LOGIN") |
end |
local function removeDots() |
local init = 0 |
if DotIt.db.profile.eshortbuffs then |
init = init + 1 |
end |
if DotIt.db.profile.ecooldowns then |
init = init + 1 |
end |
local bars = sb:GetBars() |
if not bars then return end |
for _, bar in pairs(bars) do |
if bar.pos and bar.pos >= init then |
bar.frame:Hide() |
bar.frame = nil |
local pos = bar.pos |
bar.pos = nil |
bar.data = nil |
deepDel(bar) |
bar = nil |
end |
end |
end |
local function addDots() |
for i = 1, 40 do |
if select(8, UnitDebuff("target", i)) then |
local name, rank, _, application, _, _, expTime, ismine = UnitDebuff("target", i) |
if name then |
if appl == 0 then appl = 1 end |
local link = GetSpellLink(name, rank) |
if link then |
local spellid = string.match(link, "Hspell:(%d+)") |
local info = createSpellInfo(UnitGUID("target"), spellid, DotIt:getTyp(spellid)) |
if info.typ == "SharedDebuffs" or ismine then |
if info then |
spellid = tonumber(spellid) |
local dur, appl, color, colorzero = DotIt:GetSpellInfo("Shortbuffs", spellid) |
dur = expTime - GetTime() |
if not color then |
color = deepCopy(DotIt.colorcache[spellid]) |
end |
if not color then |
color = {r = 1, g = 1, b = 1, a = 1} |
end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if not appl or appl == 0 then appl = 1 end |
if not application or application == 0 then application = 1 end |
color.a = (application / appl) * (color.a or 1) |
if (not isBarActive(info)) and getBarPos(info.dguid, info.typ) then |
sb:CreateBar(deepCopy(info), dur, 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(info.dguid, info.typ), color, colorzero, DotIt.db.profile.bartexture, DotIt.db.profile.scale, DotIt.db.profile.fonts) |
end |
end |
end |
end |
end |
end |
end |
end |
function DotIt:TargetChanged(msg, changer) |
if changer == "player" then |
removeDots() |
addDots() |
end |
end |
local function debuffCheck(cname, id) |
for i = 1, 40 do |
local name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitDebuff("target", i) |
if isMine and cname == name then |
return name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable |
end |
if DotIt:getTyp(id) == "SharedDebuffs" and cname == name then |
return name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable |
end |
end |
end |
function DotIt:CombatLogEvent(msg, timestamp, event, sguid, sname, sflags, dguid, dname, dflags, spellid, spellname, spellschool, auraType, application ) |
-- buffs |
local info, dur, appl, color, colorzero |
if auraType == "BUFF" then |
if event == "SPELL_AURA_APPLIED" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
if not info then return end |
dur, appl, color, colorzero = DotIt:GetSpellInfo("Shortbuffs", spellid) |
if not dur then return end |
if not tonumber(dur) then return end |
if not color then |
color, colorzero = schoolColor(spellschool) |
end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if appl then |
color.a = (1/appl) * (color.a or 1) |
end |
if not isBarActive(info) and getBarPos(info.dguid, info.typ) then |
sb:CreateBar(deepCopy(info), tonumber(dur), 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(info.dguid, info.typ), color, colorzero, self.db.profile.bartexture, self.db.profile.scale, self.db.profile.fonts) |
end |
deepDel(info) |
info = nil |
-- internal cooldowns |
info = createSpellInfo(UnitGUID("player"), spellid, "InternalCooldowns") |
dur, appl, color, colorzero = DotIt:GetSpellInfo("InternalCooldowns", spellid) |
if not dur then return end |
if not tonumber(dur) then return end |
if not color then |
color, colorzero = schoolColor(spellschool) |
end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if appl then |
color.a = (1/appl) * (color.a or 1) |
end |
if not isBarActive(info) and getBarPos(info.dguid, info.typ) then |
sb:CreateBar(deepCopy(info), dur, 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(info.dguid, info.typ), color, colorzero, self.db.profile.bartexture, self.db.profile.scale, self.db.profile.fonts) |
end |
-- ic end |
elseif event == "SPELL_AURA_REMOVED" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
if not info then return end |
if not (info.typ == "InternalCooldowns") then |
hideBar(info) |
end |
elseif event == "SPELL_AURA_APPLIED_DOSE" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
if not info then return end |
dur, appl, color, colorzero = self:GetSpellInfo("Shortbuffs", spellid) |
if not color then |
color, colorzero = schoolColor(spellschool) |
end |
color.a = (application / appl) * (color.a or 1) |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
setBarDur(deepCopy(info), self:GetSpellInfo("Shortbuffs", spellid)) |
setBarColor(info, color, colorzero) |
elseif event == "SPELL_AURA_REFRESH" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
if not info then return end |
dur, appl, color, colorzero = self:GetSpellInfo("Shortbuffs", spellid) |
setBarDur(deepCopy(info), dur) |
end |
elseif auraType == "DEBUFF" then |
-- debuffs |
if event == "SPELL_AURA_APPLIED" then |
if DotIt:GetSpellInfo("SharedDebuffs", spellid) or (sguid == UnitGUID("player")) then |
if (self.db.profile.owndots and dguid == UnitGUID("target")) or (not self.db.profile.owndots) then |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
if not info then return end |
expT[spellid..dguid] = select(7, debuffCheck(spellname, spellid)) |
dur, appl, color, colorzero = self:GetSpellInfo(info.typ, spellid) |
if not color then |
color, colorzero = schoolColor(spellschool) |
end |
if appl then |
color.a = (1/appl) * (color.a or 1) |
end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if not isBarActive(info) and getBarPos(info.dguid, info.typ) then |
sb:CreateBar(deepCopy(info), dur, 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(info.dguid, info.typ), color, colorzero, self.db.profile.bartexture, self.db.profile.scale, self.db.profile.fonts) |
if not self.db.profile.owndots then |
sb:SetFixedText(dname, getBarPos(info.dguid, info.typ)) |
end |
DotIt.colorcache[spellid] = deepCopy(color) |
end |
end |
end |
-- this event does not provide sguid! returns 0 |
elseif event == "SPELL_AURA_REFRESH" and dguid == UnitGUID("target") then |
------------------------------------------ |
-- |
-- temorary fix! (because sguid is alway 0) |
-- |
------------------------------------------ |
local expirationTime = select(7, debuffCheck(spellname, spellid)) |
if not expirationTime then return end |
if not expT[spellid..dguid] then return end |
if expT[spellid..dguid] == expirationTime then return end |
expT[spellid..dguid] = expirationTime |
------------------------------------------ |
-- |
-- temorary fix end! |
-- |
------------------------------------------ |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
if not info then return end |
setBarDur(deepCopy(info), self:GetSpellInfo(info.typ, spellid)) |
-- this event does not provide sguid! returns 0 |
elseif event == "SPELL_AURA_APPLIED_DOSE" and dguid == UnitGUID("target") then |
------------------------------------------ |
-- |
-- temorary fix! (because sguid is alway 0) |
-- |
------------------------------------------ |
local expirationTime = select(7, debuffCheck(spellname, spellid)) |
if not expirationTime then return end |
if not expT[spellid..dguid] then return end |
if expT[spellid..dguid] == expirationTime then return end |
expT[spellid..dguid] = expirationTime |
------------------------------------------ |
-- |
-- temorary fix end! |
-- |
------------------------------------------ |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
if not info then return end |
dur, appl, color, colorzero = self:GetSpellInfo(info.typ, spellid) |
if not color then |
color, colorzero = schoolColor(spellschool) |
end |
if appl then |
color.a = (application/appl) * (color.a or 1) |
end |
setBarDur(deepCopy(info), self:GetSpellInfo(info.typ, spellid)) |
setBarColor(info, color, colorzero) |
elseif event == "SPELL_AURA_REMOVED" and (sguid == UnitGUID("player") or DotIt:getTyp(spellid) == "SharedDebuffs") then |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
if not info then return end |
expT[spellid..dguid] = nil |
hideBar(info) |
end |
end |
if info then |
deepDel(info) |
end |
end |
function DotIt:SaveCombo(msg, unit) |
if GetComboPoints("player") ~= 0 then |
cps = GetComboPoints("player") |
end |
end |
function DotIt:GetComboPoints() |
return cps |
end |
function DotIt:checkGlyph(name) |
for i = 1, 6 do |
local glyph = select(3, GetGlyphSocketInfo(i)) |
if glyph == name then |
return true |
else |
return false |
end |
end |
end |
function DotIt:scanItem(id) |
for i = 0, 18 do |
if string.find(GetInventoryItemLink("player", i), id) then return true end |
end |
return false |
end |
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ |
..\FrameXML\UI.xsd"> |
<script file="libs\LibStub\LibStub.lua"/> |
<Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/> |
<Include file="libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/> |
<Include file="libs\AceEvent-3.0\AceEvent-3.0.xml"/> |
<Include file="libs\AceDB-3.0\AceDB-3.0.xml"/> |
<Include file="libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/> |
<Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/> |
<Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/> |
<Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/> |
<Include file="libs\LibSharedMedia-3.0\LibSharedMedia-3.0.lua"/> |
<Include file="libs\AceHook-3.0\AceHook-3.0.xml"/> |
<Include file="libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/> |
<script file="libs\sbar.lua"/> |
</Ui> |
local sp = DotIt:GetModule("spells") |
local warlock = { Dots = { |
-- Immolate |
[707] = 348, |
[1094] = 348, |
[2941] = 348, |
[11665] = 348, |
[11667] = 348, |
[11668] = 348, |
[25309] = 348, |
[27215] = 348, |
[47810] = 348, |
[47811] = 348, |
[348] = [[return DotIt.sp:GMTD(348)]], |
-- Corruption |
[6222] = 172, |
[6223] = 172, |
[7648] = 172, |
[11671] = 172, |
[11672] = 172, |
[25311] = 172, |
[27216] = 172, |
[47812] = 172, |
[47813] = 172, |
[172] = [[return DotIt.sp:GMTD(172)]], |
-- Curse of Agony |
[1014] = 980, |
[6217] = 980, |
[11711] = 980, |
[11712] = 980, |
[11713] = 980, |
[27218] = 980, |
[47863] = 980, |
[47864] = 980, |
[980] = [[return DotIt.sp:GMTD(980)]], |
-- Siphon Life |
[18879] = 18265, |
[18880] = 18265, |
[18881] = 18265, |
[27264] = 18265, |
[30911] = 18265, |
[47861] = 18265, |
[47862] = 18265, |
[18265] = [[return DotIt.sp:GMTD(18265)]], |
-- Seed of Corruption |
[47835] = 27243, |
[47836] = 27243, |
[27243] = [[return DotIt.sp:GMTD(27243)]], |
-- Unstable Affliction |
[30404] = 30108, |
[30405] = 30108, |
[47841] = 30108, |
[47843] = 30108, |
[30108] = [[return DotIt.sp:GMTD(30108)]], |
-- Haunt |
[59161] = 48181, |
[59163] = 48181, |
[59164] = 48181, |
[48181] = [[return 12]], |
-- drain soul .. is channeled |
--[1120] = [[return DotIt.sp:GMTD(1120)]], |
--[8288] = 1120, |
--[8289] = 1120, |
--[11675] = 1120, |
--[27217] = 1120, |
--[47855] = 1120, |
-- hellfire |
[1949] = [[return 15]], |
[11683] = 1949, |
[11684] = 1949, |
[27213] = 1949, |
[47823] = 1949, |
-- rain of fire |
[5740] = [[return 8]], |
[6219] = 5740, |
[11677] = 5740, |
[11678] = 5740, |
[27212] = 5740, |
[47819] = 5740, |
[47820] = 5740, |
-- shadowflame |
[47897] = [[return 8]], |
[61290] = 47897, |
}, |
Debuffs = { |
-- shadow embrace |
[32386] = [[return DotIt.sp:GMTD(32386), 2]], |
[32388] = 32386, |
[32389] = 32386, |
[32390] = 32386, |
[32391] = 32386, |
-- pyroclasm |
[18093] = [[retur 3]], |
-- imprved fear (nightmare) |
[60946] = [[return 5]], |
[60947] = [[return 5]], |
-- aftermath |
[18118] = [[return 5]], |
-- curse of the elements |
[1490] = [[return DotIt.sp:GMTD(1490)]], |
[11721] = 1490, |
[11722] = 1490, |
[27228] = 1490, |
[47865] = 1490, |
-- curse of recklessness |
[704] = [[return DotIt.sp:GMTD(59671)]], |
[7658] = 704, |
[7659] = 704, |
[11717] = 704, |
[27226] = 704, |
[57595] = 704, |
-- challenging howl |
[59671] = [[return DotIt.sp:GMTD(59671)]], |
-- curse of weakness |
[702] = [[return DotIt.sp:GMTD(702)]], |
[1108] = 702, |
[6205] = 702, |
[7646] = 702, |
[11707] = 702, |
[27224] = 702, |
[11708] = 702, |
[30909] = 702, |
[50511] = 702, |
-- curse of tongues |
[1714] = [[return DotIt.sp:GMTD(1714)]], |
[11719] = 1714, |
-- curse of doom |
[603] = [[return DotIt.sp:GMTD(603)]], |
[30910] = 603, |
[47867] = 603, |
-- curse of exhaustion |
[18223] = [[return DotIt.sp:GMTD(18223)]], |
}, |
CCs = { |
-- demon charge |
[54785] = [[return DotIt.sp:GMTD(54785)]], |
-- howl of terror |
[5484] = [[return 6]], |
[17928] = [[return 8]], |
-- fear |
[5782] = [[return DotIt.sp:GMTD(5782)]], |
[6213] = 5782, |
[6215] = 5782, |
-- banish |
[710] = [[return DotIt.sp:GMTD(710)]], |
[18647] = 710, |
-- death coil |
[6789] = [[return DotIt.sp:GMTD(6789)]], |
[17925] = 6789, |
[17926] = 6789, |
[27223] = 6789, |
[47859] = 6789, |
[47860] = 6789, |
-- shadowfury |
[30283] = [[return DotIt.sp:GMTD(30283)]], |
[30413] = 30283, |
[30414] = 30283, |
[47846] = 30283, |
[47847] = 30283, |
}, |
InternalCooldowns = { |
-- backlash |
[54274] = [[return 8]], |
[47274] = [[return 30]], |
}, |
Shortbuffs = { |
-- wrecking crew (enrage) |
[57518] = [[return DotIt.sp:GPB(57518)]], |
[57519] = 57518, |
[57520] = 57518, |
[57521] = 57518, |
[57522] = 57518, |
-- demonic pact |
[48090] = [[return DotIt.sp:GPB(48090)]], |
-- nightfall (shadow trance) |
[17941] = [[return DotIt.sp:GPB(17941)]], |
-- molten core |
[47383] = [[return DotIt.sp:GPB(47383)]], |
-- metamorphosis |
[47241] = [[return DotIt.sp:GPB(47241)]], |
-- eradicition |
[47274] = [[return DotIt.sp:GPB(47274)]], |
-- empowered imp |
[47283] = [[return DotIt.sp:GPB(47283)]], |
-- demonic empowerment (maybe this is a buff on the pet!) |
[54436] = [[local name = GetSpellInfo(54436) local dur = select(7, UnitBuff("pet", name)) if not dur then dur = 0 else dur = dur-GetTime() end return dur]], |
[54444] = [[local name = GetSpellInfo(54444) local dur = select(7, UnitBuff("pet", name)) if not dur then dur = 0 else dur = dur-GetTime() end return dur]], |
[54509] = [[local name = GetSpellInfo(54509) local dur = select(7, UnitBuff("pet", name)) if not dur then dur = 0 else dur = dur-GetTime() end return dur]], |
[54508] = [[local name = GetSpellInfo(54508) local dur = select(7, UnitBuff("pet", name)) if not dur then dur = 0 else dur = dur-GetTime() end return dur]], |
[54443] = [[local name = GetSpellInfo(54443) local dur = select(7, UnitBuff("pet", name)) if not dur then dur = 0 else dur = dur-GetTime() end return dur]], |
-- demonic empathy |
[48069] = [[return DotIt.sp:GPB(48069)]], |
[54388] = 48069, |
[54389] = 48069, |
-- backdraft |
[54274] = [[return DotIt.sp:GPB(54274)]], |
[54276] = 54274, |
[54277] = 54274, |
-- backlash |
[54274] = [[return DotIt.sp:GPB(54274)]], |
-- detect invisibility |
[132] = [[return DotIt.sp:GPB(132)]], |
-- shadow ward |
[6229] = [[return DotIt.sp:GPB(6229)]], |
[11739] = 6229, |
[11740] = 6229, |
[28610] = 6229, |
[47890] = 6229, |
[47891] = 6229, |
-- unending breath |
[5697] = [[return DotIt.sp:GPB(5697)]], |
}, |
Cooldowns = { |
-- shadow ward |
[6229] = 698, |
-- howl of terror |
[5484] = 698, |
-- conflagerate |
[17962] = 698, |
-- death coil |
[6789] = 698, |
-- inferno |
[1122] = 698, |
-- curse of doom |
[603] = 698, |
-- demon charge |
[54785] = 698, |
-- shadow cleave |
[50581] = 698, |
-- shadowfury |
[30283] = 698, |
-- soulshatter |
[29858] = 698, |
-- ritual of souls |
[29893] = 698, |
-- chaos bolt |
[50796] = 698, |
-- haunt |
[48181] = 698, |
-- shadowflame |
[47897] = 698, |
-- demonic circle: teleport |
[48020] = 698, |
-- demonic empowerment |
[47193] = 698, |
-- fel domination |
[18708] = 698, |
-- metamorphosis |
[47241] = 698, |
-- ritual of summoning |
[698] = [[return 0]], |
-- shadowburn |
[17877] = 698, |
}, |
} |
sp:insertSpells(warlock, "WARLOCK") |
local sp = DotIt:GetModule("spells") |
local hunter = { Dots = { |
-- Hunter |
-- volley |
[42243] = [[return DotIt.sp:GMTD(42243)]], |
[42244] = 42243, |
[42245] = 42243, |
[42234] = 42243, |
[58432] = 42243, |
[58433] = 42243, |
-- explosive track |
[13813] = [[return 20]], |
[14316] = 13813, |
[14317] = 13813, |
[27025] = 13813, |
[49066] = 13813, |
[49067] = 13813, |
-- Wyvern Sting |
[24132] = 19386, |
[24133] = 19386, |
[27068] = 19386, |
[49011] = 19386, |
[49012] = 19386, |
[19386] = [[return DotIt.sp:GMTD(19386)]], |
-- Serpent Sting |
[13549] = 1978, |
[13550] = 1978, |
[13551] = 1978, |
[13552] = 1978, |
[13553] = 1978, |
[13554] = 1978, |
[13555] = 1978, |
[25295] = 1978, |
[27016] = 1978, |
[49000] = 1978, |
[49001] = 1978, |
[1978] = [[if DotIt:checkGlyph(56832) then return 15 + 6 end return 15]], |
-- immolation trap |
[13795] = [[return DotIt.sp:GMTD(13795)]], |
[14302] = 13795, |
[14303] = 13795, |
[14304] = 13795, |
[14305] = 13795, |
[27023] = 13795, |
[49055] = 13795, |
[49056] = 13795, |
-- explosive shot |
[53301] = [[return 2]], |
[60051] = 53301, |
[60052] = 53301, |
[60053] = 53301, |
}, |
Cooldowns = { |
-- bestial wrath |
[19574] = 2973, |
-- freezing arrow |
[60192] = 2973, |
-- master's call |
[53271] = 2973, |
-- kill shot |
[53351] = 2973, |
-- misdirection |
[34477] = 2973, |
-- disengage |
[781] = 2973, |
-- multi-shot |
[2643] = 2973, |
-- traps (tracked by immolation trap lvl 1) |
[13795] = 2973, |
-- arcane shot |
[3044] = 2973, |
-- concussive shot |
[5116] = 2973, |
-- raptor strike |
[2973] = [[return 0]], |
-- distracting shot |
[20736] = 2973, |
-- scare beast |
[1513] = 2973, |
-- Rapid Fire |
[3045] = 2973, |
-- aimed shot |
[19434] = 2973, |
-- flare |
[1543] = 2973, |
-- viper sting |
[3034] = 2973, |
-- wyvern sting |
[19386] = 2973, |
-- counterattack |
[19306] = 2973, |
-- deterence |
[19263] = 2973, |
-- tranquilizing shot |
[19801] = 2973, |
-- kill command |
[34026] = 2973, |
-- explosive shot |
[53301] = 2973, |
-- chimera shot |
[53209] = 2973, |
-- intimidation |
[19577] = 2973, |
-- silencing shot |
[34490] = 2973, |
}, |
Shortbuffs = { |
-- cobra strikes |
[53257] = [[return 10, 2]], |
-- bestial wrath |
[19574] = [[return DotIt.sp:GPB(19574)]], |
-- master's call |
[53271] = [[return DotIt.sp:GPB(53271)]], |
-- misdirection |
[34477] = [[return DotIt.sp:GPB(34477)]], |
-- deterence |
[19263] = [[return DotIt.sp:GPB(19263)]], |
-- Rapid Fire |
[3045] = [[return DotIt.sp:GPB(3045)]], |
-- eagle eye |
[6197] = [[return DotIt.sp:GPB(6197)]], |
-- eyes of the beast |
[1002] = [[return DotIt.sp:GPB(1002)]], |
-- master tactician |
[34833] = [[return DotIt.sp:GPB(34833)]], |
[34834] = 34833, |
[34835] = 34833, |
[34836] = 34833, |
[34837] = 34833, |
}, |
Debuffs = { |
-- silencing shot |
[34490] = [[return DotIt.sp:GMTD(34490)]], |
-- improved wing clip |
[19229] = [[return DotIt.sp:GMTD(19229), 1, {r = 1, g = 0, b = 0, a = 1}]], |
[35963] = 19229, |
[47168] = 19229, |
-- concussive shot |
[5116] = [[return DotIt.sp:GMTD(5116)]], |
-- entrapment |
[19185] = [[return 4]], |
-- counterattack |
[19306] = [[return DotIt.sp:GMTD(19306)]], |
[20909] = 19306, |
[20910] = 19306, |
[27067] = 19306, |
[48998] = 19306, |
[48999] = 19306, |
-- viper sting |
[3034] = [[return DotIt.sp:GMTD(3034)]], |
-- flare |
[1543] = [[return 20]], |
-- aimed shot |
[19434] = [[return DotIt.sp:GMTD(19434)]], |
[20900] = 19434, |
[20901] = 19434, |
[20902] = 19434, |
[20903] = 19434, |
[20904] = 19434, |
[27065] = 19434, |
[49049] = 19434, |
[49050] = 19434, |
-- hunters mark |
[1130] = [[return DotIt.sp:GMTD(1130)]], |
[14323] = 1130, |
[14324] = 1130, |
[14325] = 1130, |
[53338] = 1130, |
-- distracting shot |
[20736] = [[return DotIt.sp:GMTD(20736)]], |
-- wing clip |
[2974] = [[return DotIt.sp:GMTD(2974)]], |
-- scare beast |
[1513] = [[return DotIt.sp:GMTD(1513)]], |
[14326] = [[return DotIt.sp:GMTD(14326)]], |
[14327] = [[return DotIt.sp:GMTD(14327)]], |
}, |
CCs = { |
-- intimidation |
[24394] = [[return DotIt.sp:GMTD(24394)]], |
-- scatter shot |
[19503] = [[return DotIt.sp:GMTD(19503)]], |
-- t.n.t |
[56338] = [[return 3]], |
-- freezing trap |
[1499] = [[return 10]], |
[14310] = [[return 15]], |
[14311] = [[return 20]], |
}, |
InternalCooldowns = { |
[56453] = [[return 30]], |
} |
} |
sp:insertSpells(hunter, "HUNTER") |
local sp = DotIt:GetModule("spells") |
local warrior = { Dots = { |
-- Rend |
[6546] = [[return DotIt.sp:GMTD(6546)]], |
[6547] = [[return DotIt.sp:GMTD(6547)]], |
[6548] = 6547, |
[11572] = 6547, |
[11573] = 6547, |
[11574] = 6547, |
[25208] = 6547, |
[46845] = 6547, |
[47465] = 6547, |
[772] = [[return DotIt.sp:GMTD(772)]], |
-- deep wounds |
[12162] = [[return 6]], |
[12850] = 12162, |
[12868] = 12162, |
}, |
SharedDebuffs = { |
-- sunder armor |
[7405] = 7386, |
[8380] = 7386, |
[11596] = 7386, |
[11597] = 7386, |
[25225] = 7386, |
[47467] = 7386, |
[7386] = [[return 15, 5]], |
}, |
Debuffs = { |
-- trauma |
[46856] = [[return DotIt.sp:GMTD(46856)]], |
[46857] = 46856, |
-- piercing howl |
[12323] = [[return 6]], |
-- gag order (silenced - gag order) |
[18498] = [[return DotIt.sp:GMTD(18498)]], |
-- furious attacks |
[56112] = [[return DotIt.sp:GMTD(56112), 2]], |
-- mortal strike |
[12294] = [[return DotIt.sp:GMTD(12294)]], |
[21551] = 12294, |
[21552] = 12294, |
[21553] = 12294, |
[25248] = 12294, |
[30330] = 12294, |
[47485] = 12294, |
[47486] = 12294, |
-- intercept stun |
[20253] = [[return DotIt.sp:GMTD(20253)]], |
-- challenging shout |
[1161] = [[return 6]], |
-- disarm |
[676] = [[return DotIt.sp:GMTD(676)]], |
-- mocking blow |
[694] = [[return DotIt.sp:GMTD(694)]], |
-- shield bash (dazed) |
[29703] = [[return DotIt.sp:GMTD(29703)]], |
-- taunt |
[355] = [[return DotIt.sp:GMTD(355)]], |
-- hamstring |
[1715] = [[return DotIt.sp:GMTD(1715)]], |
-- charge stun |
[7922] = [[return DotIt.sp:GMTD(7922)]], |
-- demoralizing shout |
[6190] = 1160, |
[11554] = 1160, |
[11555] = 1160, |
[11556] = 1160, |
[25202] = 1160, |
[25203] = 1160, |
[47437] = 1160, |
[1160] = [[return 30]], |
-- thunder clap |
[8198] = 6343, |
[8204] = 6343, |
[8205] = 6343, |
[11580] = 6343, |
[11581] = 6343, |
[25264] = 6343, |
[47501] = 6343, |
[47502] = 6343, |
[6343] = [[return 10]], |
-- |
}, |
Shortbuffs = { |
-- taste for blood |
[60503] = [[return DotIt.sp:GPB(60503)]], |
-- sword and board |
[50227] = [[return DotIt.sp:GPB(50227)]], |
-- second wind |
[29834] = [[return DotIt.sp:GPB(29834)]], |
[29838] = 29834, |
-- rampage |
[30029] = [[return DotIt.sp:GPB(30029)]], |
-- last stand |
[12975] = [[return DotIt.sp:GPB(12975)]], |
-- improved defensive stance (enrage) |
[57514] = [[return DotIt.sp:GPB(57514)]], |
[57516] = 57514, |
-- flurry |
[12966] = [[return DotIt.sp:GPB(12966)]], |
[12967] = 12966, |
[12968] = 12966, |
[12969] = 12966, |
[12970] = 12966, |
-- enrage |
[12880] = [[return DotIt.sp:GPB(12880)]], |
[14201] = 12880, |
[14203] = 12880, |
[14202] = 12880, |
[14204] = 12880, |
-- death whish |
[12292] = [[return DotIt.sp:GPB(12292)]], |
-- bloodsurge (slam!) |
[46916] = [[return DotIt.sp:GPB(46916)]], |
-- blood craze |
[16488] = [[return DotIt.sp:GPB(16488)]], |
[16490] = 16488, |
[16491] = 16488, |
-- bladestorm |
[46924] = [[return DotIt.sp:GPB(46924)]], |
-- enraged regeneration |
[55694] = [[return DotIt.sp:GPB(55694)]], |
-- intervene |
[3411] = [[return DotIt.sp:GPB(3411)]], |
-- commanding shout |
[469] = [[return DotIt.sp:GPB(469)]], |
[47439] = 469, |
[47440] = 469, |
-- spell reflect |
[23920] = [[return DotIt.sp:GPB(23920)]], |
-- recklessness |
[1719] = [[return DotIt.sp:GPB(1719)]], |
-- berserker rage |
[18499] = [[return DotIt.sp:GPB(18499)]], |
-- shield wall |
[871] = [[return DotIt.sp:GPB(871)]], |
-- retaliation |
[20230] = [[return DotIt.sp:GPB(20230)]], |
-- shield block |
[2565] = [[return DotIt.sp:GPB(2565)]], |
-- bloodrage |
[29131] = [[return DotIt.sp:GPB(29131)]], |
-- battle shout |
[6673] = [[return DotIt.sp:GPB(6673)]], |
[5242] = 6673, |
[6192] = 6673, |
[11549] = 6673, |
[11550] = 6673, |
[11551] = 6673, |
[25289] = 6673, |
[2048] = 6673, |
[47436] = 6673, |
}, |
Cooldowns = { |
-- bloodrage |
[2687] = 100, |
-- taunt |
[355] = 100, |
-- overpower |
[7384] = 100, |
-- shield bash |
[72] = 100, |
-- revenge |
[6572] = 100, |
-- mocking blow |
[694] = 100, |
-- shield block |
[2565] = 100, |
-- disarm |
[676] = 100, |
-- retaliation |
[20230] = 100, |
-- intimidating shout |
[5246] = 100, |
-- challenging shout |
[1161] = 100, |
-- shield wall |
[871] = 100, |
-- intercept |
[20252] = 100, |
-- berserker rage |
[18499] = 100, |
-- whirlwind |
[1680] = 100, |
-- pummel |
[6552] = 100, |
-- shield slam |
[23922] = 100, |
-- recklessness |
[1719] = 100, |
-- mortal strike |
[12294] = 100, |
-- spell reflect |
[23920] = 100, |
-- intervene |
[3411] = 100, |
-- enraged regeneration |
[55694] = 100, |
-- heroic throw |
[57755] = 100, |
-- bladestorm |
[46924] = 100, |
-- bloodthirst |
[23881] = 100, |
-- concussion blow |
[12809] = 100, |
-- death wish |
[12292] = 100, |
-- heroic fury |
[60970] = 100, |
-- last stand |
[12975] = 100, |
-- shockwave |
[46968] = 100, |
-- sweeping strikes |
[12328] = 100, |
-- charge |
[100] = [[return 0]], |
}, |
CCs = { |
-- shockwave |
[46968] = [[return 4]], |
-- improved hamstring |
[23694] = [[return DotIt.sp:GMTD(23694)]], |
-- intimidating shout |
[20511] = [[return 8]], |
} |
} |
sp:insertSpells(warrior, "WARRIOR") |
local sp = DotIt:GetModule("spells") |
local priest = { Dots = { |
-- Priest |
-- Devouring Plague |
[19276] = 2944, |
[19277] = 2944, |
[19278] = 2944, |
[19279] = 2944, |
[19280] = 2944, |
[25467] = 2944, |
[48299] = 2944, |
[48300] = 2944, |
[2944] = [[return 24]], |
-- Shadow Word: Pain |
[594] = 589, |
[992] = 589, |
[970] = 589, |
[2767] = 589, |
[10892] = 589, |
[10893] = 589, |
[10894] = 589, |
[25367] = 589, |
[25368] = 589, |
[48124] = 589, |
[48125] = 589, |
[589] = [[return DotIt.sp:GMTD(589)]], |
-- Vampiric Touch |
[34916] = 34914, |
[34917] = 34914, |
[48159] = 34914, |
[48160] = 34914, |
[34914] = [[return DotIt.sp:GMTD(34914)]], |
-- mind sear |
[49821] = [[return 10]], |
[53022] = 49821, |
}, |
Shortbuffs = { |
-- pain suppression |
[33206] = [[return DotIt.sp:GPB(33206)]], |
-- grace |
[47930] = [[return DotIt.sp:GPB(47930)]], |
-- borrowed time |
[59887] = [[return DotIt.sp:GPB(59887)]], |
-- blessed resilience |
[33143] = [[return DotIt.sp:GPB(33143)]], |
-- levitate |
[1706] = [[return DotIt.sp:GPB(1706)]], |
-- fear ward |
[6346] = [[return DotIt.sp:GPB(6346)]], |
-- dispersion |
[47585] = [[return DotIt.sp:GPB(47585)]], |
-- power word: shield |
[17] = [[return DotIt.sp:GPB(17)]], |
[592] = 17, |
[600] = 17, |
[3747] = 17, |
[6065] = 17, |
[6066] = 17, |
[10898] = 17, |
[10899] = 17, |
[10900] = 17, |
[10901] = 17, |
[25217] = 17, |
[25218] = 17, |
[48065] = 17, |
[48066] = 17, |
-- fade |
[586] = [[return DotIt.sp:GPB(586)]], |
-- holy concentration (clearcasting) |
[34754] = [[return DotIt.sp:GPB(34754)]], |
-- improved holy concentration |
[47894] = [[return DotIt.sp:GPB(47894)]], |
[47895] = 47894, |
[47896] = 47894, |
-- improved spirit tap |
[49694] = [[return DotIt.sp:GPB(49694)]], |
[59000] = 49694, |
-- spirit tap |
[15271] = [[return DotIt.sp:GPB(15271)]], |
-- vampiric embrace |
[15286] = [[return DotIt.sp:GPB(15286)]], |
-- martyrdom (focused casting) |
[14743] = [[return DotIt.sp:GPB(14743)]], |
[27828] = 14743, |
-- spirit of redemption |
[20711] = [[return DotIt.sp:GPB(20711)]], |
-- surge of light |
[33151] = [[return DotIt.sp:GPB(33151)]], |
}, |
Cooldowns = { |
-- silence |
[15487] = 17, |
-- pain suppression |
[33206] = 17, |
-- inner focus |
[14751] = 17, |
-- vampiric embrace |
[15286] = 17, |
-- guardian spirit |
[47788] = 17, |
-- divine hymn |
[47951] = 17, |
-- penance |
[47540] = 17, |
-- prayer of mending |
[33076] = 17, |
-- shadowfiend |
[34433] = 17, |
-- shadow word: death |
[32379] = 17, |
-- hymn of hope |
[60931] = 17, |
-- circle of healing |
[34861] = 17, |
-- lightwell |
[724] = 17, |
-- holy nova |
[15237] = 17, |
-- holy fire |
[14914] = 17, |
-- dispersion |
[47585] = 17, |
-- fear ward |
[6346] = 17, |
-- psychic scream |
[8122] = 17, |
-- mind blast |
[8092] = 17, |
-- fade |
[586] = 17, |
-- power word: shield |
[17] = [[return 0]], |
-- desperate prayer |
[19236] = 17, |
}, |
Debuffs = { |
-- blackout |
[44415] = [[return 3]], |
-- mind soothe |
[453] = [[return DotIt.sp:GMTD(453)]], |
-- silence |
[15487] = [[return DotIt.sp:GMTD(15487)]], |
-- misery |
[33196] = [[return DotIt.sp:GMTD(33196)]], |
[33197] = 33196, |
[33198] = 33196, |
}, |
CCs = { |
-- psychic scream |
[8122] = [[if DotIt:checkGlyph(55676) then return 8 + 1 else return 8 end]], |
[8124] = 8122, |
[10888] = 8122, |
[10890] = 8122, |
-- divine hmyn |
[47951] = [[return 20]], |
-- shackle undead |
[9484] = [[return DotIt.sp:GMTD(9484)]], |
[9485] = 9484, |
[10955] = 9484, |
}, |
} |
sp:insertSpells(priest, "PRIEST") |
local sp = DotIt:GetModule("spells") |
local druid = { Dots = { |
-- huricane |
[16914] = [[return 10]], |
[17401] = 16914, |
[17402] = 16914, |
[27012] = 16914, |
[48467] = 16914, |
-- infected wounds |
[48483] = [[return 12]], |
[48484] = 48483, |
[48485] = 48483, |
-- entangling roots |
[339] = [[return 12]], |
[1062] = 339, |
[5195] = 339, |
[5196] = 339, |
[9852] = 339, |
[9853] = 339, |
[26989] = 339, |
[53308] = 339, |
-- Moonfire |
[8921] = [[return 9+(3*select(5, GetTalentInfo(1,8)))]], |
[8925] = 8924, |
[8926] = 8924, |
[8927] = 8924, |
[8928] = 8924, |
[8929] = 8924, |
[9833] = 8924, |
[9834] = 8924, |
[9835] = 8924, |
[26987] = 8924, |
[26988] = 8924, |
[48462] = 8924, |
[48463] = 8924, |
[8924] = [[return 12+(3*select(5, GetTalentInfo(1,8)))]], |
-- Insect Swarm |
[24974] = 5570, |
[24975] = 5570, |
[24976] = 5570, |
[24977] = 5570, |
[27013] = 5570, |
[48468] = 5570, |
[5570] = [[return 12+(2*select(5, GetTalentInfo(1,8)))]], -- check Nature's Spendor (2 second duration increase) |
-- Lacerate |
[48567] = 33745, |
[48568] = 33745, |
[33745] = [[return 15]], |
-- Rip |
[9492] = 1079, |
[9493] = 1079, |
[9752] = 1079, |
[9894] = 1079, |
[9896] = 1079, |
[27008] = 1079, |
[49799] = 1079, |
[49800] = 1079, |
[1079] = [[local count = 0 local tocheck = {d10 = {39553, 39554, 39555, 39556, 39557}, d25 = {40471, 40472, 40473, 40493, 40494}} for i = 1, 5 do if DotIt:scanItem(tocheck.d10[i]) or DotIt:scanItem(tocheck.d25[i]) then count = count + 1 end end if count >= 2 then return 12 + 4 return 12]], |
-- Rake |
[1823] = 1822, |
[1824] = 1822, |
[9904] = 1822, |
[27003] = 1822, |
[48574] = 1822, |
[1822] = [[return DotIt.sp:GMTD(1822)]], |
-- lacerate |
[33745] = [[return DotIt.sp:GMTD(33745), 5]], |
[48567] = 33745, |
[48568] = 33745, |
}, |
Debuffs = { |
-- earth and moon |
[60433] = [[return 12]], |
[60431] = 60433, |
[60432] = 60433, |
-- demoralizing roar debuff |
[99] = [[return 30]], |
[1735] = 99, |
[9490] = 99, |
[9747] = 99, |
[9898] = 99, |
[26998] = 99, |
[48559] = 99, |
[48560] = 99, |
-- feral charge cat debuff |
[49376] = [[return 3]], |
-- mangle bear |
[33878] = [[return 12]], |
[33986] = 33878, |
[33987] = 33878, |
[48563] = 33878, |
[48564] = 33878, |
}, |
InternalCooldowns = { |
-- eclipse |
[48518] = [[return 30, 1, {r = 198/255, g = 226/255, b = 1, a = 1}]], |
-- eclipse #2 |
[48517] = [[return 30, 1, {r = 1, g = 165/255, b = 79/255, a = 1}]], |
}, |
Shortbuffs = { |
-- eclipse |
[48517] = [[return DotIt.sp:GPB(48517)]], |
-- eclipse |
[48518] = [[return DotIt.sp:GPB(48518)]], |
-- starfall |
[48505] = [[return DotIt.sp:GPB(48505)]], |
[53199] = 48505, |
[53200] = 48505, |
[53201] = 48505, |
-- tiger's fury |
[5217] = [[return DotIt.sp:GPB(5217)]], |
[6793] = 5217, |
[9845] = 5217, |
[9846] = 5217, |
[50212] = 5217, |
[50213] = 5217, |
-- owlkin frenzy buff |
[48389] = 48393, |
[48392] = 48393, |
[48393] = [[return DotIt.sp:GPB(48393)]], |
-- Savage Roar |
[52610] = [[return DotIt.sp:GPB(52610)]], |
[50334] = [[return DotIt.sp:GPB(50334)]], |
[22842] = [[return DotIt.sp:GPB(22842)]], |
-- nature's grasp shortbuff |
[16689] = 53312, |
[16810] = 53312, |
[16811] = 53312, |
[16812] = 53312, |
[16813] = 53312, |
[17329] = 53312, |
[27009] = 53312, |
[53312] = [[return DotIt.sp:GPB(53312)]], |
-- enrage |
[5229] = [[return DotIt.sp:GPB(5229)]], |
-- innervate |
[29166] = [[return DotIt.sp:GPB(29166)]], |
-- frenzied regeneration |
[22842] = [[return DotIt.sp:GPB(22842)]], |
-- barkskin |
[22812] = [[return DotIt.sp:GPB(22812)]], |
-- savage roar |
[52610] = [[return DotIt.sp:GPB(52610)]], |
}, |
Cooldowns = { |
-- force of nature |
[33831] = 6795, |
-- wild growth |
[48438] = 6795, |
-- starfall |
[48505] = 6795, |
-- maim |
[22570] = 6795, |
-- typhoon |
[50516] = 6795, |
-- mangle bear |
[33878] = 6795, |
-- barkskin |
[22812] = 6795, |
-- cower |
[8998] = 6795, |
-- omen of clarity buff |
[16864] = 6795, |
-- frenzied regeneration |
[22842] = 6795, |
-- innervate |
[29166] = 6795, |
-- prowl |
[5215] = 6795, |
-- rebirth |
[20484] = 6795, |
-- tranquility |
[740] = 6795, |
-- tiger's fury |
[5217] = 6795, |
-- bash |
[5211] = 6795, |
-- enrage |
[5229] = 6795, |
-- survival instincts |
[61336] = [[return 0]], |
-- growl |
[6795] = [[return 0]], |
-- nature's grasp |
[16689] = 6795, |
--[16810] = 6795, |
--[16811] = 6795, |
--[16812] = 6795, |
--[16813] = 6795, |
--[17329] = 6795, |
--[27009] = 6795, |
--[53312] = 6795, |
-- feral charge |
[16979] = [[return 0]], |
}, |
CCs = { |
-- cyclone |
[33786] = [[return DotIt.sp:GMTD(33786)]], |
-- maim |
[22570] = [[return DotIt.sp:GMTD(22570)]], |
[49802] = [[return DotIt.sp:GMTD(49802)]], |
-- pounce |
[9005] = [[return DotIt.sp:GMTD(9005)]], |
[9823] = 9005, |
[9827] = 9005, |
[27006] = 9005, |
[49803] = 9005, |
-- soothe animal cc |
[2908] = [[return DotIt.sp:GMTD(2908)]], |
[8955] = 2908, |
[9901] = 2908, |
[26995] = 2908, |
-- feral charge bear |
[16979] = [[return 4]], |
-- bash dur |
[5211] = [[return DotIt.sp:GMTD(5211)]], |
[6798] = [[return DotIt.sp:GMTD(6798)]], |
[8983] = [[return DotIt.sp:GMTD(8983)]], |
-- growl |
[6795] = [[return 3]], |
-- hibernate |
[2637] = [[return 20]], |
[18657] = 2637, |
[18658] = 2637, |
}, |
SharedDebuffs = { |
-- fearie fire -- changes with 3.1 |
[770] = 48476, |
[48476] = [[return 40]], |
-- fearie fire feral -- changes with 3.1 |
[16857] = 48476, |
[48475] = 48476, |
}, |
} |
sp:insertSpells(druid, "DRUID") |
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ |
..\FrameXML\UI.xsd"> |
<script file="deathknight.lua"/> |
<script file="druid.lua"/> |
<script file="generalspells.lua"/> |
<script file="hunter.lua"/> |
<script file="mage.lua"/> |
<script file="paladin.lua"/> |
<script file="priest.lua"/> |
<script file="rogue.lua"/> |
<script file="shaman.lua"/> |
<script file="warlock.lua"/> |
<script file="warrior.lua"/> |
</Ui> |
local sp = DotIt:GetModule("spells") |
local shaman = { Dots = { |
-- Flame Shock |
[8052] = 8050, |
[8053] = 8050, |
[10447] = 8050, |
[10448] = 8050, |
[29228] = 8050, |
[25457] = 8050, |
[49232] = 8050, |
[49233] = 8050, |
[8050] = [[return DotIt.sp:GMTD(8050)]], |
}, |
Shortbuffs = { |
-- water shield |
[52127] = [[return DotIt.sp:GMTD(52127)]], |
[52129] = 52127, |
[52131] = 52127, |
[52134] = 52127, |
[52136] = 52127, |
[52138] = 52127, |
[24398] = 52127, |
[33736] = 52127, |
[57960] = 52127, |
-- lightning shield |
[324] = [[return DotIt.sp:GPB(324), 3 + 2 * select(5, GetTalentInfo(2,21))]], |
[325] = 324, |
[905] = 324, |
[945] = 324, |
[8134] = 324, |
[10431] = 324, |
[10432] = 324, |
[25469] = 324, |
[25472] = 324, |
[49280] = 324, |
[49281] = 324, |
-- water breathing |
[131] = [[return DotIt.sp:GPB(131)]], |
-- far sight |
[6196] = [[return DotIt.sp:GPB(6196)]], |
-- water walking |
[546] = [[return DotIt.sp:GPB(546)]], |
-- earth shield |
[974] = [[return DotIt.sp:GPB(974), 6 + select(5, GetTalentInfo(3,24))]], |
[32593] = 974, |
[32594] = 974, |
[49283] = 974, |
[49284] = 974, |
-- riptide |
[61295] = [[return DotIt.sp:GPB(61295)]], |
[61299] = 61295, |
[61300] = 61295, |
[61301] = 61295, |
-- elemental devestation |
[30165] = [[return DotIt.sp:GPB(61295)]], |
[29177] = 30165, |
[29178] = 30165, |
-- clearcasting |
[16246] = [[return DotIt.sp:GPB(16246)]], |
[16870] = 16246, |
-- elemental mastery |
[16166] = [[return DotIt.sp:GPB(16166)]], |
-- elemental oath |
[53410] = [[return DotIt.sp:GPB(53410)]], |
[53414] = 53410, |
-- flurry |
[16257] = [[return DotIt.sp:GPB(16257)]], |
[16277] = 16257, |
[16278] = 16257, |
[16279] = 16257, |
[16280] = 16257, |
-- maelstrom weapon |
[53817] = [[return DotIt.sp:GPB(17364), 5]], |
-- nature's swiftness |
[16188] = [[return DotIt.sp:GPB(16188)]], |
-- tidal focus |
[55198] = [[return DotIt.sp:GPB(55198)]], |
-- shamanistic rage |
[30823] = [[return DotIt.sp:GPB(30823)]], |
-- tidal waves |
[53390] = [[return DotIt.sp:GPB(53390)]], |
-- unleashed rage |
[30803] = [[return DotIt.sp:GPB(53390)]], |
[30804] = 30803, |
[30805] = 30803, |
[30806] = 30803, |
[30807] = 30803, |
}, |
Cooldowns = { |
-- tidal focus |
[55198] = 8042, |
-- shamanistic rage |
[30823] = 8042, |
-- nature's swiftness |
[16188] = 8042, |
-- mana tide totem |
[16190] = 8042, |
-- lava lash |
[60103] = 8042, |
-- stormstrike |
[17364] = 8042, |
-- feral spirit |
[51533] = 8042, |
-- elemental mastery |
[16166] = 8042, |
-- hex |
[51514] = 8042, |
-- lava burst |
[51505] = 8042, |
-- thunderstorm |
[51490] = 8042, |
-- riptide |
[61295] = 8042, |
-- fire elemental |
[2894] = 8042, |
-- earth elemental |
[2062] = 8042, |
-- chain lightning |
[421] = 8042, |
-- reincarnation (a bit to long imo) |
--[20608] = 8042, |
-- grounding totem |
[8177] = 8042, |
-- stoneclaw totem |
[5730] = 8042, |
-- fire nova totem |
[1535] = 8042, |
-- shocks (tracked by flame shock r1) |
[8042] = [[return 0]], |
}, |
Debuffs = { |
[17364] = [[return DotIt.sp:GMTD(17364), 2 + select(5, GetTalentInfo(2,23))]], |
}, |
CCs = { |
-- hex |
[51514] = [[return DotIt.sp:GMTD(51514)]], |
}, |
} |
sp:insertSpells(shaman, "SHAMAN") |
local sp = DotIt:GetModule("spells") |
local paladin = { |
Dots = { |
-- blood corruption |
[53742] = [[return DotIt.sp:GMTD(53742), 5]], |
-- holy vengeance |
[31803] = [[return DotIt.sp:GMTD(31803), 5]], |
--consecration |
[48819] = [[if DotIt:checkGlyph(54928) then return 8 + 2 else return 8 end]], |
[26573] = 26573, |
[20116] = 26573, |
[20922] = 26573, |
[20923] = 26573, |
[20924] = 26573, |
[27173] = 26573, |
[48818] = 26573, |
}, |
Debuffs = { |
-- judgement of justice |
[53407] = [[return DotIt.sp:GMTD(53407)]], |
-- judgement of light |
[20271] = [[return DotIt.sp:GMTD(20271)]], |
-- judgement of wisdom |
[53408] = [[return DotIt.sp:GMTD(53408)]], |
-- turn evil |
[10326] = [[return DotIt.sp:GMTD(10326)]], |
-- avenger's shield |
[31935] = [[return 10]], |
[32699] = 31935, |
[32700] = 31935, |
[48826] = 31935, |
[48827] = 31935, |
-- vindication |
[67] = [[return 15]], |
[26017] = [[return 15]], |
}, |
Cooldowns = { |
-- avenger's shield |
[31935] = 498, |
-- divine shield |
[642] = 498, |
-- hand of salvation |
[1038] = 498, |
-- turn evil |
[10326] = 498, |
-- exorcism |
[879] = 498, |
-- hand of freedom |
[1044] = 498, |
-- lay on hands |
[633] = 498, |
-- righteous defense |
[31789] = 498, |
-- hand of reckoning |
[62124] = 498, |
-- divine protection |
[498] = [[return 0]], |
-- hand of protection |
[1022] = 498, |
--shield of righteousness |
[53600] = 498, |
[61411] = 498, |
--hammer of justice |
[53595] = 498, |
-- judgement of justice |
[53407] = 498, |
-- judgement of light |
[20271] = 498, |
-- judgement of wisdom |
[53408] = 498, |
--consecration |
[26573] = 498, |
--holy shield |
[20925] = 498, |
-- divine intervention |
[19752] = 498, |
-- hand of sacrifie |
[6940] = 498, |
-- holy shock |
[20473] = 498, |
-- holy wrath |
[2812] = 498, |
-- avanging wrath |
[31884] = 498, |
-- divine plea |
[54428] = 498, |
-- crusader strike |
[35395] = 498, |
-- divine favor |
[20216] = 498, |
-- divine illumination |
[31842] = 498, |
-- divine storm |
[53385] = 498, |
-- hammer of the righteous |
[53595] = 498, |
-- repentance |
[20066] = 498, |
}, |
Shortbuffs = { |
-- the art of war |
[53489] = [[return DotIt.sp:GPB(53489)]], |
[59578] = 59578, |
-- lights grace |
[31834] = [[return DotIt.sp:GPB(31834)]], |
-- judgement of the pur |
[53655] = [[return DotIt.sp:GPB(53655)]], |
[53656] = 53655, |
[53657] = 53655, |
[54152] = 53655, |
[54153] = 53655, |
-- infusion of light |
[53672] = [[return DotIt.sp:GPB(53672)]], |
[54149] = 53672, |
-- divine illumination |
[31842] = [[return DotIt.sp:GPB(31842)]], |
-- sacred shield |
[53601] = [[return DotIt.sp:GPB(53601)]], |
-- divine plea |
[54428] = [[return DotIt.sp:GPB(54428)]], |
-- avanging wrath |
[31884] = [[return DotIt.sp:GPB(31884)]], |
-- seal of command |
--[20375] = [[return DotIt.sp:GPB(20375)]], |
-- seal of the martyr |
--[53720] = [[return DotIt.sp:GPB(53720)]], |
-- seal of corruption |
--[53736] = [[return DotIt.sp:GPB(53736)]], |
-- seal of blood |
--[31892] = [[return DotIt.sp:GPB(31892)]], |
-- seal of vengeance |
--[31801] = [[return DotIt.sp:GPB(31801)]], |
-- holy shield |
[20925] = [[return DotIt.sp:GPB(20925)]], |
[20927] = 20925, |
[20928] = 20925, |
[27179] = 20925, |
[48951] = 20925, |
[48952] = 20925, |
-- hammer of wrath |
[24275] = [[return DotIt.sp:GPB(24275)]], |
-- seal of wisdom |
[20166] = [[return DotIt.sp:GPB(20166)]], |
-- seal of light |
[20165] = [[return DotIt.sp:GPB(20165)]], |
-- hand of salvation |
[1038] = [[return DotIt.sp:GPB(1038)]], |
-- seal of justice |
[20164] = [[return DotIt.sp:GPB(20164)]], |
-- hand of freedom |
[1044] = [[return DotIt.sp:GPB(1044)]], |
-- divine protection |
[498] = [[return DotIt.sp:GPB(498)]], |
-- hand of protection |
[1022] = [[return DotIt.sp:GPB(1022)]], |
}, |
CCs = { |
-- repentance |
[20066] = [[return DotIt.sp:GMTD(20066)]], |
-- holy wrath |
[2812] = [[return DotIt.sp:GMTD(2812)]], |
[2812] = 2812, |
[2812] = 2812, |
[2812] = 2812, |
[2812] = 2812, |
--hammer of justice |
[10308] = [[return DotIt.sp:GMTD(10308)]], |
[5589] = [[return DotIt.sp:GMTD(5589)]], |
[5588] = [[return DotIt.sp:GMTD(5588)]], |
[853] = [[return DotIt.sp:GMTD(853)]], |
}, |
} |
sp:insertSpells(paladin, "PALADIN") |
local sp = DotIt:GetModule("spells") |
local mage = { |
Dots = { |
-- Living Bomb |
[55359] = 44457, |
[55360] = 44457, |
[44457] = [[return 12]], |
-- flamestrike |
[2121] = [[return 8]], |
[2120] = 2121, |
[8422] = 2121, |
[8423] = 2121, |
[10215] = 2121, |
[10216] = 2121, |
[27086] = 2121, |
[42925] = 2121, |
[42926] = 2121, |
-- ignite |
[12654] = [[return 4]], |
}, |
CCs = { |
--impact |
[12355] = [[return 2]], |
-- polymorph |
[118] = [[return DotIt.sp:GMTD(118)]], |
[12824] = 118, |
[12825] = 118, |
[61305] = 118, |
[28272] = 118, |
[12826] = 118, |
[61025] = 118, |
[28271] = 118, |
}, |
Debuffs = { |
-- blizzard |
[10] = [[return 8]], |
[6141] = 120, |
[8427] = 120, |
[10185] = 120, |
[10186] = 120, |
[10187] = 120, |
[27085] = 120, |
[42939] = 120, |
[42940] = 120, |
-- cone of cold |
[120] = [[return 8]], |
[8492] = 120, |
[10159] = 120, |
[10160] = 120, |
[10161] = 120, |
[27087] = 120, |
[42930] = 120, |
[42931] = 120, |
-- frost nova |
[122] = [[return DotIt.sp:GMTD(122)]], |
[865] = 122, |
[6131] = 122, |
[10230] = 122, |
[27088] = 122, |
[42917] = 122, |
-- improved scorch |
[22959] = [[return DotIt.sp:GMTD(22959),5]], |
-- counterspell |
[2139] = [[return DotIt.sp:GMTD(2139)]], |
-- blast wave |
[11113] = [[return 6]], |
[13018] = 11113, |
[13019] = 11113, |
[13020] = 11113, |
[13021] = 11113, |
[27133] = 11113, |
[33933] = 11113, |
[42944] = 11113, |
[42945] = 11113, |
-- dragon's breath |
[31661] = [[return 5]], |
[33041] = 31661, |
[33042] = 31661, |
[33043] = 31661, |
[42949] = 31661, |
[42950] = 31661, |
-- deep freeze |
[44572] = [[return DotIt.sp:GMTD(44572)]], |
-- fingers of frost |
[44544] = [[return DotIt.sp:GMTD(44544)]], |
-- winters chill |
[12579] = [[return DotIt.sp:GMTD(12579), 5]], |
}, |
Shortbuffs = { |
-- presence of mind |
[12043] = [[return DotIt.sp:GPB(12043)]], |
-- missile barrage |
[44401] = [[return DotIt.sp:GPB(44401)]], |
-- hot streak |
[48108] = [[return DotIt.sp:GPB(48108)]], |
-- firestarter |
[54741] = [[return DotIt.sp:GPB(54741)]], |
-- burning determination |
[54748] = [[return DotIt.sp:GPB(54748)]], |
-- brain freeze (fireball!) |
[57761] = [[return DotIt.sp:GPB(57761)]], |
-- invisibility |
[66] = [[return DotIt.sp:GPB(66)]], |
-- ice barrier |
[11426] = [[return DotIt.sp:GPB(11426)]], |
[13031] = 11426, |
[13032] = 11426, |
[13033] = 11426, |
[27134] = 11426, |
[33405] = 11426, |
[43038] = 11426, |
[43039] = 11426, |
-- ice block |
[45438] = [[return DotIt.sp:GPB(45438)]], |
-- slow fall |
[130] = [[return DotIt.sp:GPB(130)]], |
-- icy veins |
[12472] = [[return DotIt.sp:GPB(12472), nil, {r = 0,g = 0, b = 1, a = 1}]], |
-- arcane blast |
[36032] = [[return 10, 3]], |
-- arcane power |
[12042] = [[return DotIt.sp:GPB(12042)]], |
-- slow |
[31589] = [[return DotIt.sp:GPB(31589)]], |
-- fire ward |
[543] = [[return DotIt.sp:GPB(543)]], |
[8457] = 543, |
[8458] = 543, |
[10223] = 543, |
[10225] = 543, |
[27128] = 543, |
[43010] = 543, |
-- focus magic |
[54648] = [[return DotIt.sp:GPB(54648)]], |
-- mana shield |
[1463] = [[return DotIt.sp:GPB(1463)]], |
[8494] = 1463, |
[8495] = 1463, |
[10191] = 1463, |
[10192] = 1463, |
[10193] = 1463, |
[27131] = 1463, |
[43019] = 1463, |
[43020] = 1463, |
-- frost ward |
[6143] = [[return DotIt.sp:GPB(6143)]], |
[8461] = 6143, |
[8462] = 6143, |
[10177] = 6143, |
[28609] = 6143, |
[32796] = 6143, |
[43012] = 6143, |
-- clearcasting |
[12536] = [[return DotIt.sp:GPB(12536)]], |
-- combustion |
[28682] = [[return DotIt.sp:GPB(12536), 10]], |
}, |
Cooldowns = { |
-- summon water elemental |
[31687] = 2136, |
-- presence of mind |
[12043] = 2136, |
-- blink |
[1953] = 2136, |
-- deep freeze |
[44572] = 2136, |
-- combustion |
[11129] = 2136, |
-- cold snap |
[11958] = 2136, |
-- ritual of refreshment |
[43987] = 2136, |
-- arcane barrage |
[44425] = 2136, |
-- invisibility |
[66] = 2136, |
-- dragon's breath |
[31661] = 2136, |
-- ice barrier |
[11426] = 2136, |
-- blast wave |
[11113] = 2136, |
-- ice block |
[45438] = 2136, |
-- cone of cold |
[120] = 2136, |
-- counterspell |
[2139] = 2136, |
-- wards (share cd) |
[543] = 2136, |
-- evocation |
[12051] = 2136, |
-- frost nova |
[122] = 2136, |
-- fire blast |
[2136] = [[return 0]], |
} |
} |
sp:insertSpells(mage, "MAGE") |
local sp = DotIt:GetModule("spells") |
local deathknight = { |
Dots = { |
-- Death Knight |
-- Frost Fever |
[55095] = [[return 12 + (3* select(5, GetTalentInfo(1,4)))]], |
-- Blood Plague |
[55078] = [[return 12 + (3* select(5, GetTalentInfo(1,4)))]], |
}, |
Debuffs = { |
-- chains of ice |
[45524] = [[return 10]], |
-- strangulate |
[49916] = 49913, |
[49915] = 49913, |
[49914] = 49913, |
[49913] = [[return 5]], |
-- death and decay |
[43265] = [[return 10]], |
[49936] = 43265, |
[49937] = 43265, |
[49938] = 43265, |
-- mark of blood |
[49005] = [[return 20]], |
}, |
Shortbuffs = { |
-- icebound fort |
[48792] = [[return DotIt.sp:GPB(48792)]], |
-- raise dead |
[46584] = [[if select(5, GetTalentInfo(3, 19)) == 0 then return 2*60 end]], |
-- blood tap |
[45529] = [[return DotIt.sp:GPB(45529)]], |
-- anti magic shell |
[48707] = [[return DotIt.sp:GPB(48707)]], |
-- unholy blight |
[49194] = [[return DotIt.sp:GPB(49194)]], |
[51376] = 49194, |
[51378] = 49194, |
[51379] = 49194, |
-- summon gargoyle |
[49206] = [[return DotIt.sp:GPB(49206)]], |
-- bone armor |
[54467] = [[return DotIt.sp:GPB(54467)]], |
-- horn of winter |
[57330] = [[return DotIt.sp:GPB(57330)]], |
[57623] = [[return DotIt.sp:GPB(57623)]], |
-- unholy strength |
[53365] = [[return DotIt.sp:GPB(53365)]], |
-- killing machine |
[51124] = [[return DotIt.sp:GPB(51124)]], |
-- freezing fog |
[59052] = [[return DotIt.sp:GPB(59052)]], |
-- ebon plague |
[51735] = [[return DotIt.sp:GPB(51735)]], |
-- abominations might |
[53137] = [[return DotIt.sp:GPB(53137)]], |
-- blody vengenance |
[50447] = 50449, |
[50448] = 50449, |
[50449] = [[return DotIt.sp:GPB(50449)]], |
-- dancing runeblade |
[49028] = [[return DotIt.sp:GPB(49028)]], |
-- deathchill |
[49796] = [[return DotIt.sp:GPB(49796)]], |
-- hungering cold |
[49203] = [[return DotIt.sp:GPB(49203)]], |
-- hysteria |
[49016] = [[return DotIt.sp:GPB(49016)]], |
-- lichborne |
[49039] = [[return DotIt.sp:GPB(49039)]], |
-- death trance! |
[50466] = [[return DotIt.sp:GPB(50466)]], |
-- unbreakable armor |
[51271] = [[return DotIt.sp:GPB(51271)]], |
-- vampiric blood |
[55233] = [[return DotIt.sp:GPB(55233)]], |
-- glyph of blood boil |
[58617] = [[return DotIt.sp:GPB(58617)]], |
-- scent of blood |
[50421] = [[return DotIt.sp:GPB(50421)]], |
}, |
Cooldowns = { |
-- vampiric blood |
[55233] = 48792, |
-- unbreakable armor |
[51271] = 48792, |
-- mark of blood |
[49005] = 48792, |
-- lichborne |
[49039] = 48792, |
-- hysteria |
[49016] = 48792, |
-- hungering cold |
[49203] = 48792, |
-- deathchill |
[49796] = 48792, |
-- dancing runeblade |
[49028] = 48792, |
-- corpse explosion |
[49158] = 48792, |
-- anti-magic zone |
[51052] = 48792, |
-- abominations might |
[53137] = 48792, |
-- horn of winter |
[57330] = 48792, |
[57623] = 48792, |
-- summon gargoyle |
[49206] = 48792, |
-- bone armor |
[54467] = 48792, |
-- icebound fort |
[48792] = [[return 0]], |
-- howling blast |
[51408] = [[return 0]], |
[49184] = 51408, |
[51409] = 51408, |
[51410] = 51408, |
[51411] = 51408, |
-- death and decay |
[43265] = [[return 0]], |
[49936] = 43265, |
[49937] = 43265, |
[49938] = 43265, |
-- death grip |
[49576] = [[return 0]], |
-- raise dead |
[46584] = [[return 0]], |
-- mind freeze |
[47528] = [[return 0]], |
-- strangulate |
[49916] = 49913, |
[49915] = 49913, |
[49914] = 49913, |
[49913] = [[return 0]], |
-- blood tap |
[45529] = [[return 0]], |
-- death pact |
[48743] = [[return 0]], |
-- anti magic shell |
[48707] = [[return 0]], |
-- raise ally |
[61999] = [[return 0]], |
-- army of the dead |
[42650] = [[return 0]], |
}, |
} |
sp:insertSpells(deathknight, "DEATHKNIGHT") |
local sp = DotIt:GetModule("spells") |
local generalspells = { |
Shortbuffs = { |
-- Casted by a Shaman but important for everyone |
-- Heroism -- Bloodlust |
[2825] = [[return DotIt.sp:GPB(2825), 1, {r = 0,g = 0, b = 1, a = 1}]], |
[32182] = [[return DotIt.sp:GPB(32182), 1, {r = 0,g = 0, b = 1, a = 1}]], |
-- power infusion |
[10060] = [[return DotIt.sp:GPB(10060)]], |
-- Tricks of the Trade |
[57934] = [[local name = GetSpellInfo(57934) local dur, ismine = select(7, UnitBuff("player", name)) if not dur then dur = 0 else dur = dur-GetTime() end if ismine then dur = 0 end return dur, 1, {r = 1,g = 0, b = 0, a = 1}]], |
-- Potion effects |
-- Potion of speed |
[53908] = [[return DotIt.sp:GPB(53908), 1, {r = 0,g = 1, b = 0, a = 1}]], |
-- Potion of Wild Magic |
[53909] = [[return DotIt.sp:GPB(53909), 1, {r = 0,g = 1, b = 0, a = 1}]], |
-- ferocious inspiration |
[34455] = [[return DotIt.sp:GPB(34455), 1, {r = 0,g = 1, b = 0, a = 1}]], |
[34459] = 34455, |
[34459] = 34460, |
-- replenishment |
[57669] = [[return DotIt.sp:GPB(57669), 1, {r = 0,g = 1, b = 0, a = 1}]], |
}, |
} |
sp:insertSpells(generalspells, "GENERAL") |
local sp = DotIt:GetModule("spells") |
local rogue = { |
Dots = { |
-- Garrote |
[8631] = 703, |
[8632] = 703, |
[8633] = 703, |
[11289] = 703, |
[11290] = 703, |
[26839] = 703, |
[26884] = 703, |
[48676] = 703, |
[48675] = 703, |
[703] = [[if DotIt:checkGlyph(56812) then return 15 else return 18 end]], |
-- Rupture |
[8639] = 1943, |
[8640] = 1943, |
[11273] = 1943, |
[11274] = 1943, |
[11275] = 1943, |
[26867] = 1943, |
[48671] = 1943, |
[48672] = 1943, |
[1943] = [[return DotIt.sp:GMTD(1943)]], |
-- Deadly Poison |
[11353] = 2818, |
[2819] = 2818, |
[11354] = 2818, |
[25349] = 2818, |
[26968] = 2818, |
[27187] = 2818, |
[57969] = 2818, |
[57970] = 2818, |
[2818] = [[return 12, 5]], |
}, |
Debuffs = {-- Wound Poison |
[13222] = 13218, |
[13223] = 13218, |
[13224] = 13218, |
[27189] = 13218, |
[57974] = 13218, |
[57975] = 13218, |
[13218] = [[return 15]], |
-- Crippling Poison |
[3409] = [[return 12]], |
-- Mind-numbing Poison |
[5760] = [[return 10]], |
-- dismantle |
[51722] = [[return DotIt.sp:GMTD(51722)]], |
-- deadly throw |
[26679] = [[return DotIt.sp:GMTD(26679)]], |
[48673] = 26679, |
[48674] = 26679, |
-- riposte |
[14251] = [[return DotIt.sp:GMTD(14251)]], |
}, |
SharedDebuffs = { |
-- expose armor |
-- 3.1 |
[8647] = [[return DotIt.sp:GTD(8647)]], |
}, |
Shortbuffs = { |
-- Slice and Dice |
[6774] = 5171, |
[5171] = [[return DotIt.sp:GPB(5171), nil, {r = 222/255, g = 184/255, b = 135/255, a = 1}]], |
-- Blade flurry |
[13877] = [[return DotIt.sp:GPB(13877), nil, {r = 219/255,g = 219/255, b = 112/255, a = 1}]], |
-- Hunger for Blood |
[51662] = [[return DotIt.sp:GPB(51662), 3, {r = 142/255,g = 35/255, b = 35/255, a = 1}]], |
-- Adrenaline Rush |
[13750] = [[return DotIt.sp:GPB(13750), 3, {r = 1,g = 1, b = 1, a = 1}]], |
-- evsion |
[5277] = [[return DotIt.sp:GPB(5277)]], |
[26669] = [[return DotIt.sp:GPB(26669)]], |
-- sprint |
[2983] = [[return DotIt.sp:GPB(2983)]], |
[8696] = [[return DotIt.sp:GPB(8696)]], |
[11305] = [[return DotIt.sp:GPB(11305)]], |
-- feint |
[48659] = [[return DotIt.sp:GPB(48659)]], |
-- vanish |
[1856] = [[return DotIt.sp:GPB(1856)]], |
[1857] = 1857, |
[26889] = 1857, |
-- cloak of shadows |
[31224] = [[return DotIt.sp:GPB(31224)]], |
-- envenom |
[32684] = [[return DotIt.sp:GPB(32684), nil, {r = 0, g = 1, b = 0, a = 1}]], |
[32645] = 32684, |
[57992] = 32684, |
[57993] = 32684, |
-- shadow dance |
[51713] = [[return DotIt.sp:GPB(51713)]], |
-- shadowstep |
[36554] = [[return DotIt.sp:GPB(36554)]], |
}, |
Cooldowns = { |
-- kidney shot |
[8643] = 5277, |
[408] = 5277, |
-- shadowstep |
[36554] = 5277, |
-- shadow dance |
[51713] = 5277, |
-- cold blood |
[14177] = 5277, |
-- killing spree |
[51690] = 5277, |
-- premeditation |
[14183] = 5277, |
-- preperation |
[14185] = 5277, |
-- riposte |
[14251] = 5277, |
-- cloak of shadows |
[31224] = 5277, |
-- blind |
[2094] = 5277, |
-- vanish |
[1856] = 5277, |
[1857] = 5277, |
[26889] = 5277, |
-- stealth |
[1785] = 5277, |
[1784] = 5277, |
[1786] = 5277, |
[1787] = 5277, |
-- distract |
[1725] = 5277, |
-- dismantle |
[51722] = 5277, |
-- feint |
[1966] = 5277, |
[6768] = 5277, |
[8637] = 5277, |
[11303] = 5277, |
[25302] = 5277, |
[27448] = 5277, |
[48658] = 5277, |
[48659] = 5277, |
-- kick |
[1766] = 5277, |
-- evsion |
[5277] = [[return 0]], |
[26669] = 5277, |
-- sprint |
[2983] = 5277, |
[8696] = 5277, |
[11305] = 5277, |
-- Tricks of the Trade |
[57934] = [[return 0, 1, {r = 1, g = 0, b = 0, a = 1}]], |
}, |
CCs = { |
-- cheap shot |
[1833] = [[return DotIt.sp:GMTD(1833)]], |
-- sap |
[6770] = [[return DotIt.sp:GMTD(6770)]], |
[2070] = 6770, |
[11297] = 6770, |
[51724] = 6770, |
-- blind |
[2094] = [[return 10]], |
-- kidney shot |
[8643] = [[return DotIt.sp:GMTD(8643)]], |
[408] = [[return DotIt.sp:GMTD(408)]], |
}, |
} |
sp:insertSpells(rogue, "ROGUE") |
if not DotIt then |
error("DotIt has to be loaded first") |
end |
local newList, del, deepDel, deepCopy = DotIt.sb:GetRecyclingFunctions() |
local bossmods = DotIt:NewModule("bossmods") |
local function DotIt:BigWigs_StartBar(msg, self, text, length, icon) |
end |
local function dbmhook(timer, id, icon, huge, small, color) |
DEFAULT_CHAT_FRAME:AddMessage(timer) |
DEFAULT_CHAT_FRAME:AddMessage(id) |
end |
local function setupHooks() |
-- dbm hook |
if IsAddonLoaded("Deadly Bossmods") then |
DotIt:Hook(DBT, "CreateBar", function(...) dbmHook(...) end) |
elseif IsAddonLoaded("BigWigs") then |
DotIt:RegisterEvent("BigWigs_StartBar") |
end |
end |
function bossmods:OnInitialize() |
setupHooks() |
end |
local major = "SBar-0.1" |
local minor = 1 |
local DEBUG = true |
local tinsert = table.insert |
assert(LibStub, string.format("%s requires LibStub.", major)) |
local sbar = LibStub:NewLibrary(major, minor) |
if( not sbar ) then return end |
local scaleinfo |
local default = { |
texture = "Interface\\ChatFrame\\ChatFrameBackground" |
} |
local poolNum = 0 |
local newList, del, deepDel, deepCopy |
do |
local pool = setmetatable({}, {__mode='k'}) |
function newList(...) |
poolNum = poolNum + 1 |
local t = next(pool) |
if t then |
pool[t] = nil |
for i = 1, select('#', ...) do |
t[i] = select(i, ...) |
end |
else |
t = { ... } |
end |
return t |
end |
function del(t) |
if type(t) ~= "table" then |
error("Bad argument #1 to `del'. Expected table, got nil.", 2) |
end |
if pool[t] then |
error("Double-free syndrome.", 2) |
end |
pool[t] = true |
poolNum = poolNum - 1 |
for k in pairs(t) do |
t[k] = nil |
end |
setmetatable(t, nil) |
t[''] = true |
t[''] = nil |
return nil |
end |
local deepDel_data |
function deepDel(tinp) |
local t = tinp |
tinp = nil |
local made_deepDel_data = not deepDel_data |
if made_deepDel_data then |
deepDel_data = newList() |
end |
if type(t) == "table" and not deepDel_data[t] then |
deepDel_data[t] = true |
for k,v in pairs(t) do |
deepDel(v) |
deepDel(k) |
end |
del(t) |
end |
if made_deepDel_data then |
deepDel_data = del(deepDel_data) |
end |
return nil |
end |
function deepCopy(t) |
if type(t) ~= "table" then |
return t |
else |
local u = newList() |
for k, v in pairs(t) do |
u[deepCopy(k)] = deepCopy(v) |
end |
return u |
end |
end |
end |
local function argcheck(param, num, ...) |
for i = 1, select('#', ...) do |
if(type(param) == select(i, ...)) then |
return |
end |
end |
local types = string.join(", ", ...) |
local caller = string.match(debugstack(2,2,0), ": in function [`<](.-)['>]") |
error(tostring("Bad argument %d in function %s. (%s instead of %s)"):format(num, caller, type(param), types)) |
end |
--*------------------------------------------- |
-- private methods |
--*------------------------------------------- |
local fixedText = newList() |
local bars |
local function clearFixedText(pos) |
if not pos then return end |
for _, bar in pairs(bars) do |
if bar.pos and bar.pos == pos then |
return |
end |
end |
sbar:SetFixedText(nil, pos) |
end |
local function out(text) |
if DEBUG then |
DEFAULT_CHAT_FRAME:AddMessage(text) |
end |
end |
local function setFont(obj, what) |
if not scaleinfo.fonts then |
obj:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE, MONOCHROME") |
end |
local font, size, flags |
if what == "scale" then |
font = scaleinfo.fonts.scale.font |
size = scaleinfo.fonts.scale.size |
flags = "" |
if scaleinfo.fonts.scale.outline then |
flags = flags.."OUTLINE" |
end |
if scaleinfo.fonts.scale.thickoutline then |
if flags == "" then |
flags = flags.."THICKOUTLINE" |
else |
flags = flags..", THICKOUTLINE" |
end |
end |
if scaleinfo.fonts.scale.monochrome then |
if flags == "" then |
flags = flags.."MONOCHROME" |
else |
flags = flags..", MONOCHROME" |
end |
end |
else |
font = scaleinfo.fonts.bar.font |
size = scaleinfo.fonts.bar.size |
flags = "" |
if scaleinfo.fonts.bar.outline then |
flags = flags.."OUTLINE" |
end |
if scaleinfo.fonts.bar.thickoutline then |
if flags == "" then |
flags = flags.."THICKOUTLINE" |
else |
flags = flags..", THICKOUTLINE" |
end |
end |
if scaleinfo.fonts.bar.monochrome then |
if flags == "" then |
flags = flags.."MONOCHROME" |
else |
flags = flags..", MONOCHROME" |
end |
end |
end |
obj:SetFont(font, size, flags) |
end |
local function getPosition(frame) |
return frame:GetLeft() * frame:GetEffectiveScale(), frame:GetBottom() * frame:GetEffectiveScale() |
end |
local function setPosition(frame, x, y) |
frame:SetPoint("BOTTOMLEFT", x / frame:GetEffectiveScale(), y / frame:GetEffectiveScale()) |
end |
local function strvert(str) |
local outp = "" |
for b in string.gmatch(str, "%w+") do |
outp = outp .. b .. "\n" |
end |
outp = string.sub(outp, 1, string.len(outp)-1) |
return outp |
end |
local function strvertret(str) |
return string.join("", string.gmatch(str, "%w+")) |
end |
local function qsort(x,l,u,f) |
if l<u then |
local m=math.random(u-(l-1))+l-1 -- choose a random pivot in range l..u |
x[l],x[m]=x[m],x[l] -- swap pivot to first position |
local t=x[l] -- pivot value |
m=l |
local i=l+1 |
while i<=u do |
-- invariant: x[l+1..m] < t <= x[m+1..i-1] |
if f(x[i],t) then |
m=m+1 |
x[m],x[i]=x[i],x[m] -- swap x[i] and x[m] |
end |
i=i+1 |
end |
x[l],x[m]=x[m],x[l] -- swap pivot to a valid place |
-- x[l+1..m-1] < x[m] <= x[m+1..u] |
qsort(x,l,m-1,f) |
qsort(x,m+1,u,f) |
end |
end |
local function updateBarsFrameLevel(bartupd) |
if not bartupd then return false end |
local j, t |
-- simple bubble sort |
local n=1 |
while bartupd[n] do n=n+1 end; n=n-1 |
qsort(bartupd, 1, n, function(x, y) return (x.start+x.dur) < (y.start + y.dur) end) |
-- |
local count = #bartupd + 2 |
local i = 1 |
while bartupd[i] do |
count = count - 1 |
bartupd[i].frame:SetFrameLevel(count) |
i = i + 1 |
end |
del(bartupd) |
end |
-- |
local function checkLog() |
if not scaleinfo.amaxtimes then return false end |
local count = 0 |
for k, v in pairs(scaleinfo.amaxtimes) do |
count = count + 1 |
end |
if count == 0 then return false end |
return true |
end |
local function OnVerticalUpdate(bars, el, maxneg, maxtime, loflag) |
-- loop through all bars |
if not bars then return end |
local tmptime |
for k, bar in pairs(bars) do |
if bar.frame then |
-- solves the truncating problem |
local sekinp = scaleinfo.size / scaleinfo.maxtime |
if not bar.start or not bar.dur then return end |
if maxneg > bar.start then |
bar.dur = bar.dur + (bar.start - maxneg) |
bar.start = maxneg |
end |
if maxneg == bar.start then |
if checkLog() and (bar.dur + bar.start) > scaleinfo.maxtime then |
tmptime = bar.dur - el |
bar.dur = scaleinfo.maxtime - bar.start |
else |
bar.dur = bar.dur - el |
end |
else |
bar.start = bar.start - el |
end |
if checkLog() and (bar.dur + bar.start) > scaleinfo.maxtime then |
tmptime = bar.dur |
bar.dur = scaleinfo.maxtime - bar.start |
end |
-- |
if not loflag then |
bar.frame:SetPoint("BOTTOMRIGHT", scaleinfo.frame, "BOTTOMLEFT", 8 - bar.pos * scaleinfo.height, sekinp*bar.start) |
else |
bar.frame:SetPoint("BOTTOMLEFT", scaleinfo.frame, "BOTTOMRIGHT", -8 + bar.pos * scaleinfo.height, sekinp*bar.start) |
end |
bar.frame:SetHeight(sekinp*bar.dur) |
if bar.dur + bar.start <= 0 then |
local wpos = bar.pos |
tmppos = bar.pos |
bar.pos = nil |
clearFixedText(wpos) |
bar.frame:Hide() |
bar.frame = nil |
bar.pos = nil |
bar.dur = nil |
bar.start = nil |
bar.data = nil |
deepDel(bar) |
bar = nil |
end |
if bar then |
if(bar.start < 0) then |
if(math.abs(bar.start) < bar.dur) then |
bar.tex:Show() |
bar.texg:Show() |
bar.tex:SetHeight(sekinp*(bar.dur-math.abs(bar.start))) |
bar.texg:SetHeight(sekinp*math.abs(bar.start)) |
else |
bar.tex:Hide() |
bar.texg:Show() |
bar.texg:SetHeight(bar.frame:GetWidth()) |
end |
else |
bar.tex:Show() |
bar.texg:Hide() |
bar.tex:SetHeight(sekinp*bar.dur) |
end |
end |
if tmptime and checkLog() then |
local count = 0 |
local mtime = scaleinfo.maxtime |
local parttime |
for k, v in pairs(scaleinfo.amaxtimes) do |
mtime = mtime + v |
parttime = v |
if mtime > tmptime then break end |
count = count + 1 |
end |
-- we have count full bars and count + 1 is the bar that is not full |
local partsekinp = scaleinfo.part / parttime |
local timeinseg = tmptime - (mtime - parttime) |
bar.frame:SetHeight(bar.frame:GetHeight() + scaleinfo.part * count + partsekinp * timeinseg) |
bar.tex:SetHeight(bar.tex:GetHeight() + scaleinfo.part * count + partsekinp * timeinseg) |
bar.dur = tmptime |
end |
tmptime = nil |
end |
end |
-- |
end |
local function OnHorizontalUpdate(bars, el, maxneg, loflag) |
if not bars then return end |
-- loop through all bars |
local tmptime |
for k, bar in pairs(bars) do |
if bar.frame then |
local sekinp = scaleinfo.size / scaleinfo.maxtime |
-- solves the truncating problem |
if not bar.start or not bar.dur then return end |
if maxneg > bar.start then |
bar.dur = bar.dur + (bar.start - maxneg) |
bar.start = maxneg |
end |
if maxneg == bar.start then |
if checkLog() and (bar.dur + bar.start) > scaleinfo.maxtime then |
tmptime = bar.dur - el |
bar.dur = scaleinfo.maxtime - bar.start |
else |
bar.dur = bar.dur - el |
end |
else |
bar.start = bar.start - el |
end |
if checkLog() and (bar.dur + bar.start) > scaleinfo.maxtime then |
tmptime = bar.dur |
bar.dur = scaleinfo.maxtime - bar.start |
end |
-- |
-- bar.frame, bar.tex, bar.texg, bar.dur, bar.start, bar.pos, bar.icon, bar.text |
--out(GetTime()) |
if not loflag then |
bar.frame:SetPoint("BOTTOMLEFT", scaleinfo.frame, "TOPLEFT", sekinp*bar.start, -8 + bar.pos * scaleinfo.height) |
else |
bar.frame:SetPoint("TOPLEFT", scaleinfo.frame, "BOTTOMLEFT", sekinp*bar.start, 8 - bar.pos * scaleinfo.height) |
end |
bar.frame:SetWidth(sekinp*bar.dur) |
if bar.dur + bar.start <= 0 then |
local wpos = bar.pos |
tmppos = bar.pos |
bar.pos = nil |
clearFixedText(wpos) |
bar.frame:Hide() |
bar.frame = nil |
bar.pos = nil |
bar.dur = nil |
bar.start = nil |
bar.data = nil |
deepDel(bar) |
bar = nil |
end |
if bar then |
if(bar.start < 0) then |
if(math.abs(bar.start) < bar.dur) then |
bar.tex:Show() |
bar.texg:Show() |
bar.tex:SetWidth(sekinp*(bar.dur-math.abs(bar.start))) |
bar.texg:SetWidth(sekinp*math.abs(bar.start)) |
else |
bar.tex:Hide() |
bar.texg:Show() |
bar.texg:SetWidth(bar.frame:GetWidth()) |
end |
else |
bar.tex:Show() |
bar.texg:Hide() |
bar.tex:SetWidth(sekinp*bar.dur) |
end |
end |
if tmptime and checkLog() then |
local count = 0 |
local mtime = scaleinfo.maxtime |
local parttime |
for k, v in pairs(scaleinfo.amaxtimes) do |
mtime = mtime + v |
parttime = v |
if mtime > tmptime then break end |
count = count + 1 |
end |
-- we have count full bars and count + 1 is the bar that is not full |
local partsekinp = scaleinfo.part / parttime |
local timeinseg = tmptime - (mtime - parttime) |
bar.frame:SetWidth(bar.frame:GetWidth() + scaleinfo.part * count + partsekinp * timeinseg) |
bar.tex:SetWidth(bar.tex:GetWidth() + scaleinfo.part * count + partsekinp * timeinseg) |
bar.dur = tmptime |
end |
tmptime = nil |
end |
end |
-- |
end |
-- |
local el = 0 |
local function OnUpdate(self, elapsed) |
el = el + elapsed |
--if el < 1 then return end |
local count = 0 |
if bars then |
for k, bar in pairs(bars) do |
if bar.frame then |
count = count + 1 |
end |
end |
end |
if count == 0 then |
if scaleinfo.hide and scaleinfo.frame:IsShown() then |
scaleinfo.frame:Hide() |
end |
el = 0 |
scaleinfo.frame:SetScript("OnUpdate", nil) |
return |
end |
if scaleinfo.horizontal then |
OnHorizontalUpdate(bars, el, scaleinfo.maxneg, scaleinfo.loflag) |
else |
OnVerticalUpdate(bars, el, scaleinfo.maxneg, scaleinfo.maxtime, scaleinfo.loflag) |
end |
el = 0 |
sbar:UpdateFrameLevel() |
end |
local function createVericalScale(height, maxtime, steps, handler, loflag, texture) |
local secforstep = maxtime / steps |
local f = CreateFrame("Frame", "SBarAnchorFrame",UIParent) -- only used for the scale |
f:EnableMouse(true) |
f:SetMovable(true) |
f:SetFrameStrata("BACKGROUND") |
f:SetWidth(32) |
f:SetHeight(height) |
f:SetPoint("CENTER",UIParent,"CENTER",0,0) |
f:Show() |
local function OnDragStart(self) |
if not scaleinfo.locked then |
if( IsAltKeyDown() ) then |
self.isMoving = true |
self:StartMoving() |
end |
end |
end |
local function OnDragStop(self) |
if( self.isMoving) then |
self:StopMovingOrSizing() |
end |
if type(handler) == "function" then |
handler() |
else |
if handler then |
local x, y = getPosition(scaleinfo.frame) |
handler.x = x |
handler.y = y |
end |
end |
end |
f:SetScript("OnMouseDown", OnDragStart) |
f:SetScript("OnMouseUp", OnDragStop) |
local maintexture = f:CreateTexture(nil, "BACKGROUND") |
maintexture:SetTexture(texture or default.texture) |
maintexture:SetPoint("CENTER", 0, -1) |
maintexture:SetWidth(2) |
maintexture:SetHeight(f:GetHeight()) |
maintexture:SetVertexColor(1, 1, 1, 1) |
local part = f:GetHeight() / steps |
for i = 0, steps do |
local font |
if scaleinfo.scaletext then |
font = f:CreateFontString() |
setFont(font, "scale") |
font:SetText(string.sub(tostring(secforstep * i), 1, 3)) |
end |
local tex = f:CreateTexture(nil, "BACKGROUND") |
tex:SetTexture(texture or default.texture) |
tex:SetHeight(2) |
tex:SetWidth(6) |
tex:SetVertexColor(1, 1, 1, 1) |
if not loflag then |
tex:SetPoint("BOTTOMRIGHT", -16, part*i - 2) |
if scaleinfo.scaletext then |
font:SetPoint("BOTTOMRIGHT", 1, part*i) |
end |
else |
tex:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", 16, part*i - 2) |
if scaleinfo.scaletext then |
font:SetPoint("BOTTOMLEFT", 1, part*i) |
end |
end |
end |
if checkLog() then |
scaleinfo.part = part |
local count = steps + 1 |
local tex = maxtime |
f:SetHeight(f:GetHeight() + part * #scaleinfo.amaxtimes) |
for k,v in pairs(scaleinfo.amaxtimes) do |
local font |
if scaleinfo.scaletext then |
font = f:CreateFontString() |
setFont(font, "scale") |
tex = tex + v |
font:SetText(tex) |
end |
local tex = f:CreateTexture(nil, "BACKGROUND") |
tex:SetTexture(texture or default.texture) |
tex:SetWidth(6) |
tex:SetHeight(2) |
tex:SetVertexColor(1, 1, 1, 1) |
if not loflag then |
tex:SetPoint("BOTTOMRIGHT", -16, part*count - 2) |
if scaleinfo.scaletext then |
font:SetPoint("BOTTOMRIGHT", 1, part*count) |
end |
else |
tex:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", 16, part*count - 2) |
if scaleinfo.scaletext then |
font:SetPoint("BOTTOMLEFT", 1, part*count) |
end |
end |
count = count + 1 |
end |
end |
maintexture:SetHeight(f:GetHeight()) |
return f |
end |
local function createHorizontalScale(width, maxtime, steps, handler, loflag, texture) |
local secforstep = maxtime / steps |
local f = CreateFrame("Frame", "SBarAnchorFrame",UIParent) -- only used for the scale |
f:EnableMouse(true) |
f:SetMovable(true) |
f:SetFrameStrata("BACKGROUND") |
f:SetWidth(width) |
f:SetHeight(32) |
f:SetPoint("CENTER",UIParent,"CENTER",0,0) |
f:Show() |
local function OnDragStart(self) |
if not scaleinfo.locked then |
if( IsAltKeyDown() ) then |
self.isMoving = true |
self:StartMoving() |
end |
end |
end |
local function OnDragStop(self) |
if( self.isMoving) then |
self:StopMovingOrSizing() |
end |
if type(handler) == "function" then |
handler() |
else |
if handler then |
local x, y = getPosition(scaleinfo.frame) |
handler.x = x |
handler.y = y |
end |
end |
end |
f:SetScript("OnMouseDown", OnDragStart) |
f:SetScript("OnMouseUp", OnDragStop) |
local maintexture = f:CreateTexture(nil, "BACKGROUND") |
maintexture:SetTexture(texture or default.texture) |
maintexture:SetPoint("CENTER", 0, -1) |
maintexture:SetHeight(2) |
maintexture:SetVertexColor(1, 1, 1, 1) |
local part = f:GetWidth() / steps |
for i = 0, steps do |
local font |
if scaleinfo.scaletext then |
font = f:CreateFontString() |
setFont(font, "scale") |
font:SetText(string.sub(tostring(secforstep * i), 1, 3)) |
end |
local tex = f:CreateTexture(nil, "BACKGROUND") |
tex:SetTexture(texture or default.texture) |
tex:SetHeight(6) |
tex:SetWidth(2) |
tex:SetVertexColor(1, 1, 1, 1) |
if not loflag then |
if i == steps then |
tex:SetPoint("BOTTOMLEFT", width -2, 16) |
else |
tex:SetPoint("BOTTOMLEFT", part*i, 16) |
end |
if scaleinfo.scaletext then |
font:SetPoint("BOTTOMLEFT", part*i, 0) |
end |
else |
if i == steps then |
tex:SetPoint("TOPLEFT", width - 2, -16) |
else |
tex:SetPoint("TOPLEFT", part*i - 2, -16) |
end |
if scaleinfo.scaletext then |
font:SetPoint("TOPLEFT", f, "TOPLEFT", part*i, 0) |
end |
end |
end |
if checkLog() then |
scaleinfo.part = part |
local count = steps + 1 |
local tex = maxtime |
f:SetWidth(f:GetWidth() + part * #scaleinfo.amaxtimes) |
for k,v in pairs(scaleinfo.amaxtimes) do |
local font |
if scaleinfo.scaletext then |
font = f:CreateFontString() |
setFont(font, "scale") |
tex = tex + v |
font:SetText(tex) |
end |
local tex = f:CreateTexture(nil, "BACKGROUND") |
tex:SetTexture(texture or default.texture) |
tex:SetHeight(6) |
tex:SetWidth(2) |
tex:SetVertexColor(1, 1, 1, 1) |
if not loflag then |
tex:SetPoint("BOTTOMLEFT", part * count, 16) |
if scaleinfo.scaletext then |
font:SetPoint("BOTTOMLEFT", part * count, 0) |
end |
else |
tex:SetPoint("TOPLEFT", part * count - 2, -16) |
if scaleinfo.scaletext then |
font:SetPoint("TOPLEFT", f, "TOPLEFT", part * count, 0) |
end |
end |
count = count + 1 |
end |
end |
maintexture:SetWidth(f:GetWidth()) |
return f |
end |
local function createVerticalBar(data, duration, start, barheight, maxtime, text, icon, pos, color, colorzero, maxneg, loflag, texture) |
local tmptime |
if not scaleinfo.frame:IsShown() then |
scaleinfo.frame:Show() |
end |
if not scaleinfo.frame:GetScript("OnUpdate") then |
scaleinfo.frame:SetScript("OnUpdate", OnUpdate) |
end |
if not bars then bars = newList() end |
if maxneg > start then |
if checkLog() and (duration + start) > maxtime then |
tmptime = duration |
duration = maxtime |
else |
duration = duration + (start - maxneg) |
end |
start = maxneg |
elseif checkLog() and (duration + start) > maxtime then |
tmptime = duration |
duration = maxtime |
end |
local sekinp = barheight / maxtime |
-- barframe |
local barf = CreateFrame("Frame", nil, scaleinfo.frame) |
-- set it depending on the scale (right or left from the scale) |
if not loflag then |
barf:SetPoint("BOTTOMRIGHT", scaleinfo.frame, "BOTTOMLEFT", 8 - pos * scaleinfo.height, sekinp*start) |
else |
barf:SetPoint("BOTTOMLEFT", scaleinfo.frame, "BOTTOMRIGHT", -8 + pos * scaleinfo.height, sekinp*start) |
end |
barf:SetWidth(scaleinfo.height) |
barf:SetHeight(sekinp*duration) |
local barfon = newList() |
--barfont |
if text then |
local count = 0 |
for ch in string.gmatch(string.upper(text), ".") do |
-- first element |
local fobj = barf:CreateFontString() |
setFont(font) |
barfon[count] = fobj |
fobj:SetText(ch) |
if count == 0 then |
fobj:SetPoint("TOPLEFT", barf, "TOPLEFT", barf:GetWidth()/2 - fobj:GetStringWidth()/2 , -1*scaleinfo.height - 5) |
else |
fobj:SetPoint("TOPLEFT", barfon[count-1], "BOTTOMLEFT", 0, 0) |
end |
count = count + 1 |
end |
end |
--normal texture |
local bart = barf:CreateTexture(nil, "BACKGROUND") |
bart:SetTexture(texture or default.texture) |
bart:SetPoint("TOPRIGHT", barf, "TOPRIGHT", 0, 0) |
bart:SetWidth(barf:GetWidth()) |
bart:SetVertexColor(color.r, color.g, color.b, color.a) |
-- grayed texture |
local bartg = barf:CreateTexture(nil, "BACKGROUND") |
bartg:SetTexture(texture or default.texture) |
bartg:SetPoint("BOTTOMLEFT", barf, "BOTTOMLEFT", 0, 0) |
bartg:SetWidth(barf:GetWidth()) |
bartg:SetVertexColor(colorzero.r, colorzero.g , colorzero.b, colorzero.a) |
if(start < 0) then |
if(math.abs(start) < duration) then |
bart:Show() |
bartg:Show() |
bart:SetHeight(sekinp*(duration-math.abs(start))) |
bartg:SetHeight(sekinp*math.abs(start)) |
else |
bart:Hide() |
bartg:Show() |
bartg:SetHeight(barf:GetHeight()) |
end |
else |
bart:Show() |
bartg:Hide() |
bart:SetHeight(sekinp*duration) |
end |
-- create the logarithmic parts |
if tmptime and checkLog() then |
local count = 0 |
local mtime = maxtime |
local parttime |
for k, v in pairs(scaleinfo.amaxtimes) do |
mtime = mtime + v |
parttime = v |
if mtime > tmptime then break end |
count = count + 1 |
end |
-- we have count full bars and count + 1 is the bar that is not full |
local partsekinp = scaleinfo.part / parttime |
local timeinseg = tmptime - (mtime - parttime) |
barf:SetHeight(barf:GetHeight() + scaleinfo.part * count + partsekinp * timeinseg) |
bart:SetHeight(bart:GetHeight() + scaleinfo.part * count + partsekinp * timeinseg) |
duration = tmptime |
end |
tmptime = nil |
-- icon |
local baric = barf:CreateTexture(nil, "BORDER") |
baric:SetTexture(icon) |
baric:SetHeight(scaleinfo.height) |
baric:SetWidth(scaleinfo.height) |
if scaleinfo.iconpos then |
baric:SetPoint("TOPRIGHT", barf, "TOPRIGHT", 0, baric:GetHeight()) |
else |
baric:SetPoint("TOPRIGHT", barf, "TOPRIGHT", 0, 0) |
end |
tinsert(bars, { data = data, frame = barf, tex = bart, texg = bartg, dur = duration, start = start, pos = pos, text = barfon, icon = baric } ) |
end |
-- |
local function createHorizontalBar(data, duration, start, barwidth, maxtime, text, icon, pos, color, colorzero, maxneg, loflag, texture) |
-- |
local tmptime |
if not scaleinfo.frame:IsShown() then |
scaleinfo.frame:Show() |
end |
-- |
if not scaleinfo.frame:GetScript("OnUpdate") then |
scaleinfo.frame:SetScript("OnUpdate", OnUpdate) |
end |
if not bars then bars = newList() end |
if maxneg > start then |
if checkLog() and (duration + start) > maxtime then |
tmptime = duration |
duration = maxtime |
else |
duration = duration + (start - maxneg) |
end |
start = maxneg |
elseif checkLog() and (duration + start) > maxtime then |
tmptime = duration |
duration = maxtime |
end |
local sekinp = barwidth / maxtime |
-- barframe |
local barf = CreateFrame("Frame", nil, scaleinfo.frame) |
if not loflag then |
barf:SetPoint("BOTTOMLEFT", scaleinfo.frame, "TOPLEFT", sekinp*start, -8 + pos * scaleinfo.height) |
else |
barf:SetPoint("TOPLEFT", scaleinfo.frame, "BOTTOMLEFT", sekinp*start, 8 - pos * scaleinfo.height) |
end |
barf:SetWidth(sekinp*duration) |
barf:SetHeight(scaleinfo.height) |
-- barfont |
local barfon = barf:CreateFontString() |
setFont(barfon) |
barfon:SetText(text) |
barfon:SetPoint("BOTTOMRIGHT", barf, "BOTTOMRIGHT", -1 * scaleinfo.height - 5 , scaleinfo.height/2 - barfon:GetStringWidth()/2) |
-- normal texture |
local bart = barf:CreateTexture(nil, "BACKGROUND") |
bart:SetTexture(texture or default.texture) |
bart:SetPoint("TOPRIGHT", barf, "TOPRIGHT", 0, 0) |
bart:SetHeight(barf:GetHeight()) |
bart:SetVertexColor(color.r, color.g, color.b, color.a) |
-- grayed texture |
local bartg = barf:CreateTexture(nil, "BACKGROUND") |
bartg:SetTexture(texture or default.texture) |
bartg:SetPoint("TOPLEFT", barf, "TOPLEFT", 0, 0) |
bartg:SetHeight(barf:GetHeight()) |
bartg:SetVertexColor(colorzero.r, colorzero.g , colorzero.b, colorzero.a) |
if(start < 0) then |
if(math.abs(start) < duration) then |
bart:Show() |
bartg:Show() |
bart:SetWidth(sekinp * (duration-math.abs(start))) |
bartg:SetWidth(sekinp * math.abs(start)) |
else |
bart:Hide() |
bartg:Show() |
bartg:SetWidth(barf:GetWidth()) |
end |
else |
bart:Show() |
bartg:Hide() |
bart:SetWidth(sekinp*duration) |
end |
-- create the logarithmic parts |
if tmptime and checkLog() then |
local count = 0 |
local mtime = maxtime |
local parttime |
for k, v in pairs(scaleinfo.amaxtimes) do |
mtime = mtime + v |
parttime = v |
if mtime > tmptime then break end |
count = count + 1 |
end |
-- we have count full bars and count + 1 is the bar that is not full |
local partsekinp = scaleinfo.part / parttime |
local timeinseg = tmptime - (mtime - parttime) |
barf:SetWidth(barf:GetWidth() + scaleinfo.part * count + partsekinp * timeinseg) |
bart:SetWidth(bart:GetWidth() + scaleinfo.part * count + partsekinp * timeinseg) |
duration = tmptime |
end |
tmptime = nil |
-- icon |
local baric = barf:CreateTexture(nil, "BORDER") |
baric:SetTexture(icon) |
baric:SetHeight(scaleinfo.height) |
baric:SetWidth(scaleinfo.height) |
if scaleinfo.iconpos then |
baric:SetPoint("TOPRIGHT", barf, "TOPRIGHT", baric:GetWidth(), 0) |
else |
baric:SetPoint("TOPRIGHT", barf, "TOPRIGHT", 0, 0) |
end |
tinsert(bars, { data = data, frame = barf, tex = bart, texg = bartg, dur = duration, start = start, pos = pos, text = barfon, icon = baric } ) |
end |
local function getMaxPos() |
local maxpos = 0 |
if not bars then return false end |
for _, bar in pairs(bars) do |
if bar.pos and maxpos < bar.pos then |
maxpos = bar.pos |
end |
end |
return maxpos |
end |
local function updateFrameLevel() |
if not getMaxPos() then return end |
for i = 0, getMaxPos() do |
local bartou = newList() |
for _, bar in pairs(bars) do |
if bar.pos == i then |
tinsert(bartou, bar) |
end |
end |
updateBarsFrameLevel(bartou) |
end |
end |
function sbar:UpdateFrameLevel() |
updateFrameLevel() |
end |
--*------------------------------------------- |
-- public methods |
--*------------------------------------------- |
--- Returns recycling functions which are used to create, delete and copy tables |
-- @return newList Creates a new table. Example: table = newList() |
-- @return del Deletes a table. Example: del(table) |
-- @return deepDel Deletes the table and every nested table. Example: deepDel(table) |
-- @return deepCopy Creates a copy of the table (includes nested tables). Example: table2 = deepCopy(table) |
function sbar:GetRecyclingFunctions() return newList, del, deepDel, deepCopy end |
--- Sets the text of a bar |
-- @param bar The bar of which the text should be set. |
-- @param text The text that will be used. |
function sbar:SetText(bar, text) |
argcheck(bar, 1, "table") |
argcheck(text, 2, "string") |
if scaleinfo.horizontal then |
bar.text:SetText(text) |
else |
local count = 0 |
--if not bar.text then bar.text = newList() end |
for _, te in pairs(bar.text) do |
te:SetText() |
te = nil |
end |
for ch in string.gmatch(string.reverse(string.upper(text)), ".") do |
-- first element |
local fobj = bar.text[count] |
if not fobj then |
fobj = bar.frame:CreateFontString() |
setFont(fobj) |
bar.text[count] = fobj |
end |
fobj:SetText(ch) |
if count == 0 then |
fobj:SetPoint("BOTTOMLEFT", bar.frame, "BOTTOMLEFT", 0 , 5) |
else |
fobj:SetPoint("BOTTOMLEFT", bar.text[count-1], "TOPLEFT", 0, 0) |
end |
count = count + 1 |
end |
end |
end |
--- Gets the text of a bar |
-- @param bar The bar of which the text should be returned. |
-- @return The text of the bar |
function sbar:GetText(bar) |
argcheck(bar, 1, "table") |
if scaleinfo.horizontal then |
return bar.text:GetText(text) |
else |
if bar.text then |
local rstr = "" |
for i = 0, #bar.text do |
if bar.text[i] and bar.text[i]:GetText() then |
rstr = rstr .. bar.text[i]:GetText() |
end |
end |
return string.reverse(rstr) |
end |
end |
end |
--- Creates a bar on the previously created scale |
-- @param data User specific data. |
-- @param duration Current duration in seconds. |
-- @param start Current start time in seconds. |
-- @param text FontString object. |
-- @param icon Path to an icon (or any other texture). |
-- @param pos The current position of the bar (horizontal = y, vertical = x). |
-- @param color The color for the positive side of the bar (color_def). |
-- @param colorzero The color for the negative side of the bar (color_def). |
-- @see color_def |
function sbar:CreateBar(data, duration, start, text, icon, pos, color, colorzero, texture) |
argcheck(duration, 2, "number") |
argcheck(start, 3, "number") |
argcheck(text, 4, "string", "nil") |
argcheck(icon, 5, "string", "nil") |
argcheck(pos, 6, "number") |
argcheck(color, 7, "table") |
argcheck(colorzero, 8, "table") |
argcheck(texture, 9, "string", "nil") |
local scale |
if scaleinfo.horizontal then |
createHorizontalBar(data, duration, start, scaleinfo.size, scaleinfo.maxtime, text, icon, pos, color, colorzero, scaleinfo.maxneg, scaleinfo.loflag, texture) |
else |
createVerticalBar(data, duration, start, scaleinfo.size, scaleinfo.maxtime, text, icon, pos, color, colorzero, scaleinfo.maxneg, scaleinfo.loflag, texture) |
end |
self:UpdateFrameLevel() |
end |
function sbar:SetIcon(iconpos) |
scaleinfo.iconpos = iconpos |
end |
--- Creates the scale for the bar |
-- @name CreateScale |
-- @param size The size of the scale. If the bar is horizontal then this parameter describes the x value otherwise the y. |
-- @param maxtime The maximum time which can be displayed on the scale |
-- @param steps This paramter describes how many markers you will have on the bar (execluding the zero). |
-- If you want to create a bar which should display 10 seconds and you want to have a sperator every second then this |
-- parameter will be ten. |
-- @param maxneg Optional parameter that describes if the bar should truncate somewhere. If you have a 30 second long bar and |
-- want it to start resizing when it has reached -10 then this paramter should be -10. |
-- @param horizontal Optional parameter that describes if the bar should be horizontal. Default is vertical. |
-- @param savepos Function which is called when the frame dragging is stoped or a table which is filled with x and y values. |
-- @param loflag Indicates if the scale is on the left or above the bars (default is right or beneath) |
-- @param texture The texture of the scale |
-- @param locked The lock status of the bar |
function sbar:CreateScale(size, maxtime, steps, maxneg, savepos, horizontal, loflag, texture, locked, scale, height, fonts, scaletext, amaxtimes, hide, iconpos) |
argcheck(size, 1, "number") |
argcheck(maxtime, 2, "number") |
argcheck(steps, 3, "number") |
argcheck(maxneg, 4, "number") |
argcheck(savepos, 5, "function", "table", "nil") |
argcheck(horizontal, 6, "boolean", "nil") |
argcheck(loflag, 7, "boolean", "nil") |
argcheck(texture, 8, "string", "nil") |
argcheck(locked, 9, "boolean", "nil") |
argcheck(scale, 10, "number") |
argcheck(height, 11, "number") |
argcheck(fonts, 12, "table") |
argcheck(scaletext, 13, "boolean", "nil") |
argcheck(amaxtimes, 14, "table") |
argcheck(hide, 15, "boolean", "nil") |
argcheck(iconpos, 16, "boolean", "nil") |
scaleinfo = newList() |
scaleinfo.fonts = deepCopy(fonts) |
scaleinfo.scaletext = scaletext |
scaleinfo.amaxtimes = deepCopy(amaxtimes) |
scaleinfo.iconpos = iconpos |
scaleinfo.hide = hide |
if horizontal then |
scaleinfo.frame = createHorizontalScale(size, maxtime, steps, savepos, loflag, texture) |
else |
scaleinfo.frame = createVericalScale(size, maxtime, steps, savepos, loflag, texture) |
end |
scaleinfo.frame:SetScale(scale) |
scaleinfo.horizontal = horizontal |
scaleinfo.size = size |
scaleinfo.maxtime = maxtime |
scaleinfo.maxneg = maxneg |
scaleinfo.loflag = loflag |
scaleinfo.locked = locked |
scaleinfo.height = height |
if type(savepos) == "table" and savepos.x and savepos.y then |
sbar:SetPosition(savepos.x, savepos.y) |
end |
scaleinfo.frame:SetScript("OnUpdate", OnUpdate) |
end |
function sbar:SetScale(scale) |
scaleinfo.frame:SetScale(scale) |
end |
function sbar:GetScale() |
return scale |
end |
function sbar:SetLock(status) |
scaleinfo.locked = status |
end |
--- Gets the Position of the main frame (the scale) |
-- @return x The x value. |
-- @return y The y value. |
function sbar:GetPosition() |
return getPosition(scaleinfo.frame) |
end |
--- Sets the Position of the main frame (the scale) |
-- @param x The x value. |
-- @param y The y value. |
function sbar:SetPosition(x, y) |
argcheck(x, 1, "number") |
argcheck(y, 2, "number") |
setPosition(scaleinfo.frame, x, y) |
end |
--- Finds (a) bar(s) depending on the parameters |
-- @param duration The current duration of a barf |
-- @param start The current start values |
-- @param text The text of the bar |
-- @param icon The icon of the bar |
-- @param pos The position on the barf |
-- @return A table with bars (bars_def) |
-- @see bars_def |
function sbar:FindBars(duration, start, text, icon, pos) |
argcheck(duration, 1, "number", "nil") |
argcheck(start, 2, "number", "nil") |
argcheck(text, 3, "text", "nil") |
argcheck(icon, 4, "text", "nil") |
argcheck(pos, 5, "number", "nil") |
local barfind |
if not(duration and start and text and icon and pos) then |
return deepCopy(bars) |
end |
for _, bar in pairs(bars) do |
if bar.pos then |
local inp = newList(duration, start, text, icon, pos) |
local outer = newList(bar.dur, bar.start, bar.text, bar.icon, bar.pos) |
local check = true |
for i = 1, 5 do |
if (inp[i] and not outer[i]) or (inp[i] ~= outer[i]) then |
check = false |
end |
end |
if check then |
if not barfind then barfind = newList() end |
tinsert(barfind, deepCopy(bar)) |
end |
end |
end |
return barfind |
end |
--- This function sets a text at the end of the bar. |
-- So it will always be at the maxneg position |
-- @param text The text for the bar |
-- @param pos The position on the bar |
function sbar:SetFixedText(text, pos) |
argcheck(text, 1, "string", "nil") |
argcheck(pos, 2, "number") |
local sekinp = scaleinfo.size / scaleinfo.maxtime |
if scaleinfo.horizontal then |
if fixedText[pos] then |
fixedText[pos]:SetText() |
fixedText[pos]:Hide() |
fixedText[pos] = nil |
end |
if not text then return end |
local fobj |
fobj = scaleinfo.frame:CreateFontString() |
setFont(fobj) |
fobj:SetText(text) |
if not scaleinfo.loflag then |
fobj:SetPoint("BOTTOMRIGHT", scaleinfo.frame, "TOPLEFT", sekinp*scaleinfo.maxneg, -8 + pos * scaleinfo.height + scaleinfo.height/2 - fobj:GetStringHeight()/2) |
else |
fobj:SetPoint("TOPRIGHT", scaleinfo.frame, "BOTTOMLEFT", sekinp*scaleinfo.maxneg, 8 - pos * scaleinfo.height - scaleinfo.height/2 + fobj:GetStringHeight()/2) |
end |
fixedText[pos] = fobj |
else |
local count = 0 |
if not fixedText[pos] then fixedText[pos] = newList() end |
for _, te in pairs(fixedText[pos]) do |
te:SetText() |
te:Hide() |
te = nil |
end |
if not text then return end |
text = string.sub(string.upper(text), 1, 10) |
for ch in string.gmatch(text, ".") do |
-- first element |
local fobj = fixedText[pos][count] |
if not fobj then |
fobj = scaleinfo.frame:CreateFontString() |
setFont(fobj) |
fixedText[pos][count] = fobj |
end |
fobj:SetText(ch) |
fobj:Show() |
if count == 0 then |
if not scaleinfo.loflag then |
fobj:SetPoint("TOPRIGHT", scaleinfo.frame, "BOTTOMLEFT", 8 - pos*scaleinfo.height - scaleinfo.height/2 + fobj:GetStringHeight()/2, sekinp*scaleinfo.maxneg) |
else |
fobj:SetPoint("TOPLEFT", scaleinfo.frame, "BOTTOMRIGHT", -8 + pos * scaleinfo.height + scaleinfo.height/2 - fobj:GetStringHeight()/2, sekinp*scaleinfo.maxneg) |
end |
else |
fobj:SetPoint("TOPLEFT", fixedText[pos][count-1], "BOTTOMLEFT", 0, 0) |
end |
count = count + 1 |
end |
end |
end |
--- Returns a table with all the bars |
-- @return bars |
-- @see bars_def |
function sbar:GetBars() |
return bars |
end |
--- Redraws the Scale |
-- @see CreateScale |
function sbar:RedrawScale(size, maxtime, steps, maxneg, savepos, horizontal, loflag, texture, locked, scale, height, fonts, scaletext, amaxtimes, hide, iconpos) |
if bars then |
for _, bar in pairs(bars) do |
if bar.frame then |
if bar.frame:IsShown() then |
for _, child in pairs(bar.frame:GetChildren() or {}) do |
child:Hide() |
end |
bar.frame:Hide() |
bar = nil |
end |
end |
end |
end |
if scaleinfo and scaleinfo.frame then |
--for _, child in pairs(scaleinfo.frame:GetChildren()) do |
-- child:Hide() |
--end |
scaleinfo.frame:Hide() |
scaleinfo.frame:SetScript("OnUpdate",nil) |
deepDel(scaleinfo) |
end |
deepDel(fixedText) |
fixedText = nil |
fixedText = newList() |
sbar:CreateScale(size, maxtime, steps, maxneg, savepos, horizontal, loflag, texture, locked, scale, height, fonts, scaletext, amaxtimes, hide, iconpos) |
end |
--*-------------------------------- |
-- only for documentation purpose |
--*-------------------------------- |
--- Table that holds the information for the bars |
-- @class table |
-- @name bars_def |
-- @field data Can be assigned with anything from the user. |
-- @field frame The frame of the bar. |
-- @field tex The texture which belongs to the positive area. |
-- @field texg The texture which belong to the negative area. |
-- @field dur The current duration of the bar. |
-- @field start The current start time of the bar. |
-- @field pos The position of the bar (horizontal = x position, vertical = y position). |
-- @field text The text item which will be displayed only if the bar is horizontal. |
-- @field icon The icon of the bar. |
local bars_def = { data = data, frame = frame, tex = tex, texg = texg, dur = dur, start = start, pos = pos, text = text, icon = icon } |
bars_def = nil |
--- A Table that holds color information |
-- @class table |
-- @name color_def |
-- @field r Red (0.0 - 1.0). |
-- @field g Green (0.0 - 1.0). |
-- @field b Blue (0.0 - 1.0). |
-- @field a Alpha (0.0 - 1.0). |
local color_def = { r = r, g = g, b = b, a = a } |
color = nil |
if not DotIt then |
error("DotIt has to be loaded first") |
end |
DotIt.Spells = {} |
local newList, del, deepDel, deepCopy = DotIt.sb:GetRecyclingFunctions() |
local spells = DotIt:NewModule("spells") |
function spells:OnInitialize() |
end |
function spells:insertSpells(struct, name) |
DotIt.Spells[name] = struct |
end |
-- returns the duration of a debuff (only YOUR debuffs) |
function spells:GMTD(id) |
local name = GetSpellInfo(id) |
local dur, mine = select(7, UnitDebuff("target", name)) |
if not dur then |
dur = 0 |
else |
dur = dur-GetTime() |
end |
if not mine then |
dur = 0 |
end |
return dur |
end |
-- returns the duration of a debuff (also ones not from you!) |
function spells:GTD(id) |
local name = GetSpellInfo(id) |
local bname, rank, icon, count, debuffType, duration, expirationTime, isMine, dur |
dur = 0 |
for i = 1, 40 do |
bname, rank, icon, count, debuffType, duration, expirationTime, isMine = UnitDebuff("target", name) |
if isMine and bname == name then |
dur = expirationTime - GetTime() |
end |
end |
return dur |
end |
-- get player buffs |
function spells:GPB(id) |
local name = GetSpellInfo(id) |
local dur = select(7, UnitBuff("player", name)) |
if not dur then |
dur = 0 |
else |
dur = dur-GetTime() |
end |
return dur |
end |