Commit f7ef7615 authored by Tukz's avatar Tukz
Browse files

Upload T16.01 Again.

parent 856fcdd7
local T, C, L = select(2, ...):unpack()
----------------------------------------------------------------
-- Default settings of Tukui
----------------------------------------------------------------
C["General"] = {
["AutoScale"] = true,
["UIScale"] = 0.71,
["BackdropColor"] = {0.1, 0.1, 0.1},
["BorderColor"] = {0.6, 0.6, 0.6},
["HideShadows"] = false,
}
C["ActionBars"] = {
["Enable"] = true,
["HotKey"] = false,
["Macro"] = false,
["ShapeShift"] = false,
["Pet"] = true,
["NormalButtonSize"] = 27,
["PetButtonSize"] = 25,
["ButtonSpacing"] = 4,
["OwnShadowDanceBar"] = false,
["OwnMetamorphosisBar"] = true,
["OwnWarriorStanceBar"] = false,
["HideBackdrop"] = false,
["Font"] = "Tukui Outline",
}
C["Auras"] = {
["Enable"] = true,
["Consolidate"] = false,
["Flash"] = false,
["ClassicTimer"] = false,
["HideBuffs"] = false,
["HideDebuffs"] = false,
["Animation"] = false,
["BuffsPerRow"] = 12,
["Font"] = "Tukui Outline",
}
C["Bags"] = {
["Enable"] = true,
["ButtonSize"] = 28,
["Spacing"] = 4,
["ItemsPerRow"] = 11,
["PulseNewItem"] = false,
["Font"] = "Tukui Outline",
["BagFilter"] = false,
}
C["Chat"] = {
["Enable"] = true,
["WhisperSound"] = true,
["LinkColor"] = {0.08, 1, 0.36},
["LinkBrackets"] = true,
["LootFrame"] = true,
["Background"] = false,
["ScrollByX"] = 3,
["TabFont"] = "Tukui",
["ChatFont"] = "Tukui",
}
C["Cooldowns"] = {
["Font"] = "Tukui Outline",
}
C["DataTexts"] = {
["Battleground"] = true,
["LocalTime"] = true,
["Time24HrFormat"] = false,
["NameColor"] = {1, 1, 1},
["ValueColor"] = {1, 1, 1},
["Font"] = "Tukui",
}
C["Merchant"] = {
["AutoSellGrays"] = true,
["SellMisc"] = true,
["AutoRepair"] = true,
["UseGuildRepair"] = false,
}
C["Misc"] = {
["ThreatBarEnable"] = true,
["AltPowerBarEnable"] = true,
["ExperienceEnable"] = true,
["ReputationEnable"] = true,
["ErrorFilterEnable"] = true,
}
C["NamePlates"] = {
["Enable"] = true,
["Width"] = 120,
["Height"] = 8,
["CastHeight"] = 5,
["Spacing"] = 4,
["NonTargetAlpha"] = .5,
["Texture"] = "Tukui",
["Font"] = "Tukui Outline",
}
C["Party"] = {
["Enable"] = true,
["Portrait"] = true,
["HealBar"] = true,
["ShowPlayer"] = false,
["ShowHealthText"] = true,
["Font"] = "Tukui UF",
["HealthFont"] = "Tukui UF Outline",
["PowerTexture"] = "Tukui",
["HealthTexture"] = "Tukui",
}
C["Raid"] = {
["Enable"] = true,
["HealBar"] = true,
["AuraWatch"] = true,
["AuraWatchTimers"] = true,
["DebuffWatch"] = true,
["RangeAlpha"] = 0.3,
["ShowRessurection"] = true,
["ShowHealthText"] = true,
["Font"] = "Tukui UF",
["HealthFont"] = "Tukui UF Outline",
["PowerTexture"] = "Tukui",
["HealthTexture"] = "Tukui",
["GroupBy"] = {
["Options"] = {
["Group"] = "GROUP",
["Class"] = "CLASS",
["Role"] = "ROLE",
},
["Value"] = "GROUP",
},
}
C["Tooltips"] = {
["Enable"] = true,
["HideOnUnitFrames"] = false,
["UnitHealthText"] = true,
["ShowSpec"] = true,
["HealthFont"] = "Tukui",
["HealthTexture"] = "Tukui",
}
C["UnitFrames"] = {
["Enable"] = true,
["Portrait"] = false,
["CastBar"] = true,
["UnlinkCastBar"] = false,
["CastBarIcon"] = true,
["CastBarLatency"] = true,
["Smooth"] = true,
["CombatLog"] = false,
["WeakBar"] = true,
["HealBar"] = true,
["TotemBar"] = true,
["AnticipationBar"] = true,
["SerendipityBar"] = true,
["OnlySelfDebuffs"] = false,
["DarkTheme"] = false,
["Font"] = "Tukui UF Outline",
["PowerTexture"] = "Tukui",
["HealthTexture"] = "Tukui",
}
\ No newline at end of file
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Config.lua"/>
</Ui>
\ No newline at end of file
local T, C = select(2, ...):unpack()
--[[
Execute an animation;
frame:SetAnimation("AnimType", ...)
Set a callback function when the animation is done;
frame:AnimOnFinished("AnimType", function(self, ...)
end)
arguments; self, and all the args fed into the "Animation" function for the frame
Animation types;
"FadeIn" & "FadeOut";
arg1: fade time (number)
arg2: start alpha (number)
arg3: end alpha (number)
"Move";
arg1: direction (string - "Vertical" or "Horizontal")
arg2: distance (number)
arg3: speed (number)
"Width" & "Height";
arg1: width or height (number)
arg2: speed (number)
"Expand";
arg1: width (number)
arg2: height (number)
arg3: speed (number)
--]]
local Frame = CreateFrame("Frame")
local strlower = string.lower
local select = select
local unpack = unpack
local modf = math.modf
local UIFrameFadeIn = UIFrameFadeIn
local UIFrameFadeOut = UIFrameFadeOut
-- Localize some frame methods
local Show = Frame.Show
local Hide = Frame.Hide
local GetPoint = Frame.GetPoint
local GetWidth = Frame.GetWidth
local GetHeight = Frame.GetHeight
-- Vertical frame movement
local OnUpdateVerticalMove = function(self)
local Point, RelativeTo, RelativePoint, XOfs, YOfs = GetPoint(self)
if (self.MoveType == "Positive") then
if (YOfs + self.MoveSpeed > self.EndY) then
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs, YOfs + 1)
else
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs, YOfs + self.MoveSpeed)
end
if (YOfs >= self.EndY) then
self:SetScript("OnUpdate", nil)
self:Point(Point, RelativeTo, RelativePoint, XOfs, self.EndY)
self.IsMoving = false
self:AnimCallback("move", self.MoveDirection, self.ValueY, self.MoveSpeed)
end
else
if (YOfs - self.MoveSpeed < self.EndY) then
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs, YOfs - 1)
else
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs, YOfs - self.MoveSpeed)
end
if (YOfs <= self.EndY) then
self:SetScript("OnUpdate", nil)
self:Point(Point, RelativeTo, RelativePoint, XOfs, self.EndY)
self.IsMoving = false
self:AnimCallback("move", self.MoveDirection, self.ValueY, self.MoveSpeed)
end
end
end
-- Horizontal frame movement
local OnUpdateHorizontalMove = function(self)
local Point, RelativeTo, RelativePoint, XOfs, YOfs = GetPoint(self)
if (self.MoveType == "Positive") then
if (XOfs + self.MoveSpeed > self.EndX) then
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs + 1, YOfs)
else
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs + self.MoveSpeed, YOfs)
end
if (XOfs >= self.EndX) then
self:SetScript("OnUpdate", nil)
self:Point(Point, RelativeTo, RelativePoint, self.EndX, YOfs)
self.IsMoving = false
self:AnimCallback("move", self.MoveDirection, self.ValueX, self.MoveSpeed)
end
else
if (XOfs - self.MoveSpeed < self.EndX) then
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs - 1, YOfs)
else
self:SetPoint(Point, RelativeTo, RelativePoint, XOfs - self.MoveSpeed, YOfs)
end
if (XOfs <= self.EndX) then
self:SetScript("OnUpdate", nil)
self:Point(Point, RelativeTo, RelativePoint, self.EndX, YOfs)
self.IsMoving = false
self:AnimCallback("move", self.MoveDirection, self.ValueX, self.MoveSpeed)
end
end
end
local MoveFrameVertical = function(self, y, speed)
if self.IsMoving then
return
end
self.MoveSpeed = speed
if (y < 0) then
self.MoveType = "Negative"
else
self.MoveType = "Positive"
end
self.ValueY = y
self.EndY = select(5, GetPoint(self)) + y
self:SetScript("OnUpdate", OnUpdateVerticalMove)
end
local MoveFrameHorizontal = function(self, x, speed)
if self.IsMoving then
return
end
self.MoveSpeed = speed
if (x < 0) then
self.MoveType = "Negative"
else
self.MoveType = "Positive"
end
self.ValueX = x
self.EndX = select(4, GetPoint(self)) + x
self:SetScript("OnUpdate", OnUpdateHorizontalMove)
end
-- Frame movement controller
local MoveFrame = function(self, direction, offset, speed)
if (not direction) then
direction = "horizontal"
end
if (strlower(direction) == "vertical") then
MoveFrameVertical(self, offset or 100, speed or 6)
else
MoveFrameHorizontal(self, offset or 100, speed or 6)
end
self.MoveDirection = direction
end
local OnFinishedHeight = function(self)
self:SetScript("OnUpdate", nil)
--self.HeightSizing = false
self:Height(self.EndHeight)
self:AnimCallback("height", self.HeightValue, self.HeightSpeed)
end
local OnUpdateHeight = function(self)
local Height = GetHeight(self)
if (self.HeightType == "Negative") then
if (Height - self.HeightSpeed <= self.EndHeight) then
self:SetHeight(Height - 1)
else
self:SetHeight(Height - self.HeightSpeed)
end
if (Height <= self.EndHeight) then
OnFinishedHeight(self)
end
else
if (Height + self.HeightSpeed >= self.EndHeight) then
self:SetHeight(Height + 1)
else
self:SetHeight(Height + self.HeightSpeed)
end
if (Height >= self.EndHeight) then
OnFinishedHeight(self)
end
end
end
-- Height
local Height = function(self, height, speed)
--if self.HeightSizing then
--return
--end
self.HeightValue = height
self.EndHeight = height or GetHeight(self) + 100
self.HeightSpeed = speed or 4
if (self.EndHeight > GetHeight(self)) then
self.HeightType = "Positive"
else
self.HeightType = "Negative"
end
self:SetScript("OnUpdate", OnUpdateHeight)
--self.HeightSizing = true
end
local OnFinishedWidth = function(self)
self:SetScript("OnUpdate", nil)
--self.WidthSizing = false
self:Width(self.EndWidth)
self:AnimCallback("width", self.WidthValue, self.WidthSpeed)
end
local OnUpdateWidth = function(self) -- BROKEN, SEE NOTE BELOW
-- This is tainting when we /rl and when we are in combat
if InCombatLockdown() then
return
end
local Width = GetWidth(self)
if (self.WidthType == "Negative") then
if (Width - self.WidthSpeed <= self.EndWidth) then
self:SetWidth(Width - 1)
else
self:SetWidth(Width - self.WidthSpeed)
end
if (Width <= self.EndWidth) then
OnFinishedWidth(self)
end
else
if (Width + self.WidthSpeed >= self.EndWidth) then
self:SetWidth(Width + 1)
else
self:SetWidth(Width + self.WidthSpeed)
end
if (Width >= self.EndWidth) then
OnFinishedWidth(self)
end
end
end
-- Width
local Width = function(self, width, speed)
--if self.WidthSizing then
--return
--end
self.WidthValue = width
self.EndWidth = width or GetWidth(self) + 100
self.WidthSpeed = speed or 4
if (self.EndWidth >= GetWidth(self)) then
self.WidthType = "Positive"
else
self.WidthType = "Negative"
end
self:SetScript("OnUpdate", OnUpdateWidth)
--self.WidthSizing = true
end
-- Expand/Collapse frames
local OnExpandFinished = function(self)
self:SetScript("OnUpdate", nil)
--self.ExpandSizing = false
self:Height(self.ExpandEndHeight)
self:Width(self.ExpandEndWidth)
self:AnimCallback("expand", self.WidthValue, self.HeightValue, self.ExpandSpeed)
end
local Expand = function(self)
local CurHeight = GetHeight(self)
local MaxHeight = self.ExpandEndHeight
local CurWidth = GetWidth(self)
local MaxWidth = self.ExpandEndWidth
if (CurWidth < MaxWidth) then
if (CurWidth + self.ExpandSpeed > MaxWidth) then
self:SetWidth(CurWidth + 1)
else
self:SetWidth(CurWidth + self.ExpandSpeed)
end
else
if (CurHeight < MaxHeight) then
if (CurHeight + self.ExpandSpeed > MaxHeight) then
self:SetHeight(CurHeight + 1)
else
self:SetHeight(CurHeight + self.ExpandSpeed)
end
else
OnExpandFinished(self)
end
end
end
local Collapse = function(self)
local CurHeight = GetHeight(self)
local MaxHeight = self.ExpandEndHeight
local CurWidth = GetWidth(self)
local MaxWidth = self.ExpandEndWidth
if (CurHeight > MaxHeight) then
if (CurHeight - self.ExpandSpeed < 1) then
self:SetHeight(CurHeight - 1)
else
self:SetHeight(CurHeight - self.ExpandSpeed)
end
else
if (CurWidth > MaxWidth) then
if (CurWidth - self.ExpandSpeed < 1) then
self:SetWidth(CurWidth - 1)
else
self:SetWidth(CurWidth - self.ExpandSpeed)
end
else
OnExpandFinished(self)
end
end
end
local ExpandFrame = function(self, width, height, speed)
--if self.ExpandSizing then
--return
--end
self.WidthValue = width
self.HeightValue = height
self.ExpandEndWidth = width or GetWidth(self) + 100
self.ExpandEndHeight = height or GetHeight(self) + 100
self.ExpandSpeed = speed or 8
--self.ExpandSizing = true
if (self.ExpandEndWidth > GetWidth(self) or self.ExpandEndHeight > GetHeight(self)) then
self:SetScript("OnUpdate", Expand)
else
self:SetScript("OnUpdate", Collapse)
end
end
local CombatTaintFix = function(self)
if InCombatLockdown() then
self.Show = function() end
self.Hide = function() end
else
self.Show = Show
self.Hide = Hide
end
end
local HookAlpha = function(self, alpha)
if (self.FadeType == "in") then
if (alpha == self.EndAlpha and not self.FadeInComplete) then
self.FadeInComplete = true
self:AnimCallback("fadein", self.FadeTime, self.StartAlpha, self.EndAlpha)
end
else
if (alpha == self.EndAlpha and not self.FadeOutComplete) then
self.FadeOutComplete = true
self:AnimCallback("fadeout", self.FadeTime, self.StartAlpha, self.EndAlpha)
end
end
end
local FadeIn = function(self, fadeTime, startAlpha, endAlpha)
CombatTaintFix(self)
self.FadeInComplete = false
self.FadeType = "in"
self.FadeTime = fadeTime or 0.6
self.StartAlpha = startAlpha or self:GetAlpha()
self.EndAlpha = endAlpha or 1
UIFrameFadeIn(self, self.FadeTime, self.StartAlpha, self.EndAlpha)
if (not self.AlphaIsHooked) then
hooksecurefunc(self, "SetAlpha", HookAlpha)
self.AlphaIsHooked = true
end
end
local FadeOut = function(self, fadeTime, startAlpha, endAlpha)
CombatTaintFix(self)
self.FadeOutComplete = false
self.FadeType = "out"
self.FadeTime = fadeTime or 0.6
self.StartAlpha = startAlpha or self:GetAlpha()
self.EndAlpha = endAlpha or 0
UIFrameFadeOut(self, self.FadeTime, self.StartAlpha, self.EndAlpha)
if (not self.AlphaIsHooked) then
hooksecurefunc(self, "SetAlpha", HookAlpha)
self.AlphaIsHooked = true
end
end
-- Gradient Animation
local ColorGradient = function(a, b, ...)
local perc
if (b == 0) then
perc = 0
else
perc = a / b
end
if (perc >= 1) then
local r, g, b = select(select("#", ...) - 2, ...)
return r, g, b
elseif (perc <= 0) then
local r, g, b = ...
return r, g, b
end