Holiday conditions?
WanderingFox opened this issue ยท 3 comments
Would it be possible to add a condition to check if a specific holiday event is active?
It looks like this would be doable via C_Calendar.GetHolidayInfo(0, todaysday, eventindex)
where eventindex
ranges from 1 to maxindex
and todaysdate
is C_DateAndTime.GetCurrentCalendarTime().monthDay
and maxindex
is C_Calendar.GetNumDayEvents(0, todaysdate)
From there you can just check if result.name
matches.
eg. something like:
CONDITIONS["hallowsend"] = {
handler =
function (cond, context)
local currentDay = C_DateAndTime.GetCurrentCalendarTime().monthDay
local numEvents = C_Calendar.GetNumDayEvents(0, currentDay)
for i = 1, numEvents do
local eventInfo = C_Calendar.GetHolidayInfo(0, currentDay, i)
if eventInfo and eventInfo.name == "Hallow's End" then
return true
end
end
return false
end,
}
I have something like this that I just wrote (it's called "holiday" rather than specifically hallows end). Great minds think alike because your code is quite close, and also I love tickets with code in them! Please send more :)
It should be there in the new beta version 10.1.7-7beta1 if you want to try it out. Getting out a release is a bit tricky at the moment because I'm in the middle of messing everything up to see if WotLK classic support is viable.