/trunk/Core
function SliceCommander:UIScale(event) |
if not _G['SC'].SET or _G['SC'].SET.PixelPerfect then |
local resolution = ({GetScreenResolutions()})[GetCurrentResolution()] or GetCVar("gxWindowedResolution") |
if resolution == nil then |
local screenwidth, screenheight = GetScreenWidth(),GetScreenHeight() |
if screenwidth == nil or screenheight == nil then |
if not _G['SC'].SET then |
return false |
end |
end |
return false |
end |
local tableResolution = SC_split(resolution, 'x') |
local screenwidth, screenheight = tableResolution[1],tableResolution[2] |
if IsMacClient() and _G['SC'].screenheight and _G['SC'].screenwidth and (screenwidth ~= _G['SC'].screenheight or screenheight ~= _G['SC'].screenwidth) then |
screenheight = _G['SC'].screenheight |
end |
function SliceCommander:StaticPopup_CollapseTable() |
if (SC.StaticPopup_DisplayedFrames == nil) then |
SliceCommander:LoadPopup(); |
end |
local displayedFrames = SC.StaticPopup_DisplayedFrames; |
local index = #displayedFrames; |
while ( ( index >= 1 ) and ( not displayedFrames[index]:IsShown() ) ) do |
type = "group", |
order = SliceCommander:getOrder(), |
args = SliceCommander_TableMerge( |
SliceCommander:getCDSettings('ERCD').args, |
SliceCommander:getSpellCDSettings('ER').args, |
SliceCommander:getCDSettings('SUMSCD').args |
) |
}, |
SC.BARS['CP']['obj'].combos[i].bg:SetVertexColor(unpack(SC.SET.CP[maxCP][i])) |
end |
for i = 1, 10 do |
SC.BARS['CP']['obj'].combos[i]:Hide() |
SC.BARS['CP']['obj'].combos[i].bg:Hide() |
end |
SliceCommander:SetTimersHeight(SC.SET.TimerHeight) |
_G['SC'].order = 0 |
_G['SC'].maxPos = 0 |
_G['SC'].maxCDPos = 0 |
_G['SC'].previouKyrCount = 0 |
SliceCommander:TestValueOptions() |
SliceCommander:SetEssence() |
SliceCommander:InitConfigurationTable() |
end |
end |
function SliceCommander:TestKYRIAN() |
local _, spellId |
local count = 0 |
local kyrBuff = { |
[323558] = 2, -- 2nd CP |
[323559] = 3, -- 3rd CP |
[323560] = 4, -- 4th CP |
[354838] = 5, -- 5th CP |
} |
for k, v in pairs(kyrBuff) do |
_, _, _, _, _, _, _, _, _, spellId = SliceCommander:UnitAura("player", k, "HELPFUL PLAYER") |
if spellId then |
count = v |
end |
end |
if count ~= _G['SC'].previouKyrCount then |
if _G['SC'].previouKyrCount > 0 then |
_G['SC'].BARS['CP']['obj'].combos[_G['SC'].previouKyrCount].anim:Stop() |
end |
if count > 0 then |
print(count) |
_G['SC'].BARS['CP']['obj'].combos[count].anim:Play() |
end |
_G['SC'].previouKyrCount = count |
end |
end |
function SliceCommander:OnUpdate() |
SliceCommander:Latency()--timer reference and latency |
SliceCommander:GCD()--GCD |
SliceCommander:TargetThreat()--Threat |
for k, v in pairs(SC.BARS) do |
if SC.BARS[k]['type'] ~= nil then |
if SC.BARS[k]['type'] ~= nil then--1=BUFF 2=DEBUFF 3=SELF DEBUF |
if SC.BARS[k]['type'] == 1 or SC.BARS[k]['type'] == 2 or SC.BARS[k]['type'] == 3 then |
SliceCommander:UpdateBar(k) |
elseif SC.BARS[k]['type'] == 4 then |
elseif SC.BARS[k]['type'] == 4 then--CD |
SliceCommander:AbilityCDBar(k) |
elseif SC.BARS[k]['type'] == 5 then |
elseif SC.BARS[k]['type'] == 5 then--CHARGE CD |
SliceCommander:ChargeAbilityCDBar(k) |
elseif SC.BARS[k]['type'] == 6 then |
elseif SC.BARS[k]['type'] == 6 then--MULTIPLE BUFF BAR |
SliceCommander:MultipleAbilityBar(k) |
end |
end |
end |
SliceCommander:TestKYRIAN()--DP Icon |
SliceCommander:TestDP()--DP Icon |
end |
local inset = 0 |
-- pixel perfect script of custom ui Scale. |
local resolution = ({GetScreenResolutions()})[GetCurrentResolution()] or GetCVar("gxWindowedResolution") |
local tableResolution = SC_split(resolution, 'x') |
local width, height = tableResolution[1],tableResolution[2] |
local width, height = GetScreenWidth(),GetScreenHeight() |
local uiscale = min(2, max(.64, 768/width)) |
local mult = 768/height/uiscale |
}) |
if not noinset and not f.isInsetDone then |
f.insettop = f:CreateTexture(nil, "BORDER") |
f.insettop = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insettop:Point("TOPLEFT", f, "TOPLEFT", -1, 1) |
f.insettop:Point("TOPRIGHT", f, "TOPRIGHT", 1, -1) |
f.insettop:Height(1) |
f.insettop:SetColorTexture(0,0,0) |
f.insettop:SetDrawLayer("BORDER", -7) |
f.insetbottom = f:CreateTexture(nil, "BORDER") |
f.insetbottom = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insetbottom:Point("BOTTOMLEFT", f, "BOTTOMLEFT", -1, -1) |
f.insetbottom:Point("BOTTOMRIGHT", f, "BOTTOMRIGHT", 1, -1) |
f.insetbottom:Height(1) |
f.insetbottom:SetColorTexture(0,0,0) |
f.insetbottom:SetDrawLayer("BORDER", -7) |
f.insetleft = f:CreateTexture(nil, "BORDER") |
f.insetleft = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insetleft:Point("TOPLEFT", f, "TOPLEFT", -1, 1) |
f.insetleft:Point("BOTTOMLEFT", f, "BOTTOMLEFT", 1, -1) |
f.insetleft:Width(1) |
f.insetleft:SetColorTexture(0,0,0) |
f.insetleft:SetDrawLayer("BORDER", -7) |
f.insetright = f:CreateTexture(nil, "BORDER") |
f.insetright = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insetright:Point("TOPRIGHT", f, "TOPRIGHT", 1, 1) |
f.insetright:Point("BOTTOMRIGHT", f, "BOTTOMRIGHT", -1, -1) |
f.insetright:Width(1) |
f.insetright:SetColorTexture(0,0,0) |
f.insetright:SetDrawLayer("BORDER", -7) |
f.insetinsidetop = f:CreateTexture(nil, "BORDER") |
f.insetinsidetop = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insetinsidetop:Point("TOPLEFT", f, "TOPLEFT", 1, -1) |
f.insetinsidetop:Point("TOPRIGHT", f, "TOPRIGHT", -1, 1) |
f.insetinsidetop:Height(1) |
f.insetinsidetop:SetColorTexture(0,0,0) |
f.insetinsidetop:SetDrawLayer("BORDER", -7) |
f.insetinsidebottom = f:CreateTexture(nil, "BORDER") |
f.insetinsidebottom = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insetinsidebottom:Point("BOTTOMLEFT", f, "BOTTOMLEFT", 1, 1) |
f.insetinsidebottom:Point("BOTTOMRIGHT", f, "BOTTOMRIGHT", -1, 1) |
f.insetinsidebottom:Height(1) |
f.insetinsidebottom:SetColorTexture(0,0,0) |
f.insetinsidebottom:SetDrawLayer("BORDER", -7) |
f.insetinsideleft = f:CreateTexture(nil, "BORDER") |
f.insetinsideleft = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insetinsideleft:Point("TOPLEFT", f, "TOPLEFT", 1, -1) |
f.insetinsideleft:Point("BOTTOMLEFT", f, "BOTTOMLEFT", -1, 1) |
f.insetinsideleft:Width(1) |
f.insetinsideleft:SetColorTexture(0,0,0) |
f.insetinsideleft:SetDrawLayer("BORDER", -7) |
f.insetinsideright = f:CreateTexture(nil, "BORDER") |
f.insetinsideright = f:CreateTexture(nil, "BORDER", nil, 1) |
f.insetinsideright:Point("TOPRIGHT", f, "TOPRIGHT", -1, -1) |
f.insetinsideright:Point("BOTTOMRIGHT", f, "BOTTOMRIGHT", 1, 1) |
f.insetinsideright:Width(1) |
local function StyleButton(button) |
if button.SetHighlightTexture and not button.hover then |
local hover = button:CreateTexture("frame", nil, self) |
local hover = button:CreateTexture("frame", nil, self, 1) |
hover:SetColorTexture(1, 1, 1, 0.3) |
hover:Point("TOPLEFT", 2, -2) |
hover:Point("BOTTOMRIGHT", -2, 2) |
end |
if button.SetPushedTexture and not button.pushed then |
local pushed = button:CreateTexture("frame", nil, self) |
local pushed = button:CreateTexture("frame", nil, self, 1) |
pushed:SetColorTexture(0.9, 0.8, 0.1, 0.3) |
pushed:Point("TOPLEFT", 2, -2) |
pushed:Point("BOTTOMRIGHT", -2, 2) |
end |
if button.SetCheckedTexture and not button.checked then |
local checked = button:CreateTexture("frame", nil, self) |
local checked = button:CreateTexture("frame", nil, self, 1) |
checked:SetColorTexture(0,1,0,.3) |
checked:Point("TOPLEFT", 2, -2) |
checked:Point("BOTTOMRIGHT", -2, 2) |
local handled = {["Frame"] = true} |
local object = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate") |
addapi(object) |
addapi(object:CreateTexture()) |
addapi(object:CreateTexture(nil, "OVERLAY", nil, 1)) |
addapi(object:CreateFontString()) |
object = EnumerateFrames() |
SC.OTHER['POISON']['obj'].button:SetFrameLevel(5) |
SC.OTHER['POISON']['obj'].button:SetPoint("BOTTOMLEFT", SC.OTHER['POISON']['obj'], "BOTTOMLEFT") |
SC.OTHER['POISON']['obj'].button:SetPoint("TOPRIGHT", SC.OTHER['POISON']['obj'], "TOPRIGHT") |
SC.OTHER['POISON']['obj'].button:RegisterForClicks("LeftButtonUp", "RightButtonUp") |
local state = C_CVar.GetCVarBool("ActionButtonUseKeyDown") |
if state then |
SC.OTHER['POISON']['obj'].button:RegisterForClicks("LeftButtonDown", "RightButtonDown") |
else |
SC.OTHER['POISON']['obj'].button:RegisterForClicks("LeftButtonUp", "RightButtonUp") |
end |
SC.OTHER['POISON']['obj'].button:SetAttribute("unit", "player") |
SC.OTHER['POISON']['obj'].button:SetAttribute("*type1", "spell") |
SC.OTHER['POISON']['obj'].button:SetAttribute("*type2", "spell") |
SC.OTHER['POISON']['obj'].button:SetAttribute("type", "spell") |
SC.OTHER['POISON']['obj'].button:EnableMouse(false) |
end |
SliceCommander:SetSizeBorder(0, h, SC.BARS['CP']['obj'].combos[i].border) |
end |
SC.BarFont1:SetFont(SliceCommander:GetFont(), (h-2)*SC.V.pxH) |
SC.BarFont2:SetFont(SliceCommander:GetFont(), (h-2)*SC.V.pxH) |
SC.BarFont1:SetFont(SliceCommander:GetFont(), (h-2)*SC.V.pxH, "") |
SC.BarFont2:SetFont(SliceCommander:GetFont(), (h-2)*SC.V.pxH, "") |
SC.BARS['CP']['obj'].comboText:SetFont(SliceCommander:GetFont(), (h-2)*SC.V.pxH, "THINOUTLINE") |
SliceCommander:SetWidth(SC.SET.Width) |
end |
if _G['SC'].version == nil or _G['SC'].version < '7.00' then |
_G['SC'] = {version = GetAddOnMetadata("SliceCommander", "Version")} |
else |
if _G['SC'].version < '9.01' then |
if tonumber(_G['SC'].version) < 9.01 then |
_G['SC'].SET.Pos['RIP'] = nil--Remove ripost |
_G['SC'].BARS['RIP'] = nil |
_G['SC'].SET.Pos['RIPCD'] = nil |
_G['SC'].SET.Pos['STH'] = nil |
_G['SC'].BARS['STH'] = nil |
end |
if _G['SC'].version < '9.06' then |
if tonumber(_G['SC'].version) < 9.06 then |
_G['SC'].SET.Pos['TXBCD'] = nil |
_G['SC'].BARS['TXBCD'] = nil |
_G['SC'].SET.Pos['TXB'] = nil |
_G['SC'].BARS['FOTD'] = nil |
end |
if tonumber(_G['SC'].version) < 10.0 then |
_G['SC'].SET.CP = nil |
end |
_G['SC'].version = GetAddOnMetadata("SliceCommander", "Version") |
end |
end |
end |
function SliceCommander:Global() |
SliceCommander:DisplaySpells({'CP', 'THREAT', 'SND', 'CS', 'KS', 'KSCD', 'CV', 'CVCD', 'TOTCD', 'FE', 'SSCD', 'SUB', 'CDCD', 'AC', 'MDCD', 'DFACD', 'Poison', 'MAI', 'FECD', 'ESSECD', 'DPICON', 'SUMSCD', 'FCCD', 'SOSCD', 'DOSCD', 'ERCD', 'SBSCD', 'SBS', 'SPCD', 'FLACD', 'SP', 'FLA'}) |
SliceCommander:DisplaySpells({'CP', 'THREAT', 'SND', 'CS', 'KS', 'KSCD', 'CV', 'CVCD', 'TOTCD', 'FE', 'SSCD', 'SUB', 'CDCD', 'AC', 'MDCD', 'DFACD', 'Poison', 'MAI', 'FECD', 'ESSECD', 'DPICON', 'SUMSCD', 'FCCD', 'SOSCD', 'DOSCD', 'ERCD', 'SBSCD', 'SBS', 'SPCD', 'FLACD', 'SP', 'FLA', 'ER'}) |
SliceCommander:NotDisplaySpells({'HEALTH', 'THEALTH', 'VANCD', 'KICD', 'COS', 'COSCD', 'EVA', 'EVACD', 'SPR', 'SPRCD', 'SS'}) |
SliceCommander:FlashSpells({'SND'}) |
SC.SET.Pos.CP = -1 |
end |
SliceCommander:OrderSpells({'SND', 'CV', 'FE', 'SUB', 'AC', 'MAI', 'COS', 'EVA', 'SPR', 'SS', 'SP', 'FLA', 'SBS'}) |
SliceCommander:OrderSpells({'SND', 'CV', 'FE', 'SUB', 'AC', 'MAI', 'COS', 'EVA', 'SPR', 'SS', 'SP', 'FLA', 'SBS', 'ER'}) |
SliceCommander:OrderCDs({'CVCD', 'TOTCD', 'VANCD', 'SSCD', 'CDCD', 'MDCD', 'DFACD', 'THREAT', 'HEALTH', 'THEALTH', 'CS', 'KS', 'KSCD', 'KICD', 'COSCD', 'EVACD', 'SPRCD', 'FECD', 'ESSECD', 'SUMSCD', 'FCCD', 'SOSCD', 'DOSCD', 'ERCD', 'SBSCD', 'SPCD', 'FLACD'}) |
end |
[4] = {.65, .42, .31}, |
[5] = {.69, .31, .31}, |
[6] = {.74, .20, .27}, |
}, |
[7] = { |
[1] = {.33, .63, .33}, |
[2] = {.46, .63, .35}, |
[3] = {.65, .63, .35}, |
[4] = {.65, .42, .31}, |
[5] = {.69, .31, .31}, |
[6] = {.74, .20, .27}, |
[7] = {.8, .12, .25}, |
} |
} |
end |
if SC.BARS['ERCD'] == nil then--Echoing Reprimand (Kyrian) |
SC.BARS['ERCD'] = {['color'] = {.2, .45, .82}} |
end |
if SC.BARS['ER'] == nil then--Echoing Reprimand (Kyrian) |
SC.BARS['ER'] = {['color'] = {.2, .45, .82}} |
end |
if SC.BARS['SBSCD'] == nil then--Serrated Bone Spike (Necrolord) |
SC.BARS['SBSCD'] = {['color'] = {.2, .45, .82}} |
end |
SC.BARS[k]['id'] = SC_SPELLID[k] |
end |
local buff = {'AR', 'SUB', 'EP', 'CV', 'AC', 'FE', 'SND', 'SD', 'SOD', 'SB', 'OP', 'ENV', 'GB', 'GSWW', 'MAI', 'LD', 'BF', 'SHT', 'COS', 'EVA', 'SPR', 'BLS', 'MA', 'SS'} |
local buff = {'AR', 'SUB', 'EP', 'CV', 'AC', 'FE', 'SND', 'SD', 'SOD', 'SB', 'OP', 'ENV', 'GB', 'GSWW', 'MAI', 'LD', 'BF', 'SHT', 'COS', 'EVA', 'SPR', 'BLS', 'MA', 'SS', 'ER'} |
for i, v in ipairs(buff) do--BUFF |
SC.BARS[v]['type'] = 1 |
end |
f:SetFrameStrata("MEDIUM") |
-- text on the right -- |
f.text = f:CreateFontString(nil, nil, "GameFontWhite") |
f.text = f:CreateFontString(nil, nil, 'GameFontNormal') |
f.text:SetFontObject(SC.BarFont1) |
f.text:SCWidth(120) |
f.text:SCPoint("TOPRIGHT", f, "TOPRIGHT", -5, 0) |
f.text:SetJustifyH("RIGHT") |
f.icon = f:CreateTexture(nil, "OVERLAY") |
f.icon = f:CreateTexture(nil, "OVERLAY", nil, 1) |
f.icon:SCPoint("RIGHT", f, "LEFT", -2, 0) |
f.icon:SetTexCoord(.08, .92, .08, .92) |
-- text on the center -- |
f.text2 = f:CreateFontString(nil, nil, nil) |
f.text2 = f:CreateFontString(nil, nil, 'GameFontNormal') |
f.text2:SCPoint("CENTER", f, "CENTER", -8, 0) |
f.text2:SetFontObject(SC.BarFont1) |
f.text2:SCWidth(200) |
function SliceCommander:CPFrame() |
local f = CreateFrame("StatusBar", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate") |
local colorAnim = {.6, .6, 1, 1} |
f.bg = f:CreateTexture(nil, "BACKGROUND") |
f.bg = f:CreateTexture(nil, "BACKGROUND", nil, 1) |
f.bg:SCPoint("TOPLEFT", f, "TOPLEFT", 0, 0) |
f.bg:SCPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", 0, 0) |
f:SetFrameStrata("MEDIUM") |
for i = 1, 10 do--Maximum CP is 10 with anticipation |
local combo = CreateFrame("Frame", nil, f, BackdropTemplateMixin and "BackdropTemplate") |
combo.bg = combo:CreateTexture(nil, "BACKGROUND") |
combo.bg = combo:CreateTexture(nil, "BACKGROUND", nil, 1) |
combo.bg:SetAllPoints(combo) |
combo.bg:SetTexture("Interface\\AddOns\\SliceCommander\\Images\\solid.tga") |
combo.border = SliceCommander:tukSkin(combo, false) |
combo:Hide() |
combo.bg:Hide() |
local animPlaying = false |
combo.anim = { |
Play = function() |
animPlaying = true |
Glower.PixelGlow_Start(combo, colorAnim, 8, .5) |
end, |
Stop = function() |
animPlaying = false |
Glower.PixelGlow_Stop(combo) |
end, |
IsPlaying = function() |
return animPlaying |
end |
} |
f.combos[i] = combo |
end |
f.overlay = CreateFrame("Frame", nil, f, BackdropTemplateMixin and "BackdropTemplate") |
f.overlay:SetAllPoints(f) |
f.comboText = f.overlay:CreateFontString(nil, 'OVERLAY') |
f.comboText = f.overlay:CreateFontString(nil, 'OVERLAY', 'GameFontNormal') |
f.comboText:SetFont(SliceCommander:GetFont(), 8, "THINOUTLINE") |
f.comboText:SetShadowColor(0, 0, 0, 0.4) |
f.comboText:SetTextColor(1, 1, 1) |
f:Show() |
end |
f.txt = f:CreateFontString('VTimerEnergyTxt', 'OVERLAY', GameFontWhite) |
f.txt = f:CreateFontString('VTimerEnergyTxt', 'OVERLAY', 'GameFontNormal') |
f.txt:SetJustifyH("RIGHT") |
f.txt:SCSize(49, 20) |
f.txt:SCPoint('RIGHT', VTimerEnergy, 'RIGHT', -5, 0) |
end |
function SliceCommander:CreateComboText() |
VTimerEnergy:CreateFontString('SliceCommander_Combo', 'OVERLAY') |
VTimerEnergy:CreateFontString('SliceCommander_Combo', 'OVERLAY', 'GameFontNormal') |
SliceCommander_Combo:SetFont(SliceCommander:GetFont(), 17, "THINOUTLINE") |
SliceCommander_Combo:SetShadowColor(0, 0, 0, 0.4) |
SliceCommander_Combo:SetTextColor(1, 1, 1) |
function SliceCommander:CreateSpark() |
for i = 1, 3 do |
SC.Spark[i] = VTimerEnergy:CreateTexture(nil, 'OVERLAY', GameFontWhite) |
SC.Spark[i] = VTimerEnergy:CreateTexture(nil, 'OVERLAY', nil, 1) |
SC.Spark[i]:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark") |
SC.Spark[i]:SetBlendMode('ADD') |
SC.Spark[i]:SCSize(5,20) |
end |
function SliceCommander:NewTickArray(BAR) |
local tickObj = BAR['obj']:CreateTexture(nil, 'OVERLAY', GameFontWhite) |
local tickObj = BAR['obj']:CreateTexture(nil, 'OVERLAY', nil, 1) |
tickObj:SetTexture('Interface\\AddOns\\SliceCommander\\Images\\solid.tga') |
tickObj:SCWidth(2) |
tickObj:SCHeight(SC.SET.TimerHeight) |
f:SetFrameLevel(1) |
f.moveframe = MoveFrame |
local fIcon = f:CreateTexture(nil) |
local fIcon = f:CreateTexture(nil, "OVERLAY", nil, 1) |
fIcon:SCPoint("CENTER", f, "CENTER", 0, 0) |
fIcon:SetAlpha(1) |
fIcon:SetTexCoord(.08, .92, .08, .92) |
f.overlay:SetBackdropColor(0,0,0,.3) |
f.overlay:Hide() |
f.iconTxt = f.overlay:CreateFontString(nil, 'OVERLAY', GameFontWhite) |
f.iconTxt = f.overlay:CreateFontString(nil, 'OVERLAY', 'GameFontNormal') |
f.iconTxt:SetJustifyH("CENTER") |
f.iconTxt:SetJustifyV("MIDDLE") |
f.iconTxt:SCPoint('CENTER', f, "CENTER", 2, 0) |
function SliceCommander:NewFont(name, FontSize, aShadow, rColor, gColor, bColor) |
local f = CreateFont(name) |
f:SetFont(SliceCommander:GetFont(), FontSize) |
f:SetFont(SliceCommander:GetFont(), FontSize, "") |
f:SetShadowColor(0, 0, 0, aShadow) |
f:SetTextColor(rColor, gColor, bColor, 1) |
f:SetShadowOffset(0.8, -0.8) |