Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- committed Nov 7, 2023
2 parents 3a239e6 + 8c3c2f7 commit 8914272
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .currency_build.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Set-Location $PSScriptRoot

$csv = Invoke-WebRequest "https://wago.tools/db2/CurrencyTypes/csv" | ConvertFrom-Csv

$currenciesToBlacklist = @(
Expand Down
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ read_globals = {
"AchievementFrame",
"AchievementFrame_LoadUI",
"AchievementFrame_SelectAchievement",
"AddonCompartmentFrame",
"AlertFrame",
"ArchaeologyFrame",
"ArcheologyDigsiteProgressBar",
Expand Down
2 changes: 2 additions & 0 deletions .luacheckrc_build.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Set-Location $PSScriptRoot

$luacheckrc = ".\.luacheckrc"

$out = ""
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# CHANGELOG

## Version 100200.01

- Added 10.2 support.
- Added "LS: Toasts" entry to the addon compartment in the top right corner of the minimap.
- Tweaked toast borders so that the texture looks more consistent with no warping or shifting.
Doesn't affect ElvUI skins.

### Transmogrification

- Fixed an issue where sometimes a toast wouldn't show up. It's primarily affecting "Quantum Items" that unlock
a random appearance on use.

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

## Version 100105.01

- Added 10.1.5 support.
Expand Down
Binary file added ls_Toasts/assets/logo-32.TGA
Binary file not shown.
10 changes: 9 additions & 1 deletion ls_Toasts/core/changelog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ local _G = getfenv(0)

-- Mine
E.CHANGELOG = [[
- Added 10.1.5 support.
- Added 10.2 support.
- Added "LS: Toasts" entry to the addon compartment in the top right corner of the minimap.
- Tweaked toast borders so that the texture looks more consistent with no warping or shifting.
Doesn't affect ElvUI skins.
### Transmogrification
- Fixed an issue where sometimes a toast wouldn't show up. It's primarily affecting "Quantum Items" that unlock
a random appearance on use.
]]
2 changes: 2 additions & 0 deletions ls_Toasts/core/toast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ local function createBorder(self, drawLayer, drawSubLevel)

for _, v in next, sections do
border[v] = self:CreateTexture(nil, drawLayer or "OVERLAY", nil, drawSubLevel or 1)
border[v]:SetTexelSnappingBias(0)
border[v]:SetSnapToPixelGrid(false)
end

border.TOPLEFT:SetTexCoord(0.5, 0.625, 0, 1)
Expand Down
13 changes: 13 additions & 0 deletions ls_Toasts/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ local BLACKLISTED_EVENTS = {
["SHOW_LOOT_TOAST_UPGRADE"] = true,
["SHOW_PVP_FACTION_LOOT_TOAST"] = true,
["SHOW_RATED_PVP_REWARD_TOAST"] = true,
["SKILL_LINE_SPECS_UNLOCKED"] = true,
["TRANSMOG_COLLECTION_SOURCE_ADDED"] = true,
["TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED"] = true,
}
Expand Down Expand Up @@ -517,6 +518,18 @@ E:RegisterEvent("ADDON_LOADED", function(arg1)

Settings.RegisterAddOnCategory(Settings.RegisterCanvasLayoutCategory(panel, L["LS_TOASTS"]))

AddonCompartmentFrame:RegisterAddon({
text = L["LS_TOASTS"],
icon = "Interface\\AddOns\\ls_Toasts\\assets\\logo-32",
notCheckable = true,
registerForAnyClick = true,
func = function()
if not InCombatLockdown() then
LibStub("AceConfigDialog-3.0"):Open(addonName)
end
end,
})

E:RegisterEvent("PLAYER_REGEN_DISABLED", function()
LibStub("AceConfigDialog-3.0"):Close(addonName)
end)
Expand Down
4 changes: 2 additions & 2 deletions ls_Toasts/ls_Toasts.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Interface: 100105
## Interface: 100200
## Author: lightspark
## Version: 100105.01
## Version: 100200.01
## Title: LS: |cff00cc99Toasts|r
## Notes: Better toasts, cheers!
## IconTexture: Interface\AddOns\ls_Toasts\assets\logo-64
Expand Down
223 changes: 222 additions & 1 deletion ls_Toasts/systems/loot_currency.lua

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions ls_Toasts/systems/transmog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local E, L, C = addonTable.E, addonTable.L, addonTable.C

-- Lua
local _G = getfenv(0)
local t_wipe = _G.table.wipe

-- Mine
local function Toast_OnClick(self)
Expand Down Expand Up @@ -65,11 +66,34 @@ local function Toast_SetUp(event, sourceID, isAdded, attempt)
end
end

local pendingSourceIDs = {}
local wipeTimer

local function wiper()
t_wipe(pendingSourceIDs)
end

local function resetWipeTimer()
if not wipeTimer then
wipeTimer = C_Timer.NewTimer(5, wiper)
else
wipeTimer:Cancel()

wipeTimer = C_Timer.NewTimer(5, wiper)
end
end

local function TRANSMOG_COLLECTION_SOURCE_ADDED(sourceID)
-- don't show toasts for sources that aren't in player's wardrobe
local _, canCollect = C_TransmogCollection.PlayerCanCollectSource(sourceID)
if canCollect then
Toast_SetUp("TRANSMOG_COLLECTION_SOURCE_ADDED", sourceID, true, 1)
else
-- however, they may become available shortly after when
-- TRANSMOG_SOURCE_COLLECTABILITY_UPDATE fires
pendingSourceIDs[sourceID] = "TRANSMOG_COLLECTION_SOURCE_ADDED"

resetWipeTimer()
end
end

Expand All @@ -81,6 +105,12 @@ local function TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED(sourceID)
local _, canCollect = C_TransmogCollection.PlayerCanCollectSource(sourceID)
if canCollect then
Toast_SetUp("TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED", sourceID, true, 1)
else
-- however, they may become available shortly after when
-- TRANSMOG_SOURCE_COLLECTABILITY_UPDATE fires
pendingSourceIDs[sourceID] = "TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED"

resetWipeTimer()
end
end

Expand All @@ -92,18 +122,33 @@ local function TRANSMOG_COLLECTION_SOURCE_REMOVED(sourceID)
end
end

-- in some cases, for instance, quantum items, the source is marked as
-- collectable only after the _ADDED events fire
-- TRANSMOG_SOURCE_COLLECTABILITY_UPDATE usually fires a second or so later
local function TRANSMOG_SOURCE_COLLECTABILITY_UPDATE(sourceID, isCollectable)
if isCollectable and pendingSourceIDs[sourceID] then
Toast_SetUp(pendingSourceIDs[sourceID], sourceID, true, 1)

pendingSourceIDs[sourceID] = nil

resetWipeTimer()
end
end

local function Enable()
if C.db.profile.types.transmog.enabled then
E:RegisterEvent("TRANSMOG_COLLECTION_SOURCE_ADDED", TRANSMOG_COLLECTION_SOURCE_ADDED)
E:RegisterEvent("TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED", TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED)
E:RegisterEvent("TRANSMOG_COLLECTION_SOURCE_REMOVED", TRANSMOG_COLLECTION_SOURCE_REMOVED)
E:RegisterEvent("TRANSMOG_SOURCE_COLLECTABILITY_UPDATE", TRANSMOG_SOURCE_COLLECTABILITY_UPDATE)
end
end

local function Disable()
E:UnregisterEvent("TRANSMOG_COLLECTION_SOURCE_ADDED", TRANSMOG_COLLECTION_SOURCE_ADDED)
E:UnregisterEvent("TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED", TRANSMOG_COSMETIC_COLLECTION_SOURCE_ADDED)
E:UnregisterEvent("TRANSMOG_COLLECTION_SOURCE_REMOVED", TRANSMOG_COLLECTION_SOURCE_REMOVED)
E:UnregisterEvent("TRANSMOG_SOURCE_COLLECTABILITY_UPDATE", TRANSMOG_SOURCE_COLLECTABILITY_UPDATE)
end

local function Test()
Expand Down

0 comments on commit 8914272

Please sign in to comment.