Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- committed Mar 27, 2021
2 parents aa324e8 + cc4d2e3 commit 59e616b
Show file tree
Hide file tree
Showing 28 changed files with 121 additions and 82 deletions.
5 changes: 4 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ read_globals = {
"CreateFrame",
"GetCursorPosition",
"GetGameTime",
"GetItemInfo",
"GetMinimapZoneText",
"GetZonePVPInfo",
"IsAddOnLoaded",
Expand All @@ -67,13 +68,13 @@ read_globals = {
"C_MountJournal",
"C_PvP",
"C_Timer",
"C_WowTokenPublic",

-- FrameXML functions
"CastingBarFrame_SetUnit",
"Minimap_ZoomIn",
"Minimap_ZoomOut",
"MiniMapTracking_OnMouseDown",
"Mixin",
"RegisterStateDriver",
"UIDropDownMenu_GetCurrentDropDown",
"UnitFrame_OnEnter",
Expand Down Expand Up @@ -110,4 +111,6 @@ read_globals = {
-- FrameXML vars
"ChatTypeInfo",
"DEFAULT_CHAT_FRAME",
"ITEM_QUALITY_COLORS",
"WOW_TOKEN_ITEM_ID",
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## Version 90005.02

- Added WoW Token price to the "Inventory" micro button's tooltip;
- Fixed misc class power bar issues.

## Version 90005.01

- Added 125% and 150% size options for the round minimap. Can be found at /LSUI > Minimap > Size
Expand Down
2 changes: 1 addition & 1 deletion core/border.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function border_proto:IsObjectType(_, t)
end

function E:CreateBorder(parent, drawLayer, drawSubLevel)
local border = Mixin({__parent = parent}, border_proto)
local border = P:Mixin({__parent = parent}, border_proto)

for _, v in next, sections do
border[v] = parent:CreateTexture(nil, drawLayer or "OVERLAY", nil, drawSubLevel or 1)
Expand Down
34 changes: 34 additions & 0 deletions core/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local next = _G.next
local pairs = _G.pairs
local s_format = _G.string.format
local s_split = _G.string.split
local select = _G.select
local t_insert = _G.table.insert
local type = _G.type
local xpcall = _G.xpcall
Expand Down Expand Up @@ -70,6 +71,39 @@ do
end
end

------------
-- MIXINS --
------------

do
-- not sure about this implementation just yet, but I'll try using it for
-- profiling later on
local registry = {
-- [obj] = {["method"] = func,},
}

function P:Mixin(obj, ...)
registry[obj] = {}

for i = 1, select("#", ...) do
local mixin = select(i, ...)
for k, v in next, mixin do
if type(v) == "function" then
registry[obj][k] = v
end

obj[k] = v
end
end

return obj
end

function P:GetMixedInRegistry()
return registry
end
end

------------
-- ERRORS --
------------
Expand Down
2 changes: 1 addition & 1 deletion ls_UI.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 90005
## Author: lightspark
## Version: 90005.01
## Version: 90005.02
## Title: LS: |cff1a9fc0UI|r
## Notes: Yet another UI, but this one is a bit special...
## SavedVariablesPerCharacter: LS_UI_CHAR_CONFIG
Expand Down
25 changes: 24 additions & 1 deletion modules/bars/micromenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ local BUTTONS = {
icon = "INVENTORY",
events = {
BAG_UPDATE_DELAYED = true,
TOKEN_MARKET_PRICE_UPDATED = true,
},
},
spellbook = {
Expand Down Expand Up @@ -485,6 +486,7 @@ do
local CURRENCY_DETAILED_TEMPLATE = "%s / %s|T%s:0|t"

local freeSlots, totalSlots = 0, 0
local lastTokenUpdate = 0

local function updateBagUsageInfo()
freeSlots, totalSlots = 0, 0
Expand Down Expand Up @@ -523,6 +525,15 @@ do

GameTooltip:AddDoubleLine(L["GOLD"], GetMoneyString(GetMoney(), true), 1, 1, 1, 1, 1, 1)

local tokenPrice = C_WowTokenPublic.GetCurrentMarketPrice()
if tokenPrice and tokenPrice > 0 then
local name, _, quality = GetItemInfo(WOW_TOKEN_ITEM_ID)
local color = ITEM_QUALITY_COLORS[quality]
GameTooltip:AddDoubleLine(name, GetMoneyString(tokenPrice, true), color.r, color.g, color.b, 1, 1, 1)
elseif GetTime() - lastTokenUpdate > 300 then -- 300 is pollTimeSeconds = select(2, C_WowTokenPublic.GetCommerceSystemStatus())
C_WowTokenPublic.UpdateMarketPrice()
end

if C.db.profile.bars.micromenu.bars.bags.enabled then
GameTooltip:AddLine(" ")
GameTooltip:AddLine(L["INVENTORY_BUTTON_RCLICK_TOOLTIP"])
Expand Down Expand Up @@ -550,11 +561,23 @@ do
end
end

function inventoryButton_OnEvent(self, event)
function inventoryButton_OnEvent(self, event, ...)
if event == "BAG_UPDATE_DELAYED" then
self:UpdateIndicator()
elseif event == "UPDATE_BINDINGS" then
self.tooltipText = MicroButtonTooltipText(L["INVENTORY_BUTTON"], "OPENALLBAGS")
elseif event == "TOKEN_MARKET_PRICE_UPDATED" then
lastTokenUpdate = GetTime()

if ... == LE_TOKEN_RESULT_ERROR_DISABLED then
return
end

if GameTooltip:IsOwned(self) then
GameTooltip:Hide()

inventoryButton_OnEnter(self)
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions modules/minimap/minimap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ function MODULE:Init()
holder:SetPoint(unpack(C.db.profile.minimap[E.UI_LAYOUT].point))
E.Movers:Create(holder)

Mixin(Minimap, minimap_proto)
P:Mixin(Minimap, minimap_proto)
Minimap:EnableMouseWheel()
Minimap:ClearAllPoints()
Minimap:SetParent(holder)
Expand All @@ -895,7 +895,7 @@ function MODULE:Init()
ignoredChildren[textureParent] = true

if isSquare then
Mixin(Minimap, square_minimap_proto)
P:Mixin(Minimap, square_minimap_proto)
Minimap:SetArchBlobRingScalar(0)
Minimap:SetQuestBlobRingScalar(0)
Minimap:SetMaskTexture("Interface\\BUTTONS\\WHITE8X8")
Expand Down
6 changes: 3 additions & 3 deletions modules/unitframes/elements/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function element_proto:CreateIcon(index)
config = self._config
end

local button = Mixin(E:CreateButton(self, "$parentAura" .. index, true, true, true), button_proto)
local button = P:Mixin(E:CreateButton(self, "$parentAura" .. index, true, true, true), button_proto)
button:SetScript("OnEnter", button.OnEnter)
button:SetScript("OnLeave", button.OnLeave)

Expand Down Expand Up @@ -383,9 +383,9 @@ function frame_proto:UpdateAuras()
end

function UF:CreateAuras(frame, unit)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local element = Mixin(CreateFrame("Frame", nil, frame), element_proto)
local element = P:Mixin(CreateFrame("Frame", nil, frame), element_proto)
element:SetSize(48, 48)

element.CustomFilter = filterFunctions[unit] or filterFunctions.default
Expand Down
4 changes: 2 additions & 2 deletions modules/unitframes/elements/castbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ function frame_proto:UpdateCastbar()
end

function UF:CreateCastbar(frame)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local holder = CreateFrame("Frame", "$parentCastbarHolder", frame)

local element = Mixin(CreateFrame("StatusBar", nil, holder), element_proto)
local element = P:Mixin(CreateFrame("StatusBar", nil, holder), element_proto)
element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8")
element:SetFrameLevel(holder:GetFrameLevel())
element.Holder = holder
Expand Down
4 changes: 2 additions & 2 deletions modules/unitframes/elements/classindicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function frame_proto:UpdateClassIndicator()
end

function UF:CreateClassIndicator(frame)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

hooksecurefunc(frame, "Show", update)

Expand All @@ -73,7 +73,7 @@ function UF:CreateClassIndicator(frame)
E:SmoothColor(frame.Insets)
end

return Mixin({
return P:Mixin({
__owner = frame,
__color = {},
}, element_proto)
Expand Down
14 changes: 8 additions & 6 deletions modules/unitframes/elements/classpower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ local function bar_OnValueChanged(self, value)
end

local function createElement(parent, num, name, ...)
local element = Mixin(CreateFrame("Frame", nil, parent), ...)
local element = P:Mixin(CreateFrame("Frame", nil, parent), ...)
element:SetScript("OnSizeChanged", element.Layout)
element:Hide()

Expand Down Expand Up @@ -228,7 +228,7 @@ do
end

function UF:CreateRunes(frame)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

return createElement(frame, 6, "Rune", element_proto, runes_proto)
end
Expand Down Expand Up @@ -280,7 +280,9 @@ do
end

for i = max, #self - 1 do
self[i].Sep:Hide()
if i > 0 then
self[i].Sep:Hide()
end
end
end

Expand Down Expand Up @@ -341,7 +343,7 @@ do
end

function UF:CreateClassPower(frame)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

return createElement(frame, 10, "ClassPower", element_proto, class_power_proto)
end
Expand Down Expand Up @@ -425,9 +427,9 @@ do
end

function UF:CreateStagger(frame)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local element = Mixin(CreateFrame("StatusBar", nil, frame), stagger_proto)
local element = P:Mixin(CreateFrame("StatusBar", nil, frame), stagger_proto)
element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8")
element:Hide()

Expand Down
4 changes: 2 additions & 2 deletions modules/unitframes/elements/debuffindicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ function frame_proto:UpdateDebuffIndicator()
end

function UF:CreateDebuffIndicator(frame, textParent)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local element = Mixin((textParent or frame):CreateFontString(nil, "ARTWORK"), element_proto)
local element = P:Mixin((textParent or frame):CreateFontString(nil, "ARTWORK"), element_proto)
element:SetFont(GameFontNormal:GetFont(), 12)
element:SetNonSpaceWrap(true)
element:SetJustifyH("CENTER")
Expand Down
8 changes: 4 additions & 4 deletions modules/unitframes/elements/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ do
end

function UF:CreateHealth(frame, textParent)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local element = Mixin(CreateFrame("StatusBar", nil, frame), element_proto)
local element = P:Mixin(CreateFrame("StatusBar", nil, frame), element_proto)
element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8")
element._texture = element:GetStatusBarTexture()

Expand Down Expand Up @@ -270,7 +270,7 @@ do
end

function UF:CreateHealthPrediction(frame, parent)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local level = parent:GetFrameLevel()

Expand Down Expand Up @@ -303,7 +303,7 @@ do
healAbsorbBar._texture = healAbsorbBar:GetStatusBarTexture()
parent.HealAbsorb = healAbsorbBar

return Mixin({
return P:Mixin({
myBar = myBar,
otherBar = otherBar,
absorbBar = absorbBar,
Expand Down
8 changes: 4 additions & 4 deletions modules/unitframes/elements/layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ local DATA = {
}

function UF:CreateLayout(frame, level)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local bg = frame:CreateTexture(nil, "BACKGROUND", nil, -7)
bg:SetAllPoints()
Expand All @@ -406,11 +406,11 @@ function UF:CreateLayout(frame, level)
textParent:SetAllPoints()
frame.TextParent = textParent

local insets = Mixin({__owner = frame}, insets_proto)
local insets = P:Mixin({__owner = frame}, insets_proto)
frame.Insets = insets

for _, v in next, {"Left", "Right", "Top", "Bottom"} do
local inset = Mixin(CreateFrame("Frame", nil, frame), unpack(DATA[v].mixins))
local inset = P:Mixin(CreateFrame("Frame", nil, frame), unpack(DATA[v].mixins))
inset:SetFrameLevel(level)
inset:SetScript("OnSizeChanged", inset.OnSizeChanged)
inset.__owner = insets
Expand Down Expand Up @@ -540,7 +540,7 @@ function slot_proto:UpdateSize(w, h)
end

function UF:CreateSlot(frame, level)
local slot = Mixin(CreateFrame("Frame", nil, frame), slot_proto)
local slot = P:Mixin(CreateFrame("Frame", nil, frame), slot_proto)
slot:SetFrameLevel(level)
slot.__children = {}

Expand Down
4 changes: 2 additions & 2 deletions modules/unitframes/elements/name.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ function frame_proto:UpdateName()
end

function UF:CreateName(frame, textParent)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

local element = Mixin((textParent or frame):CreateFontString(nil, "OVERLAY"), element_proto)
local element = P:Mixin((textParent or frame):CreateFontString(nil, "OVERLAY"), element_proto)
element.__owner = frame
E.FontStrings:Capture(element, "unit")

Expand Down
6 changes: 3 additions & 3 deletions modules/unitframes/elements/portrait.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ function frame_proto:UpdatePortrait()
end

function UF:CreatePortrait(frame, parent)
Mixin(frame, frame_proto)
P:Mixin(frame, frame_proto)

frame.Portrait2D = Mixin((parent or frame):CreateTexture(nil, "ARTWORK"), element_proto)
frame.Portrait3D = Mixin(CreateFrame("PlayerModel", nil, parent or frame), element_proto)
frame.Portrait2D = P:Mixin((parent or frame):CreateTexture(nil, "ARTWORK"), element_proto)
frame.Portrait3D = P:Mixin(CreateFrame("PlayerModel", nil, parent or frame), element_proto)

return frame.Portrait2D
end
Loading

0 comments on commit 59e616b

Please sign in to comment.