Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rdw-software committed Nov 1, 2024
1 parent 3be0f42 commit a13ab0c
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Core/HolidayEvents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ function HolidayEvents.IsItemAvailableToday(item)
if isRequiredHolidayEventActive then
return true
end

if type(item.holidayTexture) == "table" then -- Modern file data ID format: Supports multiple textures per item
if item.holidayTexture[artTextureID] then
return true
end
end
end

return false
Expand Down
23 changes: 23 additions & 0 deletions DB/Pets/HolidayEvents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,29 @@ local holidayEventPets = {
coords = { { m = 435, i = true } },
sourceText = L["Can be contained in Loot-Filled Pumpkin, rewarded for defeating the World Event Dungeon during Hallow's End."],
},
["Lil'Kaz's Hilt"] = {
cat = CONSTANTS.ITEM_CATEGORIES.HOLIDAY,
type = CONSTANTS.ITEM_TYPES.PET,
method = CONSTANTS.DETECTION_METHODS.NPC, -- LOOT_TOAST ... ?
name = L["Lil'Kaz's Hilt"],
spellId = 466576,
itemId = 230011,
npcs = { 121818 },
chance = 10, -- No data available
creatureId = 231841,
coords = { { m = CONSTANTS.UIMAPIDS.BLASTED_LANDS, x = 32.8, y = 47.7 } },
-- TODO migrate all entries to this format? (check if Custom items/SV would be affected first...)
holidayTexture = {
[CONSTANTS.ART_TEXTURES.TWENTIETH_ANNIVERSARY_START] = true,
[CONSTANTS.ART_TEXTURES.TWENTIETH_ANNIVERSARY_ONGOING] = true,
[CONSTANTS.ART_TEXTURES.TWENTIETH_ANNIVERSARY_END] = true,
},
groupSize = 5,
equalOdds = true,
-- TODO defeat detection (daily loot lockout vs. 1st attempt bonus? check wowhead comments)
-- daily bonus: ?
-- loot lockout: 47461
},
}

Rarity.ItemDB.MergeItems(Rarity.ItemDB.pets, holidayEventPets)
7 changes: 7 additions & 0 deletions DB/SharedConstants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ C.UIMAPIDS = {
-- Classic Zones
DUROTAR = 1,
ARATHI_HIGHLANDS = 14,
BLASTED_LANDS = 17,
HILLSBRAD_FOOTHILLS = 25,
ELWYNN_FOREST = 37,
DARKSHORE = 62,
Expand Down Expand Up @@ -255,6 +256,12 @@ C.ART_TEXTURES = {
WINTERVEIL_IEND = 235483,
WINTERVEIL_ONGOING = 235484,
WINTERVEIL_START = 235485,
ANNIVERSARY_START = 1084434,
ANNIVERSARY_ONGOING = 1084433,
ANNIVERSARY_END = 1084432,
TWENTIETH_ANNIVERSARY_START = 6238552,
TWENTIETH_ANNIVERSARY_ONGOING = 6238551,
TWENTIETH_ANNIVERSARY_END = 6238550,
}

C.ARCHAEOLOGY_RACES = {
Expand Down
1 change: 1 addition & 0 deletions Locales.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local L
L = LibStub("AceLocale-3.0"):NewLocale("Rarity", "enUS", true)

-- L["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"] = true
L["Lil'Kaz's Hilt"] = true
L["Writhing Transmutagen"] = true
L["When enabled, Rarity will not add tooltip information for items that aren't being tracked."] = true
L["Hide untracked items in tooltips"] = true
Expand Down
5 changes: 4 additions & 1 deletion Tests/WOWAPI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ _G.CreateFrame = function(...)
return createDummyFrame()
end

_G.EnableAddOn = function(...)
local C_AddOns = {}
C_AddOns.EnableAddOn = function(...)
print("[EnableAddOn] NYI", ...)
end

_G.IsAddOnLoaded = function(...)
print("[IsAddOnLoaded] NYI", ...)
end

_G.C_AddOns = C_AddOns

_G.GetChannelList = function(...)
print("[GetChannelList] NYI", ...)
end
Expand Down
16 changes: 16 additions & 0 deletions Tests/test-holiday-events.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ describe("HolidayEvents", function()
holidayTexture = SharedConstants.HOLIDAY_TEXTURES.DARKMOON_FAIRE,
}
local ITEM_WITHOUT_HOLIDAY_TEXTURE = {}
local ITEM_WITH_MULTIPLE_HOLIDAY_TEXTURES = {
holidayTexture = {
[SharedConstants.ART_TEXTURES.TWENTIETH_ANNIVERSARY_START] = true,
[SharedConstants.ART_TEXTURES.TWENTIETH_ANNIVERSARY_ONGOING] = true,
[SharedConstants.ART_TEXTURES.TWENTIETH_ANNIVERSARY_END] = true,
},
}

it("should return true if the item requires an active holiday event that is currently enabled", function()
Rarity.holiday_textures[SharedConstants.ART_TEXTURES.DMF_ONGOING] = true
Expand Down Expand Up @@ -38,5 +45,14 @@ describe("HolidayEvents", function()
it("should return true if the item doesn't require any holiday event to be active", function()
assertTrue(HolidayEvents.IsItemAvailableToday(ITEM_WITHOUT_HOLIDAY_TEXTURE))
end)

it("should return true if the item uses file data IDs and the holiday event is active", function()
Rarity.holiday_textures[SharedConstants.ART_TEXTURES.TWENTIETH_ANNIVERSARY_ONGOING] = true
assertTrue(HolidayEvents.IsItemAvailableToday(ITEM_WITH_MULTIPLE_HOLIDAY_TEXTURES))
end)

it("should return false if the item uses file data IDs and the holiday event is inactive", function()
assertFalse(HolidayEvents.IsItemAvailableToday(ITEM_WITH_MULTIPLE_HOLIDAY_TEXTURES))
end)
end)
end)

0 comments on commit a13ab0c

Please sign in to comment.