Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- committed Feb 9, 2024
2 parents a26f408 + 899b96a commit 60039a1
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 30 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# CHANGELOG

## Version 100205.03

### Loot (Special)

- Added loot roll info. It's a returning feature. However, there's a caveat, I don't know if "transmog" rolls are
actually a thing in this particular case because it's basically an undocumented feature. I added it based on my
assumptions, so if it works, good, if it doesn't, oh well. But "need", "greed", and "disenchant" rolls should work as
expected.

![Imgur](https://i.imgur.com/s1VB5Lk.png)

## Version 100205.02

- Added partial Brazilian Portuguese translation. Translated by paulovnas@GitHub.
Expand Down
7 changes: 6 additions & 1 deletion ls_Toasts/core/changelog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ local _G = getfenv(0)

-- Mine
E.CHANGELOG = [[
- Added partial Brazilian Portuguese translation. Translated by paulovnas@GitHub.
### Loot (Special)
- Added loot roll info. It's a returning feature. However, there's a caveat, I don't know if "transmog" rolls are
actually a thing in this particular case because it's basically an undocumented feature. I added it based on my
assumptions, so if it works, good, if it doesn't, oh well. But "need", "greed", and "disenchant" rolls should work as
expected.
]]
85 changes: 60 additions & 25 deletions ls_Toasts/embeds/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--[[-----------------------------------------------------------------------------
ColorPicker Widget
-------------------------------------------------------------------------------]]
local Type, Version = "ColorPicker", 25
local Type, Version = "ColorPicker", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end

Expand All @@ -18,6 +18,10 @@ local function ColorCallback(self, r, g, b, a, isAlpha)
if not self.HasAlpha then
a = 1
end
-- no change, skip update
if r == self.r and g == self.g and b == self.b and a == self.a then
return
end
self:SetColor(r, g, b, a)
if ColorPickerFrame:IsVisible() then
--colorpicker is still open
Expand Down Expand Up @@ -49,31 +53,62 @@ local function ColorSwatch_OnClick(frame)
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG")
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
ColorPickerFrame:SetClampedToScreen(true)

ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end

ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end

local r, g, b, a = self.r, self.g, self.b, self.a
if self.HasAlpha then
ColorPickerFrame.opacity = 1 - (a or 0)
end
ColorPickerFrame:SetColorRGB(r, g, b)

ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
ColorPickerFrame:EnableMouse(true) -- Make sure the background isn't click-through

if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul
local r2, g2, b2, a2 = self.r, self.g, self.b, self.a

local info = {
swatchFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a)
end,

hasOpacity = self.HasAlpha,
opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a, true)
end,
opacity = (a2 or 1),

cancelFunc = function()
ColorCallback(self, r2, g2, b2, a2, true)
end,

r = r2,
g = g2,
b = b2,
}

ColorPickerFrame:SetupColorPickerAndShow(info)
else
ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end

ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end

local r, g, b, a = self.r, self.g, self.b, self.a
if self.HasAlpha then
ColorPickerFrame.opacity = 1 - (a or 0)
end
ColorPickerFrame:SetColorRGB(r, g, b)

ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
end

ColorPickerFrame:Show()
end

ColorPickerFrame:Show()
end
AceGUI:ClearFocus()
end
Expand Down
2 changes: 1 addition & 1 deletion ls_Toasts/ls_Toasts.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 100205
## Author: lightspark
## Version: 100205.02
## Version: 100205.03
## Title: LS: |cff00cc99Toasts|r
## Notes: Better toasts, cheers!
## IconTexture: Interface\AddOns\ls_Toasts\assets\logo-64
Expand Down
30 changes: 27 additions & 3 deletions ls_Toasts/systems/loot_special.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ local E, L, C = addonTable.E, addonTable.L, addonTable.C

-- Lua
local _G = getfenv(0)
local m_random = _G.math.random
local s_lower = _G.string.lower
local s_split = _G.string.split
local tonumber = _G.tonumber

-- Mine
local ROLL_TEMPLATE = "%s|A:lootroll-icon-%s:0:0:0:0|a"

local rollTypes = {
[1] = "need",
[2] = "greed",
[3] = "disenchant",
[4] = "transmog", -- no idea if it's even a thing, but I'll just assume that it is
}

local function Toast_OnClick(self)
if self._data.link and IsModifiedClick("DRESSUP") then
DressUpLink(self._data.link)
Expand Down Expand Up @@ -35,7 +45,7 @@ local function PostSetAnimatedValue(self, value)
self:SetText(value == 1 and "" or value)
end

local function Toast_SetUp(event, link, quantity, factionGroup, lessAwesome, isUpgraded, baseQuality, isLegendary, isAzerite, isCorrupted)
local function Toast_SetUp(event, link, quantity, factionGroup, lessAwesome, isUpgraded, baseQuality, isLegendary, isAzerite, isCorrupted, rollType, roll)
if link then
local sanitizedLink, originalLink, _, itemID = E:SanitizeLink(link)
local toast, isNew, isQueued = E:GetToast(event, "link", sanitizedLink)
Expand Down Expand Up @@ -83,6 +93,14 @@ local function Toast_SetUp(event, link, quantity, factionGroup, lessAwesome, isU
soundFile = 147833 -- SOUNDKIT.UI_CORRUPTED_ITEM_LOOT_TOAST
end

if rollType then
rollType = rollTypes[rollType]
if rollType then
toast.IconText3:SetFormattedText(ROLL_TEMPLATE, roll, rollType)
toast.IconText3BG:Show()
end
end

if factionGroup then
bgTexture = s_lower(factionGroup)
end
Expand Down Expand Up @@ -156,8 +174,8 @@ local function AZERITE_EMPOWERED_ITEM_LOOTED(link)
Toast_SetUp("AZERITE_EMPOWERED_ITEM_LOOTED", link, 1, nil, nil, nil, nil, nil, nil, true)
end

local function LOOT_ITEM_ROLL_WON(link, quantity, _, _, isUpgraded)
Toast_SetUp("LOOT_ITEM_ROLL_WON", link, quantity, nil, nil, isUpgraded)
local function LOOT_ITEM_ROLL_WON(link, quantity, rollType, roll, isUpgraded)
Toast_SetUp("LOOT_ITEM_ROLL_WON", link, quantity, nil, nil, isUpgraded, nil, nil, nil, nil, rollType, roll)
end

local function SHOW_LOOT_TOAST(typeID, link, quantity, _, _, _, _, lessAwesome, isUpgraded, isCorrupted)
Expand Down Expand Up @@ -272,6 +290,12 @@ local function Test()
if link then
Toast_SetUp("SPECIAL_LOOT_TEST", link, 1, nil, nil, nil, nil, nil, nil, true)
end

-- roll, Rhinestone Sunglasses
_, link = GetItemInfo(52489)
if link then
Toast_SetUp("SPECIAL_LOOT_TEST", link, 1, nil, nil, nil, nil, nil, nil, nil, m_random(1, 4), m_random(1, 100))
end
end

E:RegisterOptions("loot_special", {
Expand Down

0 comments on commit 60039a1

Please sign in to comment.